2018-05-10 23:10:35 +02:00
|
|
|
#pragma once
|
|
|
|
|
2018-05-13 16:29:15 +02:00
|
|
|
#if defined (__cplusplus)
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2018-05-10 23:10:35 +02:00
|
|
|
#include <signal.h>
|
|
|
|
|
|
|
|
enum { HAVE_TRAP_INSTRUCTION = 1, };
|
|
|
|
__attribute__((gnu_inline, always_inline))
|
|
|
|
__inline__ static void DEBUG_BREAK(void)
|
|
|
|
{
|
|
|
|
__asm__ volatile(".inst 0xe7f001f0");
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef DEBUG_BUILD
|
|
|
|
#define assert(expr) \
|
|
|
|
if( expr ){} \
|
|
|
|
else \
|
|
|
|
{ \
|
|
|
|
printf("Assert failed: %s\n" \
|
|
|
|
"File: %s\n" \
|
|
|
|
"Line: %i\n", #expr, __FILE__, __LINE__); \
|
|
|
|
DEBUG_BREAK(); \
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
#define assert(expr) //do nothing
|
|
|
|
#endif
|
2018-05-13 16:29:15 +02:00
|
|
|
|
|
|
|
#if defined (__cplusplus)
|
|
|
|
}
|
|
|
|
#endif
|