2025-11-24 12:52 AM - last edited on 2025-11-24 1:25 AM by mƎALLEm
Hello,
I am working with an STM32H563VITx (2 MB Flash) and I am experiencing a repeatable issue when placing two custom sections (.param_defaults and .app_defaults) at the end of Flash.
The application runs as long as these sections are removed.
But when they are enabled, ST-LINK GDB server / STM32CubeProgrammer fails to erase/program the Flash during a debug session.
I have a bootloader located at 0x08000000 (32 KB) and the application starts at 0x08008000.
At the end of the application Flash, I place two small tables:
.param_defaults (160 bytes)
.app_defaults (96 bytes)
Both are aligned to 32 bytes.
My linker script computes their addresses like this:
FLASH_APP_END = FLASH_APP_START + FLASH_APP_LENGTH; FLASH_APP_TABLE_START = ((FLASH_APP_END - FLASH_APP_TABLE_LENGTH + 31) / 32) * 32; FLASH_PARAM_TABLE_START = ((FLASH_APP_TABLE_START - FLASH_PARAM_TABLE_LENGTH + 31) / 32) * 32;These sections end up at:
Here the sections from my List-File:
Idx Name Size VMA LMA File off Algn
0 .isr_vector 0000024c 08008000 08008000 00001000 2**0
CONTENTS, ALLOC, LOAD, READONLY, DATA
1 .text 00008ad8 0800824c 0800824c 0000124c 2**2
CONTENTS, ALLOC, LOAD, READONLY, CODE
2 .rodata 00000010 08010d24 08010d24 00009d24 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
3 .ARM.extab 00000000 08010d34 08010d34 0000afe0 2**0
CONTENTS, READONLY
4 .ARM 00000000 08010d34 08010d34 0000afe0 2**0
CONTENTS, READONLY
5 .preinit_array 00000000 08010d34 08010d34 0000afe0 2**0
CONTENTS, ALLOC, LOAD, DATA
6 .init_array 00000004 08010d34 08010d34 00009d34 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
7 .fini_array 00000004 08010d38 08010d38 00009d38 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
8 .data 00000028 20000000 08010d3c 0000a000 2**2
CONTENTS, ALLOC, LOAD, DATA
9 .param_defaults 0000007c 081fff00 081fff00 0000af00 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
10 .app_defaults 00000040 081fffa0 081fffa0 0000afa0 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
11 .bss 00000458 20000028 20000028 0000b028 2**2
ALLOC
The .param_defaults and .app_defaults are exactly at the very top of the 2 MB Flash.
When starting a debug session in STM32CubeIDE, the ST-LINK GDB server starts programming the device but fails with:
After this, the debugging session aborts.
If I comment out the two custom sections (so nothing is placed at the Flash end), everything works normally.
Is the last Flash sector of STM32H563 protected or reserved for system use?
The error always appears when the .param_defaults and .app_defaults sections are placed in the highest Flash pages.
Does STM32CubeProgrammer or ST-LINK have limitations when programming data very close to the Flash upper boundary?
Is there an official recommended way to place application-specific data structures in the last Flash pages of the STM32H5/H56x series?
Should a safety margin be kept from the very top of Flash?
Could the address rounding (ALIGN 32) cause segments to be generated beyond the real Flash limit?
Device: STM32H563VITx
Board: NUCLEO-H563ZI
ST-LINK FW: V3J16M9
STM32CubeIDE: 1.19.0
TrustZone: Inactive
Bootloader occupies first 32 KB, application starts at 0x08008000.
I want to store persistent read-only data tables at the end of Flash.
Before I redesign the memory map, I need clarification whether:
the very last Flash pages are writable by the user
or they are reserved / protected / not programmable by default
or whether this is a software limitation in CubeProgrammer / ST-LINK
Any official advice or documentation reference would be greatly appreciated.
Thank you!