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

blogs->nordicers

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?

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

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.

## Recent blog posts

• ### Difference between nRF52840 Engineering A and B reference designs

Posted 2018-01-15 12:27:08 by Martin Børs-Lind
• ### [For Hire] Expert development services of custom Hardware devices | IoT solutions | Mobile Apps

Posted 2018-01-15 09:08:42 by Ilya Surinsky
• ### Rust bindings to nrf52 series

Posted 2018-01-12 23:23:07 by Coleman McFarland
• ### Show And Tell: Poly - Building an RC Airplane The Hard Way

Posted 2018-01-05 01:17:57 by Daniel Veilleux
• ### Bluetooth on a desktop computer (Windows, Mac, Linux)

Posted 2018-01-04 17:56:57 by kbaud

## Recent questions

• ### System off draws more then 80µA

Posted 2018-01-22 22:15:19 by ruetten
• ### How to add driver to an SDK example, in Segger Embedded Studio?

Posted 2018-01-22 21:37:18 by Mark Leavitt
• ### Send more than 60 characters with each call to ble_nus_string_send

Posted 2018-01-22 21:20:21 by fkoran
• ### DFU succeeds but flash is erased

Posted 2018-01-22 20:42:54 by brett_anderson
• ### Uart example stops blinking after a while

Posted 2018-01-22 19:56:29 by oliverpoc