From 609c615303ba809c6b000209cdb102f178cef1fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Th=C3=A9baudeau?= Date: Sat, 23 May 2015 18:25:33 +0200 Subject: [PATCH] cc2538: Move the stack out of .bss MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The initialization code clearing .bss is allowed to use the stack, so the stack can not be in .bss, or this code will badly fail if it uses the stack. Signed-off-by: Benoît Thébaudeau --- cpu/cc2538/cc2538.lds | 5 +++++ cpu/cc2538/startup-gcc.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/cpu/cc2538/cc2538.lds b/cpu/cc2538/cc2538.lds index 84908bd60..cfd4cb48c 100644 --- a/cpu/cc2538/cc2538.lds +++ b/cpu/cc2538/cc2538.lds @@ -106,6 +106,11 @@ SECTIONS _ebss = .; } > SRAM + .stack (NOLOAD) : + { + *(.stack) + } > SRAM + #if (LPM_CONF_MAX_PM==2) && (LPM_CONF_ENABLE != 0) .nrdata (NOLOAD) : { diff --git a/cpu/cc2538/startup-gcc.c b/cpu/cc2538/startup-gcc.c index b72701505..bf00c90f9 100644 --- a/cpu/cc2538/startup-gcc.c +++ b/cpu/cc2538/startup-gcc.c @@ -89,7 +89,7 @@ void uart1_isr(void) WEAK_ALIAS(default_handler); #endif /*---------------------------------------------------------------------------*/ /* Allocate stack space */ -static unsigned long stack[512]; +static unsigned long stack[512] __attribute__ ((section(".stack"))); /*---------------------------------------------------------------------------*/ /* Linker construct indicating .text section location */ extern uint8_t _text[0];