mirror of
https://github.com/licsber/micropython.git
synced 2024-09-19 16:40:23 +08:00
py/mphal: Move configuration of ATOMIC_SECTION macros to mphal.h.
MICROPY_BEGIN_ATOMIC_SECTION/MICROPY_END_ATOMIC_SECTION belong more to the MicroPython HAL rather than build configuration settings, so move their default configuration to py/mphal.h, and require all users of these macros to include py/mphal.h (here, py/objexcept.c and py/scheduler.c). This helps ports separate configuration from their HAL implementations, and can improve build times (because mpconfig.h is included everywhere, whereas mphal.h is not). Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
parent
7d784e5385
commit
bfdf500ea5
@ -1850,14 +1850,6 @@ typedef double mp_float_t;
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// On embedded platforms, these will typically enable/disable irqs.
|
|
||||||
#ifndef MICROPY_BEGIN_ATOMIC_SECTION
|
|
||||||
#define MICROPY_BEGIN_ATOMIC_SECTION() (0)
|
|
||||||
#endif
|
|
||||||
#ifndef MICROPY_END_ATOMIC_SECTION
|
|
||||||
#define MICROPY_END_ATOMIC_SECTION(state) (void)(state)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Allow to override static modifier for global objects, e.g. to use with
|
// Allow to override static modifier for global objects, e.g. to use with
|
||||||
// object code analysis tools which don't support static symbols.
|
// object code analysis tools which don't support static symbols.
|
||||||
#ifndef STATIC
|
#ifndef STATIC
|
||||||
|
@ -35,6 +35,14 @@
|
|||||||
#include <mphalport.h>
|
#include <mphalport.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// On embedded platforms, these will typically enable/disable irqs.
|
||||||
|
#ifndef MICROPY_BEGIN_ATOMIC_SECTION
|
||||||
|
#define MICROPY_BEGIN_ATOMIC_SECTION() (0)
|
||||||
|
#endif
|
||||||
|
#ifndef MICROPY_END_ATOMIC_SECTION
|
||||||
|
#define MICROPY_END_ATOMIC_SECTION(state) (void)(state)
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef mp_hal_stdio_poll
|
#ifndef mp_hal_stdio_poll
|
||||||
uintptr_t mp_hal_stdio_poll(uintptr_t poll_flags);
|
uintptr_t mp_hal_stdio_poll(uintptr_t poll_flags);
|
||||||
#endif
|
#endif
|
||||||
|
@ -81,6 +81,8 @@ void mp_init_emergency_exception_buf(void) {
|
|||||||
#else
|
#else
|
||||||
#define mp_emergency_exception_buf_size MP_STATE_VM(mp_emergency_exception_buf_size)
|
#define mp_emergency_exception_buf_size MP_STATE_VM(mp_emergency_exception_buf_size)
|
||||||
|
|
||||||
|
#include "py/mphal.h" // for MICROPY_BEGIN_ATOMIC_SECTION/MICROPY_END_ATOMIC_SECTION
|
||||||
|
|
||||||
void mp_init_emergency_exception_buf(void) {
|
void mp_init_emergency_exception_buf(void) {
|
||||||
mp_emergency_exception_buf_size = 0;
|
mp_emergency_exception_buf_size = 0;
|
||||||
MP_STATE_VM(mp_emergency_exception_buf) = NULL;
|
MP_STATE_VM(mp_emergency_exception_buf) = NULL;
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "py/mphal.h"
|
||||||
#include "py/runtime.h"
|
#include "py/runtime.h"
|
||||||
|
|
||||||
// Schedules an exception on the main thread (for exceptions "thrown" by async
|
// Schedules an exception on the main thread (for exceptions "thrown" by async
|
||||||
|
Loading…
Reference in New Issue
Block a user