I'm working on a stm32 nucleo board. My project is composed of several different libraries.
I would like to put all uninitialized variables coming from static library (mylib.a) in a specific memory section instead of the bss section.
Here is my bss section inside the linker script:
. = ALIGN(4);
.bss :
{
/* This is used by the startup in order to initialize the .bss section */
_sbss = .; /* define a global symbol at bss start */
__bss_start__ = _sbss;
*(.bss)
*(.bss*)
*(COMMON)
. = ALIGN(4);
_ebss = .; /* define a global symbol at bss end */
__bss_end__ = _ebss;
} >RAM
I tried adding this section before the bss one:
. = ALIGN(4);
.mybss :
{
/* This is used by the startup in order to initialize the .bss section */
_smybss = .; /* define a global symbol at bss start */
__mybss_start__ = _smybss;
mylib.a:*(.bss)
mylib.a:*(.bss*)
mylib.a:*(COMMON)
. = ALIGN(4);
_emybss = .; /* define a global symbol at bss end */
__mybss_end__ = _emybss;
} >RAM
The compiler does not complain but when I inspect with nm command the generated elf _smybss symbol is at the same address of _emybss symbol. So mybss section is empty.
Do you have any suggestion on how to achive this?
Thanks