My environment:
nRF Connect version 2.1.0
Board: nrf52840 DK
Host: MacOS 12.6
Trying to use the Zephyr sample project called SMP Server Sample. The instructions are here:
The project path is here:
/opt/nordic/ncs/v2.1.0/zephyr/samples/subsys/mgmt/mcumgr/smp_svr
These steps worked without error:
- Build bootloader
- flash bootloader
- Build sample application
When I try to sign the sample application I get an error.
(base) √ smp_svr % west sign -t imgtool -- --key ../../../../../../bootloader/mcuboot/root-rsa-2048.pem
=== image configuration:
partition offset: 49152 (0xc000)
partition size: 421888 (0x67000)
rom start offset: 0 (0x0)
=== signing binaries
unsigned bin: /opt/nordic/ncs/v2.1.0/zephyr/samples/subsys/mgmt/mcumgr/smp_svr/build/zephyr/zephyr.bin
signed bin: /opt/nordic/ncs/v2.1.0/zephyr/samples/subsys/mgmt/mcumgr/smp_svr/build/zephyr/zephyr.signed.bin
Usage: imgtool sign [OPTIONS] INFILE OUTFILE
Error: Invalid value for '-H' / '--header-size': Minimum value for -H/--header-size is 32
FATAL ERROR: command exited with status 2: /opt/nordic/ncs/toolchains/v2.1.0/bin/imgtool sign --version 0.0.0+0 --align 4 --header-size 0 --slot-size 421888 --key ../../../../../../bootloader/mcuboot/root-rsa-2048.pem /opt/nordic/ncs/v2.1.0/zephyr/samples/subsys/mgmt/mcumgr/smp_svr/build/zephyr/zephyr.bin /opt/nordic/ncs/v2.1.0/zephyr/samples/subsys/mgmt/mcumgr/smp_svr/build/zephyr/zephyr.signed.bin
(base) ?2 smp_svr % pwd
/opt/nordic/ncs/v2.1.0/zephyr/samples/subsys/mgmt/mcumgr/smp_svr
When I read the help for imgtool I found this:
The image header size, alignment, and slot sizes are determined from the build directory using .config and the device tree. A default version number of 0.0.0+0 is used (which can be overridden by passing "--version x.y.z+w" after "--key"). As shown above, extra arguments after a '--' are passed to imgtool directly.
Not sure how to fix the problem.