stm32/mpconfigport.h: Enable lwIP concurrency protection mechanism.
@@ -357,6 +357,11 @@ static inline mp_uint_t disable_irq(void) {
#define MICROPY_THREAD_YIELD()
#endif
+// The LwIP interface must run at a raised IRQ priority
+#define MICROPY_PY_LWIP_ENTER uint32_t irq_state = raise_irq_pri(IRQ_PRI_PENDSV);
+#define MICROPY_PY_LWIP_REENTER irq_state = raise_irq_pri(IRQ_PRI_PENDSV);
+#define MICROPY_PY_LWIP_EXIT restore_irq_pri(irq_state);
+
// We need an implementation of the log2 function which is not a macro
#define MP_NEED_LOG2 (1)
