SWO Debug#
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#
Initialize SWO Debug.
Enable an ITM channel.
Disable an ITM channel.
Write a byte to an ITM channel.
Write a half-word to an ITM channel.
Write a word to an ITM channel.
Macros#
alias for backward compatibility
Function Documentation#
sl_debug_swo_init#
sl_status_t sl_debug_swo_init (void )
Initialize SWO Debug.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
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.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint32_t | [in] | channel | ITM channel number |
Enables the given ITM channel in the Trace Enable Register.
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.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint32_t | [in] | channel | ITM channel number |
Disables the given ITM channel in the Trace Enable Register.
Returns
Status code
Return values
SL_STATUS_OK: ITM 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.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint32_t | [in] | channel | ITM channel number |
uint8_t | [in] | byte | Byte to send |
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. Note that even if the debug port is locked, the byte will still be written on the SWO.
Returns
Status code
Return values
SL_STATUS_OK: Byte sent successfully
SL_STATUS_NOT_INITIALIZED: ITM has not been enabled, call
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.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint32_t | [in] | channel | ITM channel number |
uint16_t | [in] | half_word | Half-word to send |
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.
Returns
Status code
Return values
SL_STATUS_OK: half-word sent successfully
SL_STATUS_NOT_INITIALIZED: ITM has not been enabled, call
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.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint32_t | [in] | channel | ITM channel number |
uint32_t | [in] | word | Word to send |
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.
Returns
Status code
Return values
SL_STATUS_OK: half-word sent successfully
SL_STATUS_NOT_INITIALIZED: ITM has not been enabled, call