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.pull/1610/head
parent
e629a72c3a
commit
7ca67cc4d9
@ -1,73 +1,25 @@
|
|||||||
# isort:skip_file
|
# isort:skip_file
|
||||||
|
# fmt: off
|
||||||
|
|
||||||
# unlock the device
|
# Import always-active modules
|
||||||
import boot # noqa: F401
|
import storage
|
||||||
|
import storage.device
|
||||||
|
from trezor import config, pin, utils # noqa: F401
|
||||||
|
|
||||||
# prepare the USB interfaces, but do not connect to the host yet
|
# Prepare the USB interfaces first. Do not connect to the host yet.
|
||||||
import usb
|
import usb
|
||||||
|
|
||||||
from trezor import loop, utils, wire, workflow
|
unimport_manager = utils.unimport()
|
||||||
|
|
||||||
# start the USB
|
# unlock the device, unload the boot module afterwards
|
||||||
usb.bus.open()
|
with unimport_manager:
|
||||||
|
import boot
|
||||||
|
del boot
|
||||||
def _boot_apps() -> None:
|
|
||||||
# load applications
|
|
||||||
import apps.base
|
|
||||||
import apps.management
|
|
||||||
import apps.bitcoin
|
|
||||||
import apps.misc
|
|
||||||
|
|
||||||
if not utils.BITCOIN_ONLY:
|
|
||||||
import apps.ethereum
|
|
||||||
import apps.lisk
|
|
||||||
import apps.monero
|
|
||||||
import apps.nem
|
|
||||||
import apps.stellar
|
|
||||||
import apps.ripple
|
|
||||||
import apps.cardano
|
|
||||||
import apps.tezos
|
|
||||||
import apps.eos
|
|
||||||
import apps.binance
|
|
||||||
import apps.webauthn
|
|
||||||
|
|
||||||
if __debug__:
|
|
||||||
import apps.debug
|
|
||||||
|
|
||||||
# boot applications
|
|
||||||
apps.base.boot()
|
|
||||||
apps.management.boot()
|
|
||||||
apps.bitcoin.boot()
|
|
||||||
apps.misc.boot()
|
|
||||||
if not utils.BITCOIN_ONLY:
|
|
||||||
apps.ethereum.boot()
|
|
||||||
apps.lisk.boot()
|
|
||||||
apps.monero.boot()
|
|
||||||
apps.nem.boot()
|
|
||||||
apps.stellar.boot()
|
|
||||||
apps.ripple.boot()
|
|
||||||
apps.cardano.boot()
|
|
||||||
apps.tezos.boot()
|
|
||||||
apps.eos.boot()
|
|
||||||
apps.binance.boot()
|
|
||||||
apps.webauthn.boot()
|
|
||||||
if __debug__:
|
|
||||||
apps.debug.boot()
|
|
||||||
|
|
||||||
# run main event loop and specify which screen is the default
|
# start the USB
|
||||||
apps.base.set_homescreen()
|
usb.bus.open(storage.device.get_device_id())
|
||||||
workflow.start_default()
|
|
||||||
|
|
||||||
|
|
||||||
_boot_apps()
|
|
||||||
|
|
||||||
# initialize the wire codec
|
|
||||||
wire.setup(usb.iface_wire)
|
|
||||||
if __debug__:
|
|
||||||
wire.setup(usb.iface_debug, is_debug_session=True)
|
|
||||||
|
|
||||||
loop.run()
|
|
||||||
|
|
||||||
# loop is empty. That should not happen
|
while True:
|
||||||
utils.halt("All tasks have died.")
|
with unimport_manager:
|
||||||
|
import session # noqa: F401
|
||||||
|
del session
|
||||||
|
@ -0,0 +1,28 @@
|
|||||||
|
from trezor import loop, utils, wire, workflow
|
||||||
|
|
||||||
|
# load applications
|
||||||
|
import apps.base
|
||||||
|
import usb
|
||||||
|
|
||||||
|
apps.base.boot()
|
||||||
|
|
||||||
|
if not utils.BITCOIN_ONLY and usb.ENABLE_IFACE_WEBAUTHN:
|
||||||
|
import apps.webauthn
|
||||||
|
|
||||||
|
apps.webauthn.boot()
|
||||||
|
|
||||||
|
if __debug__:
|
||||||
|
import apps.debug
|
||||||
|
|
||||||
|
apps.debug.boot()
|
||||||
|
|
||||||
|
# run main event loop and specify which screen is the default
|
||||||
|
apps.base.set_homescreen()
|
||||||
|
workflow.start_default()
|
||||||
|
|
||||||
|
# initialize the wire codec
|
||||||
|
wire.setup(usb.iface_wire)
|
||||||
|
if __debug__:
|
||||||
|
wire.setup(usb.iface_debug, is_debug_session=True)
|
||||||
|
|
||||||
|
loop.run()
|
Loading…
Reference in new issue