I'm trying to test out the boot loader using the blinky sample. However if I add the following to prj.conf:
CONFIG_SECURE_BOOT=y
CONFIG_BOOTLOADER_MCUBOOT=y
I'm getting the build error shown below:
$ west build
WARNING: This looks like a fresh build and BOARD is unknown; so it probably won't work. To fix, use --board=<your-board>.
Note: to silence the above message, run 'west config build.board_warn false'
-- west build: generating a build system
Including boilerplate (Zephyr base): /Users/denis/sandbox/ncs/zephyr/cmake/app/boilerplate.cmake
-- Application: /Users/denis/sandbox/denisbohm/firefly-go-kart/blinky
-- Zephyr version: 2.4.0 (/Users/denis/sandbox/ncs/zephyr)
-- Found Python3: /usr/local/opt/[email protected]/bin/python3.8 (found suitable exact version "3.8.7") found components: Interpreter
-- Found west (found suitable version "0.8.0", minimum required is "0.7.1")
-- Board: nrf5340dk_nrf5340_cpuapp
-- Cache files will be written to: /Users/denis/Library/Caches/zephyr
-- Found dtc: /usr/local/bin/dtc (found suitable version "1.6.0", minimum required is "1.4.6")
-- Found toolchain: gnuarmemb (/Users/denis/sandbox/gcc-arm-none-eabi-9-2019-q4-major)
-- Found BOARD.dts: /Users/denis/sandbox/ncs/zephyr/boards/arm/nrf5340dk_nrf5340/nrf5340dk_nrf5340_cpuapp.dts
nrf5340dk_nrf5340_cpuapp.dts.pre.tmp:55.42-67.3: Warning (unique_unit_address_if_enabled): /soc/peripheral@50000000/flash-controller@39000: duplicate unit-address (also used in node /soc/peripheral@50000000/kmu@39000)
nrf5340dk_nrf5340_cpuapp.dts.pre.tmp:329.19-335.3: Warning (unique_unit_address_if_enabled): /soc/peripheral@50000000/clock@5000: duplicate unit-address (also used in node /soc/peripheral@50000000/power@5000)
nrf5340dk_nrf5340_cpuapp.dts.pre.tmp:584.31-585.5: Warning (unique_unit_address_if_enabled): /reserved-memory/image@20000000: duplicate unit-address (also used in node /reserved-memory/image_s@20000000)
also defined at nrf5340dk_nrf5340_cpuapp.dts.pre.tmp:604.14-606.3
-- Generated zephyr.dts: /Users/denis/sandbox/denisbohm/firefly-go-kart/blinky/build/zephyr/zephyr.dts
-- Generated devicetree_unfixed.h: /Users/denis/sandbox/denisbohm/firefly-go-kart/blinky/build/zephyr/include/generated/devicetree_unfixed.h
Parsing /Users/denis/sandbox/ncs/zephyr/Kconfig
Loaded configuration '/Users/denis/sandbox/ncs/zephyr/boards/arm/nrf5340dk_nrf5340/nrf5340dk_nrf5340_cpuapp_defconfig'
Merged configuration '/Users/denis/sandbox/denisbohm/firefly-go-kart/blinky/prj.conf'
Configuration saved to '/Users/denis/sandbox/denisbohm/firefly-go-kart/blinky/build/zephyr/.config'
Kconfig header saved to '/Users/denis/sandbox/denisbohm/firefly-go-kart/blinky/build/zephyr/include/generated/autoconf.h'
-- The C compiler identification is GNU 9.2.1
-- The CXX compiler identification is GNU 9.2.1
-- The ASM compiler identification is GNU
-- Found assembler: /Users/denis/sandbox/gcc-arm-none-eabi-9-2019-q4-major/bin/arm-none-eabi-gcc
=== child image b0 - begin ===
Including boilerplate (Zephyr base): /Users/denis/sandbox/ncs/zephyr/cmake/app/boilerplate.cmake
-- Application: /Users/denis/sandbox/ncs/nrf/samples/bootloader
-- Zephyr version: 2.4.0 (/Users/denis/sandbox/ncs/zephyr)
-- Found Python3: /usr/local/opt/[email protected]/bin/python3.8 (found suitable exact version "3.8.7") found components: Interpreter
-- Found west (found suitable version "0.8.0", minimum required is "0.7.1")
-- Board: nrf5340dk_nrf5340_cpuapp
-- Cache files will be written to: /Users/denis/Library/Caches/zephyr
-- Found dtc: /usr/local/bin/dtc (found suitable version "1.6.0", minimum required is "1.4.6")
-- Found toolchain: gnuarmemb (/Users/denis/sandbox/gcc-arm-none-eabi-9-2019-q4-major)
-- Found BOARD.dts: /Users/denis/sandbox/ncs/zephyr/boards/arm/nrf5340dk_nrf5340/nrf5340dk_nrf5340_cpuapp.dts
nrf5340dk_nrf5340_cpuapp.dts.pre.tmp:55.42-67.3: Warning (unique_unit_address_if_enabled): /soc/peripheral@50000000/flash-controller@39000: duplicate unit-address (also used in node /soc/peripheral@50000000/kmu@39000)
nrf5340dk_nrf5340_cpuapp.dts.pre.tmp:329.19-335.3: Warning (unique_unit_address_if_enabled): /soc/peripheral@50000000/clock@5000: duplicate unit-address (also used in node /soc/peripheral@50000000/power@5000)
nrf5340dk_nrf5340_cpuapp.dts.pre.tmp:584.31-585.5: Warning (unique_unit_address_if_enabled): /reserved-memory/image@20000000: duplicate unit-address (also used in node /reserved-memory/image_s@20000000)
also defined at nrf5340dk_nrf5340_cpuapp.dts.pre.tmp:604.14-606.3
-- Generated zephyr.dts: /Users/denis/sandbox/denisbohm/firefly-go-kart/blinky/build/b0/zephyr/zephyr.dts
-- Generated devicetree_unfixed.h: /Users/denis/sandbox/denisbohm/firefly-go-kart/blinky/build/b0/zephyr/include/generated/devicetree_unfixed.h
Parsing /Users/denis/sandbox/ncs/zephyr/Kconfig
Loaded configuration '/Users/denis/sandbox/ncs/zephyr/boards/arm/nrf5340dk_nrf5340/nrf5340dk_nrf5340_cpuapp_defconfig'
Merged configuration '/Users/denis/sandbox/ncs/nrf/samples/bootloader/prj.conf'
Configuration saved to '/Users/denis/sandbox/denisbohm/firefly-go-kart/blinky/build/b0/zephyr/.config'
Kconfig header saved to '/Users/denis/sandbox/denisbohm/firefly-go-kart/blinky/build/b0/zephyr/include/generated/autoconf.h'
-- The C compiler identification is GNU 9.2.1
-- The CXX compiler identification is GNU 9.2.1
-- The ASM compiler identification is GNU
-- Found assembler: /Users/denis/sandbox/gcc-arm-none-eabi-9-2019-q4-major/bin/arm-none-eabi-gcc
CMake Warning at ../../subsys/bootloader/CMakeLists.txt:21 (message):
--------------------------------------------------------
--- WARNING: When using the immutable bootloader on ---
--- this SoC, the UICR must be erased when flashing. ---
--- E.g. by calling 'west flash --erase' ---
--------------------------------------------------------
CMake Deprecation Warning at /Users/denis/sandbox/ncs/modules/lib/civetweb/CMakeLists.txt:2 (cmake_minimum_required):
Compatibility with CMake < 2.8.12 will be removed from a future version of
CMake.
Update the VERSION argument <min> value or use a ...<max> suffix to tell
CMake that the project does not need compatibility with older versions.
CMake Warning at /Users/denis/sandbox/ncs/zephyr/kernel/CMakeLists.txt:54 (message):
Single threaded mode (CONFIG_MULTITHREADING=n) is deprecated
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/denis/sandbox/denisbohm/firefly-go-kart/blinky/build/b0
=== child image b0 - end ===
=== child image mcuboot - begin ===
Including boilerplate (Zephyr base): /Users/denis/sandbox/ncs/zephyr/cmake/app/boilerplate.cmake
-- Application: /Users/denis/sandbox/ncs/bootloader/mcuboot/boot/zephyr
-- Zephyr version: 2.4.0 (/Users/denis/sandbox/ncs/zephyr)
-- Found Python3: /usr/local/opt/[email protected]/bin/python3.8 (found suitable exact version "3.8.7") found components: Interpreter
-- Found west (found suitable version "0.8.0", minimum required is "0.7.1")
-- Board: nrf5340dk_nrf5340_cpuapp
-- Cache files will be written to: /Users/denis/Library/Caches/zephyr
-- Found dtc: /usr/local/bin/dtc (found suitable version "1.6.0", minimum required is "1.4.6")
-- Found toolchain: gnuarmemb (/Users/denis/sandbox/gcc-arm-none-eabi-9-2019-q4-major)
-- Found BOARD.dts: /Users/denis/sandbox/ncs/zephyr/boards/arm/nrf5340dk_nrf5340/nrf5340dk_nrf5340_cpuapp.dts
-- Found devicetree overlay: /Users/denis/sandbox/ncs/bootloader/mcuboot/boot/zephyr/dts.overlay
nrf5340dk_nrf5340_cpuapp.dts.pre.tmp:55.42-67.3: Warning (unique_unit_address_if_enabled): /soc/peripheral@50000000/flash-controller@39000: duplicate unit-address (also used in node /soc/peripheral@50000000/kmu@39000)
nrf5340dk_nrf5340_cpuapp.dts.pre.tmp:329.19-335.3: Warning (unique_unit_address_if_enabled): /soc/peripheral@50000000/clock@5000: duplicate unit-address (also used in node /soc/peripheral@50000000/power@5000)
nrf5340dk_nrf5340_cpuapp.dts.pre.tmp:584.31-585.5: Warning (unique_unit_address_if_enabled): /reserved-memory/image@20000000: duplicate unit-address (also used in node /reserved-memory/image_s@20000000)
also defined at nrf5340dk_nrf5340_cpuapp.dts.pre.tmp:604.14-606.3
-- Generated zephyr.dts: /Users/denis/sandbox/denisbohm/firefly-go-kart/blinky/build/mcuboot/zephyr/zephyr.dts
-- Generated devicetree_unfixed.h: /Users/denis/sandbox/denisbohm/firefly-go-kart/blinky/build/mcuboot/zephyr/include/generated/devicetree_unfixed.h
Parsing /Users/denis/sandbox/ncs/bootloader/mcuboot/boot/zephyr/Kconfig
Loaded configuration '/Users/denis/sandbox/ncs/zephyr/boards/arm/nrf5340dk_nrf5340/nrf5340dk_nrf5340_cpuapp_defconfig'
Merged configuration '/Users/denis/sandbox/ncs/bootloader/mcuboot/boot/zephyr/prj.conf'
Merged configuration '/Users/denis/sandbox/ncs/nrf/subsys/bootloader/image/multi_image_mcuboot.conf'
Merged configuration '/Users/denis/sandbox/ncs/nrf/subsys/bootloader/image/fw_info.conf'
Configuration saved to '/Users/denis/sandbox/denisbohm/firefly-go-kart/blinky/build/mcuboot/zephyr/.config'
Kconfig header saved to '/Users/denis/sandbox/denisbohm/firefly-go-kart/blinky/build/mcuboot/zephyr/include/generated/autoconf.h'
-- The C compiler identification is GNU 9.2.1
-- The CXX compiler identification is GNU 9.2.1
-- The ASM compiler identification is GNU
-- Found assembler: /Users/denis/sandbox/gcc-arm-none-eabi-9-2019-q4-major/bin/arm-none-eabi-gcc
CMake Deprecation Warning at /Users/denis/sandbox/ncs/modules/lib/civetweb/CMakeLists.txt:2 (cmake_minimum_required):
Compatibility with CMake < 2.8.12 will be removed from a future version of
CMake.
Update the VERSION argument <min> value or use a ...<max> suffix to tell
CMake that the project does not need compatibility with older versions.
CMake Warning at /Users/denis/sandbox/ncs/zephyr/kernel/CMakeLists.txt:54 (message):
Single threaded mode (CONFIG_MULTITHREADING=n) is deprecated
MCUBoot bootloader key file: /Users/denis/sandbox/ncs/bootloader/mcuboot/root-rsa-2048.pem
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/denis/sandbox/denisbohm/firefly-go-kart/blinky/build/mcuboot
=== child image mcuboot - end ===
CMake Warning at /Users/denis/sandbox/ncs/nrf/cmake/mcuboot.cmake:120 (message):
---------------------------------------------------------
--- WARNING: Using default MCUBoot key, it should not ---
--- be used for production. ---
---------------------------------------------------------
Call Stack (most recent call first):
/Users/denis/sandbox/ncs/bootloader/mcuboot/zephyr/CMakeLists.txt:1 (include)
CMake Deprecation Warning at /Users/denis/sandbox/ncs/modules/lib/civetweb/CMakeLists.txt:2 (cmake_minimum_required):
Compatibility with CMake < 2.8.12 will be removed from a future version of
CMake.
Update the VERSION argument <min> value or use a ...<max> suffix to tell
CMake that the project does not need compatibility with older versions.
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/denis/sandbox/denisbohm/firefly-go-kart/blinky/build
-- west build: building application
[0/173] Generating extra provision key files
[1/173] Preparing syscall dependency handling
[15/173] Performing build step for 'b0_subimage'
[1/144] Preparing syscall dependency handling
[139/144] Linking C executable zephyr/zephyr_prebuilt.elf
FAILED: zephyr/zephyr_prebuilt.elf
: && ccache /Users/denis/sandbox/gcc-arm-none-eabi-9-2019-q4-major/bin/arm-none-eabi-gcc zephyr/CMakeFiles/zephyr_prebuilt.dir/misc/empty_file.c.obj -o zephyr/zephyr_prebuilt.elf -Wl,-T zephyr/linker.cmd -Wl,-Map=/Users/denis/sandbox/denisbohm/firefly-go-kart/blinky/build/b0/zephyr/zephyr_prebuilt.map -Wl,--whole-archive app/libapp.a zephyr/libzephyr.a zephyr/arch/common/libarch__common.a zephyr/arch/arch/arm/core/aarch32/libarch__arm__core__aarch32.a zephyr/arch/arch/arm/core/aarch32/cortex_m/libarch__arm__core__aarch32__cortex_m.a zephyr/arch/arch/arm/core/aarch32/cortex_m/cmse/libarch__arm__core__aarch32__cortex_m__cmse.a zephyr/lib/libc/minimal/liblib__libc__minimal.a zephyr/lib/posix/liblib__posix.a zephyr/drivers/serial/libdrivers__serial.a modules/nrf/lib/fprotect/lib..__nrf__lib__fprotect.a modules/nrf/lib/fatal_error/lib..__nrf__lib__fatal_error.a modules/nrf/subsys/bootloader/bl_boot/lib..__nrf__subsys__bootloader__bl_boot.a modules/nrf/subsys/bootloader/bl_crypto/lib..__nrf__subsys__bootloader__bl_crypto.a modules/nrf/subsys/bootloader/bl_validation/lib..__nrf__subsys__bootloader__bl_validation.a modules/nrf/subsys/bootloader/bl_storage/lib..__nrf__subsys__bootloader__bl_storage.a modules/nrf/subsys/fw_info/lib..__nrf__subsys__fw_info.a modules/nrf/drivers/hw_cc310/lib..__nrf__drivers__hw_cc310.a modules/nordic/lib..__modules__hal__nordic.a -Wl,--no-whole-archive zephyr/kernel/libkernel.a zephyr/CMakeFiles/offsets.dir/./arch/arm/core/offsets/offsets.c.obj -L"/Users/denis/sandbox/gcc-arm-none-eabi-9-2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/thumb/v8-m.main/nofp" -L/Users/denis/sandbox/denisbohm/firefly-go-kart/blinky/build/b0/zephyr -lgcc -Wl,--print-memory-usage zephyr/arch/common/libisr_tables.a /Users/denis/sandbox/ncs/nrfxlib/crypto/nrf_oberon/lib/cortex-m33/soft-float/liboberon_3.0.7.a /Users/denis/sandbox/ncs/nrfxlib/crypto/nrf_cc312_platform/lib/cortex-m33/soft-float/no-interrupts/libnrf_cc312_platform_0.9.4.a -mthumb -mabi=aapcs -Wl,--gc-sections -Wl,--build-id=none -Wl,--sort-common=descending -Wl,--sort-section=alignment -Wl,-u,_OffsetAbsSyms -Wl,-u,_ConfigAbsSyms -nostdlib -static -no-pie -Wl,-X -Wl,-N -Wl,--orphan-handling=warn && :
Memory region Used Size Region Size %age Used
FLASH: 29484 B 16 KB 179.96%
SRAM: 6096 B 504 KB 1.18%
IDT_LIST: 40 B 2 KB 1.95/Users/denis/sandbox/gcc-arm-none-eabi-9-2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: zephyr/zephyr_prebuilt.elf section `text' will not fit in region `FLASH'
/Users/denis/sandbox/gcc-arm-none-eabi-9-2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: region `FLASH' overflowed by 13100 bytes
collect2: error: ld returned 1 exit status
%
ninja: build stopped: subcommand failed.
[149/173] Linking C executable zephyr/zephyr_prebuilt.elf
Memory region Used Size Region Size %age Used
FLASH: 18592 B 458240 B 4.06%
SRAM: 5648 B 504 KB 1.09%
IDT_LIST: 56 B 2 KB 2.73%
[151/173] Building C object zephyr/CMakeFiles/zephyr_final.dir/isr_tables.c.obj
FAILED: modules/nrf/samples/b0_subimage-prefix/src/b0_subimage-stamp/b0_subimage-build b0/zephyr/zephyr.hex b0/zephyr/zephyr.elf
cd /Users/denis/sandbox/denisbohm/firefly-go-kart/blinky/build/b0 && /usr/local/Cellar/cmake/3.19.1/bin/cmake --build . --
[154/173] Building C object zephyr/CMakeFiles/zephyr_final.dir/isr_tables.c.obj
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: /usr/local/bin/cmake --build /Users/denis/sandbox/denisbohm/firefly-go-kart/blinky/build