diff --git a/stmhal/main.c b/stmhal/main.c index 6140a06a8a..78afe54ef6 100644 --- a/stmhal/main.c +++ b/stmhal/main.c @@ -438,7 +438,6 @@ soft_reset: mp_obj_list_append(mp_sys_path, MP_OBJ_NEW_QSTR(MP_QSTR__slash_flash)); mp_obj_list_append(mp_sys_path, MP_OBJ_NEW_QSTR(MP_QSTR__slash_flash_slash_lib)); mp_obj_list_init(mp_sys_argv, 0); - MP_STATE_PORT(mp_kbd_exception) = mp_obj_new_exception(&mp_type_KeyboardInterrupt); // Initialise low-level sub-systems. Here we need to very basic things like // zeroing out memory and resetting any of the sub-systems. Following this diff --git a/stmhal/mpconfigport.h b/stmhal/mpconfigport.h index 203d41472b..cf1bb6abe0 100644 --- a/stmhal/mpconfigport.h +++ b/stmhal/mpconfigport.h @@ -42,6 +42,7 @@ #define MICROPY_ENABLE_GC (1) #define MICROPY_ENABLE_FINALISER (1) #define MICROPY_STACK_CHECK (1) +#define MICROPY_KBD_EXCEPTION (1) #define MICROPY_HELPER_REPL (1) #define MICROPY_REPL_EMACS_KEYS (1) #define MICROPY_REPL_AUTO_INDENT (1) @@ -208,7 +209,6 @@ extern const struct _mp_obj_module_t mp_module_network; #define MICROPY_PORT_ROOT_POINTERS \ const char *readline_hist[8]; \ \ - mp_obj_t mp_kbd_exception; \ mp_obj_t pyb_hid_report_desc; \ \ mp_obj_t pyb_config_main; \ diff --git a/stmhal/usb.c b/stmhal/usb.c index c6303befb1..95da04aba7 100644 --- a/stmhal/usb.c +++ b/stmhal/usb.c @@ -144,7 +144,7 @@ bool usb_vcp_is_enabled(void) { void usb_vcp_set_interrupt_char(int c) { if (pyb_usb_flags & PYB_USB_FLAG_DEV_ENABLED) { if (c != -1) { - mp_obj_exception_clear_traceback(MP_STATE_PORT(mp_kbd_exception)); + mp_obj_exception_clear_traceback(MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_kbd_exception))); } USBD_CDC_SetInterrupt(c); } diff --git a/stmhal/usbd_cdc_interface.c b/stmhal/usbd_cdc_interface.c index 12aa38470c..1f46b9dcc1 100644 --- a/stmhal/usbd_cdc_interface.c +++ b/stmhal/usbd_cdc_interface.c @@ -353,7 +353,7 @@ static int8_t CDC_Itf_Receive(uint8_t* Buf, uint32_t *Len) { if (*src == user_interrupt_char) { char_found = true; // raise exception when interrupts are finished - pendsv_nlr_jump(MP_STATE_PORT(mp_kbd_exception)); + pendsv_nlr_jump(&MP_STATE_VM(mp_kbd_exception)); } else { if (char_found) { *dest = *src;