In a very weird situation, our declaration of `shutdown()` shadows a
function `shutdown(int, int)` from sys/socket, which _just happens_ to
be called by libxcb when closing the sdl window. This calls
`main_clean_exit` which calls into micropython and causes at best an
uncaught NLR and at worst an outright segfault because by that time the
micropython environment doesn't exist anymore.
I didn't think this sort of thing would be possible but here we are??
Fixed by removing `__shutdown()` and replacing `shutdown` with
`trezor_shutdown`
Features `micropython` and `protobuf` are defined. Protobuf implies micropython
because our protobuf impl is pretty much _for_ micropython.
The respective subdirs are included only if the matching feature is defined.
util.rs is moved to micropython because it mostly concerns micropython interop
ResultExt, useful only for ui_debug, is moved to ui::util.
A new module `trezorhal::time` is provided. It mirrors functionality of
`micropython::time` via stmlib functions. The intended use is to always use
functions from `trezorhal::time`. The right micropython variants are used when
micropython is available, otherwise the pure stmlib versions are called.
ui::*::layout is conditional for micropython feature, because it only concerns
micropython layouts. If we want to reuse layouts defined there, we will need to
export them to not depend on Objs and Qstrs etc.
Can be built by `TREZOR_MODEL=R make build_unix`, `make build_unix_frozen` does not work yet.
All the dialogs are not very pretty, they are just meant to work.
Relevant micropython commits:
d1bfb271d7686708fe8711a177629c8bf6e7f6a6 lib/uzlib: Move uzlib code from extmod to lib.
4d546713ec8858cbf908de45de11cbfc46a20971 shared: Introduce new top-level dir and move 1st party lib code there.
ca920f72184c50f61002aa9d5cd01555b1e28b7b py/mpstate: Make exceptions thread-local.
Relevant micropython commits:
ad4656b861f94277bed9647ca176e662ce5119e3 all: Rename BYTES_PER_WORD to MP_BYTES_PER_OBJ_WORD.
9fef1c0bde2f9642d383bd56aa112447384a84ba py: Rename remaining object types to be of the form mp_type_xxx.
5fdf351178df9a18df624ae0f5947d8a5a6bce40 py/gc: Don't include mpconfig.h and misc.h in gc.h.
Seems to be micropython internal flag that hasn't been working in our
emulator for some time.
Relevant micropython commits:
b9a35bebf75be53a817bf6341af14b882093e345 py/qstr.h: Remove QSTR_FROM_STR_STATIC macro.
[no changelog]