2026-01-30 3:31 AM
Hi,
I have some CubeMX-generated code which works properly. Originally it was created to run from default address 0x08000000.
Now I have a bootloader at address 0x08000000 which is responsible for handling updates and other stuff and then jumps into the target-code, so I moved that code via linker script to 0x08020000. This also works fine, the code works as desired.
In a next step I decided to have some additional information stored in flash prior to the CubeMX generated code to make it easier for the bootloader to manage firmware versions, so I shifted the code by additional 128 bytes and now have the following section in my linker script:
MEMORY
{
FLASH_BOOT (rx) : ORIGIN = 0x08000000, LENGTH = 128K
FLASH (rx) : ORIGIN = 0x08020080, LENGTH = 1024K - 128K - 128
EEPROM_EMUL (xrw) : ORIGIN = 0x080E0000, LENGTH = 128K
DTCMRAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
RAM_D1_DMA (xrw) : ORIGIN = 0x24000000, LENGTH = 64K
RAM_D1 (xrw) : ORIGIN = 0x24010000, LENGTH = 320K - LENGTH(RAM_D1_DMA)
RAM_D2 (xrw) : ORIGIN = 0x30000000, LENGTH = 32K
RAM_D3 (xrw) : ORIGIN = 0x38000000, LENGTH = 16K
ITCMRAM (xrw) : ORIGIN = 0x00000000, LENGTH = 64K
}My problem: with the start offset of 0x08020080 my interrupts do not work any more. So what is the problem here? What do I have to do in order to work with an application offset different than 128K?
Thanks!
2026-01-30 4:15 AM
Do you set SCB_VTOR to reflect this?
JW
2026-01-30 4:31 AM
This seems to be already covered by the changes in the linker script. On initialisation, in SystemInit(), within the statement
SCB->VTOR = (uint32_t) g_pfnVectors;
that g_pfnVectors points to the changed address 0x08020080
2026-01-30 5:32 AM
Which STM32?
If the vector table is longer than 0x80 - which probably in all 'H7 is - you can't have it at 0xXXXXXX80 address.
JW
2026-01-30 5:39 AM
Can you maybe share more information about the MCU you use?
Do you really have a 1MB internal flash? I would think you have a H7, but share more info to be sure
2026-01-30 8:14 AM
The offset needs to be a multiple of 0x400 on the H7, as @waclawek.jan suggests.