Tracealyzer for Zephyr

Developing Zephyr-based software can be challenging without effective debugging and analysis tools designed for multi-threaded code. Percepio Tracealyzer lets you solve issues quickly and speed up everyday development. Optimize your system for reliable real-time performance. Get your free evaluation and get started in 15 minutes! 

Zephyr project member

Simplify Debugging and Develop Faster

Tracealyzer has doubled our development speed. Problems that would take days to solve are obvious with this tool and just a quick fix. We use it all the time.” — Alex Pabouctisids, Lead Firmware Engineer, Flyability

Fed up with endless hours debugging embedded C/C++ code? Bid farewell to tedious troubleshooting and welcome accelerated development with Percepio Tracealyzer. Traditional debugging is often ineffective for today's complex RTOS or Linux systems and may consume 40-50% of the development time.

Get visual trace observability to speed up your everyday debugging and solve issues where traditional debugging falls short. Learn how Tracealyzer simplifies debugging.

Optimize System Performance

“In less than 5 days from running the tool, we improved the performance of our graphic rendering engine by 3x” -  Terry West, CEO, Serious Integrated, Inc.

Tracealyzer offers advanced profiling features showing the events behind the numbers. Pinpoint performance bottlenecks and unlock the full potential of your hardware. Ensure you meet product performance goals and deliver a responsive user experience.

Optimization is challenging for multi-threaded RTOS or Linux systems. When a thread is slow, it is often due to factors not apparent in the source code. Visual trace observability gives the full picture and simplifies optimization.

 

Arm community

Solve Issues Quickly

  • Visualize task execution
  • Spot issues and drill down
  • Full system debugging
Arm community

Measure Performance

  • CPU load, timing variations
  • Analyze memory usage
  • Find inefficient code
Arm community

Verify Behavior

  • Matching design intent?
  • Best practices followed?
  • Performance requirements?

Deep Observability for Zephyr Software

Tracealyzer provides many views for different perspectives of your runtime system. All view are connected for a streamlined workflow. Spot anomalies in high-level overviews and then drill down into the details to see the cause.

The trace view provides a detailed timeline of task scheduling and interrupts, kernel API calls as well as custom “user event” logging in the application code. This is helps you debug your code and lets you verify that your code executes as intended. You can also learn how to improve the software design for better performance.

The large set of visual overviews includes for example CPU load, task execution times, stack usage and heap memory allocation. Such overviews provides a profile of the resource usage over time, which helps you see the big picture, spot anomalies and optimize the system.

Tracealyzer showing a FreeRTOS CPU load

Trace your Tasks

The Zephyr kernel provides multithreading, where each task has its own stack and a fixed scheduling priority which is very important for functional correctness and performance. Tracealyzer lets you analyze the behavior and performance of different priority assignments, as well as the stack usage of the tasks. If your stacks are too small, you risk nasty bugs due to stack overflow. If they are too large, you are wasting precious RAM that might be needed elsewhere in your application.

The trace view shows both the task scheduling and calls to kernel API functions. This allows you to see exactly when tasks are activated, when they actually execute, and why they sometimes don’t execute as intended. You can also see an overview showing which tasks are consuming the processor time, as shown in the “CPU Load Graph”. Detailed statistics is also available, like task execution times and response times.

Tracealyzer showing a FreeRTOS trace

Trace Zephyr Kernel API Calls

The Zephyr kernel offer several APIs for passing data between tasks and for protecting shared resources, such as queues, semaphores and mutexes. These API functions may block the calling task’s execution until another task has performed a matching operation. Such API calls may form a network of dependencies between the tasks that is not apparent in the source code. Tracealyzer can visualize the task interactions, which makes it far easier to understand, debug and optimize Zephyr applications. Some examples are provided below.

Queue Events

Queues allow tasks to communicate by sending and receiving messages. Queues have a fixed number of slots and messages are normally buffered in FIFO order.

Queue operations might block if trying to send a message to a full queue, or trying to read a message from an empty queue. The screenshot shows how Tracealyzer displays queue usage and blocking. The TX task sends two messages to the queue. This wakes up the RX task (hence the green label) and it receives the two messages. Finally, the task is blocked (red label) when trying to read from the queue since now empty.

The queue forms a dependency between TX and RX, that can be seen in the Communication Flow graph below. The direction of the arrows show the usage, i.e. that TX is sending to the queue and RX is receiving from it. Double-clicking on any of the nodes shows the corresponding events.

Blocking may result in a timeout, if a timeout duration is specified. These are displayed as orange labels in Tracealyzer. Timeouts may occur on many Zephyr API calls and are important to keep track of. Some might be intentional, while other may indicate serious errors.

Queue usage + blocking
Tracealyzer showing FreeRTOS queue API calls
Semaphore Events

Semaphores allow for waking up tasks on events. An example screenshot is shown below. The RX task is initially blocked by a previous semaphore call and wakes up when the semaphore is signaled.

Semaphores are sometimes used to protect critical sections in the code, i.e. mutual exclusion, but mutexes are better for this purpose. When using a semaphore for this purpose there is a risk for priority inversion, meaning that high-priority tasks are delayed by lower-priority tasks. Tracealyzer makes it easy to spot issues like this, for example using the “Actor Instance Graph” showing the task response times.

Tracealyzer showing FreeRTOS semaphore API calls
Mutex Events

Mutex objects are designed for critical sections. Zephyr implements priority inheritance for Mutex objects to avoid priority inversion. The below example shows how Mutexes appear in Tracealyzer. The blue labels show the priority inheritance, where the priority of the holding task is raised (inherited) to the same level as the waiting task to avoid unsuitable preemptions.

This trace view, combined with a large set of visual overviews, makes it easy to understand the real-time behavior of your Zephyr system. You can verify that task priorities are suitable and that the system works as designed. If something seems to be wrong, you can isolate and debug the real-time behavior without halting the system, especially in combination with application logging (see below). You can also profile the system to ensure it runs in an efficient manner, so you get the most out of your hardware.

Tracealyzer showing FreeRTOS blocking

Application Logging

Tracealyzer provides advanced logging capabilities. Log custom events and data in your application code and display it in Tracealyzer, together with the kernel trace and as graphical plots. This provides deeper observability into the application code at runtime.

Unlike printf-calls, the Tracealyzer logging does not slow down your code by several milliseconds. The efficient logging functions can eliminate over 99% of the logging overhead compared to printf over a UART. This low-impact logging ensures you get the right picture in your debugging, without probe effects from slow logging calls.

For example, state transitions can be logged and displayed in a “logic analyzer” view and as a state diagram. The result can be shown within the trace view (as shown on the left) or summarized as a state graph (on the right), making it easy to spot incorrect behavior.

Learn more how Tracealyzer simplifies debugging with advanced, low-impact logging capabilities.

Tracealyzer showing a state machine in a FreeRTOS trace

How it works

You do not need any particular hardware to use Tracealyzer, just a suitable development board. You can capture snapshots of the latest activity from a trace buffer in RAM, or stream the data to host using for example Ethernet or a debug probe like SEGGER J-Link, IAR I-jet or Keil ULINK. This way, you can monitor your system over long periods of time and capture any issues.

Tracealyzer for Zephyr relies on the Percepio TraceRecorder, which is available in the Zephyr repository under the Apache 2.0 license. This is integrated in your project within a few minutes by following the Getting Started guides.

Tracealyzer works with most embedded processors (e.g. Arm devices and others) and Percepio provides plugins and integrations for common development tools, including Segger J-Link, GDB, STM32CubeIDE, Keil MDK, IAR and Lauterbach.

Flyability

“Tracealyzer has doubled our development speed. Problems that otherwise would take days to solve are obvious with this tool and just a quick fix. We use it all the time.”

Alex Pabouctisids
Lead Firmware Engineer, Flyability

CGX AERO

“Tracealyzer allowed me to quickly understand and solve serious multi-threading issues, that otherwise would have taken least two weeks to analyze. I got started and solved the first issue in a single day. I strongly recommend Percepio’s tracing tools.”

Chaabane Malki
Embedded Systems Engineer, CGX Aero

SAAB AB

“The many system views of the Tracealyzer from Percepio makes it easy to quickly find solutions that we have not seen using (Wind River) System Viewer. The visualization has several advantages over the system viewer and makes it easier to understand system behavior. This tool would be of great use for us.”

Johan Fredriksson
Software Architect, Saab AB

Serious Integrated, Inc.

“In less than 5 days from running the tool, we improved the performance of our graphic rendering engine by 3x!”

Terry West
CEO, Serious Integrated, Inc.

Telcred AB

“Tracealyzer have enabled us to better understand and further improve our embedded software. Using this tool, we have been able to identify performance bottlenecks and solve problems, which otherwise would have been very hard to analyze.”

Carlo Pompili
CEO, Telcred AB

ABB Robotics

“ABB Robotics is using the first generation Tracealyzer in all of the IRC5 robot controllers shipped since 2005. The tool has proven its value many times in all corners of the world.”

Roger Kulläng
Global System Architect, ABB Robotics

Sensonix

“I am looking at an existing code base and architecture in use here on several projects. If we improve how we use FreeRTOS, we would substantially improve software quality, make better use of microcontroller resources and streamline our debugging efforts.  I plan on using Tracealyzer to understand where the project is at today and to help me analyze changes I make going forward.  It is obvious to me that Percepio is working to improve Tracealyzer every day.”

Jim Knutsen

Neovigie

“It is not always easy to decide if an investment is a good idea or not. But now that we have invested in Tracealyzer, it is very difficult for us to imagine developing firmware based on FreeRTOS without it. Money is always a delicate point for every company, but from my point of view, Tracealyzer for an RTOS is like an oscilloscope for hardware design; it’s not an option, it’s a requirement.”

Mr. Ravache
R&D, Neovigie

Endress+Hauser Flow

“Percepio Trazealyzer allows us to quickly analyze and understand our embedded system. It gives us great insight on process timing and interactions within our software.”

Davide Ferrari
Embedded Software Engineer, Endress+Hauser Flow

ARIS Switzerland

“Tracealyzer allowed us to see what our software was doing. It gave us insight into available memory for tasks, and we could verify real-time requirements. We used it throughout the project and found integrating it into our application quite easy thanks to the included instructions.”

Lukas Voge
Electronics & Software Engineer, ARIS Switzerland

Stay informed.
Sign up for our newsletter.

Our Products

Percepio® is the leading provider of visual trace diagnostics for embedded and IoT software systems in development and in the field.

TRACEALYZER

Percepio® Tracealyzer combines software tracing with powerful visualizations, allowing users to spot and analyze issues in software recordings during development and testing.

Learn more about Tracealyzer

DEVALERT

Percepio® DevAlert is a cloud-connected monitoring framework for OEMs developing RTOS device software, providing instant insight on bugs and anomalies.

Learn more about DevAlert