Partition conflict when enabling littlefs in both mcuboot and app simultaneously?

I successfully enabled littlefs in mcuboot and read/write it successfully (due to project requirements), and then tried to enable littlefs in both mcuboot and app, operating on the same lfs partition. However, I received an error message during the build process, indicating that the partition does not meet the requirements? Or something else. I have tried to make a static partition table with LFS enabled separately in mcuboot or in the app, but there has been no improvement. How can I solve the problem of this partition not meeting the requirements?

In addition, I have made many different attempts based on the error content, and personally think it may be related to TFM? Could it be because mcuboot and the app run in different trust zones that their littlefs zones conflict?

Parents
  • Hi llly,

    Could you please share more details about your setup, and also the static configuration attempt?

    Hieu

    Update**: There is an important warning I would like to add to this first reply:

    Hieu said:

    Bootloaders are immutable for the lifetime of a product and it's imperative that they do not have security vulnerabilities or a large attack surface because if you compromise a bootloader, you compromise. Adding LittleFS read/write both adds a vulnerability and increases the attack surface.

    We highly recommend that the bootloader stay minimally simple. Giving both the application and the bootloader access to the same file system is especially recommended against.

  • Hi Hieu
    This is a dynamic partition table that I built when only enabling LFS in mcuboot or app (my project requires a single slot, so there is no mcuboot secondary partition, and I initially thought that the insufficient size of the mcuboot partition affected the activation of LFS, so I set it to 100k)

    EMPTY_0:
      address: 0x19000
      end_address: 0x20000
      placement:
        before:
        - mcuboot_pad
      region: flash_primary
      size: 0x7000
    app:
      address: 0x28000
      end_address: 0x80000
      region: flash_primary
      size: 0x58000
    littlefs_storage:
      address: 0x80000
      end_address: 0x100000
      inside:
      - nonsecure_storage
      placement:
        align:
          start: 0x8000
        before:
        - end
      region: flash_primary
      size: 0x80000
    mcuboot:
      address: 0x0
      end_address: 0x19000
      placement:
        before:
        - mcuboot_primary
      region: flash_primary
      size: 0x19000
    mcuboot_pad:
      address: 0x20000
      end_address: 0x20200
      placement:
        align:
          start: 0x8000
        before:
        - mcuboot_primary_app
      region: flash_primary
      size: 0x200
    mcuboot_primary:
      address: 0x20000
      end_address: 0x80000
      orig_span: &id001
      - tfm
      - app
      - mcuboot_pad
      region: flash_primary
      size: 0x60000
      span: *id001
    mcuboot_primary_app:
      address: 0x20200
      end_address: 0x80000
      orig_span: &id002
      - app
      - tfm
      region: flash_primary
      size: 0x5fe00
      span: *id002
    mcuboot_sram:
      address: 0x20000000
      end_address: 0x20008000
      orig_span: &id003
      - tfm_sram
      region: sram_primary
      size: 0x8000
      span: *id003
    nonsecure_storage:
      address: 0x80000
      end_address: 0x100000
      orig_span: &id004
      - littlefs_storage
      region: flash_primary
      size: 0x80000
      span: *id004
    nrf_modem_lib_ctrl:
      address: 0x20008000
      end_address: 0x200084e8
      inside:
      - sram_nonsecure
      placement:
        after:
        - tfm_sram
        - start
      region: sram_primary
      size: 0x4e8
    nrf_modem_lib_rx:
      address: 0x2000a568
      end_address: 0x2000c568
      inside:
      - sram_nonsecure
      placement:
        after:
        - nrf_modem_lib_tx
      region: sram_primary
      size: 0x2000
    nrf_modem_lib_sram:
      address: 0x20008000
      end_address: 0x2000c568
      orig_span: &id005
      - nrf_modem_lib_ctrl
      - nrf_modem_lib_tx
      - nrf_modem_lib_rx
      region: sram_primary
      size: 0x4568
      span: *id005
    nrf_modem_lib_tx:
      address: 0x200084e8
      end_address: 0x2000a568
      inside:
      - sram_nonsecure
      placement:
        after:
        - nrf_modem_lib_ctrl
      region: sram_primary
      size: 0x2080
    otp:
      address: 0xff8108
      end_address: 0xff83fc
      region: otp
      size: 0x2f4
    sram_nonsecure:
      address: 0x20008000
      end_address: 0x20040000
      orig_span: &id006
      - sram_primary
      - nrf_modem_lib_ctrl
      - nrf_modem_lib_tx
      - nrf_modem_lib_rx
      region: sram_primary
      size: 0x38000
      span: *id006
    sram_primary:
      address: 0x2000c568
      end_address: 0x20040000
      region: sram_primary
      size: 0x33a98
    sram_secure:
      address: 0x20000000
      end_address: 0x20008000
      orig_span: &id007
      - tfm_sram
      region: sram_primary
      size: 0x8000
      span: *id007
    tfm:
      address: 0x20200
      end_address: 0x28000
      inside:
      - mcuboot_primary_app
      placement:
        before:
        - app
      region: flash_primary
      size: 0x7e00
    tfm_nonsecure:
      address: 0x28000
      end_address: 0x80000
      orig_span: &id008
      - app
      region: flash_primary
      size: 0x58000
      span: *id008
    tfm_secure:
      address: 0x20000
      end_address: 0x28000
      orig_span: &id009
      - mcuboot_pad
      - tfm
      region: flash_primary
      size: 0x8000
      span: *id009
    tfm_sram:
      address: 0x20000000
      end_address: 0x20008000
      inside:
      - sram_secure
      placement:
        after:
        - start
      region: sram_primary
      size: 0x8000
    

    Then I copied this dynamic partition table into a static partition table and enabled LFS in both mcuboot and app, and the above error occurred.

    I have temporarily solved this problem, but I don't think it's the right way.

    I opened the file ncs\v2.6.1\nrf\scripts\partition_manager.py, found the error line, and commented out this part of the code. The build can be completed, and the code is currently running normally. But I don't know if there's any hidden danger in this.

    If you need any other detailed information, please let me know. I am not sure what can help you analyze this issue

  • Hi llly,

    Nothing stands out to me from the YAML file.

    Could you please share the spot in partition_manager.py where the issue happened?

Reply Children
Related