MCUBoot without Partition Manager

Hi, I want to implement DFU on an nRF52832 with a mx25r1635f external flash, originally I implement the partitions and everything using the devicetree since I find it a lot more comfortable to use. I followed this proccess: https://devzone.nordicsemi.com/guides/nrf-connect-sdk-guides/b/software/posts/ncs-dfu , but the CONFIG_BOOTLOADER_MCUBOOT option enables the partition manager by default, is there a way to use it with the devicetree method for partitions? I saw that most applications on Zephyr do actually use the devicetree instead of the partition manager, so I expect it to be possible, but couldn't find a way to do it.

Parents
  • Hi, 

    Which NCS are you using? Is it v2.2.0? If so, You can have .conf and .overly for mcuboot as this example

    Regards,
    Amanda H.

  • Hi, I tried to build the code, but I'm getting a lot of error messages, I tried taking out a couple of config parameters, even after trying many combinations, I still can't make it build. Do you know what config parameters I need to use for the nRF52832 with SPI-NOR flash, not QSPI? 

  • Unfortunately, the Partition Manager cannot be disabled, but you can use static partitions to modify the memory layout as you desire. See Configuring static partitions and this example

    -Amanda H.

  • Ok, that's very unfortunate, but if there's no alternative I'll have to use it. So I added the pm.yml file and now I'm having trouble with defining my own partition, it gives this error:

    C:\ncs\v2.2.0\nrf\include\flash_map_pm.h:41:22: error: 'PM_lfs1_part_ID' undeclared here (not in a function)
       41 | #define PM_ID(label) PM_##label##_ID
          |                      ^~~
    C:\ncs\v2.2.0\nrf\include\flash_map_pm.h:46:35: note: in expansion of macro 'PM_ID'
       46 | #define FIXED_PARTITION_ID(label) PM_ID(label)
          |                                   ^~~~~
    c:\Projetos\Smartpet\sirros_smartpet\firmware\Smartpet_NRF52_SDK\src\Sirros_NRF52_configHandler.c:25:32: note: in expansion of macro 'FIXED_PARTITION_ID'
       25 |         .storage_dev = (void *)FIXED_PARTITION_ID(lfs1_part),

    The pm.yml file is this:

    app:
      address: 0x20200
      region: flash_primary
      size: 0xdfe00
    mcuboot:
      address: 0x0
      region: flash_primary
      size: 0x20000
    mcuboot_pad:
      address: 0x20000
      region: flash_primary
      size: 0x200
    mcuboot_primary:
      address: 0x20000
      orig_span: &id001
      - mcuboot_pad
      - app
      region: flash_primary
      size: 0xe0000
      span: *id001
    mcuboot_primary_app:
      address: 0x20200
      orig_span: &id002
      - app
      region: flash_primary
      size: 0xdfe00
      span: *id002
    mcuboot_primary_1:
      address: 0x0
      size: 0x40000
      device: flash_ctrl
      region: ram_flash
    mcuboot_secondary:
      address: 0x00000
      size: 0xe0000
      device: MX25R16
      region: external_flash
    mcuboot_secondary_1:
      address: 0xe0000
      size: 0x40000
      device: MX25R16
      region: external_flash
    lfs1_part:
      address: 0x120000
      size: 0x6e0000
      device: MX25R16
      region: external_flash

    Do you know what I'm doing wrong?

  • Hi, 

    Are you trying to allocate a separate partition for littleFS? If so, you can take a look at this post

    The pm_static.yml example is for nRF5340 which has two cores and that might mislead you, so I have updated it for nRF52. I also update my example in the previous reply with the pm_static.yml as 

    mcuboot_primary:
        orig_span: &id001
            - mcuboot_pad
            - app
        span: *id001
        address: 0xc000
        size: 0xf2000
        region: flash_primary
    mcuboot_primary_app:
        orig_span: &id002
            - app
        span: *id002
        address: 0xc200
        size: 0xf1e00
    
    settings_storage:
        address: 0xfe000
        size: 0x2000
        region: flash_primary
    
    mcuboot_secondary:
        address: 0x0
        size: 0xf2000
        device: MX25R64
        region: external_flash
        
    
    littlefs_storage:
        address: 0xf2000
        size: 0x7000
        device: MX25R64
        region: external_flash
     
    external_flash:
       address: 0xf9000
       size: 0x707000
       device: MX25R64
       region: external_flash 

    It would look like this

    -Amanda H.

  • I made the changes you showed, but now I'm getting this error:

    error: 'PM_MCUBOOT_SECONDARY_ID' undeclared (first use in this function); did you mean 'PM_MCUBOOT_PRIMARY_ID'

  • Another thing I'm finding weird is that the flash size is going down to 232kB even though the flash has 512kB, that is making my code overflow the flash in 47kB, but I can't reduce the code any more than I've already done. Is this a bug or is there a configuration I can change to fix that?

Reply Children
Related