wasefire
wasefire copied to clipboard
Use defmt for Rust applets
trafficstars
Once https://github.com/knurling-rs/defmt/issues/738 is fixed, the prelude can provide a defmt global logger such that applets may use defmt for logging. This would reduce the size of applets (as well as serial communication) when debugging.
There are a few design questions to be solved:
- Should the platform multiplex the applet serials into its own? This could be done by assuming defmt is using rzCOBS encoding. Each null byte may be followed by a byte describing which "binary" (platform or applet) it is coming from. On the other side of the serial, those bytes would be removed and used to send the frame to the correct defmt decoder.
- How to deal with applets made of multiple modules? This is not possible yet, but is a possibility to share code between applets. There would be one defmt table per module. Maybe each module has its own defmt global logger deferring to the defmt module with some magical id.
References:
- The logging section of the Embedonomicon explains the idea for ELF.