Good morning,
I've a problem related to linker allocation of memory sections, the linker keep putting variables in .bss memory section even if they are initialized and different from 0.
The #pragma section instruction on the arm site (that i've seen in a similar discussion) seems to have no effect.
COMPILER OUTPUT:
Invoking: Cross ARM C++ Linker
.....
..../kds_v3/toolchain/bin/../lib/gcc/arm-none-eabi/4.8.4/../../../../arm-none-eabi/bin/ld.exe: myelf.elf section `.bss' will not fit in region `m_data'
..../kds_v3/toolchain/bin/../lib/gcc/arm-none-eabi/4.8.4/../../../../arm-none-eabi/bin/ld.exe: region `m_data' overflowed by 92 bytes
collect2.exe: error: ld returned 1 exit status
i want to know if there is an effective and proved solution to avoid bss occupation because every global variable that i use has it's own initialization function that is called inside the code so i don't see the need of the compiler to do it before my initialization.
Thaks for help,
i hope you help me to clarify this.
已解决! 转到解答。
Hello Roberto,
- The .bss contains all the uninitalized data.
text, data and bss: Code and Data Size Explained | MCU on Eclipse
- If the RAM overflowed, you can relocate the variable into flash , the detail steps
please refer to this DOC:
Relocating Code and Data Using the KDS GCC Linker File for Kinetis
Hope it helps
Have a great day,
Alice Yang
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hello Roberto,
- The .bss contains all the uninitalized data.
text, data and bss: Code and Data Size Explained | MCU on Eclipse
- If the RAM overflowed, you can relocate the variable into flash , the detail steps
please refer to this DOC:
Relocating Code and Data Using the KDS GCC Linker File for Kinetis
Hope it helps
Have a great day,
Alice Yang
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Thank you very much,
i was already confident with the first link you gave me, i knew that bss was where to put uninitalized data, and i think also the data intialized as zero goes there.
I took care of all the initialization but i think sometimes code optimization play me. I solved the problem simply reorganizing the code so there is still some "black magic" for me.
I was hoping to find a much easier (and portable) solution than using the section attribute, but i think there is "no free lunch", thanks for the link, i really missed that topic...
Anyway thanks for help!!! the topic helped me to have a deeper understanding.