Open matejcik opened 2 years ago
I've thought about this a bit, and my plan was to:
- the fun part:
I envision this part of the sequence a little differently:
boot.py
are either already in Rust, or implementable in Rust
storage
, we can call C's storage_get()
directly)main()
, invoke this Rust event loopmain.py
(which now excludes import boot
and friends)next step from that is expanding the Rust part to initialize the uPy interpreter, then to run the main.py loop, etc.
That's a faster way to have the boot in Rust, yes.
Due to memory layout optimization and the unimport mechanism, the contents of
main.py
are very fragile in terms of order of import statements: a wrongly placed import can significantly increase memory footprint, or in some cases even cause basic functions to fail (such as in #2129 experiments)When the Rust UI is done, it should be relatively easy to implement
boot.py
fully in Rust, and that paves the way to implement all ofmain.py
in Rust. This would remove the fragility and significantly shorten boot-up time. (which is currently ~3 seconds until the user sees any content on screen).In order to run the main boot sequence, we would also need to modify
modtrezorio-usb-*
and directly export the interface objects from Rust.Open question: if the main sequence runs from Rust, when does the MicroPython interpreter start? A nice answer would be to restart it after every workflow, but we could only do that if the startup of the interpreter itself is fast enough.