Cannot build new image for FOTA through MCUboot

Hi.

I want to build firmware for FOTA into the slot1 partition.

I'm using NCS 2.5.0 in Visual Studio Code Envrionment.

I already build primary firmware(old firmware) with mcuboot and it works well.

but I want to build new image for update.

As I know, MCUBoot read slot1 that new firmware is located in.

So I want to build new firmware in slot 1, but It doesn't work.

I add CONFIG_BUILD_S1_VARIANT=y and CONFIG_SECURE_BOOT, but Compiler print out about error on Cmake.

Here is my error log

Building test_image_0
west build --build-dir c:/Users/jswco/OneDrive/Desktop/Github/Firmware/test_image_0/build c:/Users/jswco/OneDrive/Desktop/Github/Firmware/test_image_0 --pristine --board starpickers_l200 --no-sysbuild -- -DNCS_TOOLCHAIN_VERSION=NONE -DCONF_FILE=c:/Users/jswco/OneDrive/Desktop/Github/Firmware/test_image_0/prj.conf -DBOARD_ROOT=c:/ncs/v2.5.0/nrf

-- west build: making build dir c:\Users\jswco\OneDrive\Desktop\Github\Firmware\test_image_0\build pristine
-- west build: generating a build system
Loading Zephyr default modules (Zephyr base).
-- Application: C:/Users/jswco/OneDrive/Desktop/Github/Firmware/test_image_0
-- CMake version: 3.20.5
-- Found Python3: C:/ncs/toolchains/c57af46cb7/opt/bin/python.exe (found suitable version "3.8.2", minimum required is "3.8") found components: Interpreter 
-- Cache files will be written to: C:/ncs/v2.5.0/zephyr/.cache
-- Zephyr version: 3.4.99 (C:/ncs/v2.5.0/zephyr)
-- Found west (found suitable version "1.1.0", minimum required is "0.14.0")
-- Board: starpickers_l200
-- Found host-tools: zephyr 0.16.1 (C:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk)
-- Found toolchain: zephyr 0.16.1 (C:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk)
-- Found Dtc: C:/ncs/toolchains/c57af46cb7/opt/bin/dtc.exe (found suitable version "1.4.7", minimum required is "1.4.6") 
-- Found BOARD.dts: C:/ncs/v2.5.0/nrf/boards/arm/starpickers_l200/starpickers_l200.dts
-- Generated zephyr.dts: C:/Users/jswco/OneDrive/Desktop/Github/Firmware/test_image_0/build/zephyr/zephyr.dts
-- Generated devicetree_generated.h: C:/Users/jswco/OneDrive/Desktop/Github/Firmware/test_image_0/build/zephyr/include/generated/devicetree_generated.h
-- Including generated dts.cmake file: C:/Users/jswco/OneDrive/Desktop/Github/Firmware/test_image_0/build/zephyr/dts.cmake
Parsing C:/ncs/v2.5.0/zephyr/Kconfig
Loaded configuration 'C:/ncs/v2.5.0/nrf/boards/arm/starpickers_l200/starpickers_l200_defconfig'
Merged configuration 'c:/Users/jswco/OneDrive/Desktop/Github/Firmware/test_image_0/prj.conf'
Configuration saved to 'C:/Users/jswco/OneDrive/Desktop/Github/Firmware/test_image_0/build/zephyr/.config'
Kconfig header saved to 'C:/Users/jswco/OneDrive/Desktop/Github/Firmware/test_image_0/build/zephyr/include/generated/autoconf.h'
-- Found GnuLd: c:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe (found version "2.38") 
-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- The ASM compiler identification is GNU
-- Found assembler: C:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc.exe

=== child image b0 -  begin ===
loading initial cache file C:/Users/jswco/OneDrive/Desktop/Github/Firmware/test_image_0/build/b0/child_image_preload.cmake
Loading Zephyr default modules (Zephyr base).
-- Application: C:/ncs/v2.5.0/nrf/samples/bootloader
-- CMake version: 3.20.5
-- Found Python3: C:/ncs/toolchains/c57af46cb7/opt/bin/python.exe (found suitable version "3.8.2", minimum required is "3.8") found components: Interpreter 
-- Cache files will be written to: C:/ncs/v2.5.0/zephyr/.cache
-- Zephyr version: 3.4.99 (C:/ncs/v2.5.0/zephyr)
-- Found west (found suitable version "1.1.0", minimum required is "0.14.0")
-- Board: starpickers_l200
-- Found host-tools: zephyr 0.16.1 (C:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk)
-- Found toolchain: zephyr 0.16.1 (C:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk)
-- Found Dtc: C:/ncs/toolchains/c57af46cb7/opt/bin/dtc.exe (found suitable version "1.4.7", minimum required is "1.4.6") 
-- Found BOARD.dts: C:/ncs/v2.5.0/nrf/boards/arm/starpickers_l200/starpickers_l200.dts
-- Generated zephyr.dts: C:/Users/jswco/OneDrive/Desktop/Github/Firmware/test_image_0/build/b0/zephyr/zephyr.dts
-- Generated devicetree_generated.h: C:/Users/jswco/OneDrive/Desktop/Github/Firmware/test_image_0/build/b0/zephyr/include/generated/devicetree_generated.h
-- Including generated dts.cmake file: C:/Users/jswco/OneDrive/Desktop/Github/Firmware/test_image_0/build/b0/zephyr/dts.cmake

warning: UART_NRFX (defined at drivers/serial/Kconfig.nrfx:6) has direct dependencies (DT_HAS_NORDIC_NRF_UART_ENABLED || DT_HAS_NORDIC_NRF_UARTE_ENABLED) && SERIAL with value n, but is currently being y-selected by the following symbols:
 - SECURE_BOOT_DEBUG_UART (defined at C:/ncs/v2.5.0/nrf\subsys\bootloader/Kconfig:222), with value y, direct dependencies <choice SECURE_BOOT_DEBUG_BACKEND> (value: y), and select condition <choice SECURE_BOOT_DEBUG_BACKEND> (value: y)

warning: UART_CONSOLE (defined at drivers/console/Kconfig:43) has direct dependencies SERIAL && SERIAL_HAS_DRIVER && CONSOLE with value n, but is currently being y-selected by the following symbols:
 - SECURE_BOOT_DEBUG_UART (defined at C:/ncs/v2.5.0/nrf\subsys\bootloader/Kconfig:222), with value y, direct dependencies <choice SECURE_BOOT_DEBUG_BACKEND> (value: y), and select condition <choice SECURE_BOOT_DEBUG_BACKEND> (value: y)

error: Aborting due to Kconfig warnings

Parsing C:/ncs/v2.5.0/zephyr/Kconfig
Loaded configuration 'C:/ncs/v2.5.0/nrf/boards/arm/starpickers_l200/starpickers_l200_defconfig'
Merged configuration 'C:/ncs/v2.5.0/nrf/samples/bootloader/prj.conf'
Merged configuration 'C:/ncs/v2.5.0/nrf/subsys/partition_manager/partition_manager_enabled.conf'
Merged configuration 'C:/Users/jswco/OneDrive/Desktop/Github/Firmware/test_image_0/build/b0/zephyr/misc/generated/extra_kconfig_options.conf'
CMake Error at C:/ncs/v2.5.0/zephyr/cmake/modules/kconfig.cmake:348 (message):
  command failed with return code: 1
Call Stack (most recent call first):
  C:/ncs/v2.5.0/nrf/cmake/modules/kconfig.cmake:29 (include)
  C:/ncs/v2.5.0/zephyr/cmake/modules/zephyr_default.cmake:129 (include)
  C:/ncs/v2.5.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
  C:/ncs/v2.5.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
  CMakeLists.txt:9 (find_package)


-- Configuring incomplete, errors occurred!
CMake Error at C:/ncs/v2.5.0/nrf/cmake/multi_image.cmake:449 (message):
  CMake generation for b0 failed, aborting.  Command: 1
Call Stack (most recent call first):
  C:/ncs/v2.5.0/nrf/cmake/multi_image.cmake:178 (add_child_image_from_source)
  C:/ncs/v2.5.0/nrf/samples/CMakeLists.txt:18 (add_child_image)


-- Configuring incomplete, errors occurred!
See also "C:/Users/jswco/OneDrive/Desktop/Github/Firmware/test_image_0/build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/jswco/OneDrive/Desktop/Github/Firmware/test_image_0/build/CMakeFiles/CMakeError.log".
FATAL ERROR: command exited with status 1: 'C:\ncs\toolchains\c57af46cb7\opt\bin\cmake.EXE' -DWEST_PYTHON=C:/ncs/toolchains/c57af46cb7/opt/bin/python.exe '-Bc:\Users\jswco\OneDrive\Desktop\Github\Firmware\test_image_0\build' -GNinja -DBOARD=starpickers_l200 -DNCS_TOOLCHAIN_VERSION=NONE -DCONF_FILE=c:/Users/jswco/OneDrive/Desktop/Github/Firmware/test_image_0/prj.conf -DBOARD_ROOT=c:/ncs/v2.5.0/nrf '-Sc:\Users\jswco\OneDrive\Desktop\Github\Firmware\test_image_0'

 *  The terminal process terminated with exit code: 1. 
 *  Terminal will be reused by tasks, press any key to close it. 

And this is my prj.conf

# General Config
CONFIG_CPP=y

# RTT Config
CONFIG_CONSOLE=y
CONFIG_RTT_CONSOLE=y
CONFIG_USE_SEGGER_RTT=y
CONFIG_CBPRINTF_COMPLETE=y
CONFIG_CBPRINTF_FP_SUPPORT=y

# BT 설정
CONFIG_BT=y
CONFIG_BT_DEVICE_NAME_DYNAMIC=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_OBSERVER=y

# MCUBoot
CONFIG_BOOTLOADER_MCUBOOT=y
CONFIG_MCUBOOT_BOOTLOADER_MODE_OVERWRITE_ONLY=y

# MCUMGR
CONFIG_SECURE_BOOT=y
CONFIG_BUILD_S1_VARIANT=y
CONFIG_FW_INFO=y
CONFIG_SB_SIGNING_KEY_FILE="C:/ncs/v2.5.0/bootloader/mcuboot/root-rsa-2048.pem"
CONFIG_SERIAL=n

How can I build firmware for Slot 1?

  • Thank you for reply.

    I checked again and applied it to my project.

    So, I finally got the app_update.hex and bin file.

    I want to write it to memory slot 1 by manually, because LTE modem cannot send any SMP messages.

    So, my plan is as follow.

    1. LTE modem download new binary or hex file(maybe app_update.bin or app_update.hex ??) from our server, and it will be stored in LTE Modem's internal flash.

    2. Read downloaded file LTE modem through UART one by one byte using AT Command and Write it into the slot 1 flash(Maybe from 0x45000)

    3. After write all data, reboot using NVIC_SystemReset(); function.

    4. MCUboot will check new firmware in slot1 automatically.

    5. If it is valid, MCUboot will copy new firmware from slot1 to slot 0.

    6. After the copy is complete, device will reboot and start with new firmware.

    Is it possible?

  • Hi, 

    Please create a new support case for the new issue which is away from the original scope. 

    -Amanda H.

Related