diff options
author | 2023-02-11 02:46:17 +0000 | |
---|---|---|
committer | 2023-02-11 02:46:17 +0000 | |
commit | 2bdd95f3172fe741ac1e6fb8659ba06aed1a395d (patch) | |
tree | 8d540b62422397a55b15b9ab729515875ff4b21e | |
parent | ac8d42bb2e0b41ea29efe3fbeb85273d388e6a0c (diff) | |
parent | 34b14d802156a77c9533cab2349e93523ce0aa96 (diff) | |
download | cortex-m-2bdd95f3172fe741ac1e6fb8659ba06aed1a395d.tar.gz cortex-m-2bdd95f3172fe741ac1e6fb8659ba06aed1a395d.tar.zst cortex-m-2bdd95f3172fe741ac1e6fb8659ba06aed1a395d.zip |
Merge #464
464: cortex-m-rt: assert in linker script that stack_start is 8-byte aligned. r=adamgreig a=Dirbaio
If the user sets RAM length to something that's not multiple of 8, the stack won't be 8-byte aligned. This'll trigger the same horrible symptoms as #463 .
This PR adds an assert to the linker script that enforces alignment.
Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
-rw-r--r-- | cortex-m-rt/link.x.in | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/cortex-m-rt/link.x.in b/cortex-m-rt/link.x.in index 4461646..9f893d4 100644 --- a/cortex-m-rt/link.x.in +++ b/cortex-m-rt/link.x.in @@ -217,6 +217,12 @@ BUG(cortex-m-rt): .bss is not 4-byte aligned"); ASSERT(__sheap % 4 == 0, " BUG(cortex-m-rt): start of .heap is not 4-byte aligned"); +ASSERT(_stack_start % 8 == 0, " +ERROR(cortex-m-rt): stack start address is not 8-byte aligned. +If you have set _stack_start, check it's set to an address which is a multiple of 8 bytes. +If you haven't, stack starts at the end of RAM by default. Check that both RAM +origin and length are set to multiples of 8 in the `memory.x` file."); + /* # Position checks */ /* ## .vector_table */ |