ncs1.7 ota use external flash

Hello

 I need to use external flash upgrade to be compatible with our old products.I found some information as follows,I can build and download it but I don't know how to upgrade it.

https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/ug_bootloader_external_flash.html#ug-bootloader-external-flash

Can you give me some advice? I have nrf52840dk and nrf5340dk for test.

ncs1.7.2
project: ncs/nrf/tests/modules/mcuboot/external_flash

Parents
  • Hello!

    I managed to get the OTA process working on an nRF52840-DK using NCS version 1.7.1 and the external flash for the secondary MCUboot slot. My project is based on the SMP Server Sample (smp_svr) with overlay `overlay-bt.conf`. I used Using external flash memory partitions and NCS: mcu_boot/external_flash/child_image/mcuboot/  as a reference.

    Starting from the SMP Server sample project, I added the board overlay for the external flash and the configuration of the MCUboot child image.

    boards/nrf52840dk_nrf52840.overlay:

    / {
    	chosen {
    		nordic,pm-ext-flash = &mx25r64;
    	};
    };
    


    child_image/mcuboot/prj.conf:
    #
    # Copyright (c) 2021 Nordic Semiconductor ASA
    #
    # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
    #
    
    # In order to provide board specific configurations to the MCUboot child image
    # we also need to provide a base configuration for MCUboot. This file contains
    # the basic configurations needed to successfully build and run MCUboot.
    
    # MCUboot requires a large stack size, otherwise an MPU fault will occur
    CONFIG_MAIN_STACK_SIZE=10240
    
    # Set the size here so that the size of MCUBOOT_SECONDARY won't change
    # if the default value changes.
    CONFIG_PM_PARTITION_SIZE_MCUBOOT=0x20000
    
    CONFIG_DEBUG_OPTIMIZATIONS=y
    
    # Enable flash operations
    CONFIG_FLASH=y
    
    # This value must match the size of the MCUboot primary partition.
    CONFIG_PM_PARTITION_SIZE_MCUBOOT_SECONDARY=0xda000
    
    # This must be increased to accommodate the bigger images.
    CONFIG_BOOT_MAX_IMG_SECTORS=256
    
    # Enable serial recovery
    CONFIG_UART_CONSOLE=n
    CONFIG_MCUBOOT_SERIAL=y
    CONFIG_MCUBOOT_SERIAL_DIRECT_IMAGE_UPLOAD=y
    
    CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=16
    



    Additionally I have to add following configuration lines to the project configuration file to fix application startup and image verification.

    prj.conf:

    # This value must match the size of the MCUboot primary partition
    CONFIG_PM_PARTITION_SIZE_MCUBOOT_SECONDARY=0xda000
    
    CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=16



    The partition size of the secondary MCUboot slot have been updated in prj.conf and child_image/mcuboot/prj.conf to correspond with the CMake output (see Using external flash memory partitions). To get image verification working for the secondary slot, it was necessary to add CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=16 to both configuration files.

    Image upload and verification is working and has been tested with the MCUmgr image management tool. One remaining problem is, that the application does not boot after a j-Link flash. A second reset is required to get the application up running. Do you have any advice on how to fix this?

  • Hello,

    Thank you for your sharing,you can add these config at your child_image/mcuboot/prj.conf.
    Through uart0 maybe you can find the problem. 

    Maybe west flash is not good, you can use nRF Connect->Programmer it works ok

    CONFIG_LOG=y
    CONFIG_LOG_MODE_IMMEDIATE=y
    CONFIG_LOG_DEFAULT_LEVEL=4
    CONFIG_PRINTK=y
    CONFIG_LOG_MODE_MINIMAL=n
    CONFIG_UART_CONSOLE=y
    CONFIG_RTT_CONSOLE=n
    CONFIG_CONSOLE_HANDLER=y
Reply
  • Hello,

    Thank you for your sharing,you can add these config at your child_image/mcuboot/prj.conf.
    Through uart0 maybe you can find the problem. 

    Maybe west flash is not good, you can use nRF Connect->Programmer it works ok

    CONFIG_LOG=y
    CONFIG_LOG_MODE_IMMEDIATE=y
    CONFIG_LOG_DEFAULT_LEVEL=4
    CONFIG_PRINTK=y
    CONFIG_LOG_MODE_MINIMAL=n
    CONFIG_UART_CONSOLE=y
    CONFIG_RTT_CONSOLE=n
    CONFIG_CONSOLE_HANDLER=y
Children
No Data
Related