BSS section problems KDS3.0 with kv4x

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

BSS section problems KDS3.0 with kv4x

Jump to solution
802 Views
robertozanichel
Contributor I

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.

Labels (1)
Tags (2)
1 Solution
581 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

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!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

2 Replies
582 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

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!
-----------------------------------------------------------------------------------------------------------------------

581 Views
robertozanichel
Contributor I

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.



 

0 Kudos