Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Link with LLD #18

Merged
merged 2 commits into from
Mar 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .cargo/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[target.thumbv7em-tock-eabi]
rustflags = [
"-C link-args=-Tlayout.ld",
]
5 changes: 1 addition & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: rust
rust:
- nightly-2018-02-23
- nightly-2018-03-06

os:
- linux
Expand All @@ -12,12 +12,9 @@ cache:
- tock/userland/tools/elf2tbf/target

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

script:
- export PATH="$PATH:gcc-arm-none-eabi-6_2-2016q4/bin"
- export RUSTFLAGS="$RUSTFLAGS -D warnings"
- cargo test --lib
- ./build_examples.sh
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"editor.formatOnSave": true,
"rust-client.channel": "nightly-2018-02-23",
"rust-client.channel": "nightly-2018-03-06",
}
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,3 @@ lto = true
[profile.release]
panic = "abort"
lto = true
debug = true
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ This project is nascent and still under heavy development, but first steps:

1. Ensure you have a working toolchain available:

`rustup install nightly-2017-12-16`
`rustup install nightly-2018-03-06`

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

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

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

Expand Down
4 changes: 1 addition & 3 deletions build_examples.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/usr/bin/env bash

set -eux
export RUST_TARGET_PATH=`pwd`
export CARGO_INCREMENTAL=0

cargo run --manifest-path xargo/Cargo.toml -- build --release --target=thumbv7em-tock-eabi --examples
RUST_TARGET_PATH=$(pwd) cargo run --manifest-path xargo/Cargo.toml -- build --release --target=thumbv7em-tock-eabi --examples
8 changes: 2 additions & 6 deletions layout.ld
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,15 @@ STACK_SIZE = 2048;
APP_HEAP_SIZE = 1024;
KERNEL_HEAP_SIZE = 1024;

/* Memory Spaces Definitions, 448K flash, 64K ram */
PROG_LENGTH = 0x00040000;
RAM_LENGTH = 0x00010000;

ENTRY(_start)

/* Note: Because apps are relocated, the FLASH address here acts as a sentinel
* value for relocation fixup routines. The application loader will select the
* actual location in flash where the app is placed.
*/
MEMORY {
FLASH (rx) : ORIGIN = 0x80000000, LENGTH = PROG_LENGTH
SRAM (RWX) : ORIGIN = 0x00000000, LENGTH = RAM_LENGTH
FLASH (rx) : ORIGIN = 0x80000000, LENGTH = 0x0040000
SRAM (RWX) : ORIGIN = 0x00000000, LENGTH = 0x0010000
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to inline those to make lld happy.

}

SECTIONS {
Expand Down
7 changes: 2 additions & 5 deletions run_example.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,11 @@

set -eux

export RUST_TARGET_PATH=`pwd`
export CARGO_INCREMENTAL=0

tab_file_name=metadata.toml
elf_file_name=cortex-m4.elf
bin_file_name=cortex-m4.bin

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

Expand All @@ -30,7 +27,7 @@ then
echo "do not delete apps from board."
else
tockloader uninstall --jtag --arch cortex-m4 --board nrf52-dk --jtag-device nrf52 --app-address 0x20000 || true
fi
fi
else
tockloader uninstall --jtag --arch cortex-m4 --board nrf52-dk --jtag-device nrf52 --app-address 0x20000 || true
fi
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nightly-2018-02-23
nightly-2018-03-06
10 changes: 2 additions & 8 deletions thumbv7em-tock-eabi.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,7 @@
"executables": true,
"no-compiler-rt": false,
"relocation-model": "ropi-rwpi",
"linker": "arm-none-eabi-ld",
"linker-flavor": "ld",
"linker-flavor": "ld.lld",
"linker-is-gnu": true,
"disable-redzone": true,
"pre-link-args": {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know why but the pre-link-args section stopped having any effect on the linker, so I had to move that part to .cargo/config.

"ld": [
"-Tlayout.ld"
]
}
"disable-redzone": true
}
2 changes: 1 addition & 1 deletion xargo
Submodule xargo updated 5 files
+2 −3 .travis.yml
+7 −0 CHANGELOG.md
+1 −1 Cargo.toml
+3 −0 bors.toml
+11 −0 src/sysroot.rs