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_u8 (uint32_t channel, uint8_t byte)
 Write a byte to an ITM channel.
 
sl_status_t sl_debug_swo_write_u16 (uint32_t channel, uint16_t half_word)
 Write a half-word to an ITM channel.
 
sl_status_t sl_debug_swo_write_u32 (uint32_t channel, uint32_t word)
 Write a word to an ITM channel.
 

Macros

#define sl_debug_swo_write   sl_debug_swo_write_u8
 alias for backward compatibility
 

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_OKSWO 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]channelITM channel number
Returns
Status code
Return values
SL_STATUS_OKITM 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]channelITM channel number
Returns
Status code
Return values
SL_STATUS_OKITM channel disabled successfully

◆ sl_debug_swo_write_u8()

sl_status_t sl_debug_swo_write_u8 ( uint32_t  channel,
uint8_t  byte 
)

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]channelITM channel number
[in]byteByte to send
Returns
Status code
Return values
SL_STATUS_OKByte sent successfully
SL_STATUS_NOT_INITIALIZEDITM has not been enabled, call sl_debug_swo_init first.

◆ sl_debug_swo_write_u16()

sl_status_t sl_debug_swo_write_u16 ( uint32_t  channel,
uint16_t  half_word 
)

Write a half-word to an ITM channel.

Writes the given half-word 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]channelITM channel number
[in]half_wordHalf-word to send
Returns
Status code
Return values
SL_STATUS_OKhalf-word sent successfully
SL_STATUS_NOT_INITIALIZEDITM has not been enabled, call sl_debug_swo_init first.

◆ sl_debug_swo_write_u32()

sl_status_t sl_debug_swo_write_u32 ( uint32_t  channel,
uint32_t  word 
)

Write a word to an ITM channel.

Writes the given word 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]channelITM channel number
[in]wordWord to send
Returns
Status code
Return values
SL_STATUS_OKhalf-word sent successfully
SL_STATUS_NOT_INITIALIZEDITM has not been enabled, call sl_debug_swo_init first.

Macro Definition Documentation

◆ sl_debug_swo_write

#define sl_debug_swo_write   sl_debug_swo_write_u8

alias for backward compatibility