It does not have the reset register kind of operation for firmware download.
We've the jump to program entry vendor request for this. It is 0xA0 vendor request with wValue (LSW) and wIndex (MSW) containing the address of the 4-byte program entry address.
I suppose this offset address does not change. Can you please post the values in question?
Thanks in advance,
In the FX3 programmers manual, p. 131, I see 0x40000000. Is this correct?
The address does move around depending on where CyU3PFirmwareEntry() gets placed during linking. The "FX3 Boot Image Format" section of the FX3 Programmer's Manual describes where the start address may be found in a .img file, or you can use arm-none-eabi-objdump on the ELF file or look it up in a map file. Probably you could also set up a custom linker script to force CyU3PFirmwareEntry to be placed at a particular address.
Reading the next to last DWORD of the firmware file seems to be the easiest way to go. I suppose this is what you meant.
Well, there remains the case where I don't have the firmware file at hand, but still need to reset the FX3 in software before I can upload new firmware. Which approach do you suggest in such a setting?
In that case I think the only option is to build the firmware so that its start address is constant. There may be an elegant way to do that with only a linker script; if so, I don't know it. What you can do is add an assembly file (call it "Start.S") to your Eclipse project:
Then, use a custom linker script. You can clone the one in the FX3 SDK firmware/common folder into your project.
Delete this line:
And, modify the file so that it reads like this:
. = 0x40003000;
*Start.o(.text) /* Nail down the start address */
You'll also need to modify the linker options to remove the " -Wl,--entry,CyU3PFirmwareEntry" from the ld command line. Then, your start address should always be 0x40003000.
Hope this helps,
thanks for your reply. The first thing I thought of was reading the current firmware file from memory and jump the dLength fields until I hit dLength N (which should be zero). The Program Entry is immediately afterwards then.