cancel
Showing results for 
Search instead for 
Did you mean: 

[STM32H7S3L8] ELF file size mismatch and flashing error with Mongoose skeleton project (Baremetal, no RTOS/LwIP)

Sajidaap
Associate III

1. Problem Description

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.

2. Development Environment

  • 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

 

3. Steps Already Taken

  • 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

 

4. Current Linker Script (STM32H7S3L8HX_FLASH.ld)

 

 
__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
}
 

5. Additional Notes

  • 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:

    1. A toolchain section misalignment issue (sections mapped beyond 0x0820_0000)

    2. A possible bug in STM32CubeIDE → STM32CubeProgrammer integration

    3. Some hidden MCU configuration in project properties that overrides the linker script

6. My Questions

  1. Why does CubeProgrammer report “file size is bigger than flash” when my ELF is only ~69 KB?

  2. Is there a known issue with STM32CubeIDE 1.17.0 + GNU Tools 12.3.rel1 where the ELF mapping is misinterpreted?

  3. For STM32H7S3L8 (2 MB flash, 560 KB RAM), is my linker script correct?

  4. Could CubeIDE still be using an old _RAM.ld file or wrong debug config even though I selected FLASH?

 

CubeIDE Load Error when Flash is set 2MBCubeIDE Load Error when Flash is set 2MB

 

STM32H7S3L8HX_FLASH.ld fileSTM32H7S3L8HX_FLASH.ld file

 

Build fail while Flash memory set 64KBBuild fail while Flash memory set 64KB

 

CubeProgrammer Load Error - elf fileCubeProgrammer Load Error - elf file

 

CubeProgrammer Load Error - bin fileCubeProgrammer Load Error - bin file

0 REPLIES 0