Debugging large software programs is always a challenge; often, it’s tough to know where to even begin! The MSP432 low-power and performance Microcontroller (MCU) offers an advanced debugging utility, brand new to the MSP family of MCUs: Serial Wire Output (SWO) Trace. This utility is helpful for debugging complex projects, tracking multiple events, analyzing application performance statistics, and tracking the big-picture flow of data.
The MSP432 MCU features an ARM® Cortex®-M4F CPU, and the ARM hardware provides modules that can be harnessed for debugging purposes. Specifically, two components—the Data and Watchpoint Trace Unit (DWT) and Instruction Trace Macrocell (ITM)—can be used to find out when different functions are called, what happens at specific memory addresses, or how interrupts are occurring. The data on when these events take place is output through the Serial Wire Output, hence, the name of the utility.
TI’s Code Composer Studio™ (CCS) provides three easy-to-use functions: Statistical Function Profiling, Data Variable Tracing, and Interrupt Profiling.
Statistical Function Profiling not only shows you which functions get called in your program, but it also shows you how often each function is accessed. This is helpful when you want to decrease the power or resource consumption of your program as a whole. If you optimize a function that is called often, it will be more useful than if you focus on a function that is only called once.
Data Variable Tracing lets you see the big picture of what happens at a memory address or variable over time. You can see if your counters are working properly or if a variable is responding and changing correctly.
Interrupt Profiling helps you visualize how your interrupts are working. You can see when interrupts were entered and exited, and whether interrupts were preempted or not.
Finally, CCS gives you the option of fully customizing how you want to use SWO Trace. With Custom Core Trace, you can pick what triggers an output!
Remember, this nifty utility is only available for the MSP432 MCUs, so get a LaunchPad™ Development Kit and try it out for yourself! This short training video will help you get started.
Developers can also harness the power of SWO with other MSP432 MCU Development Environments such as Keil® uVision® or IAR Embedded Workbench®, each has its own tutorial for using SWO Trace.