You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Kolosso edited this page Aug 11, 2024
·
14 revisions
The Debug module contains several tools for debugging your program.
Print Macros
There are three print macros included:
PRINT_INFO: for printing general debug information.
PRINT_ERROR: for printing errors.
PRINT_WARN: for printing warnings.
These macros do a few nice things for you:
They format your messages in a nice way.
They include extra information for errors and warnings.
They can be disabled so your program is stripped of all print statements (good for optimizing).
Example
Here's an example program using the print macros:
#include"tuk/tuk.h"// define the name of the file/module.#definePRINT_SUBJECT "Main"
intmain()
{
/* HAL init... */PRINT_INFO("This is a test");
PRINT_WARN("This is a warning. There's about to be an error!");
PRINT_ERROR("Ahhh, your board is on fire!");
intmy_integer=15;
PRINT_INFO("my_integer = %d", &my_integer);
return0;
}
The output would be:
[Main] This is a test
[Main] WARNING: This is a warning. There's about to be an error! ('../Core/Src/main.c':103)
[Main] ERROR: Ahhh, your board is on fire! ('../Core/Src/main.c':104)
[Main] my_integer = 15
Setup
In order to see your program's output, you will need to do some setup in STM32CubeIDE. This article includes step-by-step instructions on how to do that.