Device Firmware Update (DFU) with MCUBoot bootloader showing Failed reading sectors; BOOT_MAX_IMG_SECTORS=128 - too small?

Hi All,

I am trying to do  Device Firmware Update (DFU) with MCUBoot bootloader for nrf52840 DK and I am following this link https://devzone.nordicsemi.com/guides/nrf-connect-sdk-guides/b/software/posts/device-firmware-update-dfu-with-mcuboot-bootloader, Till 17th step its working as expected but when i run the west flash command I am getting the following error in the board 

*** Booting Zephyr OS build v2.6.99-ncs1-1 ***
I: Starting bootloader
W: Failed reading sectors; BOOT_MAX_IMG_SECTORS=128 - too small?
W: Cannot upgrade: not a compatible amount of sectors
E: Unable to find bootable image

~Thanks in advance

Parents
  • Hi,

     

    W: Failed reading sectors; BOOT_MAX_IMG_SECTORS=128 - too small?

    This configuration should match the largest image that you support. 128*4k = 512k. If your images are larger, you should adjust this value. It is typically 256 for a 1MB flash device, such as nRF52840.

     

    Kind regards,

    Håkon

  • Hello Hakon,

    I have updated CONFIG_BOOT_MAX_IMG_SECTORS= 256 in usb_cdc_acm_log_recovery.conf file, after flashing i am getting the following error.

    *** Booting Zephyr OS build v2.6.99-ncs1-1 ***
    I: Starting bootloader
    W: Failed reading sectors; BOOT_MAX_IMG_SECTORS=256 - too small?
    W: Cannot upgrade: not a compatible amount of sectors
    E: Unable to find bootable image

    where i can modify BOOT_MAX_IMG_SECTORS ?

    ~Thanks

  • Hi,

     

    What exactly are you doing to recreate this scenario? ie. which project are you using and what specifically did you change in this process?

    Is this occurring when you issue an updated "app_update.bin" to mcuboot, or when you initially flash your project?

     

    Kind regards,

    Håkon 

  • Hi,

    after west build i am getting merged.hex file

    [199/206] Linking C executable zephyr/zephyr_prebuilt.elf

    [206/206] Linking C executable zephyr/zephyr.elf
    Memory region Used Size Region Size %age Used
    FLASH: 62984 B 256 KB 24.03%
    SRAM: 33440 B 256 KB 12.76%
    IDT_LIST: 0 GB 2 KB 0.00%
    [151/166] Linking C executable zephyr/zephyr_prebuilt.elf

    [158/166] Linking C executable zephyr/zephyr.elf
    Memory region Used Size Region Size %age Used
    FLASH: 19816 B 392704 B 5.05%
    SRAM: 7424 B 256 KB 2.83%
    IDT_LIST: 0 GB 2 KB 0.00%
    [166/166] Generating zephyr/merged.hex

    after this i am flashing using west flash command and it successfully flashed the hex file.

    after running the west flash command only i am getting the error

    *** Booting Zephyr OS build v2.6.99-ncs1-1 ***
    I: Starting bootloader
    W: Failed reading sectors; BOOT_MAX_IMG_SECTORS=128 - too small?
    W: Cannot upgrade: not a compatible amount of sectors
    E: Unable to find bootable image

    ~Thanks

  • Hi,

     

    This means that you are seeing this after directly flashing your device. Which sample are you using, and have you done any specific changes to it? This will help me reproduce the error to debug the scenario at my end.

     

    Kind regards,

    Håkon

  • Hi Hakon,

    Development Environment used: ncs sdk v1.7.1 (Zeyphr RTOS

    MCU: nRF52840

    It is a custom board and doesn't have reset button. We need to put the custom board into the casing. Currently we are flashing the code using SWD. But now we want to update / flash the firmware using USB. Please let us know how can we achieve this?

    What we are trying to achieve is to do DFU / Flashing from USB using MCUBootloader. We followed the following link https://devzone.nordicsemi.com/guides/nrf-connect-sdk-guides/b/software/posts/device-firmware-update-dfu-with-mcuboot-bootloader to achieve it. But we are facing with the below mentioned error.

    W: Failed reading sectors; BOOT_MAX_IMG_SECTORS=128 - too small?
    W: Cannot upgrade: not a compatible amount of sectors
    E: Unable to find bootable image

Reply Children
  • Hi,

     

    Here's a quickly edited "blinky" sample, with the changes described in the link you posted:

    279429_blinky_mcuboot_cdc.zip

     

    This boots as expected on my end. Do you still see issues with this one?

    Please note that the mcuboot configuration is located in the child_image directory.

     

    Kind regards,

    Håkon

  • Hi Hakon,

    From the sample example provided by you, We were able to successfully put the device into bootloader mode by pressing the button 1 and reset button and we are able to perform DFU.

    But, now in our custom device (nrf52840) doesn't have any button (reset / button). How do we implement this DFU method for our custom board. 

    Please help us, matter is very urgent.  

  • Hi,

     

    You need some way to reset the device.

     

    The only good option if you do not have a nRESET button/signal, is to do a power cycle while holding in the button to enter bootloader serial recovery mode.

     

    Kind regards,

    Håkon

  • Hi Hakon,

    There is no button available on our device. From the application can we reset the device? Is there any sample code to do it?

    In our custom board, we power the device by giving 5v to VDDH pin. Is it sufficient to run serial recovery mode?

    Any suggestion on this will help us a lot

    Thank you

  • Hi, 

    I see this topic is new and active, I thought I'd jump in Slight smile

    I have this exact same issue, when I try to integrate the MCUboot to my blinky app on the PCA10040 board. My setup is almost exact as in the example you provided, with the only difference of removing

    CONFIG_MCUBOOT_SERIAL
    and 
    CONFIG_BOOT_SERIAL_CDC_ACM
    flags, since I'm running this on PCA10040. 
    When I compile and flash the bootloader separately in bootloader/mcuboot/boot/zephyr/, it works fine, but when I integrate it with the blinky app, I get the same error, although i see in bootloader/mcuboot/boot/zephyr/build/zephyr/.config that the BOOT_MAX_IMG_SECTORS config is 128 as well. 
    NB! Also tried changing this value to 256 and 64 without any results.
    With regards,

    UPDATE:
    I have come to realize that it has something to do with the overlay file and the build system. I use
    west build -b nrf52dk_nrf52832 -- -Dmcuboot_OVERLAY_CONFIG=<app_samples>/basic/blinky/usb_cdc_acm_log_recovery.conf
    to build my application.
    Even if I have a completely empty usb_cdc_acm_recovery.conf file, the issue occurs. And vice versa, when I just paste these configs directly into bootloaders prj.conf, it works fine.
Related