Tracing FreeRTOS with a Hardware Probe

Using an RTOS is an excellent thing: it provides services and allows to scale my application. But it adds complexity. With many tasks, queues and semaphores it is hard to have an overview what is going on. To get visibility, Martin Bucher has developed in a bachelor diploma work the FreeRTOS Trace Probe.

FreeRTOSProbe Hardware based on Tower modules

FreeRTOSProbe Hardware with Tower modules

The concept is the following: the application running FreeRTOS is using RTOS hooks. The hooks are part of the FreeRTOS API, but it is up to the application to implement them. The application implements the hooks with a Processor Expert component. That component sends out the trace messages over a communication channel (SCI, I2C, SPI, etc). The Probe Hardware collects the hook messages. The collected trace data is visualized on the host:

FreeRTOS Trace Probe Concept

FreeRTOS Trace Probe Concept

The FreeRTOS Trace Probe has following parts:

  1. Trace Hooks in application: the target application RTOS is using the FreeRTOS Hook API. The target application enables and configures the hooks in the FreeRTOS Trace component:

    Trace Hooks Enabled in the Application

    Trace Hooks Enabled in the Application

  2. Processor Expert Hook Implementation: A Processor Expert component integrated with the FreeRTOS component which implements the trace hooks of the RTOS.

    FreeRTOS Trace Properties

    FreeRTOS Trace Properties

  3. Probe Hardware: An additional PCB compatible with the Towersystem. It has a battery buffered real-time clock, an SD card socket plus trace pins with level shifter. Using the connectors the hardware connects to the communication channel of the target application (e.g. I2C):

    Trace Probe Hardware

    Trace Probe Hardware

  4. Trace Probe Firmware: The firmware is running FreeRTOS on an ColdFire MCF52259 and is using Processor Expert components:

    Probe Firmware with Embedded Components

    Probe Firmware with Embedded Components

  5. Viewer Software on the Host: a Java application running on the host to visualize the trace information:

    FreeRTOS Trace Viewer

    FreeRTOS Trace Viewer

The concept worked well. Using a communication channel to stream the data off the target board is used instead of using a RAM buffer. The disadvantage is that the communication channel limits the bandwidth and amount of trace data. But for typical use cases it was good enough, especially if I limit the amount of data.

Additional information:

Happy RTOS Tracing šŸ™‚

3 thoughts on “Tracing FreeRTOS with a Hardware Probe

  1. Pingback: Tracing with FreeRTOS+Trace from Percepio | MCU on Eclipse

  2. Pingback: The Making Of RTOS Processor Expert Components | MCU on Eclipse

  3. Pingback: FreeRTOS Continuous Trace Streaming | MCU on Eclipse

What do you think?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.