circuitpython/shared
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
..
libc py/mpconfig: Provide config option for internal printf printer. 2023-03-10 11:19:15 +11:00
memzip all: Update to point to files in new shared/ directory. 2021-07-12 17:08:10 +10:00
netutils shared/netutils: Add "py/obj.h" header include. 2022-11-11 15:43:53 +11:00
readline shared/readline: Use MP_REGISTER_ROOT_POINTER(). 2022-07-18 13:48:49 +10:00
runtime shared/runtime/pyexec: Don't allow Ctrl+C to interrupt frozen boot code. 2023-04-05 10:38:50 +10:00
timeutils mimxrt/machine_rtc: Start RTC at boot and set datetime if not set. 2022-04-11 12:25:23 +10:00
tinyusb shared/tinyusb: Allow max USB descriptor string to be configured. 2023-04-04 11:57:25 +10:00
upytesthelper ports: Add '.frozen' as the first entry in sys.path. 2021-12-18 00:08:07 +11:00
README.md lib,shared: Update README's based on contents of these dirs. 2021-07-13 00:17:02 +10:00

This directory contains libraries, utilities and helper code developed specifically for this project. The code is intended to be portable and usable by any port.