rp2: Allow disabling thread support

This commit is contained in:
2024-04-30 13:57:33 +02:00
parent 3b581fbae8
commit a14f90af2f
2 changed files with 7 additions and 0 deletions

View File

@@ -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)

View File

@@ -36,9 +36,14 @@
#define SYSTICK_MAX (0xffffff)
#define MICROPY_HW_USB_CDC_TX_TIMEOUT (500)
#if MICROPY_PY_THREAD
// Entering a critical section.
#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()