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 Reply Children
  • 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? 

  • Hi, 

    Your board config should be similar to this (ie. boards/$board.conf):

    # SPI Flash
    CONFIG_SPI=y
    CONFIG_SPI_NOR=y
    
    
    # Enable flash operations.
    CONFIG_FLASH=y
    CONFIG_FLASH_MAP=y
    CONFIG_FLASH_PAGE_LAYOUT=y

    And the overlay is similar to this example (boards/$board.overlay). Instance number and pin definitions can vary, of course.

    In your child_image/mcuboot.conf, you will need to add this symbol when using SPI and flash:

    CONFIG_PM_OVERRIDE_EXTERNAL_DRIVER_CHECK=y

    -Amanda H.

  • Now I'm getting these error messages:

    C:\ncs\v2.2.0\bootloader\mcuboot\boot\zephyr\include\sysflash\sysflash.h:45:12: error: 'PM_MCUBOOT_PRIMARY_1_ID' undeclared (first use in this function); did you mean 'PM_MCUBOOT_PRIMARY_ID'?
       45 |            PM_MCUBOOT_PRIMARY_1_ID :         \
          |            ^~~~~~~~~~~~~~~~~~~~~~~
    C:\ncs\v2.2.0\bootloader\mcuboot\boot\zephyr\flash_map_extended.c:54:20: note: in expansion of macro 'FLASH_AREA_IMAGE_PRIMARY'
       54 |     case 0: return FLASH_AREA_IMAGE_PRIMARY(image_index);
          |                    ^~~~~~~~~~~~~~~~~~~~~~~~
    C:\ncs\v2.2.0\bootloader\mcuboot\boot\zephyr\include\sysflash\sysflash.h:45:12: note: each undeclared identifier is reported only once for each function it appears in
       45 |            PM_MCUBOOT_PRIMARY_1_ID :         \
          |            ^~~~~~~~~~~~~~~~~~~~~~~
    C:\ncs\v2.2.0\bootloader\mcuboot\boot\zephyr\flash_map_extended.c:54:20: note: in expansion of macro 'FLASH_AREA_IMAGE_PRIMARY'
       54 |     case 0: return FLASH_AREA_IMAGE_PRIMARY(image_index);
          |                    ^~~~~~~~~~~~~~~~~~~~~~~~
    C:\ncs\v2.2.0\bootloader\mcuboot\boot\zephyr\include\sysflash\sysflash.h:52:12: error: 'PM_MCUBOOT_SECONDARY_1_ID' undeclared (first use in this function); did you mean 'PM_MCUBOOT_SECONDARY_ID'?
       52 |            PM_MCUBOOT_SECONDARY_1_ID: \
          |            ^~~~~~~~~~~~~~~~~~~~~~~~~
    C:\ncs\v2.2.0\bootloader\mcuboot\boot\zephyr\flash_map_extended.c:56:20: note: in expansion of macro 'FLASH_AREA_IMAGE_SECONDARY'
       56 |     case 1: return FLASH_AREA_IMAGE_SECONDARY(image_index);
          |                    ^~~~~~~~~~~~~~~~~~~~~~~~~~
    C:/ncs/v2.2.0/bootloader/mcuboot/boot/zephyr/flash_map_extended.c: In function 'flash_area_id_to_multi_image_slot':
    C:\ncs\v2.2.0\bootloader\mcuboot\boot\zephyr\include\sysflash\sysflash.h:45:12: error: 'PM_MCUBOOT_PRIMARY_1_ID' undeclared (first use in this function); did you mean 'PM_MCUBOOT_PRIMARY_ID'?
       45 |            PM_MCUBOOT_PRIMARY_1_ID :         \
          |            ^~~~~~~~~~~~~~~~~~~~~~~
    C:\ncs\v2.2.0\bootloader\mcuboot\boot\zephyr\flash_map_extended.c:73:20: note: in expansion of macro 'FLASH_AREA_IMAGE_PRIMARY'
       73 |     if (area_id == FLASH_AREA_IMAGE_PRIMARY(image_index)) {
          |                    ^~~~~~~~~~~~~~~~~~~~~~~~
    C:\ncs\v2.2.0\bootloader\mcuboot\boot\zephyr\include\sysflash\sysflash.h:52:12: error: 'PM_MCUBOOT_SECONDARY_1_ID' undeclared (first use in this function); did you mean 'PM_MCUBOOT_SECONDARY_ID'?
       52 |            PM_MCUBOOT_SECONDARY_1_ID: \
          |            ^~~~~~~~~~~~~~~~~~~~~~~~~
    C:\ncs\v2.2.0\bootloader\mcuboot\boot\zephyr\flash_map_extended.c:77:20: note: in expansion of macro 'FLASH_AREA_IMAGE_SECONDARY'
       77 |     if (area_id == FLASH_AREA_IMAGE_SECONDARY(image_index)) {
          |                    ^~~~~~~~~~~~~~~~~~~~~~~~~~
    Do you know what could be causing it?
    I couldn't find anything about it that didn't involve using the Partition Manager.

  • I have a DFU with the external SPI-NOR flash sample for nRF52840DK: 7851.peripheral_lbs_DFU_ext_flash_spi_nor_NCSv2.2.0.7z   which I follow that adding DFU guide and it can work for me as:

    *** Booting Zephyr OS build v3.2.99-ncs1 ***
    I: Starting bootloader
    I: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    I: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    I: Boot source: none
    I: Swap type: none
    I: Bootloader chainload address offset: 0xc000
    *** Booting Zephyr OS build v3.2.99-ncs1 ***
    Starting Bluetooth Peripheral LBS example
    build time: Mar  6 2023 17:41:19
    I: 2 Sectors of 4096 bytes
    I: alloc wra: 0, fe8
    I: data wra: 0, 0
    I: SoftDevice Controller build revision:
    I: 6d 90 41 2a 38 e8 ad 17 |m.A*8...
    I: 29 a5 03 38 39 27 d7 85 |)..89'..
    I: 1f 85 d8 e1             |....
    I: No ID address. App must call settings_load()
    Bluetooth initialized
    Advertising successfully started
    Connected
    I: Swap type: none
    I: Swap type: none
    I: Swap type: none
    I: Swap type: none
    I: Erased 0x31000 bytes of image slot
    I: Erased 0x1000 bytes of image slot trailer
    I: Swap type: none
    I: Swap type: test
    I: Swap type: test
    *** Booting Zephyr OS build v3.2.99-ncs1 ***
    I: Starting bootloader
    I: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    I: Secondary image: magic=good, swap_type=0x2, copy_done=0x3, image_ok=0x3
    I: Boot source: none
    I: Swap type: test
    I: Starting swap using move algorithm.
    I: Bootloader chainload address offset: 0xc000
    *** Booting Zephyr OS build v2.6.99-ncs1-1  ***
    Starting Bluetooth Peripheral LBS example
    CONFIG_BT_L2CAP_TX_MTU 512
    build time: Jan 10 2023 11:16:09
    I: 2 Sectors of 4096 bytes
    I: alloc wra: 0, fd0
    I: data wra: 0, 1c
    I: SoftDevice Controller build revision:
    I: 3f 47 70 8e 81 95 4e 86 |?Gp...N.
    I: 9d d3 a2 95 88 f6 30 0a |......0.
    I: 7f 53 49 fd             |.SI.
    I: No ID address. App must call settings_load()
    Bluetooth initialized
    Advertising successfully started
    Connected
    I: Swap type: test
    I: Swap type: test
    I: Swap type: test
    

    You can take a look at the board's conf and overlay files under boards and child_image\mcuboot\boards. 

    “Beware that this code/configuration is not fully tested or qualified and should be considered provided “as-is”. Please test it with your application and let me know if you find any issues.”

    -Amanda H.

  • Hi, I tried to compile the code following this process, however it uses the Partition Manager(in the build folder you can see there is a pm.config) and I don't want to use it, that was my original question, is there a way to use the DFU Update without using the partition manager?

Related