Skip to main content
wb0gaz
Associate III
February 24, 2026
Solved

stm32cubeide STM32C011 MCU - build failing after MCU part change: section `.data' will not fit in region `RAM'

  • February 24, 2026
  • 1 reply
  • 189 views

Started project (using STM32CubeMX) with STM32C011J4M6 (SO8 package, 16K flash).

Using STM32CubeIDE

Version: 1.19.0

Build: 25607_20250703_0907 (UTC)

Application now requires >16K (flash (code+flash data space) so replaced MCU part with STM32C011J6M6 (SO8 package, 32K flash).

After adding content to project source code (a font file, taking the expected total flash space over 16384 bytes) build does not complete.

I believe the root cause is that I've not told STM32CubeIDE of change to the larger-flash version of the chip (same family, just larger flash).

What file(s) need to be edited to enable the larger flash size (or do I need to revert to STM32CubeMX and then splice the now under-development project source code into the new project?

 

C:/ST/STM32CubeIDE_1.19.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.13.3.rel1.win32_1.0.0.202411081344/tools/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/bin/ld.exe: (MY PROJECT NAME).elf section `.data' will not fit in region `RAM'

 

C:/ST/STM32CubeIDE_1.19.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.13.3.rel1.win32_1.0.0.202411081344/tools/bin/../lib/gcc/arm-none-eabi/13.3.1/../../../../arm-none-eabi/bin/ld.exe: region `RAM' overflowed by 5016 bytes

 

Thanks very much!


Dave

 

Best answer by TDK

The linker file (*.ld) is the correct place to edit the size of the regions. It is in the top-level directory along with the IOC file. You should generally be using the *_FLASH.ld linker file, not the *_RAM.ld one.

If RAM is overflowing, increasing the size of the FLASH will not help. You may have something else going on. Be sure the array is marked as const if it should live in flash.

1 reply

TDK
TDKBest answer
Super User
February 24, 2026

The linker file (*.ld) is the correct place to edit the size of the regions. It is in the top-level directory along with the IOC file. You should generally be using the *_FLASH.ld linker file, not the *_RAM.ld one.

If RAM is overflowing, increasing the size of the FLASH will not help. You may have something else going on. Be sure the array is marked as const if it should live in flash.

"If you feel a post has answered your question, please click ""Accept as Solution""."
wb0gaz
wb0gazAuthor
Associate III
February 24, 2026

Hello TDK, thanks much for the quick and extremely helpful reply!

I did not know where to look for the loader control file(s); it is informative and learning it's capabilities be helpful in the future as well. As it turns out in this case the 32K flash device was provisioned already.

On declaring font array (or other read-only sort of data) as "const" - the font data I obtained (did not create) did not have this declaration; once added the memory report from build task makes far (far) more sense!

Again, thank you so much for guiding me through this thicket of details!

Dave