glasgow icon indicating copy to clipboard operation
glasgow copied to clipboard

recover flashing doesn't work when firmware or gateware is flashed

Open electroniceel opened this issue 4 years ago • 11 comments

Steps to reproduce

  1. flash firmware or gateware onto the eeproms
  2. short the recover jumper and release reset
  3. glasgow factory --force --rev C2

Result:

W: g.device.hardware: device 001/033 did not re-enumerate after firmware upload
E: g.cli: device not found

No new serial is flashed. The Glasgow still loads firmware and gateware after a manual reset.

I haven't investigated yet, but at least loading gateware takes longer than factory is waiting for. Could be the same for firmware, but the time difference isn't as obvious.

Maybe we need to upload a special firmware during factory that ignores everything in eeprom?

electroniceel avatar Dec 30 '20 15:12 electroniceel

Maybe we need to upload a special firmware during factory that ignores everything in eeprom?

Yes, and we can even get it from libfx2.

whitequark avatar Dec 30 '20 15:12 whitequark

Yes, and we can even get it from libfx2.

One of the examples?

They don't have binaries checked in and we don't want to require sdcc.

I also think we should upload special firmware, because if the flashed firmware is completely broken (that is what recover is for), then we really don't want the fx2 to load it.

electroniceel avatar Dec 30 '20 15:12 electroniceel

No, boot-cypress.ihex (it is built like a binary extension of the fx2 wheel). (I'm not sure actually if I'm uploading fx2 wheels, let me check that.)

whitequark avatar Dec 30 '20 15:12 whitequark

Ok, there are binary wheels now: https://pypi.org/project/fx2/#files

whitequark avatar Dec 30 '20 15:12 whitequark

Specifically, I'm referring to the firmware loaded when you run fx2tool --bootloader, which is needed for its EEPROM commands.

whitequark avatar Dec 30 '20 15:12 whitequark

Ok, so the solution for factory would be:

  1. upload boot-cypress.ihex into the ram of the fx2
  2. clear & rewrite the eeprom
  3. tell the user to reset

Are the eeprom commands the same between boot-cypress.ihex and Glasgow firmware?

electroniceel avatar Dec 30 '20 15:12 electroniceel

Yes, intentionally.

whitequark avatar Dec 30 '20 15:12 whitequark

(You can also use fx2tool's EEPROM commands with Glasgow without replacing its firmware with the bootloader, although you can only access the FX2 EEPROM that way, not the FPGA EEPROM. Which is fine.)

whitequark avatar Dec 30 '20 15:12 whitequark

Hmm, let's say you have bad gateware flashed. Once you load the Glasgow firmware into the ram of the fx2, it will start to load this gateware, right? So i think factory should also clear the FPGA EEPROM.

Can the boot-cypress.ihex do this or does it just have the commands for the FX2 EEPROM?

To me it looks like it just handles the FX2 EEPROM.

electroniceel avatar Dec 30 '20 15:12 electroniceel

Once you load the Glasgow firmware into the ram of the fx2, it will start to load this gateware, right?

No it won't if the configuration doesn't tell it to do that.

whitequark avatar Dec 30 '20 15:12 whitequark

Ah, ok, I haven't looked at that part yet. So the boot-cypress.ihex is fine then when we clear this config bit.

electroniceel avatar Dec 30 '20 15:12 electroniceel