Skip to content

Commit 974ecf7

Browse files
committed
Merge pull request #1829 from mbedmicro/fix_critical_assert
Critical - use mbed assert
2 parents cb6300e + 5e62c37 commit 974ecf7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

hal/common/critical.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#include <stdint.h>
2020
#include <stddef.h>
2121
#include "cmsis.h"
22-
#include <assert.h>
22+
#include "mbed_assert.h"
2323

2424
// Module include
2525
#include "critical.h"
@@ -40,9 +40,9 @@ void core_util_critical_section_enter()
4040
/* If the interrupt_enable_counter overflows or we are in a nested critical section and interrupts
4141
are enabled, then something has gone badly wrong thus assert an error.
4242
*/
43-
assert(interrupt_enable_counter < UINT32_MAX);
43+
MBED_ASSERT(interrupt_enable_counter < UINT32_MAX);
4444
if (interrupt_enable_counter > 0) {
45-
assert(primask & 0x1);
45+
MBED_ASSERT(primask & 0x1);
4646
}
4747
interrupt_enable_counter++;
4848
}
@@ -54,7 +54,7 @@ void core_util_critical_section_exit()
5454

5555
uint32_t primask = __get_PRIMASK(); /* get the current interrupt enabled state */
5656

57-
assert(primask & 0x1); /* Interrupts must be disabled on invoking an exit from a critical section */
57+
MBED_ASSERT(primask & 0x1); /* Interrupts must be disabled on invoking an exit from a critical section */
5858

5959
interrupt_enable_counter--;
6060

0 commit comments

Comments
 (0)