Skip to content

Commit e484e68

Browse files
committed
soc: st: stm32: Add Kconfig option to control signing CLI '-align' flag
Starting in v2.21.0, the STM32 signing tool ('STM32_SigningTool_CLI') stopped automatically adding padding bytes at the beginning of the payload to align it to the 0x400 offset. To restore this behavior, the '-align' flag must be passed to the signing tool. This commit introduces a new Kconfig option, 'CONFIG_STM32_SIGNING_TOOL_ALIGN_FLAG', that controls whether the '-align' flag is passed to the signing tool when signing images. This option is now enabled by default for STM32N6x series devices. For compatibility with 'STM32_SigningTool_CLI' v2.20.0 and earlier, this Kconfig option must be disabled. For example, the following config in 'app/sysbuild/mcuboot/boards/stm32n6570_dk_stm32n657xx_fsbl.conf' will omit the '-align' flag from the signing tool arguments: CONFIG_STM32_SIGNING_TOOL_ALIGN_FLAG=n Fixes #99456 Signed-off-by: Chris Wilson <chris@binho.io>
1 parent f1c2ce4 commit e484e68

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

soc/st/stm32/Kconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,4 +132,11 @@ config STM32_APP_IN_EXT_FLASH
132132
in external Flash and is chainloaded with MCUboot.
133133
Whether the app is eXecuted in Place (XiP) depends on the MCUboot mode used.
134134

135+
config STM32_SIGNING_TOOL_ALIGN_FLAG
136+
bool "STM32 image signing tool '-align' flag"
137+
default y
138+
depends on SOC_SERIES_STM32N6X
139+
help
140+
Adds the '-align' flag when invoking the STM32 image signing tool.
141+
135142
endif # SOC_FAMILY_STM32

soc/st/stm32/stm32n6x/CMakeLists.txt

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,22 @@ if(NOT CONFIG_BOOTLOADER_MCUBOOT)
3636
You won't be able to run application on the board.
3737
Refer to board documentation for more information")
3838
else()
39-
set_property(GLOBAL APPEND PROPERTY extra_post_build_commands
40-
COMMAND ${SIGNING_TOOL}
39+
set(SIGNING_TOOL_ARGS
4140
-in ${PROJECT_BINARY_DIR}/${CONFIG_KERNEL_BIN_NAME}.bin
4241
-nk -t fsbl -hv 2.3 --silent
42+
)
43+
44+
if(CONFIG_STM32_SIGNING_TOOL_ALIGN_FLAG)
45+
list(APPEND SIGNING_TOOL_ARGS -align)
46+
endif()
47+
48+
list(APPEND SIGNING_TOOL_ARGS
4349
-o ${PROJECT_BINARY_DIR}/${CONFIG_KERNEL_BIN_NAME}.signed.bin
4450
-dump ${PROJECT_BINARY_DIR}/${CONFIG_KERNEL_BIN_NAME}.signed.bin
51+
)
52+
53+
set_property(GLOBAL APPEND PROPERTY extra_post_build_commands
54+
COMMAND ${SIGNING_TOOL} ${SIGNING_TOOL_ARGS}
4555
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
4656
)
4757

0 commit comments

Comments
 (0)