Use internal flash MCUboot and nRF5340

I'm trying to setup so that I can do firmware update on nRF5340 using only the internal flash.
Due to the many dependencies between different images I'm creating my custom board by using a copy of the
thingy53 board, however on my board there is no external flash. 

I'm using the nrf sdk 2.5.2 and it does not seem like the mcuboot integration works without external flash.

CONFIG_NRF53_MCUBOOT_PRIMARY_1_RAM_FLASH needs to be set which depends on CONFIG_NRF53_MULTI_IMAGE_UPDATE, which in turn depends on PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY.

config NRF53_MULTI_IMAGE_UPDATE
	bool "Support updating app core and net core in a single operation"
	default y
	depends on UPDATEABLE_IMAGE_NUMBER > 1
	depends on SOC_NRF5340_CPUAPP
	depends on BOOT_IMAGE_ACCESS_HOOKS
	depends on FLASH_SIMULATOR
	depends on FLASH_SIMULATOR_DOUBLE_WRITES
	depends on !FLASH_SIMULATOR_STATS
	depends on PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY
	depends on BOOT_UPGRADE_ONLY || USE_NRF53_MULTI_IMAGE_WITHOUT_UPGRADE_ONLY
	depends on $(dt_compat_enabled,$(DT_COMPAT_SIM_FLASH))
	select NRF53_MCUBOOT_PRIMARY_1_RAM_FLASH

here also BOOT_IMAGE_ACCESS_HOOKS depends on PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY being set.

Parents Reply Children
  • diff --git a/modules/mcuboot/boot/zephyr/Kconfig b/modules/mcuboot/boot/zephyr/Kconfig
    index f59464b54..519ea2ddf 100644
    --- a/modules/mcuboot/boot/zephyr/Kconfig
    +++ b/modules/mcuboot/boot/zephyr/Kconfig
    @@ -103,7 +103,7 @@ config BOOT_ERASE_PROGRESSIVELY
     
     config BOOT_IMAGE_ACCESS_HOOKS
            bool
    -       default y if UPDATEABLE_IMAGE_NUMBER > 1 && SOC_NRF5340_CPUAPP && PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY
    +       default y if UPDATEABLE_IMAGE_NUMBER > 1 && SOC_NRF5340_CPUAPP
            depends on MCUBOOT
     
     config BOOT_IMAGE_ACCESS_HOOK_NRF5340
    @@ -128,7 +128,6 @@ config NRF53_MULTI_IMAGE_UPDATE
            depends on FLASH_SIMULATOR
            depends on FLASH_SIMULATOR_DOUBLE_WRITES
            depends on !FLASH_SIMULATOR_STATS
    -       depends on PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY
            depends on BOOT_UPGRADE_ONLY || USE_NRF53_MULTI_IMAGE_WITHOUT_UPGRADE_ONLY
            depends on $(dt_compat_enabled,$(DT_COMPAT_SIM_FLASH))
            select NRF53_MCUBOOT_PRIMARY_1_RAM_FLASH

    together with a custom pm_static_*.yml file for my board. it was kind of painful to configure.

  • Thank you very much! I'm able to update the appcore but netcore is giving me some troubles and I think it's related to the netcore partitions size.

    Can you show me your pm_static.yml file?

    This is mine, I'm setting netcore partitions size of 128kB.

    app:
      address:     0x00c200
      end_address: 0x074000
      region: flash_primary
      size:        0x067e00
    
    mcuboot:
      address:     0x000000
      end_address: 0x00c000
      placement:
        before:
        - mcuboot_primary
      region: flash_primary
      size:        0x00c000
    
    mcuboot_pad:
      address:     0x00c000
      end_address: 0x00c200
      placement:
        align:
          start:   0x004000
        before:
        - mcuboot_primary_app
      region: flash_primary
      size:        0x000200
    
    mcuboot_primary:
      address:     0x00c000
      end_address: 0x074000
      orig_span: &id001
      - mcuboot_pad
      - app
      region: flash_primary
      sharers: 0x1
      size:        0x068000
      span: *id001
    
    mcuboot_primary_app:
      address:     0x00c200
      end_address: 0x074000
      orig_span: &id002
      - app
      region: flash_primary
      size:        0x067e00
      span: *id002
    
    mcuboot_secondary:
      address:     0x074000
      end_address: 0x0dc000
      placement:
        after:
        - mcuboot_primary
        align:
          start:   0x004000
      region: flash_primary
      share_size:
      - mcuboot_primary
      size:        0x068000
    
    #NetCore partitions
    # NetCore primary partition in AppCore RAM. Needed for DFU
    mcuboot_primary_1:
      address: 0x0
      device: flash_ctrl
      end_address: 0x020000
      region: ram_flash
      size: 0x020000
    
    # RAM allocation for NetCore primary partition. Used by MCUBoot. Needed for DFU
    ram_flash:
      address: 0x20000
      end_address: 0x20000
      region: ram_flash
      size: 0x0
    
    # NetCore secondary partition in internal flash. Needed for DFU
    mcuboot_secondary_1:
      address:     0x0dc000
      end_address: 0x0fc000
      placement:
        after:
        - mcuboot_secondary
      region: flash_primary
      size:        0x020000
    
    nvs_storage:
      address:     0x0fc000
      end_address: 0x100000
      placement:
        after:
        - mcuboot_secondary_1
      region: flash_primary
      size:        0x004000
      
    otp:
      address: 0xff8100
      end_address: 0xff83fc
      region: otp
      size: 0x2fc
    
    pcd_sram:
      address: 0x2006f000
      end_address: 0x20071000
      placement:
        before:
        - networkCore_sram
        - end
      region: sram_primary
      size: 0x2000
      
    networkCore_sram:
      address: 0x20071000
      end_address: 0x20080000
      placement:
        before:
        - end
      region: sram_primary
      size: 0xF000
      
    shared_sram:
      address: 0x20000000
      end_address: 0x20001000
      placement:
        before:
        - sram_primary
      region: sram_primary
      size: 0x1000
    
    sram_primary:
      address: 0x20010000
      end_address: 0x2006f000
      region: sram_primary
      size: 0x6e000
    

  • I solved it by adding a custom pm_static.yml file for the network core.

    app:
      address: 0x1008800
      end_address: 0x1020000
      orig_span: &id001
      - nodeNetworkCore
      region: flash_primary
      size: 0x17800
      span: *id001
    b0n:
      address: 0x1000000
      end_address: 0x1008580
      placement:
        after:
        - start
      region: flash_primary
      size: 0x8580
    b0n_container:
      address: 0x1000000
      end_address: 0x1008800
      orig_span: &id002
      - b0n
      - provision
      region: flash_primary
      size: 0x8800
      span: *id002
    nodeNetworkCore:
      address: 0x1008800
      end_address: 0x1020000
      region: flash_primary
      size: 0x17800
    provision:
      address: 0x1008580
      end_address: 0x1008800
      placement:
        after:
        - b0n
      region: flash_primary
      size: 0x280
    sram_primary:
      address: 0x21000000
      end_address: 0x21010000
      region: sram_primary
      size: 0x10000

Related