diff --git a/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_SDK_15_0/components/libraries/README.md b/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_SDK_15_0/components/libraries/README.md index d1fbd84ee1..9a998afc0d 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_SDK_15_0/components/libraries/README.md +++ b/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_SDK_15_0/components/libraries/README.md @@ -4,6 +4,8 @@ components/libraries # Modifications + * 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. + Only essential folders have been copied over. Removed: diff --git a/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_SDK_15_0/components/libraries/util/app_util_platform.c b/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_SDK_15_0/components/libraries/util/app_util_platform.c index 71690d0fdc..af453651ef 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_SDK_15_0/components/libraries/util/app_util_platform.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_SDK_15_0/components/libraries/util/app_util_platform.c @@ -39,6 +39,8 @@ */ #include "app_util_platform.h" +#include "mbed_critical.h" + #ifdef SOFTDEVICE_PRESENT /* Global nvic state instance, required by nrf_nvic.h */ nrf_nvic_state_t nrf_nvic_state; @@ -71,8 +73,13 @@ void app_util_critical_region_enter(uint8_t *p_nested) /* return value can be safely ignored */ (void) sd_nvic_critical_region_enter(p_nested); #else - app_util_disable_irq(); + /** Mbed modification + * Retarget nRF SDK to use Mbed critical section API + */ + //app_util_disable_irq(); + core_util_critical_section_enter(); #endif + } void app_util_critical_region_exit(uint8_t nested) @@ -85,7 +92,11 @@ void app_util_critical_region_exit(uint8_t nested) /* return value can be safely ignored */ (void) sd_nvic_critical_region_exit(nested); #else - app_util_enable_irq(); + /** Mbed modification + * Retarget nRF SDK to use Mbed critical section API + */ + //app_util_enable_irq(); + core_util_critical_section_exit(); #endif }