Skip to content

Commit 84391f0

Browse files
author
Steven Cartmell
committed
Remove invalid assert and move uVisor warning to correct function
1 parent 3c9ae7b commit 84391f0

File tree

2 files changed

+11
-14
lines changed

2 files changed

+11
-14
lines changed

hal/mbed_critical_section_api.c

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,30 +36,17 @@ MBED_WEAK void hal_critical_section_enter(void)
3636
{
3737
critical_interrupts_enabled = are_interrupts_enabled();
3838

39-
#ifndef FEATURE_UVISOR
40-
// If we are in a nested critical section and interrupts are still enabled
41-
// something has gone wrong.
42-
MBED_ASSERT(!are_interrupts_enabled());
43-
#else
44-
#warning "core_util_critical_section_enter needs fixing to work from unprivileged code"
45-
#endif /* FEATURE_UVISOR */
46-
4739
__disable_irq();
4840
}
4941

5042

5143
MBED_WEAK void hal_critical_section_exit()
5244
{
53-
// FIXME
54-
#ifndef FEATURE_UVISOR
5545
// Interrupts must be disabled on invoking an exit from a critical section
5646
MBED_ASSERT(!are_interrupts_enabled());
57-
#else
58-
#warning "core_util_critical_section_exit needs fixing to work from unprivileged code"
59-
#endif /* FEATURE_UVISOR */
6047

6148
// Restore the IRQs to their state prior to entering the critical section
6249
if (critical_interrupts_enabled == true) {
63-
__enable_irq();
50+
__enable_irq();
6451
}
6552
}

platform/mbed_critical.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ bool core_util_in_critical_section(void)
5858

5959
void core_util_critical_section_enter(void)
6060
{
61+
// FIXME
62+
#ifdef FEATURE_UVISOR
63+
#warning "core_util_critical_section_enter needs fixing to work from unprivileged code"
64+
#endif /* FEATURE_UVISOR */
65+
6166
// If the reentrancy counter overflows something has gone badly wrong.
6267
MBED_ASSERT(critical_section_reentrancy_counter < UINT32_MAX);
6368

@@ -70,6 +75,11 @@ void core_util_critical_section_enter(void)
7075

7176
void core_util_critical_section_exit(void)
7277
{
78+
// FIXME
79+
#ifdef FEATURE_UVISOR
80+
#warning "core_util_critical_section_exit needs fixing to work from unprivileged code"
81+
#endif /* FEATURE_UVISOR */
82+
7383
// If critical_section_enter has not previously been called, do nothing
7484
if (critical_section_reentrancy_counter == 0) {
7585
return;

0 commit comments

Comments
 (0)