CONFIG_BOOT_BUILD_DIRECT_XIP_VARIANT is undefined symbol

I'm using a nRF5340DK with nRF Connect SDK v1.9.0 and want to use MCUBoot with Direct-XIP.

Using the hello_world sample project, I added MCUBoot.

In the MCUBoot prf.conf file located at "ncs\v1.9.0\bootloader\mcuboot\boot\zephyr" I added "CONFIG_BOOT_DIRECT_XIP=y" and now upon starting i get:

*** Booting Zephyr OS build v2.7.99-ncs1  ***

I: Starting Direct-XIP bootloader

I: Primary   slot: version=1.0.0+0

I: Image 0 Secondary slot: Image not found

I: Image 0 loaded from the primary slot

I: Bootloader chainload address offset: 0xc000

I: Jumping to the image slot
*** Booting Zephyr OS build v2.7.99-ncs1  ***

Executing application version {1}

build time: Nov  9 2022 09:38:48

So this should work.

Now I want to load an image into the secondary slot to be executed from there. If I just flash another image with higher version number into offset 0x74000 (from pm.config), I can see the image via mcumgr in the second slot and marked as "pending", but after a reset it is still marked as pending.

The bootloader gives me this output:

*** Booting Zephyr OS build v2.7.99-ncs1  ***

I: Starting Direct-XIP bootloader

I: Primary   slot: version=1.0.0+0

I: Secondary slot: version=2.0.0+0

I: Image 0 loaded from the secondary slot

I: Bootloader chainload address offset: 0x74000

I: Jumping to the image slot
*** Booting Zephyr OS build v2.7.99-ncs1  ***

Executing application version {1}

build time: Nov  9 2022 09:38:48

So apparently it boots from 0x74000 but still executes the old code. I think this is because the image in the secondary slot was built for slot 0, therefore it links to the wrong addresses.

Here I found the "CONFIG_BOOT_BUILD_DIRECT_XIP_VARIANT=y" option and added it to my prj.conf from hello_world, but in Segger Embedded Studio I get:

-- Using NCS Toolchain 1.9.0 for building. (C:/ncs/v1.9.0/toolchain/cmake)

C:/ncs/v1.9.0/zephyr/samples/hello_world/prj.conf:6: warning: attempt to assign the value 'y' to the undefined symbol BOOT_BUILD_DIRECT_XIP_VARIANT

error: Aborting due to Kconfig warnings

CMake Error at C:/ncs/v1.9.0/zephyr/cmake/kconfig.cmake:272 (message):
  command failed with return code: 1
Call Stack (most recent call first):
  C:/ncs/v1.9.0/zephyr/cmake/app/boilerplate.cmake:544 (include)
  C:/ncs/v1.9.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:24 (include)
  C:/ncs/v1.9.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:40 (include_boilerplate)
  CMakeLists.txt:5 (find_package)



error: cmake failed
create_nordic_project.py failed (1)

How can I fix this issue?

Best regards,

Alex

prj.conf of hello_world:

# Ensure an MCUboot-compatible binary is generated.
CONFIG_BOOTLOADER_MCUBOOT=y
CONFIG_MCUBOOT_IMAGE_VERSION="2"
#CONFIG_BOOT_SIGNATURE_KEY_FILE="privMCUBoot.pem"
CONFIG_BOOT_BUILD_DIRECT_XIP_VARIANT=y

# Enable mcumgr.
CONFIG_MCUMGR=y

# Enable most core commands.
CONFIG_MCUMGR_CMD_IMG_MGMT=y
CONFIG_MCUMGR_CMD_OS_MGMT=y

# Enable the serial mcumgr transport.
CONFIG_MCUMGR_SMP_UART=y

# Some command handlers require a large stack.
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096

prj.conf of mcuboot (ncs\v1.9.0\bootloader\mcuboot\boot\zephyr)

CONFIG_PM=n

CONFIG_MAIN_STACK_SIZE=10240
CONFIG_MBEDTLS_CFG_FILE="mcuboot-mbedtls-cfg.h"

CONFIG_BOOT_SWAP_SAVE_ENCTLV=n
CONFIG_BOOT_ENCRYPT_RSA=n
CONFIG_BOOT_ENCRYPT_EC256=n
CONFIG_BOOT_ENCRYPT_X25519=n

CONFIG_BOOT_UPGRADE_ONLY=n
CONFIG_BOOT_BOOTSTRAP=n

### mbedTLS has its own heap
# CONFIG_HEAP_MEM_POOL_SIZE is not set

### We never want Zephyr's copy of tinycrypt.  If tinycrypt is needed,
### MCUboot has its own copy in tree.
# CONFIG_TINYCRYPT is not set
# CONFIG_TINYCRYPT_ECC_DSA is not set
# CONFIG_TINYCRYPT_SHA256 is not set

CONFIG_FLASH=y
CONFIG_FPROTECT=y

### Various Zephyr boards enable features that we don't want.
# CONFIG_BT is not set
# CONFIG_BT_CTLR is not set
# CONFIG_I2C is not set

CONFIG_LOG=y
CONFIG_LOG_MODE_MINIMAL=y # former CONFIG_MODE_MINIMAL
### Ensure Zephyr logging changes don't use more resources
CONFIG_LOG_DEFAULT_LEVEL=0
### Decrease footprint by ~4 KB in comparison to CBPRINTF_COMPLETE=y
CONFIG_CBPRINTF_NANO=y

CONFIG_BOOT_DIRECT_XIP=y

Parents Reply
  • Ok I see, thanks.

    Is there a way to build/link an image to a specific address in Segger Embedded Studio? I want to use MCUBoot Direct XIP, but if I just write the image to the flash at the correct offset (0x74000 for the XIP variant of MCUBoot) it links back to the first image in 0xc000 while keeping the new Image in state pending (as read by mcumgr) and not updating properly.

    Best regards,

    Alex

Children
Related