Skip to main content
HNall.1
Associate III
August 20, 2020
Question

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

  • August 20, 2020
  • 8 replies
  • 7291 views

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

This topic has been closed for replies.

8 replies

TDK
August 20, 2020

Post your linker script.

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

Hi @TDK​ ,

Please find the linker scripts.

HNall.1
HNall.1Author
Associate III
August 20, 2020
Piranha
Principal III
August 20, 2020

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

HNall.1
HNall.1Author
Associate III
August 20, 2020

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​

Tesla DeLorean
Guru
August 20, 2020

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 (See Profile) Up vote any posts that you find helpful, it shows what's working..
Piranha
Principal III
August 20, 2020

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

waclawek.jan
Super User
August 20, 2020

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