Teste semf

Debug with semf


Having errors in a source code is always a pain. Debugging is time consuming, but most of the time leads to the goal.
To have simple debugging messages available and make it more efficient we added a method to semf where you easily can get messages from the semf library if an error in the target hardware or in the library occurrres.


First define USE_SEMF_ASSERT. The best way to do that is to add it as a Symbol in the project settings (e.g. Project -> Properties -> C/C++ General -> Paths and Symbols -> Symbols in Eclipse based IDEs).
Second implement the assertFaild function in your project, for example in the cppmain.cpp file.

#include "Core/debug.h"

void semf::assertFailed(DebugId debugId)
// Option 1: End here if an error occurres and check the debugId

// Option 2: Use printf to send the debugIds through e.g. SWD or UART to the computer


Often for debugging it is helpful to have a printf functionallity available through e.g. UART or SWD.

Recommended Ressources:

  1. STMicroelectronics describes the how-to for UART and SWD in the application note AN4989 (see chapter „printf debugging“).
  2. Keil describes a how-to for SWD when using qVision on their website.
  3. IAR describes a how-to for SWD when using IAR Embedded Workbench on their website.

zurück zur Dokumentation