extmod: if debug build is used, disable LoadDevice, wipe storage on start, draw red square in corner

pull/25/head
Pavol Rusnak 7 years ago
parent 1e03a5d554
commit 94fc0f7ac0
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D

@ -21,6 +21,10 @@
/// '''
STATIC mp_obj_t mod_trezorconfig_init(void) {
storage_init();
// wipe storage when debug build is used
if (MP_STATE_VM(mp_optimise_value) == 0) {
storage_wipe();
}
return mp_const_none;
}
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).
/// '''
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();
return mp_const_none;
}

@ -41,7 +41,9 @@ def dispatch_ChangePin(*args, **kwargs):
def boot():
register(LoadDevice, protobuf_workflow, dispatch_LoadDevice)
# only enable LoadDevice in debug builds
if __debug__:
register(LoadDevice, protobuf_workflow, dispatch_LoadDevice)
register(ResetDevice, protobuf_workflow, dispatch_ResetDevice)
register(WipeDevice, protobuf_workflow, dispatch_WipeDevice)
register(RecoveryDevice, protobuf_workflow, dispatch_RecoveryDevice)

Loading…
Cancel
Save