RV32 SoC DS UG
High-Perf RV32 SoC DS UG
RV64 SoC DS UG API and Examples
Embedded IDE UG
Loading...
Searching...
No Matches
Debug API Functions

Overview

Logging macros and runtime assertion.

Macros

#define BSP_ASSERT(cond, msg)
 Assert a condition. Prints message and halts on failure.
#define LOG_INFO(mod, fmt, ...)
 Log an informational message (green).
#define LOG_WARN(mod, fmt, ...)
 Log a warning message (yellow).
#define LOG_ERR(mod, fmt, ...)
 Log an error message (red).

Macro Definition Documentation

◆ BSP_ASSERT

#define BSP_ASSERT ( cond,
msg )

#include <debug.h>

Value:
do { \
if (!(cond)) { \
const char *_p = (msg); \
while (*_p) bsp_putChar(*_p++); \
while (1); \
} \
} while (0)
#define bsp_putChar(c)
Map standard character output to the physical UART.
Definition bsp.h:95
const char msg[]
Definition syscall.h:38

Assert a condition. Prints message and halts on failure.

Parameters
condCondition to evaluate.
msgNull-terminated string to print on failure.

Definition at line 218 of file debug.h.

◆ LOG_ERR

#define LOG_ERR ( mod,
fmt,
... )

#include <debug.h>

Value:
do { \
if (SHOULD_LOG(mod, DBG_LVL_ERR)) \
printf(ANSI_RED "ERR: " fmt ANSI_RESET "\n", ##__VA_ARGS__); \
} while (0)
#define ANSI_RED
Red text.
Definition debug.h:111
#define ANSI_RESET
Reset to default color.
Definition debug.h:110
#define DBG_LVL_ERR
Show Error only.
Definition debug.h:174

Log an error message (red).

Parameters
modModule flag — see Debug Modules.
fmtPrintf-style format string.
...Format arguments.

Definition at line 257 of file debug.h.

◆ LOG_INFO

#define LOG_INFO ( mod,
fmt,
... )

#include <debug.h>

Value:
do { \
if (SHOULD_LOG(mod, DBG_LVL_ALL)) \
printf(ANSI_GREEN "INFO: " fmt ANSI_RESET "\n", ##__VA_ARGS__); \
} while (0)
#define ANSI_GREEN
Green text.
Definition debug.h:112
#define DBG_LVL_ALL
Show Info, Warn, and Error.
Definition debug.h:172

Log an informational message (green).

Parameters
modModule flag — see Debug Modules.
fmtPrintf-style format string.
...Format arguments.

Definition at line 233 of file debug.h.

◆ LOG_WARN

#define LOG_WARN ( mod,
fmt,
... )

#include <debug.h>

Value:
do { \
if (SHOULD_LOG(mod, DBG_LVL_WARN)) \
printf(ANSI_YELLOW "WRN: " fmt ANSI_RESET "\n", ##__VA_ARGS__); \
} while (0)
#define ANSI_YELLOW
Yellow text.
Definition debug.h:113
#define DBG_LVL_WARN
Show Warn and Error only.
Definition debug.h:173

Log a warning message (yellow).

Parameters
modModule flag — see Debug Modules.
fmtPrintf-style format string.
...Format arguments.

Definition at line 245 of file debug.h.