Posted 2017-04-11 11:49:17 +0200

blogs->nordicers

# FreeRTOS threads preview with J-Link, GDB/Eclipse

Short note how to make FreeRTOS program debugging with eclipse little simpler.

If you are looking the information how to configure the whole environment see this post: https://devzone.nordicsemi.com/tutorials/7/development-with-gcc-and-eclipse/

## What we get out of the box

Most low power applications stays most of the timer in idle. Ideally it would be tickless-idle. The problem begins if our program behaves strangely and we would like to stop it and check what is going on.

Lets get blinky_freertos example. Run it and halt just in random moment. Until you are very lucky you would stop somewhere in the FreeRTOS files:

The problem is that in most cases we would land in IDLE task. And there is no easy way to see the state of the task of our interest. Or is there?

## Activating j-link rtos plugin

J-link server provides proper support for info thread gdb command by special rtos plugin. To enable it just add an option to command line:

-rtos GDBServer\RTOSPlugin_FreeRTOS


See debug configuration below as a template:

Now when you run the debug and pause it, you would probably stop in idle task anyway. But all the tasks would be listed and you can easily go to the source where it waits just by clicking in the thread backtrace:

In the image above you may see that simple freertos_blinky example utilizes 3 Threads:

• IDL - Idle
• LED - our LED loop
• Tmr - Thread that processes the timers

## Bugs in jlink 6.12a

I have experienced some issues with the -rtos option when program was compiled with -03 optimisation option - the debugger often crashes, inside RTOSPlugin_FreeRTOS.dll library, when trying to stop inside a FreeRTOS task. With -00 there was no such issue.

Problem disappeared after jlink 6.14c was installed. You can download newest jlink software directly from Segger site: https://www.segger.com/downloads/jlink.

## 0 comments

Sign in to comment.

or sign up

## Recent blog posts

• ### nRF52 Development with CLion

Posted 2017-06-22 09:50:54 by dansheme
• ### Simple GPIO driver example

Posted 2017-06-22 13:38:36 by Hans Elfberg
• ### What mom didn't tell you about ble_app_att_mtu_throughput on the nRF52840 evaluation board

Posted 2017-06-16 16:12:15 by George
• ### Introducing Nordic’s new software licensing schemes

Posted 2017-06-15 11:21:39 by Reidar Martin Svendsen
• ### Open source project for live monitoring and troubleshooting of IoT systems and networks (now supports nRF52832)

Posted 2017-06-13 15:20:07 by Yaniv Nis

## Recent questions

• ### Missing closing brace in SDK13.0.0

Posted 2017-06-22 17:45:31 by Vulpiculus
• ### Clarify is_conn_params_ok() function

Posted 2017-06-22 17:18:46 by aras
• ### Enabling DC/DC mode on the NRF BEACON

Posted 2017-06-22 16:20:58 by nugget
• ### How to config SAADC?

Posted 2017-06-22 16:11:44 by Leila
• ### S130 central disconnected immediately after connection to iOS peripheral

Posted 2017-06-22 15:42:49 by Adam Heinrich