1#ifndef SBL_COMMON_ASSERT_HPP_
2#define SBL_COMMON_ASSERT_HPP_
44#ifndef SBL_FAULT_OUTPUT
47 #if SBL_LOG_HW_DEFAULTS_AVAILABLE
48 #define SBL_FAULT_OUTPUT sbl::log::UartFaultOutput
53 static void write(
const char*) {}
56 #define SBL_FAULT_OUTPUT sbl::fault::detail::NullFaultOutput
70[[noreturn]]
inline void panic(
const char* msg,
const char* file,
int line) {
71 __asm
volatile(
"cpsid i");
74 sbl::log::format(buf,
sizeof(buf),
"\r\n!!! %s\r\n at %s:%d\r\n", msg, file, line);
75 SBL_FAULT_OUTPUT::write(buf);
78 __asm
volatile(
"bkpt #0");
88#define SBL_PANIC(msg) sbl::fault::panic("PANIC: " msg, __FILE__, __LINE__)
90#ifndef SBL_ASSERT_ENABLED
91 #define SBL_ASSERT_ENABLED 1
95 #define SBL_ASSERT(cond) \
98 sbl::fault::panic("ASSERT FAILED: " #cond, __FILE__, __LINE__); \
102 #define SBL_ASSERT(cond) ((void)0)
Default logger output sink and timestamp provider.
void panic(const char *msg, const char *file, int line)
Halt with a diagnostic message. Does not return.
int format(char *buf, size_t size, const char *fmt,...)
Format a string into a buffer (snprintf-style)
static void write(const char *)