OS
v7.3.3
Documentation
|
QuarkTS include some basic macros to print out debugging messages. Messages can be simple text or the value of variables in specific base formats. To use the trace macros, a single-char output function must be defined using the qTrace_Set_OutputFcn() macro.
A single-char output function should follow this prototype:
The body of this user-defined function should have a hardware-dependent code to print out the c
variable through a specific peripheral.
For viewing or tracing a variable (up to 32-bit data) through debug, one of the following macros are available: qTrace_Var or qDebug_Var.
The only difference between qTrace_ and Debug, is that qTrace_
macros, print out additional information provided by the __FILE__
, __LINE__
and __func__
built-in preprocessing macros, mostly available in common C compilers.
For tracing memory from a specified target address, one of the following macros are available: qTrace_Mem or qDebug_Mem.
In the example below, an UART output function is coded to act as the printer. Here, the target MCU is an ARM-Cortex M0 with the UART1 as the selected peripheral for this purpose.
As seen above, the function follows the required prototype. Later, in the main thread, a call to qTrace_Set_OutputFcn() is used to set up the output-function.
After that, trace macros will be available for use.