Hi, was following this example (FX3 Fail Safe Firmware Update ) and code but modified this code to boot to SPI.
So, firstly, what works. As demonstrated in the above example, I have separated my EEPROM into multiple sections with these hardcoded addresses
EEPROM Memory organization:
Second Stage Boot-loader image
Primary Firmware image
Secondary Firmware image
Firmware Update Byte (0x00 – Primary FW, 0xFF – Secondary FW)
Using the Imgcombine.zip file, I made something that did not require C# and verified that it writes multiple image files into a single image file. That is, I write the Bootloader to 0x0, the Primary firmware image to 0x2800, and the Secondary firmware image to 0x34800.
I've used the Cypress flash tool to download this image to SPI
By flipping the Firmware Update byte, I have successfully used the second stage bootloader into the Primary or the Secondary firmware images.
What has NOT been successful is when I boot to the Primary firmware image and try to write a new secondary image. While running the primary image, I have a function that writes a new image that it transfers over USB and writes to SPI address 0x34800. I have verified that the SPI writes are correct (doing a read after the entire contents are written and comparing), and I have also verified that the entire 180+kB image is correctly written byte for byte into SPI starting @ 0x23800.
On reset, the software does not boot.
In stranger behaviour, when I boot to the secondary firmware (starting at 0x34800) and write the USB image to the SPI starting at 0x2800, the software hangs mid write and when power cycled, the hardware I assume has tried to boot from SPI but has done a failsafe fallback to USB. Seems like I'm overwriting the active RAM instance??
Lastly, I have used my read utilities to pull the first 200k off my SPI EEPROM. Other than the first four bytes ( 0x43, 0x59, 0x1C, 0xB0) the data between what is written on the SPI and the image that I flashed on using the Cypress utility is different!
This suggests that the SPI flash process does something to the image?
Is this documented anywhere?
What do I need to do with a compiled .img file to directly burn it to a specific SPI address and have it run?