EFM32 Pearl Gecko Software Documentation  efm32pg1-doc-4.2.1

Debug (DBG) Peripheral API

. More...

Functions

__STATIC_INLINE bool DBG_Connected (void)
 Check if a debugger is connected (and debug session activated) More...
 
void DBG_SWOEnable (unsigned int location)
 Enable Serial Wire Output (SWO) pin. More...
 

Detailed Description

Function Documentation

__STATIC_INLINE bool DBG_Connected ( void  )

Used to make run-time decisions depending on whether a debug session has been active since last reset, ie using a debug probe or similar. In some cases special handling is required in that scenario.

Returns
true if a debug session is active since last reset, otherwise false.

Definition at line 73 of file em_dbg.h.

void DBG_SWOEnable ( unsigned int  location)

The SWO pin (sometimes denoted SWV, serial wire viewer) allows for miscellaneous output to be passed from the Cortex-M3 debug trace module to an external debug probe. By default, the debug trace module and pin output may be disabled.

Since the SWO pin is only useful when using a debugger, a suggested use of this function during startup may be:

* if (DBG_Connected())
* {
* DBG_SWOEnable(1);
* }
* 

By checking if debugger is attached, some setup leading to higher energy consumption when debugger is attached, can be avoided when not using a debugger.

Another alternative may be to set the debugger tool chain to configure the required setup (similar to the content of this function) by some sort of toolchain scripting during its attach/reset procedure. In that case, the above suggested code for enabling the SWO pin is not required in the application.

Parameters
[in]locationPin location used for SWO pin on the application in use.

Definition at line 88 of file em_dbg.c.

References CMU_OscillatorEnable(), cmuOsc_AUXHFRCO, GPIO_DbgLocationSet(), GPIO_DbgSWOEnable(), GPIO_PinModeSet(), and gpioModePushPull.