Starting with FreeRTOS and Tracealyzer on Renesas RZ/A1

>>Starting with FreeRTOS and Tracealyzer on Renesas RZ/A1

Today I received an interesting new board to play with, a Computex board with a powerful Renesas RZ/A1 processor shown below. This has an ARM Cortex-A9 core at 400 MHz and 3 MB on-chip RAM. And if that is not enough, there is another 32 MB RAM on the board. Quite a lot of power for embedded applications!

Renesas RZ/A1 board

The first step was to get an IDE and and FreeRTOS up and running. This took less than a minute, as FreeRTOS provides suitable demo project for both ARM DS-5 Development Studio and IAR Embedded Workbench for ARM. This is found in the FreeRTOS package, under the demo folder (CORTEX_A9_RZ_R7S72100_IAR_DS-5). I’m using ARM DS-5 in this case, and the example project runs directly without problems.

The next step was to enable Tracealyzer for FreeRTOS, so I can see how my FreeRTOS tasks are actually running, like in this example below.

Tracealyzer - Main trace view

This requires hooking in one of the trace recorder libraries included with Tracealyzer, either the “streaming” recorder or the “snapshot” recorder. I choose the snapshot recorder which works with essentially any IDE and debug probe. It keeps the trace in a RAM buffer on the target system.

Adding trace capabilities into an existing FreeRTOS project is simple. There is a detailed step-by-step guide in the Tracealyzer user manual. You need to include the sources of the recorder library, update your FreeRTOSConfig.h to enable tracing, configure the recorder library for Cortex-A9 and finally call the recorder’s init and start functions, as illustrated below.

For ARM Cortex-A9 there are however two extra things that needs to be sorted. Firstly, in the recorder file “trcHardwarePort.h” we need to define the peripheral base address for the timer (used for accurate timestamping) as illustrated below. This is found in the data sheet of the specific processor.

Change needed in trcHarwarePort.h for ARM Cortex-A9

Secondly, you need to make sure the timer is initialized and started, the two lines after prvSetupHardware in the code below. This part will probably be integrated in the recorder library in the next release.

Starting Tracealyzer snapshot trace on ARM Cortex-A9

With those minor changes, the system will now record a trace of FreeRTOS events, allowing us to see what’s going on and how long time things take. Yay!

To upload the data from the Tracealyzer snapshot recorder to your PC using ARM DS-5 (or other Eclipse based IDE’s) we open the Memory view and enter “RecorderDataPtr” in the address field and “sizeof(RecorderData)” in the size field, as illustrated below.

Then we select “Export Memory…” in the drop-down menu. The range is preset to the one being viewed, so we only need to select the output format (use binary or Intel hex-32) and the filename. Note that Tracealyzer has built-in integrations for other IDE’s and also for SEGGER J-Link debuggers, which automate this part.

Saving FreeRTOS trace from eclipse or ARM DS-5

This resulting file is then opened in Tracealyzer (“drag-and-drop” works fine) and we can see the trace and other visualizations, as shown below. The main trace view is shown in the upper right, displaying a vertical timeline of task scheduling, interrupts and other events. The application used here is quite simple, but doesn’t these visualizations illustrate quite nicely how the system is working?


This example project will be included in next release, but if you are interested in Tracealyzer support for Renesas RZ/A1, contact and we can send you this project.

Tracealyzer allows you to trace and visualize the execution of exceptions (ISRs), RTOS tasks and other software events, providing more than 25 interconnected views that gives an amazing visual insight into the runtime world of RTOS-based firmware, accelerating development, validation and debugging. Tracealyzer is available for several common RTOS, including FreeRTOS, SafeRTOS, Linux, VxWorks, Micrium µC/OS-III, and a version for ThreadX will be released during 2016. And there is even a feature-limited free version. We have several new and exciting analysis features in development that allows for even better performance analysis, so stay tuned!

Download Tracealyzer

Want to learn more about RTOS-based development and Tracealyzer? More articles here!

2016-11-08T22:16:43+00:00May 18th, 2016|Categories: Blog|Tags: |