-
Notifications
You must be signed in to change notification settings - Fork 17
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
Improve support for Zephyr RTOS applications #516
Comments
Hi Benjamin! Thanks for offering your help here. Zephyr apps is definitely something I'd love to see running in Wokwi. Right now, we have three ways to use Wokwi:
Which use cases do you have in mind? |
I would love to make sure #1 gets improved, at least to the point where it allows people to get a better understanding of how they can tinker with things like device tree overlays, and project configuration. Point taken though regarding long build time possibly being a problem. Cheers! |
How complex is it to set up a Zephyr ESP32 "Hello world" project in VS Code? |
Damn, you are fast! |
Is there a repo with this setup? |
It should - but this is pretty early, so you'll probably find something I forgot. Ping me when you do.
Yes, please! |
wokwi-cli is really easy to use. |
@kartben which app is this? can you please share the repo? |
I don't remember 😭 I really need to put together a quick README somewhere... |
People keep asking about Zephyr + Wokwi. We need your README :) |
@urish Things are unfortunately really slow, and it's not clear why. I vaguely remember discussions about performance issues depending on how sleep is implemented, and also the ILI9341 simulation potentially being slow. |
w00t!
Ya but I think it's more than just SPI, let me try to produce a minimal repro sample |
Nice (the profiler I mean, not the fact that LVGL is probably a huge performance killer :D). I can't easily run it myself tho, right? From the Web UI it tries to run from source, and I don't think I can launch it from VS Code? Please see https://github.com/kartben/wokwi-zephyr-projects/tree/master/esp32c3-blinky
Could the rtc_init warning be relevant? |
currently testing with esp32s3 and the timing for blinky seems correct |
Thanks! Yeah, the profiler is not available (yet) in VS Code, but I'm working on it!
Good catch, pushed a fix. Can you please test again? |
Yay! Much better :) it looks like it speed things up a tiny bit for the lvgl sample, but that might be magical thinking. |
Another update: got rid of the "rtc_init: o_code calibration fail" issue, so now the program should start much faster for C3 and S3 (it won't keep polling the RTC until it time outs). |
very nice -- much faster indeed! |
ooh, what a neat feature :) ![]() |
Thanks for making it easy to reproduce - I found out it was a bug in the simulator (SPI hardware was not signaling the code it finished transferring data correctly). Uploaded a fix - I can see it now draws on the screen, but then the program (running in the sim) seems to crash with a exception right after it finishes drawing. Is that expected?
|
cool, works for me too! Thanks!
mmmh no (granted I don't have actual hardware to test) :) On my side I can't seem to get it to crash and it rather looks like it's stuck? Simulation rate drops to ~15%, and I can't seem to get a crashdump? |
Yeah, same here - it it stuck in the |
This time the problem was on my side! Increased stack size of the app and now it works! 🥳 |
Awesome! I can't seem to be able to crash it, no matter how hard I try :) Very cool! (updated the binaries as I had mentioned it had VT100 colors supported but it turns out it wasn't enabled in the version I had pushed to the repo)
❤️ |
Looks like the esp32-s3 issue also has to do with interrupts! |
BTW how would I go about trying to refresh some of the work from @beriberikix's with the zephyr builder, i.e. how to test things "locally"? I would like to see if we could get the .overlay and .conf files directly editable from the wokwi web workspace (which right now the first blocker would be that those file extension are not supported, I guess). ![]() |
Here's how to test things locally As a workaround for unsupported file extensions, you could just name them something.c (maybe also something.txt), and create a shell script inside the builder that would rename them before running the build (that's how we prototyped the Rust builders when we first introduced Cargo.toml, which was unsupported back at the time). Word of caution though - from what I have seen, Zephyr builds tend to take a lot of time. We won't be able to afford running builds that take several minutes in scale, unless we get some sponsorship for that. Also, most users would not have patience to wait several minutes watching a spinner. |
LMK how I can help! Zephyr's official containers are, uh, bloated. The latest CI container is ~12gb. My experiments have yielded an ESP32 container @ 1.3gb and an ESP32S3 @ 1.3gb. They're faster as well. |
@urish I've just added a few RP2040 samples :) Basic helloworld and blinky work just fine (yay!) but the "shell" sample seems stuck. |
Did you commit the shell sample? Couldn't find it in the repo |
hadn't pushed :) https://github.com/kartben/wokwi-zephyr-projects/tree/master/rpi_pico-shell_module |
More goodness with ESP32 and actual Wi-Fi connection :) (https://github.com/kartben/wokwi-zephyr-projects/tree/master/esp32s3-wifi) ![]() |
Damn you are fast! I can see that it hangs in the UART RX code in Pi Pico shell, investigating:
|
implement UARTTXINTR, and also clear UARTRXINTR when the Rx FIFO becomes empty. wokwi/wokwi-features#516
Pico shell Issue found, pushed a fix. Can you please try now? |
Works like a charm! 👏👏 |
@urish Another one for you if you're bored https://github.com/kartben/wokwi-zephyr-projects/tree/master/esp32s3-lvgl-with-encoder :) Seems like it crashes when pressing the button. |
Does it only crash on the S3? Or also in C3? |
A quick workaround is to disable bouncing on the button by setting the "bounce" attribute to "0": {
"type": "wokwi-pushbutton",
"id": "btn1",
"top": 140.6,
"left": 48,
"attrs": { "color": "green", "bounce": "0" }
} Looks like with bouncing, the button is stress-testing the interrupt mechanism :) |
Wow, this was a super tricky one - another subtle bug in interrupt handling, this time in Xtensa. Pushed a fix, so we should now play nicely even with a bouncy button that generates tons of interrupts in quick succession. |
Nice, thanks! I will give it a try and let you know. Hopefully this will unlock rotary encoders too! |
Sure, we don't want folks to think their code is working just to run it on real hardware and figure out they didn't account for bouncing, right? |
Neat! |
FWIW the encoder works like a charm too now! https://github.com/kartben/wokwi-zephyr-projects/tree/master/esp32s3-lvgl-with-encoder |
Yes, no PCNT yet |
@urish A nice one that basically worked out of the box 🥳 https://github.com/kartben/wokwi-zephyr-projects/tree/master/esp32c3-artificial-nose Actually, come to think of it, not everything worked out of the box, it would crash when I tried to use a screen rotation that's not 0 or 180 degrees. Not sure if that's a bug? (here's the relevant code on the Zephyr side https://github.com/zephyrproject-rtos/zephyr/blob/433a85e7bf32ffc77ba194bb903bcca84c44c047/drivers/display/display_ili9xxx.c#L244) |
Cool, I wanted to try Edge Impulse for a long time
Crash is in display garbage or actually the program would crash? |
The latter. I will try to upload a bin as I realize it might be hard for you to test otherwise. |
elf please |
implement UARTTXINTR, and also clear UARTRXINTR when the Rx FIFO becomes empty. wokwi/wokwi-features#516 (cherry picked from commit edf8449)
implement UARTTXINTR, and also clear UARTRXINTR when the Rx FIFO becomes empty. wokwi/wokwi-features#516 (cherry picked from commit edf8449)
The zephyr-esp32 builder is already a great start in allowing to run Zephyr apps from Wokwi.
It would be great to look into generalizing/improving support by allowing the users to configure things such as:
prj.conf
I am around to chat more around this, and I will provide help as much as I can!
The text was updated successfully, but these errors were encountered: