85 #ifndef FOXBMS__FASSERT_H_
86 #define FOXBMS__FASSERT_H_
100 #pragma SWI_ALIAS(FAS_DisableInterrupts, 5)
110 #define FAS_TRAP (0u == 1u)
154 #define ASSERT_LEVEL_INF_LOOP_AND_DISABLE_INTERRUPTS (0u)
155 #define ASSERT_LEVEL_INF_LOOP_FOR_DEBUG (1u)
156 #define ASSERT_LEVEL_NO_OP (2u)
163 #define ASSERT_LEVEL ASSERT_LEVEL_INF_LOOP_AND_DISABLE_INTERRUPTS
167 #if ASSERT_LEVEL == ASSERT_LEVEL_INF_LOOP_AND_DISABLE_INTERRUPTS
175 #elif ASSERT_LEVEL == ASSERT_LEVEL_INF_LOOP_FOR_DEBUG
182 #elif ASSERT_LEVEL == ASSERT_LEVEL_NO_OP
186 #error "Invalid value for ASSERT_LEVEL"
191 #ifdef UNITY_UNIT_TEST
209 #define FAS_ASSERT_RECORD() \
211 void *pc = __curpc(); \
212 fas_storeAssertLoc(pc, __LINE__); \
233 #ifdef UNITY_UNIT_TEST
234 #include "CException.h"
235 #define FAS_ASSERT(x) \
239 #define FAS_ASSERT(x) \
242 FAS_ASSERT_RECORD(); \
243 FAS_InfiniteLoop(); \
254 #define static_assert(cond, msg) _Static_assert(cond, msg)
static uint32_t __curpc(void)
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.
void FAS_DisableInterrupts(void)
Disable interrupts.
static void FAS_InfiniteLoop(void)
Struct for storing assert information.