Skip to content

Commit f098bae

Browse files
committed
NRF5x: rationalise sleep+critical
This follows up from previous closed PRs #8366 and #9211, in an attempt to fix the issue originally reported as #5647. As discussed in those PRs, the sleep behaviour of the NRF5x family is apparently unsafe, at least for the cases where the SoftDevice is disabled. This commit fixes it up by: * Collapsing down to 1 implementation, from 3. * Using standard PRIMASK disable when SoftDevice is disabled. * Using standard WFI when SoftDevice is disabled. This commit shouldn't change the functionality for when it is enabled - it retains the "SEVONPEND" and "FPU pending" fudges. If SoftDevice is enabled, we continue to hope that its sd_app_evt_wait() call does the Right Thing(TM). However, this seems unlikely, as documentation and the "nosd" stubs visible suggests they just do a "WFE", when we are looking for a "WFI" equivalent. Or it's possible their real implementation does the unsafe and racy "SEV; WFE; WFE;" sequence. Comments added to clarify what we are hoping for from SoftDevice.
1 parent 0bc9bcc commit f098bae

File tree

10 files changed

+318
-498
lines changed

10 files changed

+318
-498
lines changed

features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NORDIC_SOFTDEVICE/TARGET_MCU_NRF51822/hal_patch/critical_section_api.c

Lines changed: 0 additions & 84 deletions
This file was deleted.

features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NORDIC_SOFTDEVICE/TARGET_MCU_NRF51822/hal_patch/sleep.c

Lines changed: 0 additions & 71 deletions
This file was deleted.

targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF51/nordic_critical.c

Lines changed: 0 additions & 107 deletions
This file was deleted.

targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF51/sleep.c

Lines changed: 0 additions & 93 deletions
This file was deleted.

0 commit comments

Comments
 (0)