freertos trace probe - mcu on eclipse · freertos trace probe martin bucher, prof. erich styger...

16
S4D - System, Software, SoC and Silicon Debug Conference FreeRTOS Trace Probe Martin Bucher, Prof. Erich Styger [email protected], [email protected] Lucerne University of Applied Sciences and Arts September 26, 2011 1 / 16

Upload: others

Post on 25-Aug-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: FreeRTOS Trace Probe - MCU on Eclipse · FreeRTOS Trace Probe Martin Bucher, Prof. Erich Styger martin.bucher@stud.hslu.ch, erich.styger@hslu.ch Lucerne University of Applied Sciences

S4D - System, Software, SoC and Silicon Debug Conference

FreeRTOS Trace Probe

Martin Bucher, Prof. Erich Styger

[email protected], [email protected] University of Applied Sciences and Arts

September 26, 2011

1 / 16

Page 2: FreeRTOS Trace Probe - MCU on Eclipse · FreeRTOS Trace Probe Martin Bucher, Prof. Erich Styger martin.bucher@stud.hslu.ch, erich.styger@hslu.ch Lucerne University of Applied Sciences

Topics

FreeRTOS and Trace Hooks

Embedded Components

Approach with Embedded Components

Results and Conclusions

2 / 16

Page 3: FreeRTOS Trace Probe - MCU on Eclipse · FreeRTOS Trace Probe Martin Bucher, Prof. Erich Styger martin.bucher@stud.hslu.ch, erich.styger@hslu.ch Lucerne University of Applied Sciences

FreeRTOS and Trace Hooks

FreeRTOS: www.freertos.orgLGPL, 27+ architectures, 17+ tool chainsBuilt in trace hooks (task create, delete, switch, ...)Trace hooks require user implementation (both target andevaluation)

RTOSwith hooks

Probe tocollectmsg

Host tovisualize

hook msg

trace data

3 / 16

Page 4: FreeRTOS Trace Probe - MCU on Eclipse · FreeRTOS Trace Probe Martin Bucher, Prof. Erich Styger martin.bucher@stud.hslu.ch, erich.styger@hslu.ch Lucerne University of Applied Sciences

Embedded Component

Software Encapsulation

C-like scripting language

Uses Code Generation

Properties, Events, Methods and Inheritance

Embedded Component

Properties

Events

Methods

4 / 16

Page 5: FreeRTOS Trace Probe - MCU on Eclipse · FreeRTOS Trace Probe Martin Bucher, Prof. Erich Styger martin.bucher@stud.hslu.ch, erich.styger@hslu.ch Lucerne University of Applied Sciences

Approach

Extend existing FreeRTOS Embedded Component

Create new Embedded Component: TraceHooks

Re-use existing Embedded Components as trace channels

Build hardware reference system

Visualize on host system

5 / 16

Page 6: FreeRTOS Trace Probe - MCU on Eclipse · FreeRTOS Trace Probe Martin Bucher, Prof. Erich Styger martin.bucher@stud.hslu.ch, erich.styger@hslu.ch Lucerne University of Applied Sciences

Trace Flow

Instrumented RTOS with Trace Hooks

Channel used to get trace of the target

FreeRTOS probe collects trace

Host used to visualize data

Target Application

FreeRTOS

Trace Channel

FreeRTOS Probe

Firmware

Host

Visualization

6 / 16

Page 7: FreeRTOS Trace Probe - MCU on Eclipse · FreeRTOS Trace Probe Martin Bucher, Prof. Erich Styger martin.bucher@stud.hslu.ch, erich.styger@hslu.ch Lucerne University of Applied Sciences

Extended FreeRTOS Embedded Component

Enabling/Disabling Hookfunctionality

Selection of Interface

FreeRTOS remainscompatible

7 / 16

Page 8: FreeRTOS Trace Probe - MCU on Eclipse · FreeRTOS Trace Probe Martin Bucher, Prof. Erich Styger martin.bucher@stud.hslu.ch, erich.styger@hslu.ch Lucerne University of Applied Sciences

Inheritance

Seamless Integration

Inheritance (private member)

FreeRTOS inherits from FreeRTOSTrace

Interface accessible within FreeRTOS

8 / 16

Page 9: FreeRTOS Trace Probe - MCU on Eclipse · FreeRTOS Trace Probe Martin Bucher, Prof. Erich Styger martin.bucher@stud.hslu.ch, erich.styger@hslu.ch Lucerne University of Applied Sciences

Trace Hook Selection

Enabling/Disabling HooksSelection of channel

Console/Terminal (SCI)I2CSPICAN

9 / 16

Page 10: FreeRTOS Trace Probe - MCU on Eclipse · FreeRTOS Trace Probe Martin Bucher, Prof. Erich Styger martin.bucher@stud.hslu.ch, erich.styger@hslu.ch Lucerne University of Applied Sciences

Trace Message Format

Uncompressed data and message format

Prebyte followed by ID, data and end marker

Prebyte with ID used as ’start’ marker

SCI/57600: 57 bytes/10 ms

I2C: 420 bytes/10 ms

99

Start

10-43

ID

Data

4-10 Bytes

98

End

10 / 16

Page 11: FreeRTOS Trace Probe - MCU on Eclipse · FreeRTOS Trace Probe Martin Bucher, Prof. Erich Styger martin.bucher@stud.hslu.ch, erich.styger@hslu.ch Lucerne University of Applied Sciences

Probe Reference Implementation

Freescale Tower BoardsMCF52259 ColdFire V2Serial, Ethernet, USBTouch screen LCD (optional user interface)

11 / 16

Page 12: FreeRTOS Trace Probe - MCU on Eclipse · FreeRTOS Trace Probe Martin Bucher, Prof. Erich Styger martin.bucher@stud.hslu.ch, erich.styger@hslu.ch Lucerne University of Applied Sciences

Optional FreeRTOS Tower Card

Tower Card Bus (PCI Expresssockets)

SD card socket to store dataRealtime Clock

Time stamp informationBattery buffered

Level shiftersBit I/O3.3V5.0V

12 / 16

Page 13: FreeRTOS Trace Probe - MCU on Eclipse · FreeRTOS Trace Probe Martin Bucher, Prof. Erich Styger martin.bucher@stud.hslu.ch, erich.styger@hslu.ch Lucerne University of Applied Sciences

FreeRTOS Firmware

Firmware built withEmbedded Components

Running FreeRTOS

FatFS as file system

13 / 16

Page 14: FreeRTOS Trace Probe - MCU on Eclipse · FreeRTOS Trace Probe Martin Bucher, Prof. Erich Styger martin.bucher@stud.hslu.ch, erich.styger@hslu.ch Lucerne University of Applied Sciences

Offline Trace Data Viewer on Host

Implemented in Java

Load Trace Data File stored on SD card

Selection of trace event labels

14 / 16

Page 15: FreeRTOS Trace Probe - MCU on Eclipse · FreeRTOS Trace Probe Martin Bucher, Prof. Erich Styger martin.bucher@stud.hslu.ch, erich.styger@hslu.ch Lucerne University of Applied Sciences

Trace Viewer

JFreeChart WidgetConfigurable MarkersDummy Trace for non-task items

15 / 16

Page 16: FreeRTOS Trace Probe - MCU on Eclipse · FreeRTOS Trace Probe Martin Bucher, Prof. Erich Styger martin.bucher@stud.hslu.ch, erich.styger@hslu.ch Lucerne University of Applied Sciences

Summary

Simplified Trace Hook usage in FreeRTOS

Re-using existing components

SCI/Serial connection: 7 hooks per 10 ms

I2C: reasonable 25-30 hooks

Protocol needs compression for higher speed

Host trace viewer very limited

Low cost open source trace hard- and software

16 / 16