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

  • 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
  • nrf5340dk_nrf5340.overlay only triggers if you build for nrf5340dk_nrf5340 and not for nrf5340dk_nrf5340_ns

  • Great, thank you for your help, Sigurd!

    It works now and I will try to incorporate this functionality in my own application.

    Best regards,

    Mark

  • The FOTA over BLE functionality works in my application.

    The only thing I see is that for some reason the idle current has increased.

    Edited: problem solved. This was not software related.
  • At this point, we are off topic for this case.

    Can you create a new ticket for this, and then link to the new ticket from here?
    Then I will help you in the new ticket.
    Thanks for helping us keeping DevZone tidy!

Related