SWO Debug

Description

Serial Wire Output Debug Configuration.

Initializes Serial Wire Output using the DWT and ITM peripherals of Cortex-M processors. Configures output of Program Counter samples, interrupt events, and data over any ITM channel.

Functions

sl_status_t sl_debug_swo_init (void)
Initialize SWO Debug.
sl_status_t sl_debug_swo_enable_itm (uint32_t channel)
Enable an ITM channel.
sl_status_t sl_debug_swo_disable_itm (uint32_t channel)
Disable an ITM channel.
sl_status_t sl_debug_swo_write (uint32_t channel, uint8_t c)
Write a byte to an ITM channel.

Function Documentation

sl_debug_swo_init()

sl_status_t sl_debug_swo_init ( void )

Initialize SWO Debug.

Initializes SWO debug using configuration parameters for frequency, as well as whether PC sample events and interrupt events should be emitted.

Note
This function does not enable any software stimulus ports in the ITM. This can be done by calling sl_debug_swo_enable_itm or by using sl_debug_swo_write which enables the necessary ports automatically.
Returns
Status code
Return values
SL_STATUS_OK SWO initialized successfully

sl_debug_swo_enable_itm()

sl_status_t sl_debug_swo_enable_itm ( uint32_t channel )

Enable an ITM channel.

Enables the given ITM channel in the Trace Enable Register.

Parameters
[in] channel ITM channel number
Returns
Status code
Return values
SL_STATUS_OK ITM channel enabled successfully

sl_debug_swo_disable_itm()

sl_status_t sl_debug_swo_disable_itm ( uint32_t channel )

Disable an ITM channel.

Disables the given ITM channel in the Trace Enable Register.

Parameters
[in] channel ITM channel number
Returns
Status code
Return values
SL_STATUS_OK ITM channel disabled successfully

sl_debug_swo_write()

sl_status_t sl_debug_swo_write ( uint32_t channel,
uint8_t c
)

Write a byte to an ITM channel.

Writes the given byte to the given ITM channel

Note
This function ensures that the ITM channel is enabled, and enables it if it wasn't already.
Parameters
[in] channel ITM channel number
[in] c Byte to send
Returns
Status code
Return values
SL_STATUS_OK Byte sent successfully
SL_STATUS_NOT_INITIALIZED ITM has not been enabled, call sl_debug_swo_init first.