Skip to content

Commit 2bdd95f

Browse files
bors[bot]Dirbaio
andauthored
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 <[email protected]>
2 parents ac8d42b + 34b14d8 commit 2bdd95f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

cortex-m-rt/link.x.in

+6
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,12 @@ BUG(cortex-m-rt): .bss is not 4-byte aligned");
217217
ASSERT(__sheap % 4 == 0, "
218218
BUG(cortex-m-rt): start of .heap is not 4-byte aligned");
219219

220+
ASSERT(_stack_start % 8 == 0, "
221+
ERROR(cortex-m-rt): stack start address is not 8-byte aligned.
222+
If you have set _stack_start, check it's set to an address which is a multiple of 8 bytes.
223+
If you haven't, stack starts at the end of RAM by default. Check that both RAM
224+
origin and length are set to multiples of 8 in the `memory.x` file.");
225+
220226
/* # Position checks */
221227

222228
/* ## .vector_table */

0 commit comments

Comments
 (0)