Skip to content
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

Ox64 16Mb crashes at early init stage #92

Open
gamelaster opened this issue Feb 23, 2023 · 6 comments
Open

Ox64 16Mb crashes at early init stage #92

gamelaster opened this issue Feb 23, 2023 · 6 comments
Labels

Comments

@gamelaster
Copy link
Contributor

gamelaster commented Feb 23, 2023

I have following test firmware: gpio_input_output_bl808_m0.bin.zip

I flashed it to Ox64. After that, I read the contents of SPI Flash, contents are OK: flash.bin.zip
(NOTE: Firmware is on 0x2000 offset)

But after execution, firmware fails and Illegal instruction exception is thrown.
So, with CK-Link, I did this: dump binary memory ./xip-dump1.bin 0x58000000 0x58008000
The result is here: xip-dump1.bin.zip

As we can see, there is difference in 10 bytes, which can trigger invalid instruction:
image
(left is XIP dump, right is final binary).

After doing another dump: dump binary memory ./xip-dump2.bin 0x58000000 0x58008000: xip-dump2.bin.zip
The 0x2A20 offset is again correct. (ICACHE?)

I tried to switch to DIO mode, but it did not helped. This seems to be XIP issue? Or some interference?

Sadly, since I can't properly reset the chip, I can't debug this more.

@dwillmore
Copy link

dwillmore commented Feb 23, 2023

To save others time, the incorrect data in xip-dump1 is the data from offset 0x4a40.
0x2a20 = 0b0010101000100000
0x4a40 = 0b0100101001000000

@DavidVentura
Copy link

@gamelaster did you find a solution for this?

@gamelaster
Copy link
Contributor Author

@DavidVentura sadly, nothing new.

@wpwrak
Copy link

wpwrak commented Apr 28, 2023

@dwillmore, did you mean that it's from 0x2a40 (not 0x4a40) ? At least that's what I see in the hexdump:
0x2a20 = 0b0010 1010 0010 0000
0x2a40 = 0b0010 1010 0100 0000
So this looks like a single bit shift occurred in the address. This raises the question if the address is transmitted serially, and something happened with the clock or the clock-data timing, or if the address is transmitted in parallel, which would mean the corruption is caused by something else.
If it's a problem in the communication between BL808 and Flash, it should be possible to see this pattern on the QSPI bus. Probably difficult to reduce this haystack (I assume it's hidden among lots of accesses) to a point were the needle can be found, though.

@wpwrak
Copy link

wpwrak commented Apr 28, 2023

Another thought: does reading the Flash after the problem has occurred with XIP still produce the original result ?
Once upon a time, we had a system with improper power-down sequencing, and the CPU was twitching while the Flash was still fully operational. Every once in a while, such a twitch resulted in a write command, which was promptly executed by the Flash ...

@gamelaster
Copy link
Contributor Author

@wpwrak

Another thought: does reading the Flash after the problem has occurred with XIP still produce the original result ?

No, reading the firmware again after crash reads OK binary without bitshift.

Sadly, I didn't had time to hookup logic analyzer to the flash to check if it is also visible on the bus

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants