BSS section overlay - static variables
Dear openSTM32 support,
I feel like this question is related to any ld implementation but we use openSTM32 for our developments and I am asking my question here:
We use an overlay section in our linkerscript to allocate different file bss sections at the same memory address.
example: ld linkerscript excerpt:
OVERLAY :
{
.ovly0:
{
.bss: file*.o (.bss)
.bss: file_1*.o (.bss)
}
.ovly1:
{
.bss: file_2*.o (.bss)
}
}
file and file_1 bss sections are at the same location as file_2 bss section.
file and file_1 bss section are not overlapped with each other as expected from this linkerscript declaration.
Nevertheless this does not work if the global variables declared in my_file_1 and my_file are declared static.
In this case, the static variables of my_file and my_file_1 are allocated at the same memory address (this can be seen in debug mode).
Could you help me to clarify what happens here?
Should we forbid the use of the keyword “static” when using a file included in an overlay section?
Thank you,
Best regards,
Sylvain