85 #ifndef FOXBMS__FASSERT_H_
86 #define FOXBMS__FASSERT_H_
99 #pragma SWI_ALIAS(FAS_DisableInterrupts, 5)
108 #define FAS_TRAP (0u == 1u)
152 #define ASSERT_LEVEL_INF_LOOP_AND_DISABLE_INTERRUPTS (0u)
153 #define ASSERT_LEVEL_INF_LOOP_FOR_DEBUG (1u)
154 #define ASSERT_LEVEL_NO_OP (2u)
161 #define ASSERT_LEVEL ASSERT_LEVEL_INF_LOOP_AND_DISABLE_INTERRUPTS
165 #if ASSERT_LEVEL == ASSERT_LEVEL_INF_LOOP_AND_DISABLE_INTERRUPTS
173 #elif ASSERT_LEVEL == ASSERT_LEVEL_INF_LOOP_FOR_DEBUG
180 #elif ASSERT_LEVEL == ASSERT_LEVEL_NO_OP
184 #error "Invalid value for ASSERT_LEVEL"
189 #ifdef UNITY_UNIT_TEST
194 static inline uint32_t __curpc(
void) {
207 #define FAS_ASSERT_RECORD() \
209 void *pc = __curpc(); \
210 fas_storeAssertLoc(pc, __LINE__); \
231 #ifdef UNITY_UNIT_TEST
232 #include "CException.h"
233 #define FAS_ASSERT(x) \
237 #define FAS_ASSERT(x) \
240 FAS_ASSERT_RECORD(); \
241 FAS_infiniteLoop(); \
252 #define static_assert(cond, msg) _Static_assert(cond, msg)
ASSERT_LOC_s fas_assertLocation
Stores the information on the last assert.
struct ASSERT_LOC ASSERT_LOC_s
Struct for storing assert information.
void fas_storeAssertLoc(uint32_t *pc, uint32_t line)
Copy the assert location into the assert struct.
static void FAS_infiniteLoop()
void FAS_DisableInterrupts(void)
Disable interrupts.
Struct for storing assert information.