how to implement simultaneous dfu on 5340 ncs2.4 without external flash

As title, I try to implement simultaneous dfu without external flash on 5340, but it always show that  'PM_MCUBOOT_PRIMARY_1_ID' undeclared.

if use external flash, my project can work well. when i disabled QSPI and  add pm_static.yml as below, the project compilation reported the error.

so  how to implement simultaneous dfu on 5340 ncs2.4 without external flash.

【pm_static.yml】

app:
  address: 0xc200
  region: flash_primary
  size: 0x5AE00
mcuboot:
  address: 0x0
  region: flash_primary
  size: 0xc000
mcuboot_pad:
  address: 0xc000
  region: flash_primary
  size: 0x200
mcuboot_primary:
  address: 0xc000
  orig_span: &id001
  - mcuboot_pad
  - app
  region: flash_primary
  size: 0x5B000
  span: *id001
mcuboot_primary_app:
  address: 0xc200
  orig_span: &id002
  - app
  region: flash_primary
  size: 0x5AE00
  span: *id002
mcuboot_secondary:
  address: 0x67000
  size: 0x5B000
  region: flash_primary
mcuboot_primary_1:
  address: 0x0
  size: 0x3a000
  device: nordic_ram_flash_controller
  region: ram_flash
ram_flash_empty:
  address: 0x3a000
  size: 0x6000
  device: nordic_ram_flash_controller
  region: ram_flash  
mcuboot_secondary_1:
  address: 0xC2000
  size: 0x3a000
  region: flash_primary
settings_storage:
  address: 0xfc000
  region: flash_primary
  size: 0x4000 

[mcuboot.conf]

# Enable flash simulator
CONFIG_FLASH=y
CONFIG_FPROTECT=y
CONFIG_PCD_APP=y
CONFIG_FLASH_SIMULATOR=y
CONFIG_FLASH_SIMULATOR_DOUBLE_WRITES=y
CONFIG_FLASH_SIMULATOR_STATS=n

CONFIG_MAIN_STACK_SIZE=10240
CONFIG_BOOT_MAX_IMG_SECTORS=256

CONFIG_NRF53_MULTI_IMAGE_UPDATE=y
CONFIG_UPDATEABLE_IMAGE_NUMBER=2

CONFIG_BOOT_UPGRADE_ONLY=y
CONFIG_BOOT_IMAGE_ACCESS_HOOK_NRF5340=y
CONFIG_BOOT_IMAGE_ACCESS_HOOKS=y

Parents Reply Children
  • I am currently working on an nRF5340 project and am also interested in simultaneous dfu without external flash.

    Unfortunately, I can't get the 5700.peripheral_lbs_dfu example to work on ncs 2.5.0.

    If I understand it correctly from the github links above, this may be a new feature in ncs 2.6.0. Is that correct?

    Regards,

    Mark

  • MarkK said:
    Unfortunately, I can't get the 5700.peripheral_lbs_dfu example to work on ncs 2.5.0.

    The sample should work I beleive. Can you explain your issue?

    MarkK said:
    If I understand it correctly from the github links above, this may be a new feature in ncs 2.6.0. Is that correct?

    Tge PRs are still Open, so I can not say anything about when they will be merged and included into the nRF Connect SDK.

  • When I build peripheral_lbs_dfu "as-is" from the attached zip file (5700.peripheral_lbs_dfu.zip) for "nrf5340dk_nrf5340_cpuapp_ns" on ncs 2.5.0, I get the following:

    H:/Documenten/Projects/ZephyrTestProjects/peripheral_lbs_dfu/prj.conf:21: warning: attempt to assign the value '"2.3.0+0"' to the undefined symbol MCUBOOT_IMAGE_VERSION

    error: Aborting due to Kconfig warnings

    When I comment (#) the MCUBOOT_IMAGE_VERSION in prj.conf, to exclude it, then I get the following error:

    error: BOOT_ENCRYPT_RSA (defined at C:/ncs/v2.5.0/bootloader/mcuboot/boot/zephyr/Kconfig:338) is
    assigned in a configuration file, but is not directly user-configurable (has no prompt). It gets its
    value indirectly from other symbols. See
    docs.zephyrproject.org/.../kconfig.html and/or look up
    BOOT_ENCRYPT_RSA in the menuconfig/guiconfig interface. The Application Development Primer, Setting
    Configuration Values, and Kconfig - Tips and Best Practices sections of the manual might be helpful
    too.

    Parsing C:/ncs/v2.5.0/bootloader/mcuboot/boot/zephyr/Kconfig
    Loaded configuration 'C:/ncs/v2.5.0/zephyr/boards/arm/nrf5340dk_nrf5340/nrf5340dk_nrf5340_cpuapp_defconfig'
    Merged configuration 'H:/Documenten/Projects/ZephyrTestProjects/peripheral_lbs_dfu/child_image/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.conf'
    Merged configuration 'C:/ncs/v2.5.0/nrf/subsys/pcd/pcd.conf'
    Merged configuration 'C:/ncs/v2.5.0/nrf/modules/mcuboot/tfm.conf'
    Merged configuration 'C:/ncs/v2.5.0/nrf/modules/mcuboot/fih_low_enable.conf'
    Merged configuration 'C:/ncs/v2.5.0/nrf/subsys/partition_manager/partition_manager_enabled.conf'
    Merged configuration 'H:/Documenten/Projects/ZephyrTestProjects/peripheral_lbs_dfu/build/mcuboot/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:31 (find_package)

    -- Configuring incomplete, errors occurred!
    CMake Error at C:/ncs/v2.5.0/nrf/cmake/multi_image.cmake:449 (message):
    CMake generation for mcuboot 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/modules/mcuboot/CMakeLists.txt:268 (add_child_image)

  • The version error is due to the new versioning system in v2.5.0

    MarkK said:
    error: BOOT_ENCRYPT_RSA (defined at C:/ncs/v2.5.0/bootloader/mcuboot/boot/zephyr/Kconfig:338) is

    Try to remove CONFIG_BOOT_ENCRYPT_RSA from child_image/mcuboot.conf then?

  • Thank you, I appreciate your fast responses. I think I'm nearly there.

    For the versioning, I included a VERSION file, according to the new system.

    Then I removed (commented out) the 3 CONFIG_BOOT_ENCRYPT_  lines.

    When building, I get the following errors (undeclared PM_MCUBOOT_PRIMARY_1_ID, FLASH_AREA_IMAGE_1_SLOTS and ALL_AVAILABLE_SLOTS) :

    [85/269] Building C object CMakeFiles/app.dir/flash_map_extended.c.obj
    FAILED: CMakeFiles/app.dir/flash_map_extended.c.obj
    C:\ncs\toolchains\c57af46cb7\opt\zephyr-sdk\arm-zephyr-eabi\bin\arm-zephyr-eabi-gcc.exe -DKERNEL -DMBEDTLS_CONFIG_FILE=\"mcuboot-mbedtls-cfg.h\" -DNRF5340_XXAA_APPLICATION -DNRF_SKIP_FICR_NS_COPY_TO_RAM -DUSE_PARTITION_MANAGER=1 -D__PROGRAM_START -D__ZEPHYR__=1 -IC:/ncs/v2.5.0/bootloader/mcuboot/boot/zephyr/include -IC:/ncs/v2.5.0/bootloader/mcuboot/boot/zephyr/targets -IC:/ncs/v2.5.0/bootloader/mcuboot/boot/bootutil/include -IC:/ncs/v2.5.0/zephyr/include -Izephyr/include/generated -IC:/ncs/v2.5.0/zephyr/soc/arm/nordic_nrf/nrf53 -IC:/ncs/v2.5.0/zephyr/soc/arm/nordic_nrf/common/. -IC:/ncs/v2.5.0/nrf/include -IC:/ncs/v2.5.0/nrf/tests/include -IC:/ncs/v2.5.0/modules/hal/cmsis/CMSIS/Core/Include -IC:/ncs/v2.5.0/zephyr/modules/cmsis/. -IC:/ncs/v2.5.0/modules/hal/nordic/nrfx -IC:/ncs/v2.5.0/modules/hal/nordic/nrfx/drivers/include -IC:/ncs/v2.5.0/modules/hal/nordic/nrfx/mdk -IC:/ncs/v2.5.0/zephyr/modules/hal_nordic/nrfx/. -IC:/ncs/v2.5.0/modules/crypto/mbedtls/include -IC:/ncs/v2.5.0/zephyr/modules/mbedtls/configs -IC:/ncs/v2.5.0/zephyr/modules/mbedtls/include -IC:/ncs/v2.5.0/bootloader/mcuboot/boot/bootutil/zephyr/.. -IC:/ncs/v2.5.0/bootloader/mcuboot/boot/bootutil/zephyr/../include -IC:/ncs/v2.5.0/bootloader/mcuboot/boot/bootutil/zephyr/../../zephyr/include -isystem C:/ncs/v2.5.0/zephyr/lib/libc/minimal/include -isystem c:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/include -isystem c:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/include-fixed -isystem C:/ncs/v2.5.0/nrfxlib/crypto/nrf_cc312_platform/include -fno-strict-aliasing -Os -imacros H:/Documenten/Projects/ZephyrTestProjects/peripheral_lbs_dfu/build/mcuboot/zephyr/include/generated/autoconf.h -ffreestanding -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mcpu=cortex-m33 -mthumb -mabi=aapcs -mfp16-format=ieee --sysroot=C:/ncs/toolchains/c57af46cb7/opt/zephyr-sdk/arm-zephyr-eabi/arm-zephyr-eabi -imacros C:/ncs/v2.5.0/zephyr/include/zephyr/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wno-pointer-sign -Wpointer-arith -Wexpansion-to-defined -Wno-unused-but-set-variable -Werror=implicit-int -fno-pic -fno-pie -fno-asynchronous-unwind-tables -fno-reorder-functions --param=min-pagesize=0 -fno-defer-pop -fmacro-prefix-map=C:/ncs/v2.5.0/bootloader/mcuboot/boot/zephyr=CMAKE_SOURCE_DIR -fmacro-prefix-map=C:/ncs/v2.5.0/zephyr=ZEPHYR_BASE -fmacro-prefix-map=C:/ncs/v2.5.0=WEST_TOPDIR -ffunction-sections -fdata-sections -std=c99 -nostdinc -MD -MT CMakeFiles/app.dir/flash_map_extended.c.obj -MF CMakeFiles\app.dir\flash_map_extended.c.obj.d -o CMakeFiles/app.dir/flash_map_extended.c.obj -c C:/ncs/v2.5.0/bootloader/mcuboot/boot/zephyr/flash_map_extended.c
    In file included from C:/ncs/v2.5.0/bootloader/mcuboot/boot/zephyr/include/sysflash/sysflash.h:10,
    from C:/ncs/v2.5.0/bootloader/mcuboot/boot/zephyr/flash_map_extended.c:15:
    C:/ncs/v2.5.0/bootloader/mcuboot/boot/zephyr/include/sysflash/pm_sysflash.h: In function '__flash_area_ids_for_slot':
    C:/ncs/v2.5.0/bootloader/mcuboot/boot/zephyr/include/sysflash/pm_sysflash.h:48:37: error: 'PM_MCUBOOT_PRIMARY_1_ID' undeclared (first use in this function); did you mean 'PM_MCUBOOT_PRIMARY_ID'?
    48 | #define FLASH_AREA_IMAGE_1_SLOTS PM_MCUBOOT_PRIMARY_1_ID, PM_MCUBOOT_SECONDARY_1_ID
    | ^~~~~~~~~~~~~~~~~~~~~~~
    C:/ncs/v2.5.0/bootloader/mcuboot/boot/zephyr/include/sysflash/pm_sysflash.h:55:29: note: in expansion of macro 'FLASH_AREA_IMAGE_1_SLOTS'
    55 | FLASH_AREA_IMAGE_1_SLOTS
    | ^~~~~~~~~~~~~~~~~~~~~~~~
    C:/ncs/v2.5.0/bootloader/mcuboot/boot/zephyr/include/sysflash/pm_sysflash.h:67:9: note: in expansion of macro 'ALL_AVAILABLE_SLOTS'
    67 | ALL_AVAILABLE_SLOTS
    | ^~~~~~~~~~~~~~~~~~~
    C:/ncs/v2.5.0/bootloader/mcuboot/boot/zephyr/include/sysflash/pm_sysflash.h:48:37: note: each undeclared identifier is reported only once for each function it appears in
    48 | #define FLASH_AREA_IMAGE_1_SLOTS PM_MCUBOOT_PRIMARY_1_ID, PM_MCUBOOT_SECONDARY_1_ID
    | ^~~~~~~~~~~~~~~~~~~~~~~
    C:/ncs/v2.5.0/bootloader/mcuboot/boot/zephyr/include/sysflash/pm_sysflash.h:55:29: note: in expansion of macro 'FLASH_AREA_IMAGE_1_SLOTS'
    55 | FLASH_AREA_IMAGE_1_SLOTS
    | ^~~~~~~~~~~~~~~~~~~~~~~~
    C:/ncs/v2.5.0/bootloader/mcuboot/boot/zephyr/include/sysflash/pm_sysflash.h:67:9: note: in expansion of macro 'ALL_AVAILABLE_SLOTS'
    67 | ALL_AVAILABLE_SLOTS
    | ^~~~~~~~~~~~~~~~~~~
    [86/269] Building C object CMakeFiles/app.dir/C_/ncs/v2.5.0/bootloader/mcuboot/boot/bootutil/src/tlv.c.obj
    FAILED: CMakeFiles/app.dir/C_/ncs/v2.5.0/bootloader/mcuboot/boot/bootutil/src/tlv.c.obj
Related