Post-Build Script imgtool¶
The compiler output requires a post-build step to generate a .bin file that can
be used by MCUboot. An MCUboot compatible image tool must be executed called
imgtool
. It is responsible for adding the MCUBoot image header, managing
keys and sign the image. More detailed description is provided on the
imgtool documentation page.
This tool requires Python3 and is included in the SimpleLink SDK in the folder
<simplelink-install-dir>\source\third_party\mcuboot\scripts
.
The script can be executed automatically after every build by adding below lines
as Post-Build steps
in Properties > Build
as shown below. This command
defines the image version. To update the version number, adjust the string
--version 1.0.0
.
1${CG_TOOL_ROOT}/bin/tiarmobjcopy ${ProjName}.out --output-target binary ${ProjName}.bin --remove-section=.ccfg
2${COM_TI_SIMPLELINK_LOWPOWER_F3_SDK_INSTALL_DIR}/tools/common/mcuboot/imgtool sign --header-size 0x100 --align 4 --slot-size 0x4C000 --version 1.0.0 --pad-header --key ${COM_TI_SIMPLELINK_LOWPOWER_F3_SDK_INSTALL_DIR}/source/third_party/mcuboot/root-ec-p256.pem ${ProjName}.bin ${ProjName}.bin
Note
--slot-size
is used to indicate the size of the primary or secondary in which the image will be flashed.
The value used should be the same as defined in flash_map_backend.h

Figure 30. Post-Build steps included in CCS properties¶