DIY Free Toolchain for Kinetis: Part 5 – FreeRTOS Eclipse Kernel Awareness with GDB

So far I have covered in this tutorial series how to install ARM GNU gcc, adding Eclipse, followed by adding GNU GDB debugger, and then adding Processor Expert. I’m using FreeRTOS a lot in my projects, and luckily there is a Kernel Awareness Plugin available for FreeRTOS for GDB in Eclipse. This tutorial is about how to install and use it.

Queues and Tasks

Queues and Tasks

List of Tutorials

Kernel Awareness

Debugging gets a bit more complicated with an RTOS: as each task has its own stack, the debugger normally does not know which other tasks exists. As such, if I stop my program/task, then the debugger will just show the current context and task. CodeWarrior for MCU10.x comes with Kernel Awareness for MQX, but not for FreeRTOS.

What a kernel awareness plugin does is to give other information to the debugger about the RTOS. For this it needs to read the RTOS information from the target. Unfortunately, as this is dependant of the debugger, such a kernel awareness needs to match the debugger used. Other debuggers like Keil, IAR, Atollic or Lauterbach have implemented a FreeRTOS kernel awareness into their debugger. What we need here is a FreeRTOS Kernel Awareness for Eclipse and GDB.

State Viewer Plugin from Wittenstein

HighIntegritySystem/Wittenstein produces commercial version of FreeRTOS (SafeRTOS, OpenRTOS) provides a free Eclipse GDB FreeRTOS Kernel Awareness plugin which works with their products and the ‘normal’ FreeRTOS.

  1. Go to http://www.highintegritysystems.com/down-loads/stateviewer-plug-in/
  2. You need to register to receive an email with instructions to download and install the Eclipse plugin. Basically it gives you a PDF and the link to the Eclipse updater to download the plugin

Kernel Awareness Views

After installation, I have set of new views available accessible with the menu Window > Show Views:

FreeRTOS Kernel Awareness Viewers

FreeRTOS Kernel Awareness Viewers

Altough they are under  ‘OpenRTOS’ and ‘SafeRTOS’, they work very well with normal FreeRTOS. The views with the (DSF) suffix to not work with normal GDB (I’m using), they would would need a debugger with DSF (Debugger Services Framework) extension. So I’m using the ‘normal’ views.

Task Table View

The Task Table View shows the current state of all tasks:

Task Table View

Task Table View

Queue Table View

In order to display the queues, I need to configure the RTOS to use a registry for their names. I specify the number of queues in the FreeRTOS properties:

Queue Registry Size

Queue Registry Size

Additionally, in my sources I have to give it a name with vQueueAddToRegistry():

QUEUE_StdIn = xQueueCreate(QUEUE_LENGTH, QUEUE_ITEM_SIZE);
vQueueAddToRegistry(QUEUE_StdIn, (signed char*)"QUEUE_StdIn");

With this, my registered queues are shown in the Queue Table view:

FreeRTOS Queue Table View

FreeRTOS Queue Table View

Summary

With the FreeRTOS task awareness plugin, I can visualize the tasks and queues in Eclipse. The views are available for free from the Wittenstein web site after registration. Even if the views are very simple, they help to have an overlook what is going on in the system.

Happy Awarenessing 🙂

Advertisements

37 thoughts on “DIY Free Toolchain for Kinetis: Part 5 – FreeRTOS Eclipse Kernel Awareness with GDB

  1. Pingback: DIY Free Toolchain for Kinetis: Part 4 – Processor Expert for Eclipse | MCU on Eclipse

  2. Pingback: DIY Free Toolchain for Kinetis: Part 3 – Debugger (GDB Server with P&E and Segger) | MCU on Eclipse

  3. Pingback: DIY Free Toolchain for Kinetis: Part 2 – Eclipse IDE | MCU on Eclipse

  4. Pingback: DIY Free Toolchain for Kinetis: Part 1 – GNU ARM Build Tools | MCU on Eclipse

  5. Pingback: DIY Free Toolchain for Kinetis: Part 6 – Linux Host with OpenOCD and CMSIS-DAP | MCU on Eclipse

  6. Pingback: New CodeWarrior for MCU10.5 | MCU on Eclipse

  7. Pingback: DIY Free Toolchain for Kinetis: Part 7 – GNU ARM Eclipse Plugins | MCU on Eclipse

  8. Pingback: DIY Free Toolchain for Kinetis: Part 8 – Processor Expert, Eclipse and GNU ARM Eclipse Plugins | MCU on Eclipse

  9. Pingback: DIY Free Toolchain for Kinetis: Part 9 – Express Setup in 8 Steps | MCU on Eclipse

  10. Pingback: DIY Free Toolchain for Kinetis: Part 10 – Project Creation with GNU ARM Eclipse 2.1.1 | MCU on Eclipse

    • Yes, that should not make any difference, as the stateviewer plugin should not care about he connection. Are you using the DSF versions of the views or the ‘normal’ ones? Depending on how you connect to GDB, you need to use the one or the other.
      I hope this helps.

      Like

  11. Hi Erich,

    I’ve recently seen your excellent tutorial and it really helps me a lot!

    But I have the same problem with Seumas, that I cannot get the TaskTable or QueueTable to show anything. Note that I’m using Eclipse+gcc+PEx (thanks to your help 🙂 ) working on the K20D50M board, and I take Segger’s OpenSDA firmware as debug tools.

    Thanks!

    Like

      • Hi Erich,

        Thanks for your rapid reply!

        I’m using FreeRTOS v8.0, which is already integrated in the PEx v10.3 suites for Eclipse (http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=PE_DRIVER_SUITE&fpsp=1&tab=Design_Tools_Tab#). For the Wittenstein plugins, I think it should be the latest version because I’ve just downloaded it from the official site. And yes, I’m using Eclipse Kepler.

        In fact, I’m not sure if this is due to the task creation problem. When I try to create two tasks, each one controlling an LED independently, it seems that neither of them works. But if with only one of them created, it then works without problem. In terms of task create or control code, I refereed to your files on Github. I generated the FreeRTOS source code only using the PEx by adding an OS component.

        Thanks!!

        Like

      • So if you create one task, it works, but not with two? That sounds like your running out of heap space? Were you debugging/stepping through the code?

        Like

  12. Pingback: Constructing a Classroom IDE with Eclipse for ARM | MCU on Eclipse

  13. I thought this was not working for me: the Task Table was empty. But having tried all four options (OpenRTOS Viewer Task Table and TaskTable (DSF), and SafeRTOS Viewer Task Table and Task Table (DSF)) I find that one of the four (OpenRTOS TaskTable (DSF)) does appear to work.

    As I write I have not tested this thoroughly, but I thought it was worth reporting: I have installed the “latest” GNU ARM Eclipse plugins as described in Part 10 plus the P&E plugin for OpenOCD debugging. So it looks like OpenRTOS DSF is the right combination for that setup.

    Liked by 1 person

    • Yes, the SafeRTOS only work with SafeRTOS (a special (paid) version of FreeRTOS for safety system). If the DSF (Debugger Services Framework) or ‘non-DSF’ work depends on the GDB debugger connection. DSF is the newer one. The ‘old’ P&E GDB server did not use DSF, while the new one does (e.g. the one from P&E Eclipse Update Site for GNU ARM Eclipse Plugins).
      As a side note: there is no such thing as “P&E plugin for OpenOCD debugging’. The P&E plugin is for GDB debugging. OpenOCD is a completely different thing, and works with P&E too. OpenOCD is the open source equivalent what e.g. P&E and Segger do, but only on the software side.

      Like

  14. Pingback: Comparing CodeWarrior with Kinetis Design Studio | MCU on Eclipse

  15. Pingback: Tutorial: FreeRTOS with the Kinetis SDK and Processor Expert | MCU on Eclipse

  16. Hello erich,

    Nice post. This might be helpful for me to debug many freeRTOS related issues.
    I have installed the plugin you have mentioned into my CW10.3. I am using P&E multilink universal for debugging my code. I have opened the tasktable (tried both openRTOS and safeRTOS) . But its empty while I am debugging the code.

    Like

    • Hi durgesh088,
      as stated in the article and in the article header, these plugins are for GDB. So they do not work with CodeWarrior, as CodeWarrior is not using GDB. Use either DIY Kepler Eclipse or Kinetis Design Studio, as they use GDB debugger.
      Erich

      Like

  17. Hi Erich:

    Thanks for your nice post. I followed it and most parts work fore me but the StateViewer plugin. I can see the “SafeRTOS viewer” and “OpenRTOS viewer” unser window->show view. But when I open the task table, it is just blank. I am using eclipse luna and openOCD debugger. Do you have any suggestion?

    Like

    • You definitely need the OpenRTOS viewer, because SafeRTOS assumes different task descriptors. If your openOCD is based on GDB, then either the (DSF) or non-DSF views should work. Otherwise I might be a problem of your OpenOCD? I’m using it sucessfully with OpenOCD in Kinetis Design Studio.

      Like

      • I had checked my openOCD configuration, but I can’t see any problem. What do I need to do on openOCD site to make StateViewer work?

        In addition, openOCD also has freeRTOS support and I managed to make it work. What is the relationship between openOCD’s freeRTOS support and StateViewer plugin?

        I also google and some person said StateViewer is eclipse version sensitive, is it true? If so, how may I know which version eclipse I should use? The StateViewer I installed is 2.0.8.

        Like

      • StateViewer to my knowledge is using a simple gdb connection to the target. I have seen differences in the past if gdb is DSF based or not (there are two different viewers because of that). I have not used the Stateviewer in Luna (I’m still using Kepler), so this indeed might be a problem, but I’m not sure. I’m using the 2.0.8.201409041322 version of the WHIS StateViewer plugin.

        Like

  18. Pingback: FreeRTOS ARM Thread Debugging with Eclipse and GDB | MCU on Eclipse

  19. neither option works for me. 3 tasks, latest freertos and Kinetis Design Studio Version: 3.1.0 :/ i tried dsf, non-dsf, openRTOS, safeRTOS

    Like

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s