cancel
Showing results for 
Search instead for 
Did you mean: 

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

wb0gaz
Senior

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

 

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Super User

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".

View solution in original post

2 REPLIES 2
TDK
Super User

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".

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