I’m looking for a way to relocate the stack on STM32 mcu’s, normally it is placed at the end of the SRAM, but i would like to place it just behind all the data in SRAM. It seems this is also done by some other toolchains that don’t use gcc. Untill now i haven’t found anything that can point me in the right direction. Can anyone tell me how this can be done?
If you are trying to reserve a fixed amount of space for the stack/heap, please try adding the “Fixed stack/heap” framework via VisualGDB Project Properties -> Embedded Frameworks and VisualGDB will do this for you automatically.
Otherwise you would need to edit the linker script to modify the memory layout manually. You can simply copy the default linker script used by VisualGDB locally via VisualGDB Project Properties -> Build Settings, move the .reserved_for_stack section to the location you want and update the _estack symbol to be defined at the end of the .reserved_for_stack section (the initialization code will use this symbol to set the initial stack address).