diff options
| author | Chris Webb <chris@arachsys.com> | 2025-09-09 15:40:51 +0100 |
|---|---|---|
| committer | Damien George <damien.p.george@gmail.com> | 2025-09-25 23:59:24 +1000 |
| commit | 81985d20c98e1550c355263f1d6c7bd6150ee0b4 (patch) | |
| tree | 94a7e824b29d4fdbc41fb75cfed91d1bbb2ed693 /py | |
| parent | b9523fd58c02dba74239015bf6b2a1983342a06b (diff) | |
shared/runtime/mpirq: Check separate hard IRQ stack correctly.
On the zephyr port, hard IRQ handlers run with a separate stack on a
different thread, so each call to mp_irq_dispatch() and mp_irq_handler()
has to be wrapped with adjustments to the stack-limit checker.
Move these adjustments into the shared mp_irq_dispatch(), introducing
MICROPY_STACK_SIZE_HARD_IRQ which a port can define to non-zero if it
uses a separate stack for hard IRQ handlers. We only need wrap the hard
dispatch case. This should reduce binary size on zephyr without affecting
other ports.
Signed-off-by: Chris Webb <chris@arachsys.com>
Diffstat (limited to 'py')
| -rw-r--r-- | py/mpconfig.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/py/mpconfig.h b/py/mpconfig.h index ae44b461d..f4b7c1058 100644 --- a/py/mpconfig.h +++ b/py/mpconfig.h @@ -717,6 +717,13 @@ #define MICROPY_STACK_CHECK_MARGIN (0) #endif +// The size of a separate stack used for hard IRQ handlers, which should be +// checked instead of the main stack when running a hard callback. 0 implies +// there is no separate ISR stack to check. +#ifndef MICROPY_STACK_SIZE_HARD_IRQ +#define MICROPY_STACK_SIZE_HARD_IRQ (0) +#endif + // Whether to have an emergency exception buffer #ifndef MICROPY_ENABLE_EMERGENCY_EXCEPTION_BUF #define MICROPY_ENABLE_EMERGENCY_EXCEPTION_BUF (0) |
