cancel
Showing results for 
Search instead for 
Did you mean: 

Why '.bss' was created in both Flash and RAM? This causes "section `.bss' will not fit in region `RAM'" in my application.

HNall.1
Associate III

Hi All,

I have created a STM32 application using STM32CUBDEIDE. I'm using STM32F469IH6 for this project.

I have declared few uninitialized variables in one file. I know this affects ".bss" section but it is required in my code. This causes an error saying "section `.bss' will not fit in region `RAM'" in my application". I have few question regarding this?

  1. Below image shows Memory details in Build Analyzer from Map file. Why '.bss' was created in both Flash Memory and RAM ?
  2. How can i change the code to use only ".rodata"/".bss" section in Flash memory instead of RAM? I have written below piece of code to use C variable in ".rodata" section in the Flash but it was creating in RAM in a separate section called "RO".
float C[40000] __attribute__((section ("RO")));

3.Same object file(predict.o) was stored in both '.rodata' and '.bss' sections? I have attached .map file for more details.

Please find the map from below location:

https://drive.google.com/file/d/1AOiWwmsoodgzdnbz0I5Hp1NzAgetNKRA/view?usp=sharing

0693W000003PtXMQA0.png

Thanks in advance,

Hari

8 REPLIES 8
TDK
Guru

Post your linker script.

If you feel a post has answered your question, please click "Accept as Solution".
HNall.1
Associate III

Hi @TDK​ ,

Please find the linker scripts.

 
Piranha
Chief II

What do you want to achieve? If you want something to be only in the FLASH memory, then just define it as a constant.

Hi @Piranha​ ,

I am facing "RAM overflow problem". I am trying to resolve this issue by changing code to fit in desired section.

​My application cannot entirely run with constants to make it fit in FLASH.

I am new to deployment on STM32 Micro-controllers.

It would be great if you respond to above individual questions​ on the post. This will really helpful for me.

Thanks a lot,

Hari​

When posting files to Google Drive, make sure the access rights only require the link to download

Is that really the default linker script? Definitely doesn't look viable, did you edit this?

This one would work better

STM32Cube_FW_F4_V1.25.0\Projects\STM32469I_EVAL\Templates\SW4STM32\STM32469I_EVAL\STM32F469NIHx_FLASH.ld

Not sure how 700KB of data would fit in 320KB of RAM which ever way you turn it.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Piranha
Chief II

Your MCU has 320+64 KB of RAM, but you are trying to put almost 781,3 KB in it. That's just not possible! :)

If you qualify the array as const, gcc will put it into the FLASH instead of RAM. You want to provide an initialize for it and it's of course read-only.

JW