Skip to content

Commit fd4ef23

Browse files
committed
nrf: port: add memory barrier before wfi
ARM recommends issuing a DSB instruction propr to issuing WFI, as it is required on many parts suchas Cortex-M7. This is effectively a no-op on the Cortex-M4 used in most NRF parts, however it ensures that we won't be surprised when new parts come out. See http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dai0321a/BIHICBGB.html for more information. Signed-off-by: Sean Cross <sean@xobs.io>
1 parent 77cf4dc commit fd4ef23

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

ports/nrf/supervisor/port.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,10 @@ void port_sleep_until_interrupt(void) {
273273
// available, even though the actual handler won't fire until
274274
// we re-enable interrupts.
275275
common_hal_mcu_disable_interrupts();
276-
if (!tud_task_event_ready())
276+
if (!tud_task_event_ready()) {
277+
__DSB();
277278
__WFI();
279+
}
278280
common_hal_mcu_enable_interrupts();
279281
}
280282
}

0 commit comments

Comments
 (0)