Merge pull request #5597 from 0xc0170/fix_#5555

critical: fix set exclusive access if not yet defined
pull/5880/head
Cruz Monrreal 2018-01-17 14:47:34 -06:00 committed by GitHub
commit bb8ab663f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 20 additions and 1 deletions

View File

@ -24,6 +24,25 @@
#include "platform/mbed_critical.h" #include "platform/mbed_critical.h"
#include "platform/mbed_toolchain.h" #include "platform/mbed_toolchain.h"
// if __EXCLUSIVE_ACCESS rtx macro not defined, we need to get this via own-set architecture macros
#ifndef MBED_EXCLUSIVE_ACCESS
#ifndef __EXCLUSIVE_ACCESS
#if ((__ARM_ARCH_7M__ == 1U) || \
(__ARM_ARCH_7EM__ == 1U) || \
(__ARM_ARCH_8M_BASE__ == 1U) || \
(__ARM_ARCH_8M_MAIN__ == 1U)) || \
(__ARM_ARCH_7A__ == 1U)
#define MBED_EXCLUSIVE_ACCESS 1U
#elif (__ARM_ARCH_6M__ == 1U)
#define MBED_EXCLUSIVE_ACCESS 0U
#else
#error "Unknown architecture for exclusive access"
#endif
#else
#define MBED_EXCLUSIVE_ACCESS __EXCLUSIVE_ACCESS
#endif
#endif
static volatile uint32_t critical_section_reentrancy_counter = 0; static volatile uint32_t critical_section_reentrancy_counter = 0;
bool core_util_are_interrupts_enabled(void) bool core_util_are_interrupts_enabled(void)
@ -90,7 +109,7 @@ void core_util_critical_section_exit(void)
} }
} }
#if __EXCLUSIVE_ACCESS #if MBED_EXCLUSIVE_ACCESS
/* Supress __ldrex and __strex deprecated warnings - "#3731-D: intrinsic is deprecated" */ /* Supress __ldrex and __strex deprecated warnings - "#3731-D: intrinsic is deprecated" */
#if defined (__CC_ARM) #if defined (__CC_ARM)