Configuring specific H/W pins for SWO or ETM Trace

Technical Note 190507






5/23/2019 1:14 PM


On some MCUs, you can choose which H/W pins are used for SWO or ETM trace.


The C-SPY debugger normally configures the trace pins automatically using debugger macro files (*.dmac) from the directory:


To make C-SPY aware of which pins you have selected for SWO or ETM trace, there are usually macro parameters similar to these in the device-specific .dmac files:

__param _SWO_route=0;
__param _TRACE_route=0;

To change such a parameter without modifying the .dmac file, use:

Project>Options>Debugger>Extra Options>Use command line options:

--macro_param _SWO_route=1
--macro_param _TRACE_route=1

Read more about --macro_param in the C-SPY Debugging Guide for Arm.

The following list contains examples of device-specific .dmac files where SWO or ETM trace pins can be configured:

Altera CycloneVSoC*.dmac
Ambiq Micro  apollo*.dmac
Analog Devices CM40z.dmac
Cypress  CY*.dmac, S6*.dmac
Infineon  XMC*.dmac
Microchip  SAMD*.dmac, SAME*.dmac, SAMV*.dmac
NXP  iMX*.dmac, K*.dmac, LPC5*.dmac, S32K*.dmac
Renesas  EC*.dmac, RZ*.dmac
Silicon Labs  Trace*.dmac
ST  STM32M*.dmac, STM32W*.dmac
Texas Instruments  CC26*.dmac
Xilinx  Zynq7*.dmac

To find which .dmac file is used by your device, see the top of the Debug Log window. Look for the lines that begin with Loaded macro file. You can also see which .dmac file is used by looking for the DeviceMacros line in:



On some MCUs, you can choose which H/W pins are used for SWO or ETM trace. That is, you can configure the trace pins, and you can configure C-SPY to match the H/W trace pin configuration.


All product names are trademarks or registered trademarks of their respective owners.

We do no longer support Internet Explorer. To get the best experience of, we recommend upgrading to a modern browser such as Chrome or Edge.