8000 stm32: Make soft_reset use VM abort. · micropython/micropython@a2fc451 · GitHub
[go: up one dir, main page]

Skip to content

Commit a2fc451

Browse files
committed
stm32: Make soft_reset use VM abort.
Signed-off-by: Damien George <damien@micropython.org>
1 parent b94c65c commit a2fc451

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

ports/stm32/modmachine.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,8 +265,12 @@ STATIC mp_obj_t machine_reset(void) {
265265
MP_DEFINE_CONST_FUN_OBJ_0(machine_reset_obj, machine_reset);
266266

267267
STATIC mp_obj_t machine_soft_reset(void) {
268-
pyexec_system_exit = PYEXEC_FORCED_EXIT;
269-
mp_raise_type(&mp_type_SystemExit);
268+
mp_sched_vm_abort();
269+
// Either handle the pending abort, or wait if we aren't the main thread.
270+
for (;;) {
271+
MICROPY_EVENT_POLL_HOOK;
272+
}
273+
return mp_const_none;
270274
}
271275
MP_DEFINE_CONST_FUN_OBJ_0(machine_soft_reset_obj, machine_soft_reset);
272276

ports/stm32/mpconfigport.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_FLOAT)
7777
#endif
7878
#define MICROPY_USE_INTERNAL_ERRNO (1)
79+
#define MICROPY_SCHED_VM_ABORT (1)
7980
#define MICROPY_SCHEDULER_STATIC_NODES (1)
8081
#define MICROPY_SCHEDULER_DEPTH (8)
8182
#define MICROPY_VFS (1)

0 commit comments

Comments
 (0)
0