circuitpython/shared/runtime
David Grayson c046b23ea2 shared/runtime/pyexec: Don't allow Ctrl+C to interrupt frozen boot code.
Helps prevent the filesystem from getting formatted by mistake, among other
things.  For example, on a Pico board, entering Ctrl+D and Ctrl+C fast many
times will eventually wipe the filesystem (without warning or notice).

Further rationale: Ctrl+C is used a lot by automation scripts (eg mpremote)
and UI's (eg Mu, Thonny) to get the board into a known state.  If the board
is not responding for a short time then it's not possible to know if it's
just a slow start up (eg in _boot.py), or an infinite loop in the main
application.  The former should not be interrupted, but the latter should.
The only way to distinguish these two cases would be to wait "long enough",
and if there's nothing on the serial after "long enough" then assume it's
running the application and Ctrl+C should break out of it.  But defining
"long enough" is impossible for all the different boards and their possible
behaviour.  The solution in this commit is to make it so that frozen
start-up code cannot be interrupted by Ctrl+C.  That code then effectively
acts like normal C start-up code, which also cannot be interrupted.

Note: on the stm32 port this was never seen as an issue because all
start-up code is in C.  But now other ports start to put more things in
_boot.py and so this problem crops up.

Signed-off-by: David Grayson <davidegrayson@gmail.com>
2023-04-05 10:38:50 +10:00
..
gchelper_generic.c shared/runtime/gchelper: Drop cpu directive from ARM asm helpers. 2023-01-28 15:51:38 +11:00
gchelper_native.c shared/runtime/gchelper_native: Fix pointer cast on x86_64. 2022-11-08 19:15:37 +11:00
gchelper_thumb1.s shared/runtime/gchelper: Drop cpu directive from ARM asm helpers. 2023-01-28 15:51:38 +11:00
gchelper_thumb2.s shared/runtime/gchelper: Drop cpu directive from ARM asm helpers. 2023-01-28 15:51:38 +11:00
gchelper.h shared: Introduce new top-level dir and move 1st party lib code there. 2021-07-12 17:07:36 +10:00
interrupt_char.c shared: Introduce new top-level dir and move 1st party lib code there. 2021-07-12 17:07:36 +10:00
interrupt_char.h shared: Introduce new top-level dir and move 1st party lib code there. 2021-07-12 17:07:36 +10:00
mpirq.c shared/runtime: Use mp_printf consistently, instead of printf. 2023-01-24 16:57:26 +11:00
mpirq.h shared: Introduce new top-level dir and move 1st party lib code there. 2021-07-12 17:07:36 +10:00
pyexec.c shared/runtime/pyexec: Don't allow Ctrl+C to interrupt frozen boot code. 2023-04-05 10:38:50 +10:00
pyexec.h shared/runtime/pyexec: Don't allow Ctrl+C to interrupt frozen boot code. 2023-04-05 10:38:50 +10:00
semihosting.c shared: Introduce new top-level dir and move 1st party lib code there. 2021-07-12 17:07:36 +10:00
semihosting.h shared: Introduce new top-level dir and move 1st party lib code there. 2021-07-12 17:07:36 +10:00
softtimer.c shared/runtime/softtimer: Fix ticks range when computing ticks diff. 2023-02-17 12:17:28 +11:00
softtimer.h shared/runtime/softtimer: Move softtimer.[ch] to shared/runtime. 2022-07-19 12:28:26 +10:00
stdout_helpers.c shared: Introduce new top-level dir and move 1st party lib code there. 2021-07-12 17:07:36 +10:00
sys_stdio_mphal.c py/obj: Convert make_new into a mp_obj_type_t slot. 2022-09-19 19:06:15 +10:00