86 #ifndef FOXBMS__FASSERT_H_
87 #define FOXBMS__FASSERT_H_
105 #pragma SWI_ALIAS(FAS_DisableInterrupts, 5)
115 #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_OPERATION (2u)
163 #define ASSERT_LEVEL ASSERT_LEVEL_INF_LOOP_AND_DISABLE_INTERRUPTS
167 #if ASSERT_LEVEL == ASSERT_LEVEL_INF_LOOP_AND_DISABLE_INTERRUPTS
176 #elif ASSERT_LEVEL == ASSERT_LEVEL_INF_LOOP_FOR_DEBUG
183 #elif ASSERT_LEVEL == ASSERT_LEVEL_NO_OPERATION
187 #error "Invalid value for ASSERT_LEVEL"
192 #ifdef UNITY_UNIT_TEST
210 #define FAS_ASSERT_RECORD() \
214 uint32_t *pc = (uint32_t *)__curpc(); \
215 FAS_StoreAssertLocation(pc, __LINE__); \
236 #ifdef UNITY_UNIT_TEST
237 #include "CException.h"
238 #define FAS_ASSERT(x) \
242 #define FAS_ASSERT(x) \
245 FAS_ASSERT_RECORD(); \
246 FAS_InfiniteLoop(); \
251 #if defined(__STDC_VERSION__)
252 #if __STDC_VERSION__ == 199409L
253 #warning "Ignoring static asserts in C94 mode (f_static_assert)."
254 #define f_static_assert(cond, msg)
255 #elif __STDC_VERSION__ == 199901L
256 #if defined(__TI_COMPILER_VERSION__)
258 #define f_static_assert(cond, msg) _Static_assert(cond, msg)
260 #warning "Ignoring static asserts in C99 mode (f_static_assert)."
261 #define f_static_assert(...)
263 #elif __STDC_VERSION__ == 201112L
264 #define f_static_assert(cond, msg) _Static_assert(cond, msg)
265 #elif __STDC_VERSION__ == 201710L
266 #define f_static_assert(cond, msg) _Static_assert(cond, msg)
271 #warning "Ignoring static asserts in C89/C90 mode (f_static_assert)."
272 #define f_static_assert(cond, msg)
static uint32_t __curpc(void)
void FAS_StoreAssertLocation(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.