Getting CMake-Error when adding CONFIG_BUILD_S1_VARIANT=y

So I am using an nRF5340DK with the "central-bas" example project. I added the MCUBoot-Bootloader by adding "CONFIG_BOOTLOADER_MCUBOOT=y" to the prj.conf file and it works, I get output from the application core.

Now I wanted to build a second version of this firmware for slot 1, but if I add "CONFIG_BUILD_S1_VARIANT=y" to the prj.conf file, I get:

Creating solution central_bas.emProject
-- Application: C:/ncs/v1.9.0/nrf/samples/bluetooth/central_bas
-- Zephyr version: 2.7.99 (C:/ncs/v1.9.0/zephyr), build: v2.7.99-ncs1
-- Found west (found suitable version "0.12.0", minimum required is "0.7.1")
-- Board: nrf5340dk_nrf5340_cpuapp
-- Cache files will be written to: C:/ncs/v1.9.0/zephyr/.cache
-- Found dtc: C:/ncs/v1.9.0/toolchain/opt/bin/dtc.exe (found suitable version "1.4.7", minimum required is "1.4.6")
-- Found toolchain: gnuarmemb (C:/ncs/v1.9.0/toolchain/opt)
-- Found BOARD.dts: C:/ncs/v1.9.0/zephyr/boards/arm/nrf5340dk_nrf5340/nrf5340dk_nrf5340_cpuapp.dts
-- Generated zephyr.dts: C:/ncs/v1.9.0/nrf/samples/bluetooth/central_bas/build_nrf5340dk_nrf5340_cpuapp/zephyr/zephyr.dts
-- Generated devicetree_unfixed.h: C:/ncs/v1.9.0/nrf/samples/bluetooth/central_bas/build_nrf5340dk_nrf5340_cpuapp/zephyr/include/generated/devicetree_unfixed.h
-- Generated device_extern.h: C:/ncs/v1.9.0/nrf/samples/bluetooth/central_bas/build_nrf5340dk_nrf5340_cpuapp/zephyr/include/generated/device_extern.h
-- Including generated dts.cmake file: C:/ncs/v1.9.0/nrf/samples/bluetooth/central_bas/build_nrf5340dk_nrf5340_cpuapp/zephyr/dts.cmake
Parsing C:/ncs/v1.9.0/zephyr/Kconfig
Loaded configuration 'C:/ncs/v1.9.0/nrf/samples/bluetooth/central_bas/build_nrf5340dk_nrf5340_cpuapp/zephyr/.config'
No change to configuration in 'C:/ncs/v1.9.0/nrf/samples/bluetooth/central_bas/build_nrf5340dk_nrf5340_cpuapp/zephyr/.config'
No change to Kconfig header in 'C:/ncs/v1.9.0/nrf/samples/bluetooth/central_bas/build_nrf5340dk_nrf5340_cpuapp/zephyr/include/generated/autoconf.h'
loading initial cache file C:/ncs/v1.9.0/nrf/samples/bluetooth/central_bas/build_nrf5340dk_nrf5340_cpuapp/hci_rpmsg/child_image_preload.cmake
-- Application: C:/ncs/v1.9.0/zephyr/samples/bluetooth/hci_rpmsg
-- Zephyr version: 2.7.99 (C:/ncs/v1.9.0/zephyr), build: v2.7.99-ncs1
-- Found west (found suitable version "0.12.0", minimum required is "0.7.1")
-- Board: nrf5340dk_nrf5340_cpunet
-- Cache files will be written to: C:/ncs/v1.9.0/zephyr/.cache
-- Found dtc: C:/ncs/v1.9.0/toolchain/opt/bin/dtc.exe (found suitable version "1.4.7", minimum required is "1.4.6")
-- Found toolchain: gnuarmemb (C:/ncs/v1.9.0/toolchain/opt)
-- Found BOARD.dts: C:/ncs/v1.9.0/zephyr/boards/arm/nrf5340dk_nrf5340/nrf5340dk_nrf5340_cpunet.dts
-- Generated zephyr.dts: C:/ncs/v1.9.0/nrf/samples/bluetooth/central_bas/build_nrf5340dk_nrf5340_cpuapp/hci_rpmsg/zephyr/zephyr.dts
-- Generated devicetree_unfixed.h: C:/ncs/v1.9.0/nrf/samples/bluetooth/central_bas/build_nrf5340dk_nrf5340_cpuapp/hci_rpmsg/zephyr/include/generated/devicetree_unfixed.h
-- Generated device_extern.h: C:/ncs/v1.9.0/nrf/samples/bluetooth/central_bas/build_nrf5340dk_nrf5340_cpuapp/hci_rpmsg/zephyr/include/generated/device_extern.h
-- Including generated dts.cmake file: C:/ncs/v1.9.0/nrf/samples/bluetooth/central_bas/build_nrf5340dk_nrf5340_cpuapp/hci_rpmsg/zephyr/dts.cmake
Parsing C:/ncs/v1.9.0/zephyr/Kconfig
Loaded configuration 'C:/ncs/v1.9.0/nrf/samples/bluetooth/central_bas/build_nrf5340dk_nrf5340_cpuapp/hci_rpmsg/zephyr/.config'
No change to configuration in 'C:/ncs/v1.9.0/nrf/samples/bluetooth/central_bas/build_nrf5340dk_nrf5340_cpuapp/hci_rpmsg/zephyr/.config'
No change to Kconfig header in 'C:/ncs/v1.9.0/nrf/samples/bluetooth/central_bas/build_nrf5340dk_nrf5340_cpuapp/hci_rpmsg/zephyr/include/generated/autoconf.h'
loading initial cache file C:/ncs/v1.9.0/nrf/samples/bluetooth/central_bas/build_nrf5340dk_nrf5340_cpuapp/hci_rpmsg/b0n/child_image_preload.cmake
-- Application: C:/ncs/v1.9.0/nrf/samples/nrf5340/netboot
-- Zephyr version: 2.7.99 (C:/ncs/v1.9.0/zephyr), build: v2.7.99-ncs1
-- Found west (found suitable version "0.12.0", minimum required is "0.7.1")
-- Board: nrf5340dk_nrf5340_cpunet
-- Cache files will be written to: C:/ncs/v1.9.0/zephyr/.cache
-- Found dtc: C:/ncs/v1.9.0/toolchain/opt/bin/dtc.exe (found suitable version "1.4.7", minimum required is "1.4.6")
-- Found toolchain: gnuarmemb (C:/ncs/v1.9.0/toolchain/opt)
-- Found BOARD.dts: C:/ncs/v1.9.0/zephyr/boards/arm/nrf5340dk_nrf5340/nrf5340dk_nrf5340_cpunet.dts
-- Generated zephyr.dts: C:/ncs/v1.9.0/nrf/samples/bluetooth/central_bas/build_nrf5340dk_nrf5340_cpuapp/hci_rpmsg/b0n/zephyr/zephyr.dts
-- Generated devicetree_unfixed.h: C:/ncs/v1.9.0/nrf/samples/bluetooth/central_bas/build_nrf5340dk_nrf5340_cpuapp/hci_rpmsg/b0n/zephyr/include/generated/devicetree_unfixed.h
-- Generated device_extern.h: C:/ncs/v1.9.0/nrf/samples/bluetooth/central_bas/build_nrf5340dk_nrf5340_cpuapp/hci_rpmsg/b0n/zephyr/include/generated/device_extern.h
-- Including generated dts.cmake file: C:/ncs/v1.9.0/nrf/samples/bluetooth/central_bas/build_nrf5340dk_nrf5340_cpuapp/hci_rpmsg/b0n/zephyr/dts.cmake
Parsing C:/ncs/v1.9.0/nrf/samples/nrf5340/netboot/Kconfig
Loaded configuration 'C:/ncs/v1.9.0/nrf/samples/bluetooth/central_bas/build_nrf5340dk_nrf5340_cpuapp/hci_rpmsg/b0n/zephyr/.config'
No change to configuration in 'C:/ncs/v1.9.0/nrf/samples/bluetooth/central_bas/build_nrf5340dk_nrf5340_cpuapp/hci_rpmsg/b0n/zephyr/.config'
No change to Kconfig header in 'C:/ncs/v1.9.0/nrf/samples/bluetooth/central_bas/build_nrf5340dk_nrf5340_cpuapp/hci_rpmsg/b0n/zephyr/include/generated/autoconf.h'
-- Configuring done
-- Generating done
-- Build files have been written to: C:/ncs/v1.9.0/nrf/samples/bluetooth/central_bas/build_nrf5340dk_nrf5340_cpuapp/hci_rpmsg/b0n
-- libmetal version: 1.1.0 (C:/ncs/v1.9.0/zephyr/samples/bluetooth/hci_rpmsg)
-- open-amp version: 1.1.0 (C:/ncs/v1.9.0/modules/lib/open-amp/open-amp)
-- Configuring done
-- Generating done
-- Build files have been written to: C:/ncs/v1.9.0/nrf/samples/bluetooth/central_bas/build_nrf5340dk_nrf5340_cpuapp/hci_rpmsg
loading initial cache file C:/ncs/v1.9.0/nrf/samples/bluetooth/central_bas/build_nrf5340dk_nrf5340_cpuapp/mcuboot/child_image_preload.cmake
-- Application: C:/ncs/v1.9.0/bootloader/mcuboot/boot/zephyr
-- Zephyr version: 2.7.99 (C:/ncs/v1.9.0/zephyr), build: v2.7.99-ncs1
-- Found west (found suitable version "0.12.0", minimum required is "0.7.1")
-- Board: nrf5340dk_nrf5340_cpuapp
-- Cache files will be written to: C:/ncs/v1.9.0/zephyr/.cache
-- Found dtc: C:/ncs/v1.9.0/toolchain/opt/bin/dtc.exe (found suitable version "1.4.7", minimum required is "1.4.6")
-- Found toolchain: gnuarmemb (C:/ncs/v1.9.0/toolchain/opt)
-- Found BOARD.dts: C:/ncs/v1.9.0/zephyr/boards/arm/nrf5340dk_nrf5340/nrf5340dk_nrf5340_cpuapp.dts
-- Found devicetree overlay: C:/ncs/v1.9.0/nrf/modules/mcuboot/usb.overlay
-- Found devicetree overlay: C:/ncs/v1.9.0/bootloader/mcuboot/boot/zephyr/dts.overlay
-- Generated zephyr.dts: C:/ncs/v1.9.0/nrf/samples/bluetooth/central_bas/build_nrf5340dk_nrf5340_cpuapp/mcuboot/zephyr/zephyr.dts
-- Generated devicetree_unfixed.h: C:/ncs/v1.9.0/nrf/samples/bluetooth/central_bas/build_nrf5340dk_nrf5340_cpuapp/mcuboot/zephyr/include/generated/devicetree_unfixed.h
-- Generated device_extern.h: C:/ncs/v1.9.0/nrf/samples/bluetooth/central_bas/build_nrf5340dk_nrf5340_cpuapp/mcuboot/zephyr/include/generated/device_extern.h
-- Including generated dts.cmake file: C:/ncs/v1.9.0/nrf/samples/bluetooth/central_bas/build_nrf5340dk_nrf5340_cpuapp/mcuboot/zephyr/dts.cmake
Parsing C:/ncs/v1.9.0/bootloader/mcuboot/boot/zephyr/Kconfig
Loaded configuration 'C:/ncs/v1.9.0/nrf/samples/bluetooth/central_bas/build_nrf5340dk_nrf5340_cpuapp/mcuboot/zephyr/.config'
No change to configuration in 'C:/ncs/v1.9.0/nrf/samples/bluetooth/central_bas/build_nrf5340dk_nrf5340_cpuapp/mcuboot/zephyr/.config'
No change to Kconfig header in 'C:/ncs/v1.9.0/nrf/samples/bluetooth/central_bas/build_nrf5340dk_nrf5340_cpuapp/mcuboot/zephyr/include/generated/autoconf.h'
-- Configuring done
-- Generating done
-- Build files have been written to: C:/ncs/v1.9.0/nrf/samples/bluetooth/central_bas/build_nrf5340dk_nrf5340_cpuapp/mcuboot
loading initial cache file C:/ncs/v1.9.0/nrf/samples/bluetooth/central_bas/build_nrf5340dk_nrf5340_cpuapp/mcuboot/child_image_preload.cmake
-- Configuring incomplete, errors occurred!
See also "C:/ncs/v1.9.0/nrf/samples/bluetooth/central_bas/build_nrf5340dk_nrf5340_cpuapp/CMakeFiles/CMakeOutput.log".
See also "C:/ncs/v1.9.0/nrf/samples/bluetooth/central_bas/build_nrf5340dk_nrf5340_cpuapp/CMakeFiles/CMakeError.log".
Including boilerplate (Zephyr base (cached)): C:/ncs/v1.9.0/zephyr/cmake/app/boilerplate.cmake
-- Using NCS Toolchain 1.9.0 for building. (C:/ncs/v1.9.0/toolchain/cmake)
C:\ncs\v1.9.0\toolchain\opt\bin\arm-none-eabi-gdb.exe: warning: Couldn't determine a path for the index cache directory.

=== child image hci_rpmsg - CPUNET begin ===
CMake Warning (dev) at C:/ncs/v1.9.0/nrf/samples/bluetooth/central_bas/build_nrf5340dk_nrf5340_cpuapp/hci_rpmsg/child_image_preload.cmake:11 (set):
  Syntax error in cmake code at

    C:/ncs/v1.9.0/nrf/samples/bluetooth/central_bas/build_nrf5340dk_nrf5340_cpuapp/hci_rpmsg/child_image_preload.cmake:11

  when parsing string

    C:\ncs\v1.9.0\toolchain\segger_embedded_studio/html/configure_nordic_project_menuconfig.py

  Invalid escape sequence \v

  Policy CMP0010 is not set: Bad variable reference syntax is an error.  Run
  "cmake --help-policy CMP0010" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.
This warning is for project developers.  Use -Wno-dev to suppress it.

Including boilerplate (Zephyr base (cached)): C:/ncs/v1.9.0/zephyr/cmake/app/boilerplate.cmake
-- Using NCS Toolchain 1.9.0 for building. (C:/ncs/v1.9.0/toolchain/cmake)
C:\ncs\v1.9.0\toolchain\opt\bin\arm-none-eabi-gdb.exe: warning: Couldn't determine a path for the index cache directory.

=== child image b0n - CPUNET (inherited) begin ===
CMake Warning (dev) at C:/ncs/v1.9.0/nrf/samples/bluetooth/central_bas/build_nrf5340dk_nrf5340_cpuapp/hci_rpmsg/b0n/child_image_preload.cmake:11 (set):
  Syntax error in cmake code at

    C:/ncs/v1.9.0/nrf/samples/bluetooth/central_bas/build_nrf5340dk_nrf5340_cpuapp/hci_rpmsg/b0n/child_image_preload.cmake:11

  when parsing string

    C:\ncs\v1.9.0\toolchain\segger_embedded_studio/html/configure_nordic_project_menuconfig.py

  Invalid escape sequence \v

  Policy CMP0010 is not set: Bad variable reference syntax is an error.  Run
  "cmake --help-policy CMP0010" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.
This warning is for project developers.  Use -Wno-dev to suppress it.

Including boilerplate (Zephyr base (cached)): C:/ncs/v1.9.0/zephyr/cmake/app/boilerplate.cmake
-- Using NCS Toolchain 1.9.0 for building. (C:/ncs/v1.9.0/toolchain/cmake)
C:\ncs\v1.9.0\toolchain\opt\bin\arm-none-eabi-gdb.exe: warning: Couldn't determine a path for the index cache directory.
CMake Warning at C:/ncs/v1.9.0/zephyr/CMakeLists.txt:1687 (message):
  __ASSERT() statements are globally ENABLED


=== child image b0n - CPUNET (inherited) end ===

-- Build type:  
-- Host:    Windows/AMD64
-- Target:  Generic/arm
-- Machine: arm
-- Host:    Windows/AMD64
-- Target:  Generic/arm
-- Machine: arm
-- C_FLAGS :  -Wall -Wextra
=== child image hci_rpmsg - CPUNET end ===


=== child image mcuboot -  begin ===
CMake Warning (dev) at C:/ncs/v1.9.0/nrf/samples/bluetooth/central_bas/build_nrf5340dk_nrf5340_cpuapp/mcuboot/child_image_preload.cmake:9 (set):
  Syntax error in cmake code at

    C:/ncs/v1.9.0/nrf/samples/bluetooth/central_bas/build_nrf5340dk_nrf5340_cpuapp/mcuboot/child_image_preload.cmake:9

  when parsing string

    C:\ncs\v1.9.0\toolchain\segger_embedded_studio/html/configure_nordic_project_menuconfig.py

  Invalid escape sequence \v

  Policy CMP0010 is not set: Bad variable reference syntax is an error.  Run
  "cmake --help-policy CMP0010" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.
This warning is for project developers.  Use -Wno-dev to suppress it.

Including boilerplate (Zephyr base (cached)): C:/ncs/v1.9.0/zephyr/cmake/app/boilerplate.cmake
-- Using NCS Toolchain 1.9.0 for building. (C:/ncs/v1.9.0/toolchain/cmake)
C:\ncs\v1.9.0\toolchain\opt\bin\arm-none-eabi-gdb.exe: warning: Couldn't determine a path for the index cache directory.
MCUBoot bootloader key file: C:/ncs/v1.9.0/bootloader/mcuboot/root-rsa-2048.pem
=== child image mcuboot -  end ===


=== child image s1_image -  begin ===
CMake Warning (dev) at C:/ncs/v1.9.0/nrf/samples/bluetooth/central_bas/build_nrf5340dk_nrf5340_cpuapp/mcuboot/child_image_preload.cmake:9 (set):
  Syntax error in cmake code at

    C:/ncs/v1.9.0/nrf/samples/bluetooth/central_bas/build_nrf5340dk_nrf5340_cpuapp/mcuboot/child_image_preload.cmake:9

  when parsing string

    C:\ncs\v1.9.0\toolchain\segger_embedded_studio/html/configure_nordic_project_menuconfig.py

  Invalid escape sequence \v

  Policy CMP0010 is not set: Bad variable reference syntax is an error.  Run
  "cmake --help-policy CMP0010" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Error: The source "C:/ncs/v1.9.0/bootloader/mcuboot/boot/zephyr/CMakeLists.txt" does not match the source "C:/ncs/v1.9.0/nrf/samples/bluetooth/central_bas/CMakeLists.txt" used to generate cache.  Re-run cmake with a different source directory.
CMake Error at C:/ncs/v1.9.0/nrf/cmake/multi_image.cmake:409 (message):
  CMake generation for s1_image failed, aborting.  Command: 1
Call Stack (most recent call first):
  C:/ncs/v1.9.0/nrf/cmake/multi_image.cmake:150 (add_child_image_from_source)
  C:/ncs/v1.9.0/nrf/modules/mcuboot/CMakeLists.txt:222 (add_child_image)



error: cmake failed
create_nordic_project.py failed (1)

Any ideas, how to fix this issue?

Best regards,

Alex

  • Thanks for your insight.

    You must use the bootloader to upload the firmware without erasing, for example putting the device in bootloader mode and using the Programmer app with "Enable MCUboot" selected, using MCUmgr, or using OTA if you have support for that on your device.

    Which programmer app uses the "Enable MCUBoot" option?

    Is it possible to put the device into bootloader mode and send the updated firmware via serial connection? For example, I have an LPC Microcontroller on my board and would like to send firmware to it, and it then sends the new firmware via serial connection to my nRF5340 on the same board.

    Best regards,

    Alex

  • Hi Alex,

    Ryisen said:
    Which programmer app uses the "Enable MCUBoot" option?

    The Programmer app in nRF Connect for Desktop:

    See nRF Connect for Desktop for download and nRF Connect Programmer for information on how to use it.

    Ryisen said:
    Is it possible to put the device into bootloader mode and send the updated firmware via serial connection?

    Yes, this should be possible. You can use another chip as SMP client as long as the chip supports SMP or can implement it. See mcumgr and SMP for some more information about SMP. A colleague of mine has made a sample where another nRF chip is acting as SMP client, see Bluetooth: Central SMP Client DFU. If the chip is supported in nRF Connect SDK or Zephyr you can use this sample as a starting point. If it is not supported, you will have to implement the SMP client yourself. For this you can try and have a look at SMP Protocol Specification.

    Best regards,

    Marte

Related