Adding static partition between mcuboot and mcuboot_pad/app

I'm trying to add a static partition that lies between the mcuboot and mcuboot_pad/app ones, but even though my solution builds correctly, mcuboot is stuck in a loop. This is how my static partition yaml looks like:

mcuboot:
  address: 0x0
  region: flash_primary
  size: 0x10000

my_partition:
  address: 0x10000
  region: flash_primary
  size: 0x200

mcuboot_pad:
  address: 0x10200
  region: flash_primary
  size: 0x800

app:
  address: 0x10A00
  region: flash_primary
  size: 0x144600
  
  mcuboot_primary:
  orig_span: &id001
  - mcuboot_pad
  - app
  span: *id001
  address: 0x10200
  region: flash_primary
  size: 0x144600

mcuboot_primary_app:
  orig_span: &id002
  - app
  span: *id002
  address: 0x10A00
  region: flash_primary
  size: 0x144600

settings_storage:
  address: 0x173000
  region: flash_primary
  size: 0xa000

It seems like mcuboot is trying to jump to 'my_partition' instead of to 'mcuboot_pad'. I tried adding partition ids, but it didn't change. Can't find it in the documentation or similar examples. How do I achieve this using static partitions?

I'm configuring mcuboot via sysbuild, if that's important.

  • Hi,

    I'm trying to add a static partition that lies between the mcuboot and mcuboot_pad/app ones, but even though my solution builds correctly, mcuboot is stuck in a loop.

    Could you expand a bit on your motivation as for why you would want any section placed here? 

    It seems like mcuboot is trying to jump to 'my_partition' instead of to 'mcuboot_pad'. I tried adding partition ids, but it didn't change. Can't find it in the documentation or similar examples. How do I achieve this using static partitions?

    Your observation is correct, whatever MCUboot is going to is the next address space located after MCUboot (after mcuboot pad, to be honest), which is the application.

    In addition, the padding partitions on the 54L15 needs to be 0x800 instead of 0x200 https://github.com/nrfconnect/sdk-nrf/blob/73a2c95f8437c72ef5f4b75bab6a736521f6ce8a/modules/mcuboot/boot/zephyr/Kconfig#L19 and you need to page align all of your partitions 

    Here's the dynamic partitioning from the smp server per https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/app_dev/device_guides/nrf54l/fota_update.html#fota_update_sample using  west build -b board_target -- -DEXTRA_CONF_FILE=overlay-bt.conf. As you can see the pads are 0x800

    EMPTY_0:
      address: 0x15e000
      end_address: 0x15f000
      placement:
        after:
        - mcuboot_secondary
      region: flash_primary
      size: 0x1000
    app:
      address: 0xc800
      end_address: 0xb5000
      region: flash_primary
      size: 0xa8800
    littlefs_storage:
      address: 0x15f000
      end_address: 0x165000
      placement:
        align:
          start: 0x1000
        before:
        - end
      region: flash_primary
      size: 0x6000
    mcuboot:
      address: 0x0
      end_address: 0xc000
      placement:
        align:
          end: 0x1000
        before:
        - mcuboot_primary
      region: flash_primary
      size: 0xc000
    mcuboot_pad:
      address: 0xc000
      end_address: 0xc800
      placement:
        before:
        - mcuboot_primary_app
      region: flash_primary
      size: 0x800
    mcuboot_primary:
      address: 0xc000
      end_address: 0xb5000
      orig_span: &id001
      - mcuboot_pad
      - app
      region: flash_primary
      sharers: 0x1
      size: 0xa9000
      span: *id001
    mcuboot_primary_app:
      address: 0xc800
      end_address: 0xb5000
      orig_span: &id002
      - app
      region: flash_primary
      size: 0xa8800
      span: *id002
    mcuboot_secondary:
      address: 0xb5000
      end_address: 0x15e000
      placement:
        after:
        - mcuboot_primary
        align:
          start: 0x1000
      region: flash_primary
      share_size:
      - mcuboot_primary
      size: 0xa9000
    otp:
      address: 0xffd500
      end_address: 0xffd9fc
      region: otp
      size: 0x4fc
    sram_primary:
      address: 0x20000000
      end_address: 0x2002f000
      region: sram_primary
      size: 0x2f000
    

    https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/security/tfm.html#tf-m_partition_alignment_requirements also talks about the page aligning your partitions, but that's another topic for now.

    Kind regards,
    Andreas

  • Hi, thanks for the reply.

    The motivation comes from a project requirement to have a common area in the flash to store some special data regardless if we build our application for L05, L10 or L15 variant in a way that we could use L15 hardware, for example, but flash a stripped down version of the software that would be only for L05. It's the most I could tell without going into much details.
    This cannot be at the end of the flash due to their size difference, therefore my partitioning idea.

    It's quite straightforward to tell mcuboot to jump to a certain address when working outside NCS/Zephyr, so I thought it would be possible to tell the build system: "My app starts here" and it would figure it out.

  • Hi

    Anderson Felippe said:
    L05, L10 or L15 variant in a way that we could use L15 hardware, for example, but flash a stripped down version of the software that would be only for L05. It's the most I could tell without going into much details.

    No worries, that makes more than enough sense for me.

    A couple of suggestions then:

    Make sure the padding size is 0x800 and not 0x200

    https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/security/tfm.html#tf-m_partition_alignment_requirements gives some good hints (even if you're not going to use TF-M): The bootloader has to be a part of the SPU and this flash area needs to be page aligned in a multiple of 4kB. 

    This means that 

    MCUboot
    Custom partition
    MCuboot padding
    End of secure part
    
    App 

    Does not work due to the custom partition being forced inside of the Secure domain, where you need the 4k alignment granularity.

    but

    MCUboot
    MCUboot padding 
    
    End of secure
    
    Custom partition
    App

    should work.

    Kind regards,
    Andreas

  • That partition configuration seems to work. Unfortunately it doesn't suit out needs, so I'll go for another approach instead. Thank you anyways!

Related