This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

changing linker allocation order

How can I get the linker to place sections in a desired order?  I know that the default behavior is to allocate based on section size, largest to smallest.  I want to place my .bss section and a small buffer section at the beginning of SRAM, then have a large sysmem section follow.  This would allow me to switch SRAM/cache settings without wiping out my global variables.  Any way other than manually placing my sysmem section at a specific address?

  • Unfortunately there is no way to control the order of code/data sections in a single physical memory segment (the linker only puts them in its own order as you mention). To do what you want you would have to have multiple physical memory segments that you allocate the particular code/data sections to so you could get the order of sections in the SRAM as you desire, for example make SRAMLOW and SRAMHIGH segments.