rp2/cyw43_configport: Make cyw43_delay_ms() a busy loop.

Currently, `cyw43_delay_ms()` calls `mp_hal_delay_ms()` which uses PendSV
to set up a timer and wait for an interrupt, using wfe.  But in the cyw43
initialisation stage PendSV is disabled and so this delay suspends on the
wfe instruction for an indefinite amount of time.

Work around this by changing the implementation of `cyw43_delay_ms()` to a
busy loop.

Fixes issue #15220.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George 2024-06-07 11:43:06 +10:00
parent 3c8089d1b1
commit 80a4f632ee

View File

@ -117,7 +117,12 @@ static inline void cyw43_delay_us(uint32_t us) {
}
static inline void cyw43_delay_ms(uint32_t ms) {
mp_hal_delay_ms(ms);
// PendSV may be disabled via CYW43_THREAD_ENTER, so this delay is a busy loop.
uint32_t us = ms * 1000;
uint32_t start = mp_hal_ticks_us();
while (mp_hal_ticks_us() - start < us) {
mp_event_handle_nowait();
}
}
#define CYW43_EVENT_POLL_HOOK mp_event_handle_nowait()