2025-09-12 8:23 PM - edited 2025-09-12 8:30 PM
I am working on an STM32H7S3L8 Nucleo board and building a bare-metal project with the Mongoose networking library (no RTOS, no LwIP).
The project compiles successfully after adjusting flash size in the linker script, but fails to load into the MCU via STM32CubeIDE or STM32CubeProgrammer.
I consistently see this error:
Error in final launch sequence:
Failed to execute MI command:
load ".../Mongoose_Webserver_Boot.elf"
Error message from debugger back end:
Load failed
And from CubeProgrammer logs:
Memory Programming ...
File : Mongoose_Webserver_Boot.elf
Size : 68.86 KB
Address : 0x08000000
Download in Progress:
Error: file size is bigger than the flash memory size.
Error: failed to download Segment[0]
Even though the ELF file size is only ~69 KB, CubeProgrammer reports it does not fit in flash.
Board: NUCLEO-H7S3L8 (STM32H7S3L8Hx)
IDE: STM32CubeIDE 1.17.0
Toolchain: GNU Tools for STM32 12.3.rel1
Debugger: ST-LINK V3
External libs: Mongoose (baremetal, no RTOS, no LwIP
Adjusted flash and RAM sizes in linker script (STM32H7S3L8HX_FLASH.ld)
Confirmed MCU datasheet: 2 MB Flash, 560 KB RAM
Verified MEMORY map in linker file matches device reference manual
Cleaned project and rebuilt
Enabled .bin output from CubeIDE and attempted programming that
Tried both CubeIDE Debug and STM32CubeProgrammer direct load
__FLASH_BEGIN = 0x08000000;
__FLASH_SIZE = 0x00200000; /* 2 MB flash */
__RAM_BEGIN = 0x24000000;
__RAM_SIZE = 0x0008C000; /* 560 KB RAM */
__RAM_NONCACHEABLEBUFFER_SIZE = 0x400;
MEMORY
{
RAM (xrw) : ORIGIN = __RAM_BEGIN, LENGTH = __RAM_SIZE - __RAM_NONCACHEABLEBUFFER_SIZE
RAM_NONCACHEABLEBUFFER (xrw) : ORIGIN = __RAM_BEGIN + __RAM_SIZE - __RAM_NONCACHEABLEBUFFER_SIZE, LENGTH = __RAM_NONCACHEABLEBUFFER_SIZE
ITCM (xrw) : ORIGIN = 0x00000000, LENGTH = 0x00010000
DTCM (rw) : ORIGIN = 0x20000000, LENGTH = 0x00010000
SRAMAHB (rw) : ORIGIN = 0x30000000, LENGTH = 0x00008000
BKPSRAM (rw) : ORIGIN = 0x38800000, LENGTH = 0x00001000
FLASH (rx) : ORIGIN = __FLASH_BEGIN, LENGTH = __FLASH_SIZE
}
The generated ELF file is ~68 KB, so it should easily fit in 2 MB flash.
Binary output (.bin) is around 40 KB.
Still, CubeProgrammer rejects the ELF.
I suspect there might be:
A toolchain section misalignment issue (sections mapped beyond 0x0820_0000)
A possible bug in STM32CubeIDE → STM32CubeProgrammer integration
Some hidden MCU configuration in project properties that overrides the linker script
Why does CubeProgrammer report “file size is bigger than flash” when my ELF is only ~69 KB?
Is there a known issue with STM32CubeIDE 1.17.0 + GNU Tools 12.3.rel1 where the ELF mapping is misinterpreted?
For STM32H7S3L8 (2 MB flash, 560 KB RAM), is my linker script correct?
CubeIDE Load Error when Flash is set 2MB
STM32H7S3L8HX_FLASH.ld file
Build fail while Flash memory set 64KB
CubeProgrammer Load Error - elf file
CubeProgrammer Load Error - bin file