You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: boot/mbed/mbed_lib.json
+7-2Lines changed: 7 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -88,7 +88,7 @@
88
88
"value": true
89
89
},
90
90
"max-img-sectors": {
91
-
"help": "Maximum number of flash sectors per image slot. Target-dependent, please set on a per-target basis.",
91
+
"help": "Maximum number of flash sectors per image slot. This should be set to account for the sector sizes of both the main and secondary block devices. Target-dependent, please set on a per-target basis.",
92
92
"macro_name": "MCUBOOT_MAX_IMG_SECTORS",
93
93
"required": true
94
94
},
@@ -119,7 +119,7 @@
119
119
"value": null
120
120
},
121
121
"encrypt-rsa": {
122
-
"help": "Encrypt images using RSA (NOT TESTED)",
122
+
"help": "Encrypt update images using RSA",
123
123
"macro_name": "MCUBOOT_ENCRYPT_RSA",
124
124
"accepted_values": [true, null],
125
125
"value": null
@@ -189,6 +189,11 @@
189
189
"xip-secondary-slot-address": {
190
190
"help": "Specify start address for secondary slot address in XIP-accessible memory. This is required if direct-xip is enabled.",
191
191
"value": null
192
+
},
193
+
"flash-block-size": {
194
+
"help": "Size in bytes of a programmable block of the flash memory.",
message(FATAL_ERROR"The mcuboot imgtool python package needs to be installed (from mcuboot/scripts/) into Mbed's python interpreter (${Python3_EXECUTABLE})")
20
+
endif()
21
+
endif()
22
+
23
+
# Signing key
24
+
set(MCUBOOT_SIGNING_KEY""CACHESTRING"Path to key file (.pem) used to sign firmware updates for your device. The public key will be stored in the bootloader. This file must be kept safe!")
25
+
26
+
# Make sure the signing key path is absolute for EXISTS, relative to the top level build dir
set(MCUBOOT_ENCRYPTION_KEY""CACHESTRING"Path to key file (.pem) used to encrypt firmware updates for your device. The private key will be stored in the bootloader. This file must be kept safe!")
37
+
38
+
# Make sure the signing key path is absolute for EXISTS, relative to the top level build dir
message(FATAL_ERROR"Since mcuboot.encrypt-rsa is enabled, you must specify the path to a valid image encryption key via the MCUBOOT_ENCRYPTION_KEY CMake option in order to build this project.")
44
+
endif()
45
+
endif()
46
+
47
+
# Imgtool usage functions
48
+
49
+
#
50
+
# Generate a signed image hex file for the given executable target.
message(FATAL_ERROR"Hex file output must be enabled to use mcuboot. Set MBED_OUTPUT_EXT to empty string after including app.cmake in your top level CMakeLists.txt!")
55
+
endif()
56
+
57
+
if("${PROJECT_VERSION}"STREQUAL"")
58
+
message(FATAL_ERROR"You must set the project version to sign images by passing a version number into your app's project() command!")
59
+
endif()
60
+
61
+
# mbed_generate_bin_hex() puts the hex file at the following path
# If encryption is enabled, generate unencrypted initial image which supports encryption.
82
+
# See https://github.com/mbed-ce/mbed-os/issues/401#issuecomment-2567099213
83
+
set(IMGTOOL_EXTRA_ARGS--clear)
84
+
else()
85
+
set(IMGTOOL_EXTRA_ARGS"")
86
+
endif()
87
+
88
+
add_custom_command(
89
+
TARGET${TARGET}
90
+
POST_BUILD
91
+
DEPENDS${MCUBOOT_SIGNING_KEY_ABSPATH}
92
+
COMMAND
93
+
${Python3_EXECUTABLE}-mimgtool.main
94
+
sign
95
+
--key${MCUBOOT_SIGNING_KEY_ABSPATH}# this specifies the file containing the keys used to sign/verify the application
96
+
--align4# this lets mcuboot know the intrinsic alignment of the flash (32-bits = 4 byte alignment)
97
+
--version${PROJECT_VERSION}# this sets the version number of the application
98
+
--header-size${HEADER_SIZE_HEX}# this must be the same as the value specified in mcuboot.header-size configuration
99
+
--pad-header# this tells imgtool to insert the entire header, including any necessary padding bytes.
100
+
--slot-size${SLOT_SIZE_HEX}# this specifies the maximum size of the application ("slot size"). It must be the same as the configured mcuboot.slot-size!
0 commit comments