2026-02-03 10:36 PM
I am working on an STM32H563 project with a custom bootloader and two application slots (APP1 / APP2).
This is my memory layout
The bootloader is already deployed in the field and cannot be modified.
The bootloader jump sequence is standard:
This works perfectly when I build the application the “manual” way:
I would like to automate this process using cmake , without manually editing the linker script and system_stm32h5xx.c
So I implemented:
target_compile_definitions(app1 PRIVATE
VECT_TAB_OFFSET=0x00022000
)In the linker template .ld.in file, i have this:
MEMORY
{
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 640K
FLASH (rx) : ORIGIN = @FLASH_ORIGIN@, LENGTH = @FLASH_LENGTH@
}FLASH_ORIGN and FLASH_LENGTH are the variables
The generated .ld correctly shows FLASH (rx) : ORIGIN = 0x08022000, and i checked using STM32 cube programmer that the hex file is programmed at the correct address.
The problem is that when i generate the hex files from cmake , once i flash them in , the bootloader does not jump to the application.
Am i missing any obvious step here? I have attached the cmakelist file and the linker template(STM32H563xx_FLASH.ld.in)
Kindly Help