MSP432™ MCUs Training Part 14: Serial Wire Output Trace 1

Preview:

Citation preview

MSP432™ MCUs TrainingPart 14: Serial Wire Output Trace

1

What is Serial Wire Output (SWO) Trace?• A set of debugging tools based on ARM hardware

components that allow users to trace the flow of data from a big picture perspective

• Not related to EnergyTrace+– Both use the PC for data– Share the same COM port

2

ARM CoreSight Components

3

MSP432 Cortex-M4F Components

4

Data Watchpoint and Trace Unit (DWT)• Contains 3 configurable comparators:

– Hardware watchpoint– PC sampler event trigger– Data address sampler event trigger

• Counters including:– Clock cycles (CYCCNT)– Folded instructions– Load Store Unit (LSU)– Sleep cycles– Interrupt overhead

5

Instrumentation Trace Macrocell (ITM)• Generates packets of information• Sends packets to Serial Wire Output (SWO)• DWT creates the hardware-based packets

– Watchpoints for variables– PC sampler event trigger– Clock cycle counter

• Software packets generated by user via code– Creates packets when data is sent to ITM ports– ITM library can be used to send data to ports

6

IDE Implementations

7

Feature Keil uVision IAR Embedded Workbench

Texas Instruments Code Composer Studio

Required Hardware

Keil ULINK2, Keil ULINKpro, or Segger J-Link

Segger J-Link, Segger J-Trace, or IAR i-Jet

XDS110 (LaunchPad) or XDS200

Trace Functions

• Code Coverage• Performance

Analyzer• Execution Profiler• Logic Analyzer

• PC sampling• Interrupt logs• Data log events• ITM Stimulus

Ports

• Statistical Function Profiling• Data Variable

Trace• Interrupt Profiling• Custom Core

Trace

CCS Usecases• Statistical Function Profiling

– Periodically checks PC– PC determines which function

• Data Variable Tracing– Tracks reads/writes to memory location

• Interrupt Profiling– Interrupts noticed by DWT– Logged and outputted by ITM

• Custom Core Trace– Tracks writes to ITM ports– Can be configured with additional triggers

8

CCS Usecases• Statistical Function Profiling

– Shows functions called and frequency of each– Which functions are more crucial

• Data Variable Tracing– Big picture view of changes to a variable over time

• Interrupt Profiling– Understand priorities and preempting of interrupts– Observe when interrupts were entered and exited

• Custom Core Trace– Similar to printf style debugging, so more user control– Allows use of more than one of the other usecases at the same

time 9

Out of Box Experience Demo

10

Out of Box Experience Demo

11

Out of Box Experience Demo

12

Out of Box Experience Demo

13

Statistical Function Profiling• Leave the default configuration• Start the program• Let the red LED blink 10 times• Suspend the program

14

Data Variable Trace• Set the variable address to “&taps”• Start the program• Push SW1 as many times as you want• Suspend the program

15

Interrupt Profiling• No configuration necessary• Start the program• Let the red LED blink 10 times• Suspend the program

16

Interrupt Profiling• No configuration necessary• Start the program• Toggle switches randomly and quickly• Suspend the program

17

Custom Core Trace• Include the ITM library

• Insert the following code

18

Custom Core Trace• No configuration necessary• Start the program• Wait a few seconds• Suspend the program

19

Configuring Custom Core Trace• Custom Core Trace Advanced Settings• Create new triggers• Use hardware counters

and triggers to makeevents happen

20

Configuring Custom Core Trace• Replicate the three defined usecases with these trigger

settings

• Allows user to use multiple defined usecases at the same time

• Can trace multiple variables at the same time21

Summary• SWO Trace allows you to maximize use of MSP432 hardware

components

• Provides users with a big-picture view of software

• Easy to use with LaunchPad; no additional hardware required

• CCS offers:– Three easy to use defined usecases– Custom Core Trace for advanced configuration

• References:– TI Application Note: http://www.ti.com/lit/pdf/slaa674– ARM Application Note: http://www.keil.com/uvision/db_anl.asp– IAR Application Note: http://

supp.iar.com/FilesPublic/UPDINFO/005405/arm/doc/EWARM_UserGuide_AddOn1.ENU.pdf 22

Recommended