mcuboot
mcuboot copied to clipboard
zephyr: `CONFIG_BOOT_MAX_IMG_SECTORS` is not configurable for downstream platforms
Problem
The BOOT_MAX_IMG_SECTORS setup currently requires modifications to the mcuboot repo to support boards with non-default values.
https://github.com/mcu-tools/mcuboot/blob/5d067f0e0ca7639b8c1f9aa2804c8718caae2440/boot/zephyr/Kconfig#L383-L390
Because this file is the absolute first contents of the kconfig tree, there is no ability to update this default on a per-board basis.
https://github.com/mcu-tools/mcuboot/blob/5d067f0e0ca7639b8c1f9aa2804c8718caae2440/boot/zephyr/Kconfig#L758
As a result, there are board specific overlays in this application that for purposes of maintability really should be set wherever the board is defined, e.g: https://github.com/mcu-tools/mcuboot/blob/5d067f0e0ca7639b8c1f9aa2804c8718caae2440/boot/zephyr/boards/lpcxpresso55s28.conf#L1-L6
The only way to set this value is explicitly via CONFIG_BOOT_MAX_IMG_SECTORS=N. This is only possible from the command line or by modifying the mcuboot application. Attempting to set it in a board_defconfig file results in compilation errors as the symbol only exists for the bootloader application.
Expected behaviour
Defaults for the zephyr bootloader that reasonably could change on a per-board basis should be configurable in the same location that the board is defined.