feat: (wip) add qemu for development#500
feat: (wip) add qemu for development#500ngxson wants to merge 10 commits intocrosspoint-reader:masterfrom
Conversation
|
Ok so my version has been able to boot into home screen. However, watchdog is triggered randomly for no reason (not even at a fixed interval, just pure random) I suppose that esp32c3 qemu is not that stable. A simple hello world may sometimes trigger wdt timeout. At this point, I'm not confident if this is a global issue or isolated to my host machine (docker on a macbook M3). If possible, could you give this a try on your machine? @daveallie @osteotek (edit: you need to comment out all calls to digitalRead and analogRead, they will trigger panic immediately) An alternative solution could be to just run this infrastructure on a real standalone esp32c3 which is significantly cheaper than buying a new xteink. |
|
Last version should "just work" without further modifications to the source code. Some small things should be polished like: debouce button, add mutex to the emulation serial But at this point, I'm quite convinced that I should get rid of qemu, it has too many problems:
Instead, I'll replace it with an option that make it flashable to a cheap esp32c3 board (4MB flash, 3.5MB usable with huge_app partition layout). With
The 16MB flash version is a bit harder to find, but still cheap:
|
|
FWIW, I'm implementing it on my fork here because I think it will be too complicated upstream to crosspoint. My forked version requires an ESP32C3 board as mentioned in the last message, but it does work very stable. Wifi can also work exactly as on the real device. On top of that, FS proxy make debugging things much easier. I'm keeping this PR up for a bit more for anyone who wants to play with it
|
## Summary Extracted some changes from #500 to make reviewing easier This PR adds HAL (Hardware Abstraction Layer) for display and GPIO components, making it easier to write a stub or an emulated implementation of the hardware. SD card HAL will be added via another PR, because it's a bit more tricky. --- ### AI Usage While CrossPoint doesn't have restrictions on AI tools in contributing, please be transparent about their usage as it helps set the right context for reviewers. Did you use AI tools to help write this code? **NO**
## Summary Extracted some changes from crosspoint-reader#500 to make reviewing easier This PR adds HAL (Hardware Abstraction Layer) for display and GPIO components, making it easier to write a stub or an emulated implementation of the hardware. SD card HAL will be added via another PR, because it's a bit more tricky. --- ### AI Usage While CrossPoint doesn't have restrictions on AI tools in contributing, please be transparent about their usage as it helps set the right context for reviewers. Did you use AI tools to help write this code? **NO**
|
@ngxson given these changes aren't going ahead, are you ok for this to be closed out, just trying to do a sweep of all the PRs. |
|
Yeah actually I have a habit of keeping prototype PR as draft for visibility. But it's fine to close this |
## Summary Extracted some changes from crosspoint-reader#500 to make reviewing easier This PR adds HAL (Hardware Abstraction Layer) for display and GPIO components, making it easier to write a stub or an emulated implementation of the hardware. SD card HAL will be added via another PR, because it's a bit more tricky. --- ### AI Usage While CrossPoint doesn't have restrictions on AI tools in contributing, please be transparent about their usage as it helps set the right context for reviewers. Did you use AI tools to help write this code? **NO**



Summary
Important
This PR is currently on pause, see #500 (comment)
Emulation can benefit the development of functionalities that are not directly related to hardware.
Still WIP, just posting for discussion. My plan is:
For example:
Display::displayBuffer()will simply turn the buffer into base64, then print it to Serial output. The python script then forward the info back into web ui.The more complicated part will be to emulate the sdcard. Not sure yet how to do, probably emulate inside python context? (This is left open for discussion)
For now, it can already boot to home screen, but watchdog timeout is triggered randomly:
Note: The docker code is adapted from https://github.com/mluis/qemu-esp32
AI Usage
While CrossPoint doesn't have restrictions on AI tools in contributing, please be transparent about their usage as it
helps set the right context for reviewers.
Did you use AI tools to help write this code? Yes, but only for python/html code, here are some prompts that I used:
<div id="output">All C++ code is written by hand