diff options
author | Damien George <damien@micropython.org> | 2024-01-16 11:36:27 +1100 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2024-01-16 11:42:47 +1100 |
commit | efa54c27b9eab3b61319e7f16d05db0ac3b6bc14 (patch) | |
tree | c936ec511159da37e5e807d6dc7b4dd552064b9e | |
parent | a70367e293a2293918a3649dc8c6f875c39543cd (diff) |
rp2/mpconfigport: Allow MICROPY_PY_THREAD to be disabled by a board.
Signed-off-by: Damien George <damien@micropython.org>
-rw-r--r-- | ports/rp2/mpconfigport.h | 2 | ||||
-rw-r--r-- | ports/rp2/mphalport.h | 5 |
2 files changed, 7 insertions, 0 deletions
diff --git a/ports/rp2/mpconfigport.h b/ports/rp2/mpconfigport.h index ce89763d5..8f073002e 100644 --- a/ports/rp2/mpconfigport.h +++ b/ports/rp2/mpconfigport.h @@ -89,9 +89,11 @@ // Fine control over Python builtins, classes, modules, etc #define MICROPY_PY_BUILTINS_HELP_TEXT rp2_help_text #define MICROPY_PY_SYS_PLATFORM "rp2" +#ifndef MICROPY_PY_THREAD #define MICROPY_PY_THREAD (1) #define MICROPY_PY_THREAD_GIL (0) #define MICROPY_THREAD_YIELD() mp_handle_pending(true) +#endif // Extended modules #define MICROPY_EPOCH_IS_1970 (1) diff --git a/ports/rp2/mphalport.h b/ports/rp2/mphalport.h index c8e2301a9..d2d74d783 100644 --- a/ports/rp2/mphalport.h +++ b/ports/rp2/mphalport.h @@ -37,8 +37,13 @@ #define MICROPY_HW_USB_CDC_TX_TIMEOUT (500) // Entering a critical section. +#if MICROPY_PY_THREAD #define MICROPY_BEGIN_ATOMIC_SECTION() mp_thread_begin_atomic_section() #define MICROPY_END_ATOMIC_SECTION(state) mp_thread_end_atomic_section(state) +#else +#define MICROPY_BEGIN_ATOMIC_SECTION() save_and_disable_interrupts() +#define MICROPY_END_ATOMIC_SECTION(state) restore_interrupts(state) +#endif #define MICROPY_PY_PENDSV_ENTER pendsv_suspend() #define MICROPY_PY_PENDSV_EXIT pendsv_resume() |