nRF Connect SDK v2.7.0 - External SPI flash not being allocated to mcuboot_secondary partition

Hello,

I'm updating an existing NCS 2.6 application (smp_ble_feat) for a Particle Xenon (nRF52840 board) that uses onboard 4MB SPI flash.

I've successfully built the new sysbuild version under NCS 2.7.0. In examining the partitions.yml file, I find that although the firmware uses 4Mb SPI flash for the app, mcuboot_secondary partition isn't using part of the 4MB SPI flash. It still uses the SOC flash.

Here is the MCUBoot configuration, particle_xenon.conf:

# Disable Zephyr console
CONFIG_CONSOLE=n

# Multithreading
CONFIG_MULTITHREADING=y

# MCUBoot settings
CONFIG_BOOT_MAX_IMG_SECTORS=2048

# MCUboot serial recovery
CONFIG_MCUBOOT_SERIAL=y
CONFIG_BOOT_SERIAL_DETECT_DELAY=450
CONFIG_MCUBOOT_INDICATION_LED=y
CONFIG_BOOT_SERIAL_CDC_ACM=y

# USB
CONFIG_USB_DEVICE_STACK=y
CONFIG_USB_DEVICE_REMOTE_WAKEUP=n
CONFIG_USB_DEVICE_PRODUCT="XENON MCUBOOT"

CONFIG_PM_PARTITION_SIZE_MCUBOOT=0x16000

### Enable SPI flash
CONFIG_FLASH=y
CONFIG_SPI=y
CONFIG_SPI_NOR=y
CONFIG_NORDIC_QSPI_NOR=n

CONFIG_SPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096
CONFIG_BOOT_ERASE_PROGRESSIVELY=y
CONFIG_SOC_FLASH_NRF_EMULATE_ONE_BYTE_WRITE_ACCESS=y
CONFIG_FPROTECT=y

CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY=y
CONFIG_PM_OVERRIDE_EXTERNAL_DRIVER_CHECK=y

### Enable serial recovery
CONFIG_BOOT_SERIAL_NO_APPLICATION=y
CONFIG_UART_CONSOLE=n

The generated partitions.yml from the NCS 2.7.0 sysbuild is shown below.

The app  sees the 4MB SPI flash corrrectly but none is being allocated to MCUBoot. The internal nRF52840 flash is still being used by mcuboot_secondary.
 partiton.

smp_ble_feat application under NCS 2.6.0:

Note that mcuboot_secondary used external SPI flash:

and app starts using external flash after mcuboot_secondary, as expected.



What am I doing incorrectly in updating from NCS 2.6 to NCS 2.7.0 sysbuild? The build appears to run fine but for some reason mcuboot_secondary still uses SOC Flash.

I would be grateful if you could review above and let me know what's wrong with th MCUboot configuration. Thank you.


Regards,
Ravi

Parents
  • Hi, 

    Here is the MCUBoot configuration, particle_xenon.conf:

    Where does the particle_xenon.conf locate?

    Try to place the mcuboot config file under the sysbuild folder as this example: applications/nrf5340_audio/sysbuild/mcuboot

    Regards,
    Amanda H.

  • Hi Amanda,

    Thank you.

    Note that I've built the project with NCS v2.7.0 from both within nRF Connect VSCode and also from the command line using --sysbuild option.

    The MCUboot conf and overlay files for particle_xenon board are in the default location nordic/ncs/v2.7.0/bootloader/mcuboot/boot/boards/zephyr.

    Project structure is:



    With this setup, firmware built and ran successful. The app correctly used spi flash but mcuboot_secondary ended up using the soc flash.

    regions.yml below shows that QSPI NOR flash has been selected despite setting in mcuboot/boot/zephyr/boards/particle_xenon.conf.




    Following your suggestion, I tried placing
    particle_xenon.conf in  smp_ble_feat_spi_flash_ncs270/sysbuild/mcuboot  and
    particle_xenon.overlay in  smp_ble_feat_spi_flash_ncs270/sysbuild/mcuboot/boards. However, the build failed with the following error.



    After renaming  particle_xenon.conf to prj.conf, build was successful but the mcuboot_secondary still isn't using the external flash. In fact, the firmware just goes into the MCUboot bootloader.

    Here is the revised project structure.



    I have no issue in building & successfully running the project with exactly same MCUboot conf & overlay files under NCS 2.6.1 using child_image/mcuboot/boards layout. 

    Note that SPI flash is being used by both app and mcuboot_secondary.






    I suspect the issue with the NCS 2.7.0 sysbuild may be with the MCUboot conf & overlay file placements.

    Please advise what to try next. Thank you.

    Regards,
    Ravi

  • Hi, 

    zpm1066 said:
    particle_xenon.conf in  smp_ble_feat_spi_flash_ncs270/sysbuild/mcuboot  and

    If you want to use the board name for the mcuboot, it should be located under smp_ble_feat_spi_flash_ncs270/sysbuild/mcuboot/boards.

    Try to add the following configs sysbuild.conf:

    # Settings required for external flash to be used for DFU
    SB_CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY=y
    SB_CONFIG_PM_OVERRIDE_EXTERNAL_DRIVER_CHECK=y

    -Amanda H.

  • Hi Amanda,

    Earlier I did try with particle_xenon conf & overlay files in smp_ble_feat_spi_flash_ncs270/sysbuild/mcuboot/boards but build failed because it complained that there was no proj.conf under mcuboot folder. 

    As per your suggestion, I’ll remove the following from MCUBOOT particle_xenon.conf

    CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY=y
    CONFIG_PM_OVERRIDE_EXTERNAL_DRIVER_CHECK=y

    and update sysbuild.conf to the following

    SB_CONFIG_BOOTLOADER_MCUBOOT=y
    SB_CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY=y
    SB_CONFIG_PM_OVERRIDE_EXTERNAL_DRIVER_CHECK=y


    What is your recommendation for where the MCUBOOT files (conf and overlay) should be placed for a board?

    For MCUBOOT sysbuild, I have these files in nordic/ncs/v2.7.0/bootloader/mcuboot/boot/boards/zephyr.

    For the special cases where I want to use the external SPI flash for app and MCUboot, Is it recommended to place the MCUBOOT conf/overlay files in sysbuild/mcuboot/boards?

    I’ll try your recommendation and get back to you. Hopefully, I’ll get MCUBOOT to use the external flash.

    Thank you.

    Regards,
    Ravi

  • Hi Amanda,

    Your suggestion below worked. Thank you. It had to be something simple!

    SB_CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY=y
    SB_CONFIG_PM_OVERRIDE_EXTERNAL_DRIVER_CHECK=y 

    The following project layouts work for external flash.

    Project folder layout #1

    - This layout worked with MCUBoot board conf/overlay files in
    ncs/v2.7.0/bootloader/mcuboot//boot/zephyr/boards
    - particle_xenon.conf
    - particle_xenon.overlay



    Project folder layout #2

    - Uses sysbuild/mcuboot/boards folder containing the board conf/overlay files

    - The MCUBoot configuration in sysbuild/mcuboot overrides the default configuration (if specified) in location
    ncs/v2.7.0/bootloader/mcuboot//boot/zephyr/boards of conf/overlay files

    - mcbuboot folder needed a "prj.conf",otherwise get a "no prj.conf in mcuboot folder" error

    - used a blank prj.conf file


    Regards,
    Ravi

  • Hi Amanda,

    What is your recommendation for where the MCUBOOT files (conf and overlay) should be placed for a board?

    For MCUBOOT sysbuild (NCS  2.7.0), I have these files in nordic/ncs/v2.7.0/bootloader/mcuboot/boot/boards/zephyr.

    For the special cases where I want to use the external SPI flash for app and MCUboot, files have been placed in  sysbuild/mcuboot/boards.

    Is it recommended to place the MCUBOOT conf/overlay files in sysbuild/mcuboot/boards? Thanks.


    Regards,
    Ravi

Reply
  • Hi Amanda,

    What is your recommendation for where the MCUBOOT files (conf and overlay) should be placed for a board?

    For MCUBOOT sysbuild (NCS  2.7.0), I have these files in nordic/ncs/v2.7.0/bootloader/mcuboot/boot/boards/zephyr.

    For the special cases where I want to use the external SPI flash for app and MCUboot, files have been placed in  sysbuild/mcuboot/boards.

    Is it recommended to place the MCUBOOT conf/overlay files in sysbuild/mcuboot/boards? Thanks.


    Regards,
    Ravi

Children
Related