@@ -93,12 +93,6 @@ function(zephyr_mcuboot_tasks)
93
93
set (imgtool_sign ${PYTHON_EXECUTABLE} ${IMGTOOL} sign --version ${CONFIG_MCUBOOT_IMGTOOL_SIGN_VERSION} --align ${write_block_size} --slot-size ${slot_size} --header-size ${CONFIG_ROM_START_OFFSET} ${imgtool_rom_command} )
94
94
endif ()
95
95
96
- set (imgtool_directxip_hex_command)
97
-
98
- if (CONFIG_MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP_WITH_REVERT)
99
- set (imgtool_directxip_hex_command --confirm)
100
- endif ()
101
-
102
96
# Arguments to imgtool.
103
97
if (NOT CONFIG_MCUBOOT_EXTRA_IMGTOOL_ARGS STREQUAL "" )
104
98
# Separate extra arguments into the proper format for adding to
@@ -208,6 +202,25 @@ function(zephyr_mcuboot_tasks)
208
202
${imgtool_sign} ${imgtool_args} ${imgtool_bin_extra} ${imgtool_encrypt_extra_args} --encrypt
209
203
"${keyfile_enc} " ${input_arg} ${output} .encrypted.bin)
210
204
endif ()
205
+
206
+ # Generate and use the confirmed image in Direct XIP with revert, so the
207
+ # default application will boot after flashing.
208
+ if (CONFIG_MCUBOOT_GENERATE_CONFIRMED_IMAGE OR CONFIG_MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP_WITH_REVERT)
209
+ list (APPEND byproducts ${output} .confirmed.bin)
210
+ zephyr_runner_file(bin ${output} .confirmed.bin)
211
+ set (BYPRODUCT_KERNEL_SIGNED_CONFIRMED_BIN_NAME "${output} .confirmed.bin"
212
+ CACHE FILEPATH "Signed and confirmed kernel bin file" FORCE
213
+ )
214
+ if ("${keyfile_enc} " STREQUAL "" )
215
+ set_property (GLOBAL APPEND PROPERTY extra_post_build_commands COMMAND
216
+ ${imgtool_sign} ${imgtool_args} ${imgtool_bin_extra} --pad --confirm ${input_arg}
217
+ ${output} .confirmed.bin)
218
+ else ()
219
+ set_property (GLOBAL APPEND PROPERTY extra_post_build_commands COMMAND
220
+ ${imgtool_sign} ${imgtool_args} ${imgtool_bin_extra} ${imgtool_encrypt_extra_args}
221
+ --encrypt "${keyfile_enc} " --clear --pad --confirm ${input_arg} ${output} .confirmed.bin)
222
+ endif ()
223
+ endif ()
211
224
endif ()
212
225
213
226
# Set up .hex outputs.
@@ -236,12 +249,11 @@ function(zephyr_mcuboot_tasks)
236
249
# after the commands which generate the unsigned versions.
237
250
if ("${keyfile_enc} " STREQUAL "" )
238
251
set_property (GLOBAL APPEND PROPERTY extra_post_build_commands COMMAND
239
- ${imgtool_sign} ${imgtool_args} ${imgtool_directxip_hex_command} ${imgtool_hex_extra}
240
- ${input_arg} ${output} .hex)
252
+ ${imgtool_sign} ${imgtool_args} ${imgtool_hex_extra} ${input_arg} ${output} .hex)
241
253
else ()
242
254
set_property (GLOBAL APPEND PROPERTY extra_post_build_commands COMMAND
243
- ${imgtool_sign} ${imgtool_args} ${imgtool_directxip_hex_command } ${imgtool_hex_extra}
244
- ${imgtool_encrypt_extra_args} --encrypt "${keyfile_enc} " --clear ${input_arg} ${output} .hex)
255
+ ${imgtool_sign} ${imgtool_args} ${imgtool_hex_extra } ${imgtool_encrypt_extra_args} --encrypt
256
+ "${keyfile_enc} " --clear ${input_arg} ${output} .hex)
245
257
246
258
list (APPEND byproducts ${output} .encrypted.hex)
247
259
set (BYPRODUCT_KERNEL_SIGNED_ENCRYPTED_HEX_NAME "${output} .encrypted.hex"
@@ -252,6 +264,27 @@ function(zephyr_mcuboot_tasks)
252
264
${imgtool_sign} ${imgtool_args} ${imgtool_hex_extra} ${imgtool_encrypt_extra_args} --encrypt
253
265
"${keyfile_enc} " ${input_arg} ${output} .encrypted.hex)
254
266
endif ()
267
+
268
+ # Generate and use the confirmed image in Direct XIP with revert, so the
269
+ # default application will boot after flashing.
270
+ if (CONFIG_MCUBOOT_GENERATE_CONFIRMED_IMAGE OR CONFIG_MCUBOOT_BOOTLOADER_MODE_DIRECT_XIP_WITH_REVERT)
271
+ list (APPEND byproducts ${output} .confirmed.hex)
272
+ if ((NOT CONFIG_PARTITION_MANAGER_ENABLED) OR CONFIG_NCS_IS_VARIANT_IMAGE)
273
+ zephyr_runner_file(hex ${output} .confirmed.hex)
274
+ endif ()
275
+ set (BYPRODUCT_KERNEL_SIGNED_CONFIRMED_HEX_NAME "${output} .confirmed.hex"
276
+ CACHE FILEPATH "Signed and confirmed kernel hex file" FORCE
277
+ )
278
+ if ("${keyfile_enc} " STREQUAL "" )
279
+ set_property (GLOBAL APPEND PROPERTY extra_post_build_commands COMMAND
280
+ ${imgtool_sign} ${imgtool_args} ${imgtool_hex_extra} --pad --confirm ${input_arg}
281
+ ${output} .confirmed.hex)
282
+ else ()
283
+ set_property (GLOBAL APPEND PROPERTY extra_post_build_commands COMMAND
284
+ ${imgtool_sign} ${imgtool_args} ${imgtool_hex_extra} ${imgtool_encrypt_extra_args}
285
+ --encrypt "${keyfile_enc} " --clear --pad --confirm ${input_arg} ${output} .confirmed.hex)
286
+ endif ()
287
+ endif ()
255
288
endif ()
256
289
257
290
set_property (GLOBAL APPEND PROPERTY extra_post_build_byproducts ${byproducts} )
0 commit comments