summaryrefslogtreecommitdiff
path: root/ports/zephyr/machine_i2c_target.c
diff options
context:
space:
mode:
authorChris Webb <chris@arachsys.com>2025-09-09 15:40:51 +0100
committerDamien George <damien.p.george@gmail.com>2025-09-25 23:59:24 +1000
commit81985d20c98e1550c355263f1d6c7bd6150ee0b4 (patch)
tree94a7e824b29d4fdbc41fb75cfed91d1bbb2ed693 /ports/zephyr/machine_i2c_target.c
parentb9523fd58c02dba74239015bf6b2a1983342a06b (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 'ports/zephyr/machine_i2c_target.c')
-rw-r--r--ports/zephyr/machine_i2c_target.c7
1 files changed, 0 insertions, 7 deletions
diff --git a/ports/zephyr/machine_i2c_target.c b/ports/zephyr/machine_i2c_target.c
index 236f13348..c7786e7df 100644
--- a/ports/zephyr/machine_i2c_target.c
+++ b/ports/zephyr/machine_i2c_target.c
@@ -114,14 +114,7 @@ static inline size_t mp_machine_i2c_target_get_index(machine_i2c_target_obj_t *s
}
static void mp_machine_i2c_target_event_callback(machine_i2c_target_irq_obj_t *irq) {
- char dummy;
- void *orig_top = MP_STATE_THREAD(stack_top);
- mp_uint_t orig_limit = MP_STATE_THREAD(stack_limit);
- MP_STATE_THREAD(stack_top) = &dummy;
- MP_STATE_THREAD(stack_limit) = CONFIG_ISR_STACK_SIZE - 512;
mp_irq_handler(&irq->base);
- MP_STATE_THREAD(stack_top) = orig_top;
- MP_STATE_THREAD(stack_limit) = orig_limit;
}
static size_t mp_machine_i2c_target_read_bytes(machine_i2c_target_obj_t *self, size_t len, uint8_t *buf) {