2025-03-11 6:13 PM
Hi all, I have an STM32H743 project that I've been working on. I've worked on a fair amount of projects in STM32CubeIDE in the past, but now I have a problem I haven't encountered before: the linker is putting my .bss section in flash as well as RAM. I'm not sure why an uninitialized section would be placed in flash... I've attached the output from the build analyzer as well as my linker script. The script is almost the default, except that I've added D2/D3 RAM and have moved stack & heap to DTCM. I've used very similar scripts in other projects and BSS ends up only in RAM in those projects.
Can anyone find what I'm doing wrong? Thanks!
2025-04-22 4:42 AM
> ALL of them fail to find the issue.
Maybe because they are hard-locked to be polite and abstain from comments about bss on flash? They probably think, well, those humans have unicorns, dragons and Santa, why not bss in flash?
Machines are still "garbage in, garbage out" things.
2025-09-03 8:07 AM - edited 2025-09-03 8:20 AM
I ran into the same issue, and it turns out the .bss section does not actually take up space in flash as reflected in the binary/executable output files
It is a bug with the build analyzer, and possibly others. Since the linker assigns this section an LMA in FLASH due to a previous section having a VMA in the same memory region whose LMA is also in FLASH i.e. data section (this may be a linker bug or a quirk of the linker), the build analyzer erroneously determines that this region takes up space in flash.
Or select the .elf instead of the .map when using the build analyzer.
2025-09-03 1:56 PM
> Or select the .elf instead of the .map when using the build analyzer.
How?
2025-09-03 2:00 PM
Thanks for the info! If I recall correctly (it’s been a while now), the main issue for me that I needed to export the binary as a .bin file and it was coming out as 600MB in size because it was including all the bss RAM space as well as flash, and all the bytes in between. So it’s probably not just limited to the build analyzer (or the .bin file export uses the build analyzer data)
2025-09-03 8:33 PM
Oh, I see. You may be experiencing a different issue then. My .bin files come out the correct size.
600MB sounds like it is an issue separate from the build analyzer reporting .bss consuming space in flash
What are your project settings under C/C++ Build?