summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAngus Gratton <angus@redyak.com.au>2023-11-30 16:45:11 +1100
committerDamien George <damien@micropython.org>2023-12-08 12:49:49 +1100
commit393938b3e61ee34b47773766a91a45d3beea6294 (patch)
treea5e2370da1ba642641bb1eca242f665f3d6dc325
parent28529351aebe45c24e982eaecdba2383d05d2dd4 (diff)
rp2/main: Enable SEVONPEND CPU interrupt bit.
Previously this was not set, so potential for race conditions in interrupt handlers this didn't issue SEV. (Which is currently all of them, as far as I can see.) Eventually we might be able to augment the interrupt handlers that wake the main thread to call SEV, and leave the others as-is to suspend the CPU slightly faster, but this will solve the issue for now. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
-rw-r--r--ports/rp2/main.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/ports/rp2/main.c b/ports/rp2/main.c
index 43680a46c..8b41fac4b 100644
--- a/ports/rp2/main.c
+++ b/ports/rp2/main.c
@@ -73,6 +73,9 @@ bi_decl(bi_program_feature_group_with_flags(BINARY_INFO_TAG_MICROPYTHON,
BI_NAMED_GROUP_SEPARATE_COMMAS | BI_NAMED_GROUP_SORT_ALPHA));
int main(int argc, char **argv) {
+ // This is a tickless port, interrupts should always trigger SEV.
+ SCB->SCR |= SCB_SCR_SEVONPEND_Msk;
+
#if MICROPY_HW_ENABLE_UART_REPL
bi_decl(bi_program_feature("UART REPL"))
setup_default_uart();