From 34b14d802156a77c9533cab2349e93523ce0aa96 Mon Sep 17 00:00:00 2001 From: Dario Nieuwenhuis Date: Sat, 11 Feb 2023 03:03:10 +0100 Subject: cortex-m-rt: assert in linker script that stack_start is 8-byte aligned. --- cortex-m-rt/link.x.in | 6 ++++++ 1 file changed, 6 insertions(+) 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 */ -- cgit v1.2.3