Separation of STACK and HEAP
Hello,
I have a general question regarding the linker script generated by STM32CubeIDE.
Most of time the STACK and HEAP is placed together into the "same" internal SRAM (see section .user_heap_stack example for demonstration purpose).
Note: Yes, there is a chance that region can overlap, but this is something I don't want to discuss here.
._user_heap_stack :
{
. = ALIGN(8);
PROVIDE ( end = . );
PROVIDE ( _end = . );
. = . + _Min_Heap_Size;
. = . + _Min_Stack_Size;
. = ALIGN(8);
} > RAM_D1
I wanted to place some critical data, static variables, etc as well as the STACK pointer into the DTCRAM area. However, the heap is not used so heavily in our application therefore, I would like put it into a slower region e.g. RAM_D2/3.
I guess this should be possible , right ?
If I do so, I assume I can ge get rid of the ". = . + _Min_Stack_Size;"- statement in the linker script as the stack is now decoupled from the heap?
Furthermore, I assume that I need to modify the sbrk() function as well which is a fundamental part of the malloc call as there are some dependencies to linker symbols which are derived from the STACK handling . Is that correct?
Do we have a working example availble which cope with that decoupling of STACK and HEAP?