-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement static linking w/ .data and .bss initialization.
Proper compiler support for ROPI-RWPI relocation is a ways off; in the meantime, this lets Rust apps work on Tock. The application will need to know where it will be loaded in RAM, which requires adjusting the kernel's linker script. To support the existing examples, I guessed where an application would be loaded on the nRF52-DK. An application also needs to know where its .text will end up, which is immediately after the protected region. To make this predictable, we need to fix the protected region size. This is done using elf2tab's --protected-region-size, added in tock/elf2tab#6. Users of libtock-rs will need a recent elf2tab and must pass an appropriate value for protected-region-size to elf2tab.
- Loading branch information
Showing
5 changed files
with
127 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
# Target configuration for the example apps on the nRF52-DK | ||
[target.thumbv7em-none-eabi] | ||
rustflags = [ | ||
"-C", "link-arg=-Tlayout.ld", | ||
"-C", "relocation-model=ropi-rwpi", | ||
"-C", "link-arg=-Tnrf52_layout.ld", | ||
"-C", "relocation-model=static", | ||
"-D", "warnings", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* Layout for the nRF52-DK, used by the examples in this repository. */ | ||
|
||
MEMORY { | ||
/* The application region is 64 bytes (0x40) */ | ||
TEXT (rx) : ORIGIN = 0x00020040, LENGTH = 0x0005FFC0 | ||
SRAM (rwx) : ORIGIN = 0x20002000, LENGTH = 62K | ||
} | ||
|
||
MPU_MIN_ALIGN = 8K; | ||
|
||
INCLUDE layout.ld |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters