DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Adding FreeRTOS Thread Awareness to GDB and Eclipse

This article describes the steps how to use it with the NXP Kinetis Design Studio (V3.2.0) with the GNU ARM Eclipse plugins.

Erich Styger user avatar by
Erich Styger
·
Jun. 22, 16 · Tutorial
Like (1)
Save
Tweet
Share
5.07K Views

Join the DZone community and get the full member experience.

Join For Free

Segger has released a beta version of the J-Link software which includes their GDB thread awareness for embOS and FreeRTOS.

FreeRTOS Thread Aware Debugging

FreeRTOS Thread Aware Debugging

Outline

I had a first chance to try this plugin at NXP FTF 2016 in Austin (see "FreeRTOS Thread Debugging with Segger GDB in Eclipse"). Now that feature is included in the latest Segger beta download.

This article describes the steps how to use it with the NXP Kinetis Design Studio (V3.2.0) with the GNU ARM Eclipse plugins. Similar steps can apply for other Eclipse distributions with GDB. A similar feature is present in OpenOCD (see "FreeRTOS Thread Debugging with Eclipse and OpenOCD").

Note: there seems to be some problems with the GNU compiler used, not sure why (yet?)?

Installation

Download the latest Segger J-Link software version from the Segger site. Currently, it is available on the beta site (V5.41h). Then run the setup. A dialog will ask to update existing IDE’s using Segger J-Link software on Windows:

Update J-Link DLL

Update J-Link DLL

For Mac OS X and Linux you have to copy the necessary files from the installation folder. The RTOS thread awareness is using DLLs/libraries from the ‘GDBServer’ subfolder.

Segger GDB Server Plugins

Segger GDB Server Plugins

In the beta installer, that GDBServer folder is not copied into Kinetis Design Studio (subfolder ‘segger’ inside KDS). I recommend to manually copy that folder into the ‘segger’ subfolder of KDS:

GDB Server Folder in KDS

GDB Server Folder in KDS

Using the FreeRTOS Plugin

To use the FreeRTOS plugin, specify which RTOS plugin to load with:

-rtos GDBServer/RTOSPlugin_FreeRTOS


The path is relative to the Segger GDB server. If you have located the plugins elsewhere, you have to adopt the path.

Below shows the command in the debug launch configuration for GDB and Segger using the GNU ARM Eclipse plugin:

Setting in Segger J-Link Launch Configuration

Setting in Segger J-Link Launch Configuration

With this, it shows the RTOS threads in the GDB debug view under Eclipse while debugging:

FreeRTOS Thread Aware Debugging

FreeRTOS Thread Aware Debugging

Troubleshooting

The implementation checks and accesses several symbols of FreeRTOS, for example:

Received symbol: pxCurrentTCB (20003A7C)
Received symbol: pxReadyTasksLists (20003A80)
Received symbol: xDelayedTaskList1 (20003AF8)
Received symbol: xDelayedTaskList2 (20003B0C)
Received symbol: pxDelayedTaskList (20003B20)
Received symbol: pxOverflowDelayedTaskList (20003B24)
Received symbol: xPendingReadyList (20003B28)
Received symbol: xTasksWaitingTermination (00000000)
Received symbol: xSuspendedTaskList (20003B3C)
Received symbol: uxCurrentNumberOfTasks (20003B50)
Received symbol: uxTopUsedPriority (2000002C)
Received symbol: vPortEnableVFP (0000FE24)


I had faced a problem where at high compiler optimization level the function vPortEnableVFP() was inlined. I have fixed that in my FreeRTOS port with a noinline attribute so it works with highest optimization too:

void __attribute__ ((noinline)) vPortEnableVFP(void) {


Summary

The Segger RTOS plugin provides a very convenient way to debug FreeRTOS (or Segger emBOS) threads with Eclipse and GDB using a Segger J-Link debug probe. A native J-Link or an embedded J-Link probe like OpenSDA on the NXP Freedom boards. It greatly simplifies the debug experience, and after using it I don’t know how I was able to debug RTOS applications before.

Happy Threading!

FreeRTOS

Published at DZone with permission of Erich Styger, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Integration: Data, Security, Challenges, and Best Solutions
  • Handling Automatic ID Generation in PostgreSQL With Node.js and Sequelize
  • How to Cut the Release Inspection Time From 4 Days to 4 Hours
  • Getting Started With JMS-ActiveMQ: Explained in a Simple Way

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: