firmware download in RAM for FX3

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
leda_289486
Level 5
Level 5
10 sign-ins 5 sign-ins 100 replies posted

How to create the .img file to download the FX3 firmware through the USB interface (CyControl.exe) in RAM ?

   

Best Regards,

0 Likes
12 Replies
Anonymous
Not applicable

You can find the ELF to IMG conversion tool in C:\Cypress\FX3 SDK\util\elf2img.

   

I put this in the Eclipse Post Build Step: elf2img.exe -i "${BuildArtifactFileName}" -o "${BuildArtifactFileBaseName}.img"

   

For this you have to set the PATH variable in Windows correctly.

0 Likes
leda_289486
Level 5
Level 5
10 sign-ins 5 sign-ins 100 replies posted

Hi,

   

Since which version is this util (elf2img) present ?

   

I've been currently using a 321 version and it was not present.

   

I've downloaded a 384 version (of FX3 SDK only, not Eclipse nor GCC toolchain) but it is still not present.

   

Best Regards.

0 Likes
leda_289486
Level 5
Level 5
10 sign-ins 5 sign-ins 100 replies posted

Ok it is present, but there was a bad installation because I selected a different directory than "c:\cypress\fx3 sdk" as root.

   

Sorry.

   

Best Regards,

0 Likes
leda_289486
Level 5
Level 5
10 sign-ins 5 sign-ins 100 replies posted

Ok It seems to work. 2 additionnal questions :

   

is the .img file created with these options directly downloadable into RAM via USB interface ?

   

what are the options to create a SPI bootable file ?

   

Thank you for your help,

   

Best Regards.

   

D.

0 Likes
Anonymous
Not applicable

1) what are the options to create a SPI bootable file ?

   

Please check following Applucation Note for details - AN70193 - EZ-USB® FX3 SPI Boot Option.

   

You can use the same utility to create the image by just choose an appropriate EEPROM Control byte.

   

 

   

2) is the .img file created with these options directly downloadable into RAM via USB interface ?

   

The Image generated will have following 8 bytes as header:

   

'C' ,'Y',0xXX, 0xXX                             //CY Signature followed by 2 dummy bytes

   

4bytes of  'length' of image section                   //get length

   

4bytes of start 'address' in RAM            //get address

   

Next byte is start of Image section.

   

So after this you can use vendor command 0xA0 and the image can be downloaded to RAM in chunks of 4Kbytes. Each section is terminated by 4bytes of zeroes. 0x0000_0000.

   

And all new sections start with 4bytes length and 4bytes address followed by Image.

   

Thanks,

   

Shruti

0 Likes
Anonymous
Not applicable

Correction: Image generated has 12 bytes of header.

0 Likes
Anonymous
Not applicable

 You said there are 4 bytes of zeros at the end of every section.

   

 

   

Can you explain this in more detail?  Are these bytes just padding?  Are they included in the size calculations for each section?

   

 

   

Also, the elf2img tool, distributed with the SDK, does _not_ have 4 bytes of zero padding in the *.img output.  Is there a reason for this?

0 Likes
Anonymous
Not applicable

Sorry for the confusion.

   

After end of the last section next 4 bytes are 0x0000_0000. This indicated image termination. After that next 4 bytes are address you want PC to jump to after download complete.

   

And after that last 4 bytes of image are checksum bytes.

   

Any data after that is ignored.

0 Likes
Anonymous
Not applicable

 Thank you so much for responding!  You are being very helpful.

   

 

   

Okay, so, just to make sure I understand this:

   

1) Image Header:

   

C, Y, 0xXX, 0xXX

   

<4 bytes length of image>

   

<4 bytes start address in RAM>

   

Push the image header using the command 0xA0.

   

 

   

2) Each section of 4Kb chunks:

   

<4 bytes section length>

   

<4 bytes start address>

   

<image data of the length specified above>

   

Push all of the sections using the command 0xA0.

   

 

   

3) Image termination:

   

0x0000_0000,

   

<4 bytes address to jump to>

   

<checksum of image>

   

Push image termination sequence using 0xA0.

   

 

   

My last question is what other fields do we need to use for the vendor command 0xA0?  For example, in the FX2, you would need to tell the CPU to reset by pushing: <0xA0, 0xE600, 0x0000, 0x1, 1>.  Each section you pushed then looked like:

   

<0xA0, address, index (unused?), data, length>

   

Since the FX3 has 32 bit addressing, how do we do this?  For example, in order to write the image header, what does it look like?

0 Likes
Anonymous
Not applicable

 The firmware (.img) is downloaded to FX3 RAM using the Control Center --> Program --> FX3 --> RAM and selecting the .img file.

   

My question is: How can I do it programmatically from C/C++ promgram ?

   

Is there an API that do the above operation done by the Control Center GUI?

   

Thanks,

   

Zafrir Patt

0 Likes
Anonymous
Not applicable

The firmware download is included in the CyUSB3 API. Without the API you can download the new firmware by every driver/API you want (WinUSB, LibUSB) using the control transfers as described above.

0 Likes
Anonymous
Not applicable

Hi Everybody,

   

I just studied this topic, and it may be helpfull to others that there is pseudocode in

   

AN73150: Booting EZ-USB® FX3 over High-Speed USB

   

Further you may test your firmware uploader using the firmware example in

   

C:\Cypress\EZ-USB FX3 SDK\1.1\firmware\boot_fw

   

It worked for me

0 Likes