Unable to flash new firmware with DFU because of 'invalid address'

Hello, I am reaching out to you because I am trying to implement a DFU OTA in my project in order to be able to update my firmware with Bluetooth. I have been spending some time on it as the implementation is not an easy task. For a long time, I wasn't able to build, then I wasn't able to boot, and it is just recently that I managed to correctly flash and have access to the logs. I was able to connect to my board thanks to the 'Device Manager' app, but when trying to upload a 'dfu_application.zip' file with the firmware update, I had error 10 on the app and had the following logs on my board:


00> [00:01:18.563,446] <err> flash_nrf: invalid address: 0x001bbff0:16
00> [00:01:18.563,446] <inf> mcuboot_util: Secondary image of image pair (0.) is unreachable. Treat it as empty
00> [00:01:18.563,446] <inf> mcuboot_util: Image index: 0, Swap type: none
00> [00:01:18.671,234] <err> flash_nrf: invalid address: 0x001bbff0:16
00> [00:01:18.671,234] <inf> mcuboot_util: Secondary image of image pair (0.) is unreachable. Treat it as empty
00> [00:01:18.671,234] <inf> mcuboot_util: Image index: 0, Swap type: none
00> [00:01:18.671,264] <err> flash_nrf: invalid address: 0x001bbff0:16
00> [00:01:18.671,264] <inf> mcuboot_util: Secondary image of image pair (0.) is unreachable. Treat it as empty
00> [00:01:18.671,264] <inf> mcuboot_util: Image index: 0, Swap type: none
00> [00:01:18.671,417] <err> STREAM_FLASH: Incorrect parameter
00> [00:01:18.671,417] <err> mcumgr_img_grp: Irrecoverable error: flash write failed: 10

As for my configuration it goes as follow:

Here is what our project directory looks like: build/  build-mcuboot/  child_image/  CMakeLists.txt  HC_v4.overlay  Kconfig  prj.conf  README.md  src/  utils/

Here is our child_image/mcuboot.conf:

CONFIG_NORDIC_QSPI_NOR=n
CONFIG_SPI_NOR=n
CONFIG_MULTITHREADING=y
CONFIG_PM_PARTITION_SIZE_MCUBOOT=0x32000


CONFIG_BOOT_SIGNATURE_TYPE_RSA=y
CONFIG_BOOT_SIGNATURE_KEY_FILE="root-rsa-2048.pem"

CONFIG_BOOT_MAX_IMG_SECTORS=1024

CONFIG_SERIAL=y
CONFIG_LOG=y
CONFIG_PRINTK=y
CONFIG_USE_SEGGER_RTT=y

Here is what I added to our prj.conf to use the DFU:

CONFIG_BOOTLOADER_MCUBOOT=y
CONFIG_NORDIC_QSPI_NOR=n
CONFIG_FLASH_SIZE=1792
CONFIG_FLASH=y
CONFIG_SPI_NOR=n
CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU=y
CONFIG_MULTITHREADING=y

Here is the totality of our prj.conf if it is of any help:

7357.prj.conf

What element am I missing ? Please feel free to ask if you need any additional informations. Once again thank you very much for your time and have a great day.

  • Hello,

    The write address shown in the debug log is well above the valid address range for the internal flash. Could you create a memory report of the flash layout and post it here? You can do this using the memory report button in vs code, or with the following command from the terminal 

    $ west build -t partition_manager_report

    Thanks,

    Vidar

  • Thank you for the quick response, here is the report:


      flash_primary (0x1c0000 - 1792kB): 
    +--------------------------------------------------+
    | 0x0: mcuboot (0x32000 - 200kB)                   |
    | 0x32000: EMPTY_0 (0x2000 - 8kB)                  |
    +---0x34000: mcuboot_primary (0xc4000 - 784kB)-----+
    | 0x34000: mcuboot_pad (0x200 - 512B)              |
    +---0x34200: mcuboot_primary_app (0xc3e00 - 783kB)-+
    | 0x34200: app (0xc3e00 - 783kB)                   |
    +--------------------------------------------------+
    | 0xf8000: mcuboot_secondary (0xc4000 - 784kB)     |
    | 0x1bc000: EMPTY_1 (0x4000 - 16kB)                |
    +--------------------------------------------------+
    
      otp (0x2fc - 764B): 
    +------------------------------+
    | 0xff8100: otp (0x2fc - 764B) |
    +------------------------------+
    
      sram_primary (0x80000 - 512kB): 
    +-----------------------------------------------+
    | 0x20000000: sram_primary (0x70000 - 448kB)    |
    | 0x20070000: rpmsg_nrf53_sram (0x10000 - 64kB) |
    +-----------------------------------------------+
    
     CPUNET flash_primary (0x40000 - 256kB): 
    +--------------------------------------+
    +---0x1000000: app (0x40000 - 256kB)---+
    | 0x1000000: hci_ipc (0x40000 - 256kB) |
    +--------------------------------------+
    
     CPUNET sram_primary (0x10000 - 64kB): 
    +-------------------------------------------+
    | 0x21000000: sram_primary (0x10000 - 64kB) |
    +-------------------------------------------+

    I hope it helps

  • Also, if it can help, i noticed that if i try flashing with the app the same app as the one curently on the card, the app will tell me it has been successful and the board will show me this error:

    00> [00:03:34.919,891] <err> flash_nrf: invalid address: 0x001bbff0:16
    00> [00:03:34.919,891] <inf> mcuboot_util: Secondary image of image pair (0.) is unreachable. Treat it as empty
    00> [00:03:34.919,891] <inf> mcuboot_util: Image index: 0, Swap type: none

    it s still an error, but a shorter one.

  • The memory layout appears to be correct. Would you be able to share a minimal version of your project here or in a private ticket so I could try to debug this on a development board? 

  • Of course! Here is a minimal version of our project you can run on an nRF7002-DK Nordic devboard. Please don't hesitate to reach out if you need more information. Thank you very much, and have a great day.

    bugHunt (1).zip

Related