Skip to content

Commit c242e7f

Browse files
authored
Merge pull request #18 from torfmaster/feature/lld
Link with LLD
2 parents 6b8d2aa + 23033ce commit c242e7f

File tree

11 files changed

+17
-32
lines changed

11 files changed

+17
-32
lines changed

.cargo/config

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[target.thumbv7em-tock-eabi]
2+
rustflags = [
3+
"-C link-args=-Tlayout.ld",
4+
]

.travis.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
language: rust
22
rust:
3-
- nightly-2018-02-23
3+
- nightly-2018-03-06
44

55
os:
66
- linux
@@ -12,12 +12,9 @@ cache:
1212
- tock/userland/tools/elf2tbf/target
1313

1414
install:
15-
- wget -c https://developer.arm.com/-/media/Files/downloads/gnu-rm/6-2016q4/gcc-arm-none-eabi-6_2-2016q4-20161216-linux.tar.bz2
16-
- tar -xjf gcc-arm-none-eabi-6_2-2016q4-20161216-linux.tar.bz2
1715
- rustup component add rust-src
1816

1917
script:
20-
- export PATH="$PATH:gcc-arm-none-eabi-6_2-2016q4/bin"
2118
- export RUSTFLAGS="$RUSTFLAGS -D warnings"
2219
- cargo test --lib
2320
- ./build_examples.sh

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"editor.formatOnSave": true,
3-
"rust-client.channel": "nightly-2018-02-23",
3+
"rust-client.channel": "nightly-2018-03-06",
44
}

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,3 @@ lto = true
1919
[profile.release]
2020
panic = "abort"
2121
lto = true
22-
debug = true

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ This project is nascent and still under heavy development, but first steps:
88

99
1. Ensure you have a working toolchain available:
1010

11-
`rustup install nightly-2017-12-16`
11+
`rustup install nightly-2018-03-06`
1212

1313
2. Get a copy of this toolchain, in this repo's root:
1414

15-
`rustup override set nightly-2017-12-16`
15+
`rustup override set nightly-2018-03-06`
1616

1717
3. Need to grab a copy of the rust sources:
1818

build_examples.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#!/usr/bin/env bash
22

33
set -eux
4-
export RUST_TARGET_PATH=`pwd`
5-
export CARGO_INCREMENTAL=0
64

7-
cargo run --manifest-path xargo/Cargo.toml -- build --release --target=thumbv7em-tock-eabi --examples
5+
RUST_TARGET_PATH=$(pwd) cargo run --manifest-path xargo/Cargo.toml -- build --release --target=thumbv7em-tock-eabi --examples

layout.ld

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,15 @@ STACK_SIZE = 2048;
88
APP_HEAP_SIZE = 1024;
99
KERNEL_HEAP_SIZE = 1024;
1010

11-
/* Memory Spaces Definitions, 448K flash, 64K ram */
12-
PROG_LENGTH = 0x00040000;
13-
RAM_LENGTH = 0x00010000;
14-
1511
ENTRY(_start)
1612

1713
/* Note: Because apps are relocated, the FLASH address here acts as a sentinel
1814
* value for relocation fixup routines. The application loader will select the
1915
* actual location in flash where the app is placed.
2016
*/
2117
MEMORY {
22-
FLASH (rx) : ORIGIN = 0x80000000, LENGTH = PROG_LENGTH
23-
SRAM (RWX) : ORIGIN = 0x00000000, LENGTH = RAM_LENGTH
18+
FLASH (rx) : ORIGIN = 0x80000000, LENGTH = 0x0040000
19+
SRAM (RWX) : ORIGIN = 0x00000000, LENGTH = 0x0010000
2420
}
2521

2622
SECTIONS {

run_example.sh

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,11 @@
44

55
set -eux
66

7-
export RUST_TARGET_PATH=`pwd`
8-
export CARGO_INCREMENTAL=0
9-
107
tab_file_name=metadata.toml
118
elf_file_name=cortex-m4.elf
129
bin_file_name=cortex-m4.bin
1310

14-
cargo run --manifest-path xargo/Cargo.toml -- build --release --target=thumbv7em-tock-eabi --example "$1"
11+
RUST_TARGET_PATH=$(pwd) cargo run --manifest-path xargo/Cargo.toml -- build --release --target=thumbv7em-tock-eabi --example "$1"
1512
cp target/thumbv7em-tock-eabi/release/examples/"$1" "target/$elf_file_name"
1613
cargo run --manifest-path tock/userland/tools/elf2tbf/Cargo.toml -- -n "$1" -o "target/$bin_file_name" "target/$elf_file_name"
1714

@@ -30,7 +27,7 @@ then
3027
echo "do not delete apps from board."
3128
else
3229
tockloader uninstall --jtag --arch cortex-m4 --board nrf52-dk --jtag-device nrf52 --app-address 0x20000 || true
33-
fi
30+
fi
3431
else
3532
tockloader uninstall --jtag --arch cortex-m4 --board nrf52-dk --jtag-device nrf52 --app-address 0x20000 || true
3633
fi

rust-toolchain

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
nightly-2018-02-23
1+
nightly-2018-03-06

thumbv7em-tock-eabi.json

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,7 @@
1111
"executables": true,
1212
"no-compiler-rt": false,
1313
"relocation-model": "ropi-rwpi",
14-
"linker": "arm-none-eabi-ld",
15-
"linker-flavor": "ld",
14+
"linker-flavor": "ld.lld",
1615
"linker-is-gnu": true,
17-
"disable-redzone": true,
18-
"pre-link-args": {
19-
"ld": [
20-
"-Tlayout.ld"
21-
]
22-
}
16+
"disable-redzone": true
2317
}

0 commit comments

Comments
 (0)