Skip to content

Commit d71db32

Browse files
authored
Merge pull request #10881 from AGlass0fMilk/fix-nrf52-critical-region-api
Fix Nordic/Mbed Critical Section API Inconsistency (In Builds w/o Softdevice)
2 parents 6be510d + 15cd907 commit d71db32

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_SDK_15_0/components/libraries/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ components/libraries
44

55
# Modifications
66

7+
* Modified util/app_util_platform.c to retarget critical section enter/exit calls to Mbed's HAL API so they both share the same nested critical regions counter. This only applies in builds without `SOFTDEVICE_PRESENT` defined.
8+
79
Only essential folders have been copied over.
810

911
Removed:

targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_SDK_15_0/components/libraries/util/app_util_platform.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939
*/
4040
#include "app_util_platform.h"
4141

42+
#include "mbed_critical.h"
43+
4244
#ifdef SOFTDEVICE_PRESENT
4345
/* Global nvic state instance, required by nrf_nvic.h */
4446
nrf_nvic_state_t nrf_nvic_state;
@@ -71,8 +73,13 @@ void app_util_critical_region_enter(uint8_t *p_nested)
7173
/* return value can be safely ignored */
7274
(void) sd_nvic_critical_region_enter(p_nested);
7375
#else
74-
app_util_disable_irq();
76+
/** Mbed modification
77+
* Retarget nRF SDK to use Mbed critical section API
78+
*/
79+
//app_util_disable_irq();
80+
core_util_critical_section_enter();
7581
#endif
82+
7683
}
7784

7885
void app_util_critical_region_exit(uint8_t nested)
@@ -85,7 +92,11 @@ void app_util_critical_region_exit(uint8_t nested)
8592
/* return value can be safely ignored */
8693
(void) sd_nvic_critical_region_exit(nested);
8794
#else
88-
app_util_enable_irq();
95+
/** Mbed modification
96+
* Retarget nRF SDK to use Mbed critical section API
97+
*/
98+
//app_util_enable_irq();
99+
core_util_critical_section_exit();
89100
#endif
90101
}
91102

0 commit comments

Comments
 (0)