Hi there,
Over the last two weeks, I’ve experimented with writing P2 firmware using pigweed.dev and build with Bazel. My main motivation for this is host side testing and development, as well as easy reuse of code in different contexts (dev firmware, prod firmware, factory tool)
While I’m far from done, I can now sucessfully build P2 firmware that can be flashed locally or OTA. My proof-of-concept is the basic firmware with a display driver, and I can write unit tests for host side (example), on-device (example, example), I can build and flash a dev firmware (target), as well as a host-based simulator (target) thereof. For the graphics library, I use LVGL, and I can run the same UI code on device with the actual hardware as well as on the simulator.
I’m personally super excited about that, since I get much faster iteration speed, the peace-of-mind that my code works with unit tests, and asan, tsan, ubsan etc for additional correctnes verification.
There is a bunch more to explore I have not yet gotten to (the console for example. or pw_tokenizer for much smaller logs). Note that in this experiment, I completely dropped the wiring API implementation, and reimplement the Pigweed based API using the dynalib HAL API.
In the end, I get both, the Particle Cloud and a modern development environment. While I guess its not strictly needed for our hobbyist project (github)
, I have fun building this. I wanted to share in case there are folks out there who are interested in this.
I did put most of the code needed in a reusable bazel module, but focused on P2 only for now, and also only for my linux dev environment. Its not yet validated to run on other machines, I’ll do that eventually. Some documentation and decsions can be found in the main project’s documentation (link)
Cheers,
MikeS