BEEP-8 SDK
1.0.0
Loading...
Searching...
No Matches
include
b8
assert.h
1
#pragma once
2
3
#include <stdio.h>
4
#include <
b8/sys.h
>
5
24
#define _ASSERT(expr_, comment_) \
25
do { \
26
if (!(expr_)) { \
27
b8SysPuts("\n=== Assertion failed === "); \
28
b8SysPuts(__FILE__); \
29
b8SysPuts("("); \
30
b8SysPutNum(__LINE__); \
31
b8SysPuts(") "); \
32
b8SysPuts(__func__); \
33
b8SysPuts("() "); \
34
b8SysPuts(comment_); \
35
b8SysPuts("\n"); \
36
void* return_address = __builtin_return_address(0); \
37
b8SysPuts("Caller return address: 0x"); \
38
b8SysPutHex((u32)return_address); \
39
b8SysPuts("\n"); \
40
b8SysPuts("System is now halting. Please check the return address for debugging.\n"); \
41
b8SysPuts("You can analyze this address using the .map or .lst files generated by the application.\n"); \
42
asm("hlt"); \
43
} \
44
} while(0)
45
46
62
#define _NOTIMPL() \
63
do { \
64
printf( "Assertion NOTIMPL %s(%d) %s()\n",__FILE__,__LINE__, __func__ ); \
65
asm("hlt"); \
66
} while(0)
67
82
#define pass(x) \
83
do { \
84
b8SysPuts( "\n[PASS]");\
85
b8SysPuts( __FILE__ );\
86
b8SysPuts( " (");\
87
b8SysPutNum( __LINE__ );\
88
b8SysPuts( ") ");\
89
b8SysPuts( __func__ );\
90
b8SysPuts( "()");\
91
b8SysPutCR(); \
92
} while(0)
93
111
#define trace(x) \
112
do { \
113
b8SysPuts( "\n[TRACE]");\
114
b8SysPuts( __FILE__ );\
115
b8SysPuts( " (");\
116
b8SysPutNum( __LINE__ );\
117
b8SysPuts( ") ");\
118
b8SysPuts( __func__ );\
119
b8SysPuts( "() 0x");\
120
b8SysPutHex((x)); \
121
b8SysPuts( " = ") ; \
122
b8SysPutNum((x));\
123
b8SysPuts( " =" #x); \
124
b8SysPutCR(); \
125
} while(0)
126
sys.h
System utility functions for the BEEP-8 system.
Generated by
1.12.0