Problem with DFU in XUF208
Posted: Fri Feb 09, 2018 3:02 pm
Hello jents,
I don't understand what I'm doing wrong, will be very appreciate any help!
I have a project with XUF208-128-TQ64-C10, based on an Audio Reference Design.
Makefile consists of the following line:
BUILD_FLAGS = -DFLASH_MAX_UPGRADE_SIZE=128*1024 -fcomment-asm -Xmapper --map -Xmapper MAPFILE -Wall -O3 -report -lquadflash -fsubword-select -save-temps -g -DSDA_HIGH=2 -DSCL_HIGH=1 -DXUD_SERIES_SUPPORT=4 -march=xs2a -DUSB_TILE=tile[0] -DU208_ONLY
-------------------------------------------
I compiled 3 different versions and got 3 files: MyApp0.xe, MyApp1.xe and MyAp2.xe and generate MyKey.key file for security.
Then I make factory image:
xflash --factory MyApp0.xe -o MyApp0.bin --key MyKey.key
and 2 upgrade images:
xflash --factory-version 14.2 --upgrade 1 MyApp1.xe -o MyApp1up.bin --key MyKey.key
xflash --factory-version 14.2 --upgrade 2 MyApp2.xe -o MyApp2up.bin --key MyKey.key
Then I burn the factory image to CPU:
xflash --target-file MyHardware.xn --write-all MyApp0.bin
xburn --target-file MyHardware.xn --lock MyKey.key --enable-jtag --disable-master-lock
As you see - I temporary leaved JTAG enabled, and it was good!
Everything works fine.
Then I use DFUapp software and make upgrade to MyApp1up - OK
Then I use DFUapp software and make upgrade to MyApp2up - OK
Then using dfucons I made revertfactory - still OK.
------------------------------------------------------
After this I make FW update with MyApp1up again, all OK, but after - I tried to use the wrong binary file - I simply not make it encrypted:
xflash --factory-version 14.2 --upgrade 2 MyApp2.xe -o MyApp2up_noenc.bin
So in flash memory should be 3 images:
N0: Factory Image with bootloader
N1: 1st Update (normal) image,
N2: 2nd Update (wrong) image.
After this my device stop working. PC do not see it and I cannot run dfucons to return back to the factory firmware.
I'd expect that the bootloader will see the wrong image N2 and will run the image N1 or N0.
But not, device is unusable.
As I leaved JTAG enabled, I can burn the factory image again and device will work.
But I do not understood why the wrong image was not detected and no roll-back to the previous version occures?
This means that any user can easy destroy the device by using DFU with the wrong file!
And if CPU is locked and JTAG is disabled - there need to replace CPU chip!
I do not think that this is expected behavior, so It is my fault. Bur where?!
I don't understand what I'm doing wrong, will be very appreciate any help!
I have a project with XUF208-128-TQ64-C10, based on an Audio Reference Design.
Makefile consists of the following line:
BUILD_FLAGS = -DFLASH_MAX_UPGRADE_SIZE=128*1024 -fcomment-asm -Xmapper --map -Xmapper MAPFILE -Wall -O3 -report -lquadflash -fsubword-select -save-temps -g -DSDA_HIGH=2 -DSCL_HIGH=1 -DXUD_SERIES_SUPPORT=4 -march=xs2a -DUSB_TILE=tile[0] -DU208_ONLY
-------------------------------------------
I compiled 3 different versions and got 3 files: MyApp0.xe, MyApp1.xe and MyAp2.xe and generate MyKey.key file for security.
Then I make factory image:
xflash --factory MyApp0.xe -o MyApp0.bin --key MyKey.key
and 2 upgrade images:
xflash --factory-version 14.2 --upgrade 1 MyApp1.xe -o MyApp1up.bin --key MyKey.key
xflash --factory-version 14.2 --upgrade 2 MyApp2.xe -o MyApp2up.bin --key MyKey.key
Then I burn the factory image to CPU:
xflash --target-file MyHardware.xn --write-all MyApp0.bin
xburn --target-file MyHardware.xn --lock MyKey.key --enable-jtag --disable-master-lock
As you see - I temporary leaved JTAG enabled, and it was good!
Everything works fine.
Then I use DFUapp software and make upgrade to MyApp1up - OK
Then I use DFUapp software and make upgrade to MyApp2up - OK
Then using dfucons I made revertfactory - still OK.
------------------------------------------------------
After this I make FW update with MyApp1up again, all OK, but after - I tried to use the wrong binary file - I simply not make it encrypted:
xflash --factory-version 14.2 --upgrade 2 MyApp2.xe -o MyApp2up_noenc.bin
So in flash memory should be 3 images:
N0: Factory Image with bootloader
N1: 1st Update (normal) image,
N2: 2nd Update (wrong) image.
After this my device stop working. PC do not see it and I cannot run dfucons to return back to the factory firmware.
I'd expect that the bootloader will see the wrong image N2 and will run the image N1 or N0.
But not, device is unusable.
As I leaved JTAG enabled, I can burn the factory image again and device will work.
But I do not understood why the wrong image was not detected and no roll-back to the previous version occures?
This means that any user can easy destroy the device by using DFU with the wrong file!
And if CPU is locked and JTAG is disabled - there need to replace CPU chip!
I do not think that this is expected behavior, so It is my fault. Bur where?!