I am struggling with the placement of the stack in a LPC1769. This controller has two RAM banks, each 32kB. I was very surprised when my application started behaving weirdly today as the RAM usage only reached about 15.9kB (data variables suddenly changing their value, weird HardFault Exceptions). During debugging I discovered that the stack is placed at address 0x10004000, growing towards 0x10000000 where the data area starts (growing up). So effectively the stack starts at 16kB, growing towards the user data. Of course it collides with the data area very soon, even though the RAM is not used completely.
Now I want to move the stack at least to the end of the RamLoc32 area (alias RAM; the first 32kB RAM block), but even better to the RamAHB32 block (alias RAM2). I tried doing this in LPCXpresso and MCUXpresso with the option
(placed under Project -> Properties -> C/C++ Build -> Settings -> MCU Linker -> Miscellaneous -> Other options), but this has no effect (in the user program, I read the initial stack pointer value with
uint32_t stack = __get_MSP();
but is always is around 10003900 and the application crashes again). In MCUXpresso I even tried the Heap and Stack placement in MCUXpresso Style under Project -> Properties -> C/C++ Build -> Settings -> MCU Linker -> Managed Linker Script, but this has no effect as well. After changing the setting, I cleaned and rebuilt the project, no effects at all.
Can someone help me out?