mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-07-05 22:32:33 +00:00

A small fixed list of modules is kept pre-loaded in the GC arena. These must not keep references to anything else, as all other modules are unloaded and the memory is cleared.
26 lines
534 B
Python
26 lines
534 B
Python
# isort:skip_file
|
|
# fmt: off
|
|
|
|
# Import always-active modules
|
|
import storage
|
|
import storage.device
|
|
from trezor import config, pin, utils # noqa: F401
|
|
|
|
# Prepare the USB interfaces first. Do not connect to the host yet.
|
|
import usb
|
|
|
|
unimport_manager = utils.unimport()
|
|
|
|
# unlock the device, unload the boot module afterwards
|
|
with unimport_manager:
|
|
import boot
|
|
del boot
|
|
|
|
# start the USB
|
|
usb.bus.open(storage.device.get_device_id())
|
|
|
|
while True:
|
|
with unimport_manager:
|
|
import session # noqa: F401
|
|
del session
|