critical: fix set exclusive access if not yet defined

Fixes #5555 bug.
In case there is not yet defined __EXCLUSIVE_ACCESS, neither MBED_EXCLUSIVE_ACCESS that
we are introducing, use architecture macros to find out if MBED_EXCLUSIVE_ACCESS can be
enabled.
pull/5597/head
Martin Kojtal 2017-11-28 10:32:07 +00:00
parent 635a82495c
commit b37f24a2cd
1 changed files with 16 additions and 1 deletions

View File

@ -24,6 +24,21 @@
#include "platform/mbed_critical.h"
#include "platform/mbed_toolchain.h"
// if __EXCLUSIVE_ACCESS rtx macro not defined, we need to get this via own-set architecture macros
#ifndef __EXCLUSIVE_ACCESS
#ifndef MBED_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
#else
#define MBED_EXCLUSIVE_ACCESS 0U
#endif
#endif
#endif
static volatile uint32_t critical_section_reentrancy_counter = 0;
bool core_util_are_interrupts_enabled(void)
@ -90,7 +105,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" */
#if defined (__CC_ARM)