2021-08-03 01:25 AM
Hello,
Someone have a document that give explications/informations on how modify the link file ?
I must optimize ma code performance and I would realocate the stack/heap, the time critical functions, into the TCM area.
I know the way to locate variables into specific area ("attribute" put after variable declaration). But I don't find the way to do that for all the content of one source file (to put functions into specific code section and and variables into specific data section)
Thanks a lot for your time
Solved! Go to Solution.
2021-08-05 11:48 AM
Assuming gcc toolchain.
For the critical functions you may
2.+ 3. may interfer with automagically generated make- and other files depending on your IDE
The initial stack pointer is the value of symbol _estack defined in the .ld file which can be easily redefined as you like. Things get more complicated when using a RTOS with task-specifiy stacks (typically allocated on the heap).
For the main heap, check the implementation of _sbrk. In STM generated code, this is in sysmem.c and uses two linker script defined symbols for heap beginning and end. Those values can also be changed to your needs. Putting the main heap into DTCM may be too much for that valuable ressource, use with care.
2021-08-05 11:48 AM
Assuming gcc toolchain.
For the critical functions you may
2.+ 3. may interfer with automagically generated make- and other files depending on your IDE
The initial stack pointer is the value of symbol _estack defined in the .ld file which can be easily redefined as you like. Things get more complicated when using a RTOS with task-specifiy stacks (typically allocated on the heap).
For the main heap, check the implementation of _sbrk. In STM generated code, this is in sysmem.c and uses two linker script defined symbols for heap beginning and end. Those values can also be changed to your needs. Putting the main heap into DTCM may be too much for that valuable ressource, use with care.
2021-08-05 11:36 PM
Hello KnarfB
I already use the 1. solution, it's useful for locate specific function.
The manual on gcc to modify the ld file will help me a lot in the syntax undertanding of the linker file.
For the stack, I finally fond the solution that you explain.
Many thanks for your time