Description
Summary
The default values for CONFIG_ROM_START_OFFSET
are arbitrarily defined as a value that works for "most" devices, and are not linked to other values that actually drive the required values.
Lines 130 to 134 in ed7f2e0
To provide a concrete example CONFIG_ROM_START_OFFSET
is used with MCUboot to place the application with some offset, with the expectation that this offset is where the vector table lives.
However, the linker scripts which actually control the location of the vector table have nothing to do with CONFIG_ROM_START_OFFSET
. This is instead controlled (at least for ARM) by CONFIG_NUM_IRQS
.
zephyr/arch/arm/core/vector_table.ld
Lines 29 to 37 in ed7f2e0
The result of this is that for any SoC where 4 * (16 + CONFIG_NUM_IRQS)
is greater than 0x200
, the board needs to override ROM_START_OFFSET
to work properly with MCUboot. e.g.
zephyr/boards/nordic/nrf54l15dk/Kconfig.defconfig
Lines 11 to 12 in ed7f2e0
Describe the solution you'd like
The required value for CONFIG_ROM_START_OFFSET
is (at least for ARM) dependent solely on NUM_IRQS
, which in turn only depends on the SoC. Individual boards should not be required to override this value to get MCUboot working.
Something like the following?
config VTOR_ALIGNMENT
default 0x200 if ARM && NUM_IRQS < X
default 0x400 if ARM && NUM_IRQS < Y
default 0x800 if ARM && NUM_IRQS < Z
default 0x200
config ROM_START_OFFSET
default VTOR_ALIGNMENT if BOOTLOADER_MCUBOOT
default 0
Alternatives
Do nothing, all praise Ctrl-C & Ctrl-V
Additional Context
No response