Appearance
Debugging
Debugging helper functions.
The functions provided in the debugging group are meant to enable and disable certain debug outputs at runtime. As a developer you should make sure to disable any debug options in release code since it can significantly slow down execution and also increase RAM and Flash usage.
Functions Overview
Name | |
---|---|
void | osSetDebugFlags(osDebugFlags_t flags) Enable certain debugging behaviour. |
void | osClearDebugFlags(osDebugFlags_t flags) Disable certain debugging behaviour. |
int | osDebuggerAttached(void ) Query the presence of a debugging probe (JTAG/SWD) |
Defines
Name | |
---|---|
OS_DBGFLAG_HALT_ON_ERR | stop the system on any fault or assertion |
OS_DBGFLAG_MEMORY | periodically print the available heap memory |
OS_DBGFLAG_CPU_LOAD | periodically print all tasks and their cpu usage |
OS_DBGFLAG_WATCHDOG | debug watchdog and halt on "bite" |
Function Details
function osSetDebugFlags
cpp
void osSetDebugFlags(
osDebugFlags_t flags
)
Enable certain debugging behaviour.
Parameters:
- flags or'ed flags to enable
function osClearDebugFlags
cpp
void osClearDebugFlags(
osDebugFlags_t flags
)
Disable certain debugging behaviour.
Parameters:
- flags or'ed flags to disable
function osDebuggerAttached
cpp
int osDebuggerAttached(
void
)
Query the presence of a debugging probe (JTAG/SWD)
Return: 1 if a debugger is attached, 0 if not. In case of Cortex-M0/M0+ the function returns 1 for debug builds at any given time.
Be aware, that Cortex-M0 and -M0+ dont't support querying for a debugger. Also, once a debugger was attached to the system, simply detaching it won't make the function return 0. The state of "no debugger attached" will only be restored by a "cold" reboot / power-on reset.
Macros Documentation
define OS_DBGFLAG_HALT_ON_ERR
cpp
#define OS_DBGFLAG_HALT_ON_ERR (0x00000001U)
stop the system on any fault or assertion
define OS_DBGFLAG_MEMORY
cpp
#define OS_DBGFLAG_MEMORY (0x00000002U)
periodically print the available heap memory
define OS_DBGFLAG_CPU_LOAD
cpp
#define OS_DBGFLAG_CPU_LOAD (0x00000004U)
periodically print all tasks and their cpu usage
define OS_DBGFLAG_WATCHDOG
cpp
#define OS_DBGFLAG_WATCHDOG (0x00000008U)
debug watchdog and halt on "bite"