Please enable JavaScript to view this site.

winIDEA Help

Version: 9.21.260

Configure Cortex-M ITM Trace for printf() Debugging

In this topic:

Requirements

Configuration steps

 

 

Introduction

This how-to guide focuses on the Software Tracing on Arm Cortex-M architecture using the Instrumentation Trace Macrocell (ITM). It explains the use case of printf() output, including how to configure the Terminal Window and display the data.

 

By using the Cortex-M ITM, the application can “print” optional data to the Terminal window. Code is instrumented with “trace points”, which provide an insight into the embedded target behavior at full MCU speed and without stopping the execution. BlueBox captures and decodes it, and then displays a human-readable string in the Terminal window. Writing one data within the application “trace point” requires a single write cycle to the internal 32-bit register which yields negligible performance penalty.

 

itm-printf-cortex1_zoom22

 

 

Requirements

winIDEA

Build Manager

BlueBox

Target Board with Arm Cortex-M SoC featuring the ITM and the SWO output

 

 

Configuration steps

number1

Add the code snippet to your Application.

#include " core_cm4.h"

int  _write (int fd, char *ptr, int len)

{

   unsigned int i;

   for (i = 0; i < len; i++) {

       ITM_SendChar(*ptr++);

       }  

return len;

}

 

number2

Build your project.

You can use CMake, which is integrated into winIDEA.

 

number3

Open Hardware | CPU Options | SoC and select:

SWD Debug Protocol

Parallel or SWO Trace Capture Method

 

itm-cortex-swo-parallel

 

Number4

Go to View | Workspace | Terminal Window | Options and click Configure.

TerminalWindowOptionsDebugger

 

Number5

Select Trace Channel as Communication type and click Advanced.

TerminalWindowOptionsDebuggerConfig

 

number6

Select the ITM Stimuli.

From the Enable dropdown select:

All, or

Selected and one ITM Stimuli is enabled, e.g. ITM (0).

 

TerminalWindowOptionsDebuggerConfigAdvanced

 

number7

Perform a Debug Download.

 

number8

Click on the Connect button in the Terminal window and run the application.

The results will be shown in the Terminal window.

 

itm-printf-cortex

 

 

More resources

Terminal window

Instrumentation Trace Macrocell (ITM)

 

 

Copyright © 2024 TASKING