/*!
More...
Serial wire output is a mechanism for ARM targets to output signal from core through a single pin. Some IDE support SWO also, such IAR and KEIL, both input and output are supported, reference below for detail.
Guide SWO for SDK
NOTE: After the setting both "printf" and "PRINTF" are available for debugging, JlinkSWOViewer can be used to capture the output log.
Step 1: Setting up the environment
- Define DEBUG_CONSOLE_IO_SWO in your project settings.
- Prepare code, the port and baudrate can be decided by application, clkSrcFreq should be mcu core clock frequency:
- Use PRINTF or printf to print some thing in application.
Step 2: Building the project
Step 3: Download and run project
Guide SWO for IAR
NOTE: After the setting both "printf" and "scanf" are available for debugging.
Step 1: Setting up the environment
- Choose project -> "Options" -> "Debugger" -> "J-Link/J-Trace".
- Choose tab "J-Link/J-Trace" -> "Connection" tab -> "SWD".
- Choose tab "General Options" -> "Library Configurations", select Semihosted, select Via SWO.
- Make sure the SDK_DEBUGCONSOLE_UART is not defined, remove the default definition in fsl_debug_console.h..
- Start the project by choosing Project>Download and Debug.
Step 2: Building the project
Step 3: Starting swo
- Download and debug application.
- Choose View -> Terminal I/O to display the output from the I/O operations.
- Run application.
Guide SWO for Keil µVision
NOTE: After the setting both "printf" and "scanf" are available for debugging.
Step 1: Setting up the environment
- Make sure the SDK_DEBUGCONSOLE_UART is not defined, remove the default definition in fsl_debug_console.h.
- In menu bar, click Management Run-Time Environment icon, select Compiler, unfold I/O, enable STDERR/STDIN/STDOUT and set the variant to ITM.
- Open Project>Options for target or using Alt+F7 or click.
- Select “Debug” tab, select “J-Link/J-Trace Cortex” and click “Setting button”.
- Select “Debug” tab and choose Port:SW, then select "Trace" tab, choose "Enable" and click OK, please make sure the Core clock is set correctly, enable autodetect max SWO clk, enable ITM Stimulus Ports 0.
Step 3: Building the project
- Compile and link the project by choosing Project>Build Target or using F7.
Step 4: Run the project
- Choose “Debug” on menu bar or Ctrl F5.
- In menu bar, choose "Serial Window" and click to "Debug (printf) Viewer".
- Run line by line to see result in Console Window.
Guide SWO for MCUXpresso IDE
NOTE: MCUX support SWO for LPC-Link2 debug probe only.
Guide SWO for ARMGCC
NOTE: ARMGCC has no library support SWO.