DFU based on mcumgr and mcuboot not working #mcuboot #stm32


Anders
 

Hi,

For DFU using mcumgr over UDP we have a working configuration based on a version of the manifest-rev branch of mcuboot modified to support 32 byte alignment.
Environment is Zephyr 3.0.0 running on an STM32H743 MCU equipped with an IS25LP032D QSPI flash.

Now, when support for 32 byte alignment has been added to mcuboot we would like to throw away our hack and use the official version of mcuboot instead.

With version 1.9.0 (and 1.10.0-dev) image upload and staging for image swap works fine.
The problem is that the test swap gives this result (here with Zephyr 3.1.0-rc3 but behavior is the same with 3.0.0):

I: IS25LP032D: SFDP v 1.6 AP ff with 1 PH
I: PH0: ff00 rev 1.6: 16 DW @ 30
I: IS25LP032D: 4 MiBy flash
*** Booting Zephyr OS build v3.1.0-rc3-32-g801fe1fa06bd ***
I: Starting bootloader
I: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
I: Scratch: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
I: Boot source: primary slot
I: Swap type: test
I: Starting swap using scratch algorithm.
E: Write offset not aligned on flashword length. Offset: 0x1ffff0, flashword length: 32
E: Write range invalid. Offset: 2097136, len: 16
E: Write offset not aligned on flashword length. Offset: 0x1fff70, flashword length: 32
E: Write range invalid. Offset: 2097008, len: 32
E: Write offset not aligned on flashword length. Offset: 0x1fff90, flashword length: 32
E: Write range invalid. Offset: 2097040, len: 32
E: Write offset not aligned on flashword length. Offset: 0x1b3fd0, flashword length: 32
E: Write range invalid. Offset: 1785808, len: 64
E: Write offset not aligned on flashword length. Offset: 0x1bfff0, flashword length: 32
E: Write range invalid. Offset: 1834992, len: 16
E: Write offset not aligned on flashword length. Offset: 0x1b4010, flashword length: 32
E: Write range invalid. Offset: 1785872, len: 32
E: Status Bank2: 0x00800000
E: Write offset not aligned on flashword length. Offset: 0x1b4030, flashword length: 32
E: Write range invalid. Offset: 1785904, len: 32
E: Write offset not aligned on flashword length. Offset: 0x1b4050, flashword length: 32
E: Write range invalid. Offset: 1785936, len: 32
E: Write offset not aligned on flashword length. Offset: 0x1b4070, flashword length: 32
E: Write range invalid. Offset: 1785968, len: 32
E: Write offset not aligned on flashword length. Offset: 0x1b4090, flashword length: 32
E: Write range invalid. Offset: 1786000, len: 32
E: Write offset not aligned on flashword length. Offset: 0x1b40b0, flashword length: 32
E: Write range invalid. Offset: 1786032, len: 32
E: Status Bank2: 0x00800000
E: Write offset not aligned on flashword length. Offset: 0x1b40d0, flashword length: 32
E: Write range invalid. Offset: 1786064, len: 32
E: Write offset not aligned on flashword length. Offset: 0x1b40f0, flashword length: 32
E: Write range invalid. Offset: 1786096, len: 32
E: Write offset not aligned on flashword length. Offset: 0x1b4110, flashword length: 32
E: Write range invalid. Offset: 1786128, len: 32
E: Write offset not aligned on flashword length. Offset: 0x1b4130, flashword length: 32
E: Write range invalid. Offset: 1786160, len: 32
E: Write offset not aligned on flashword length. Offset: 0x1b4150, flashword length: 32
E: Write range invalid. Offset: 1786192, len: 32
E: Write offset not aligned on flashword length. Offset: 0x1b4170, flashword length: 32
E: Write range invalid. Offset: 1786224, len: 32
E: Write offset not aligned on flashword length. Offset: 0x1b4190, flashword length: 32
E: Write range invalid. Offset: 1786256, len: 32
E: Status Bank2: 0x00810000
E: Write offset not aligned on flashword length. Offset: 0x1b41b0, flashword length: 32
E: Write range invalid. Offset: 1786288, len: 32
E: Write offset not aligned on flashword length. Offset: 0x1b41d0, flashword length: 32
E: Write range invalid. Offset: 1786320, len: 32
E: Write offset not aligned on flashword length. Offset: 0x1b41f0, flashword length: 32
E: Write range invalid. Offset: 1786352, len: 32
W: 19 status write fails performing the swap
E: panic!

After power cycling the device and waiting for quite some time the following is displayed:

I: IS25LP032D: SFDP v 1.6 AP ff with 1 PH
I: PH0: ff00 rev 1.6: 16 DW @ 30
I: IS25LP032D: 4 MiBy flash
*** Booting Zephyr OS build v3.1.0-rc3-32-g801fe1fa06bd ***
I: Starting bootloader
I: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
I: Scratch: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
I: Boot source: primary slot
I: Swap type: none
E: Image in the primary slot is not valid!
E: Unable to find bootable image

This tells me that the swap actually took place and resulted in a bricked device...

Any ideas what is causing this?

Thx in advance,
Anders


Anders
 

Hi again,

I am still struggling with DFU/MCUboot...

Is there anyone out there that has successfully used MCUboot together with the STM32H7 line of MCU's?

I have updated my build environment to Zephyr 3.1.0 (including west update). Unfortunately the alignment problem when swapping images remains when using v1.9.0 of MCUboot and version 3.1.0 of Zephyr.

Regards,
Anders