mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-21 05:48:23 +00:00
extmod: if debug build is used, disable LoadDevice, wipe storage on start, draw red square in corner
This commit is contained in:
parent
1e03a5d554
commit
94fc0f7ac0
@ -21,6 +21,10 @@
|
|||||||
/// '''
|
/// '''
|
||||||
STATIC mp_obj_t mod_trezorconfig_init(void) {
|
STATIC mp_obj_t mod_trezorconfig_init(void) {
|
||||||
storage_init();
|
storage_init();
|
||||||
|
// wipe storage when debug build is used
|
||||||
|
if (MP_STATE_VM(mp_optimise_value) == 0) {
|
||||||
|
storage_wipe();
|
||||||
|
}
|
||||||
return mp_const_none;
|
return mp_const_none;
|
||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_0(mod_trezorconfig_init_obj, mod_trezorconfig_init);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_0(mod_trezorconfig_init_obj, mod_trezorconfig_init);
|
||||||
|
@ -43,6 +43,10 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_trezorui_Display_clear_obj, mod_trezorui_Di
|
|||||||
/// Refresh display (update screen).
|
/// Refresh display (update screen).
|
||||||
/// '''
|
/// '''
|
||||||
STATIC mp_obj_t mod_trezorui_Display_refresh(mp_obj_t self) {
|
STATIC mp_obj_t mod_trezorui_Display_refresh(mp_obj_t self) {
|
||||||
|
// draw red square in upper-right corner when debug build is used
|
||||||
|
if (MP_STATE_VM(mp_optimise_value) == 0) {
|
||||||
|
display_bar(DISPLAY_RESX - 8, 0, 8, 8, 0xF800);
|
||||||
|
}
|
||||||
display_refresh();
|
display_refresh();
|
||||||
return mp_const_none;
|
return mp_const_none;
|
||||||
}
|
}
|
||||||
|
@ -41,6 +41,8 @@ def dispatch_ChangePin(*args, **kwargs):
|
|||||||
|
|
||||||
|
|
||||||
def boot():
|
def boot():
|
||||||
|
# only enable LoadDevice in debug builds
|
||||||
|
if __debug__:
|
||||||
register(LoadDevice, protobuf_workflow, dispatch_LoadDevice)
|
register(LoadDevice, protobuf_workflow, dispatch_LoadDevice)
|
||||||
register(ResetDevice, protobuf_workflow, dispatch_ResetDevice)
|
register(ResetDevice, protobuf_workflow, dispatch_ResetDevice)
|
||||||
register(WipeDevice, protobuf_workflow, dispatch_WipeDevice)
|
register(WipeDevice, protobuf_workflow, dispatch_WipeDevice)
|
||||||
|
Loading…
Reference in New Issue
Block a user