DFU programming strange problem

Sub forums for various specialist XMOS applications. e.g. USB audio, motor control and robotics.
Experienced Member
Posts: 94
Joined: Sat Aug 31, 2013 11:23 pm

DFU programming strange problem

Post by genap »

We have an old product (2014) based on XS1-U8A-64
- audio reference design 6.5.0
- xTime Composer Enterprise 13.2.3
- design has a data file and extensive HID communication stuff implemented.

Product works fine, and I believe, DFU also worked fine for this product.

Now we need to implement the same design in a different product with very few firmware modifications.
Since design worked fine and it had a lot of HID stuff implemented, I've decided to keep development environment the same.

Now when I program the device with xflash, everything is ok.
But when I generate an upgrade file and program it by DFU, the device doesn't boot from an upgrade image, instead booting from a factory image (i can see it by a version).
DFU file is generated by a piece of software written in 2014 and there is no source code.
When I look at DFU binary, it looks ok:
- program is at address 0x00000 - supposed to be programmed by DFU at memory address 0x10000
- datafile is at address 0x10000 - supposed to be programmed by DFU at memory address 0x20000

When I read the content of a flash after DFU programming, I see very strange thing:
- factory image is intact
- datafile is in a right place at 0x20000
- upgrade image is programmed at 0xD000

I tried to generate the DFU binary directly by xflash.
That is what I get:
>xflash --upgrade 1 upgrade_file.xe --factory factory_file.xe 64k --data data_file.bin -o dfu_file.bin
factory_file.xe: Error: F03071 Application overruns specified boundary

If I remove 64k, I get:
>xflash --upgrade 1 upgrade_file.xe --factory factory_file.xe --data data_file.bin -o dfu_file.bin
Error: F03069 Not enough space on device (device size is 0x8000)

For information:
- factory_file.bin (with data_file) - 179K
- factory_file.bin (without data_file) - 52308 bytes
- upgrade_file.bin (with data-file) - 179K bytes
- upgrade_file.bin (without data-file) - 49668 bytes
- data_file.bin - 51.4K
- dfu_file.bin - not generated

Probably I've done something wrong.
Any ideas what is going on?

Thank you
Last edited by genap on Fri Jun 12, 2020 2:31 pm, edited 1 time in total.

User avatar
XCore Legend
Posts: 1903
Joined: Thu Jun 10, 2010 11:43 am

Post by mon2 »

Hi. There is a DFU bug that you may have stumbled across for your upgrade image. Others have already as well.

Study the attached to confirm if it is the same issue for your case.
Tools-Advisory_-Invalid-boot-image-returned-in-libflash-and-libquadflash_1.0 (1).pdf
XMOS has a small test tool to validate if your firmware contains this DFU bug.

The fix is to use more recent tools with new flash libraries. Create a new boot loader that will proceed to properly crc check the images.

If your case is the same, the upgrade image is partially erased due to a header being found for a second time inside the image sector boundary. This prevents the upgrade image from being fully erased but also has corrupted the upgrade image from booting. At this stage, the DFU will load only the factory image and stop future firmware updates.

Q: As you are the developer of your code, would you like to consider testing some ideas for a possible software only solution?

If yes, send me a PM.
You do not have the required permissions to view the files attached to this post.
Experienced Member
Posts: 94
Joined: Sat Aug 31, 2013 11:23 pm

Post by genap »

Hi mon2,

I've checked the upgrade image with xflash_image_check.
It returned "Valid image found on sector boundary @0"
So it seems like file is ok ?

I still need to figure out why it's programmed at 0xD000 instead of 0x10000.