Peering into a microcontroller and seeing how the embedded software is executing has always been important to embedded software developers. In the good old days, developers used to have to instrument their hardware with extra outputs and use all kinds of tricks in order to take a stab at understanding what was happening with their system. In most cases it was simply guess work. Those good old days are thankfully gone and developers can now use tools such as Percepios’ Tracealyzer to peer into the microcontroller and understand exactly how the software is being executed and discover issues such as priority inversions, deadlocks, and thread starvation … to name just a few.
In this post, I’m going to walk the reader through how to set up the Tracealyzer tool using FreeRTOS running on a NXP K64F Freedom Board.
Step #1 – Download the Tools and Example
Getting a project and toolchain set up can sometimes be a time-consuming endeavor depending on the development board and supporting software that will be used. One easy way to get this example up and running is to download and install the following tools, and by also downloading a pre-built project that I put together. The tools that are used can be found below:
- Atollic TrueSTUDIO Lite (located here)
- NXP Driver Suite 10.4 (Located here)
- MCUonEclipse FreeRTOS plugin (located here)
- Percepio Tracealyzer (located here)
- Beningo Example Project (located here)
Step #2 – Enable Tracealyzer in the FreeRTOS Plugin
Once the tools have been downloaded and installed, developers can open the example project in the NXP Driver Suite. After opening the processor expert file and selecting the FreeRTOS component, developers will find the Percepio Trace tab as shown in Figure 1. The first step is to enable the Percepio Trace.
|Figure 1 – Enabling Tracealyzer in FreeRTOS|
Step #3 – Set up the Real-Time Trace Buffers
Configuring the buffers that will transmit event data from the microcontroller to the Tracealyzer tool is very straightforward. There are multiple modes that Tracealyzer can be configured to operate in such as Snap Shot or Streaming mode. Snap Shot mode can be used when a small amount of trace data is required that is triggered by an event that is of interest. To take an undefined length trace, using the Streaming mode is preferred. Example settings for configuring Streaming can be seen in Figure 2.
|Figure 2 – Setting up the RTT Buffers|
Step #4 – Compile the Project and Launch Tracealyzer
Once FreeRTOS has been configured in the Driver Suite software, developers can generate their project Processor Expert settings and then open the project in Atollic TrueStudio. The example is compiled in the ARM toolchain and then loaded onto the target board. Once the debug perspective is loaded, developers who have installed the Percepio plug-in will be able to launch the Tracealyzer from the Percepio menu as shown in Figure 3.
|Figure 3 – Launch Tracealyzer through the TrueStudio Plugin|
Step #5 – Configure the Streaming Trace Settings