-
Notifications
You must be signed in to change notification settings - Fork 202
Invalid glasgow_config after flashing a modified firmware #274
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Unfortunately I don't think custom firmware is going to receive much direct support from the Glasgow project. Sorry. Depending on what you're doing, I'd encourage you to inspect the official firmware, how it is built, and work from there. If you've taken the existing firmware and tweaked it, then the This location is at the very end of the flash ( If you have access, it might be worth dumping the flash and looking at what is stored there. The USB enumeration / configuration change failing implies that something is wrong with your USB handling, but I can't offer much more than that unfortunately. Have you confirmed that you can simply build the official firmware, and that it works correctly?
It should be possible to short the two "REC" pins at power up, to present the FX2 as if it had no firmware - assuming you're on the revC1 board from me, the pins are here: Edit: I just followed the link to your custom firmware and looked at what you're doing.
|
If flashing with the REC pads shorted doesn't work for you, it could be issue #252 you are experiencing. This happens when you have flashed firmware (and not just the VID/PID for the FX2). You need to flash basic firmware from libfx2 as outlined in that issue to work around that until a proper fix for #252 is implemented. |
Thank you very much @attie and @electroniceel for the help. I will have a closer look at it in the next few days.
I'm using one of your boards 😉 and yes U34 is unpopulated. I soldered the SOIC variant on the test points at the back.
I am aware of it. I joined the #glasgow IRC last year to propose my help for authentication and @whitequark told me that the idea was discarded. I proceeded anyway since I am doing some academic work on IoT security and was interested in it. Thanks for the REC tip, I did not notice it on the board nor in the schematic. |
I'm curious to know why you decided to connect your ATECC to the internal I2C bus of Glasgow then and not to one of the regular ports A or B. Using the regular ports would allow you to easily create a Glasgow applet for the ATECC or use a REPL script like https://github.com/GlasgowEmbedded/glasgow/blob/master/examples/i2c-pcf8574.py |
The main reason was that the board was already designed with the ATECC connected to the internal bus. Also I was able to start working on the firmware with a cheap FX2LP dev board as I did not have a Glasgow and was not very confident about assembling BGA parts myself. I also think it makes more sense to be able to authenticate the device at any stage without replacing the gateware. Besides the issue when flashing this firmware, the minimal driver for the ATECC I created for the FX2 seems to work fine and have sufficient features for public key authentication and certificate retrieval. The Python authentication module is still WIP. |
I am back to firmware hacking and I am still annoyed by this issue. I am now stuck in a loop that prevents any useful work. From a C1 Glasgow with a modified firmware:
Then I send a USB requests that fails with
After that the device is unusableso I disconnect and then reconnect the Glasgow board:
And then the device is unusable. I have to put it back to FX2 bootloader mode, erase the EEPROM and start again. What kind of debug tools do you use for the FX2? |
After some more debug, the USB errors appear as I get closer to the memory limit of the 8051. It is strange, because I do not see overlaps in
I know that Commenting out a few unused functions solves the USB issues. It could be a memory alignment issue as well. I'm not sure if I should close this issue as it could happen if the current firmware is expanded. Let me know what you think. |
I agree that this is a potential issue for expanding the current firmware. |
I started investigating if this could be a config overwriting due to an overlapping EEPROM page. I enabled glasgow/software/glasgow/device/hardware.py Lines 310 to 311 in 99b81aa
glasgow/software/glasgow/device/hardware.py Lines 325 to 326 in 99b81aa
What surprises me is that the configuration is read at address 0 of the EEPROM while I thought it was located at 0x3fc0: $ glasgow flash --firmware firmware/glasgow.ihex
I: g.cli: reading device configuration
reading EEPROM chip 0 range 0000-004b
I: g.cli: device has serial C1-20210406T021410Z Is the memory mapping reversed? |
No. Take a look at the section of the FX2 manual that describes how loads its firmware from EEPROM. In short, there's a series of length-address-value chunks at the start of the EEPROM, so the EEPROM addresses and the XRAM addresses have no correspondence. |
At a glance, this issue seems to have been caused by the code area becoming too large and overflowing into something important. (The In any case this is not an actionable issue for the Glasgow project. |
Hi,
I got an assembled Glasgow rev C1 and I am playing with the FX2 firmware. I noticed some strange issues if I erase the FX2 EEPROM, perform a
glasgow factory --rev C1
:And then after a power cycle
glasgow flash --firmware firmware/glasgow.ihex
with a modified firmware:The board becomes unusable after that and requires a flash erase with an external tool as it is not properly enumerated after a power cycle otherwise:
However, the issue does not appear if I first flash the firmware compiled from master and then the same custom firmware.
My first thought that maybe a memory region grew a bit too much and the memory location of
glasgow_config
slightly moved and/or was erased by other regions. However it seems to be allocated the very end of the usable memory:glasgow/firmware/glasgow.h
Line 81 in 25fe8d3
So I tried to slightly increase XRAM and reduce CODE by the same amount:
glasgow/firmware/Makefile
Lines 4 to 6 in 25fe8d3
None of my attempts solved the issue. Do you have any idea of what kind of black magic could be happening?
The text was updated successfully, but these errors were encountered: