This module provides lightweight debug logging suitable for embedded systems that lack traditional stdout or UART interfaces. Logging is stored in a RAM-based circular buffer and can be inspected live via JTAG.
When the DEBUG macro is defined, functions and macros such as dbg_info(),
dbg_assert(), and dbg_trace() become active. If DEBUG is undefined,
all macros become no-ops via ((void)0) for safe compilation.
The debug log is stored in a static character buffer. Macros like dbg_info()
write formatted strings into this buffer. The content can be retrieved via
dbg_get_buffer() and viewed using tools like CCS memory view.
- Ring buffer logging to RAM
- Macros for info, warning, error, trace
dbg_assert()withESTOP0trigger- Optional EEPROM backup support (via user integration)
- Fully disabled in release builds via
#undef DEBUG
#define DEBUG
#include "debug.h"void foo(void) {
dbg_enter();
dbg_info("Running foo()");
dbg_assert(1 == 1);
dbg_exit();
}This project uses Meson as the build system.
meson setup builddir
meson compile -C builddirEnsure Unity is available via subprojects/unity.wrap (already configured).
meson test -C builddir --print-errorlogsTo generate HTML documentation from the source and Doxygen comments:
-
Generate Doxygen XML:
cd doc/sphinx doxygen Doxyfile -
Build Sphinx HTML:
make html
-
Open the docs:
doc/sphinx/_build/html/index.html
Note: Ensure you have installed
doxygen,python3-sphinx, andbreathepackages.