UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Observer dmitril
Observer
3,615 Views
Registered: ‎01-17-2018

How to debug FreeRTOS?

Hi,

This question was already asked:

https://forums.xilinx.com/t5/Embedded-Development-Tools/freertos823-xilinx-thread-debugging/m-p/762518/highlight/true#M41689

but I had not seen any answers.

 

It appears that there are no tools for debugging FreeRTOS with System Debugger on Xilinx SDK 2016.4

Is it still true?

I read in some posts that FreeRTOS debugging may be possible with GDB,

but I cannot find any instructions how to create Debug Configuration in Xilinx SDK for GDB.

Is it possible?

 

Thank you

0 Kudos
8 Replies
Observer richardbarry
Observer
3,570 Views
Registered: ‎04-26-2008

Re: How to debug FreeRTOS?

There are FreeRTOS thread aware debugger plug-ins for Eclipse from, for example, Segger or Code Confidence, but they require a GDB interface.  I think the SDK enables you to use either the system debugger or GDB, but I've not tried the GDB option.

Regards,
Richard.

+ http://www.FreeRTOS.org
The de facto standard, downloaded every 4.2 minutes during 2015.

+ http://www.FreeRTOS.org/plus
IoT, Trace, Certification, TCP/IP, FAT FS, Training, and more...
0 Kudos
Xilinx Employee
Xilinx Employee
3,526 Views
Registered: ‎01-03-2017

Re: How to debug FreeRTOS?

Hi @dmitril,

 

You can debug the FreeRTOS applications using the system debugger and you can find the steps in sdk help.

 

Go to Help--> and search for debugging application, then you will see the instructions.

 

Thanks & Regards,

Praveen Kumar. V

0 Kudos
Observer dmitril
Observer
3,514 Views
Registered: ‎01-17-2018

Re: How to debug FreeRTOS?

> I think the SDK enables you to use either the system debugger or GDB, but I've not tried the GDB option

 

So far I was not able to setup a GDB debug configuration.

It appears that GDB is no longer supported:

https://www.xilinx.com/html_docs/xilinx2016_4/SDK_Doc/index.html?q=/html_docs/xilinx2016_4/SDK_Doc/SDK_tasks/task_faq_inwhichscenarioshouldiusedebugger.html

"GNU Debugger does not support the latest Xilinx devices."

I do not know whether this applies to my device or not.

 

> Go to Help--> and search for debugging application, then you will see the instructions.

 

Sorry, I cannot invoke this link from SDK GUI.

Could you, please, send me a Web link to this page (specific to FreeRTOS debug)>

 

Thank you

 

0 Kudos
Xilinx Employee
Xilinx Employee
3,502 Views
Registered: ‎10-21-2010

Re: How to debug FreeRTOS?

Hi,

As Richard pointed out, SDK debugger is not FreeRTOS thread aware. You can debug FreeRTOS more like baremetal

 

Please refer to https://www.xilinx.com/html_docs/xilinx2017_4/SDK_Doc/SDK_tasks/sdk_t_tcf_supported_design_flows.html for details about using System Debugger

 

GDB flow is currently deprecated, but in 2018.1, we're enhancing GDB debug to support all devices. Again, this will not be FreeRTOS thread aware

0 Kudos
Observer dmitril
Observer
3,489 Views
Registered: ‎01-17-2018

Re: How to debug FreeRTOS?

> You can debug FreeRTOS more like baremetal

 

Well, not really.
In "baremetal" app there is only one task/thread and only once stack and debugger displays that stack.
But in RTOS there are multiple tasks and stacks, but debugger only displays stack for the current task,
which is usually IDLE task, so this stack display is useless and, therefore, your entire "System Debugger" is useless as well.
There is no way to figure out where my task is stuck without manually deciphering the stack memory,
which is very tedious and error prone.
So, at the very minimum, there should be a way to ask debugger to examine stack for the given task instead of the current stack.
Is it possible?
Can I ask "System Debugger" to display stack at a given address?
Thank you

0 Kudos
Adventurer
Adventurer
3,258 Views
Registered: ‎08-04-2017

Re: How to debug FreeRTOS?

Have you tried various methods suggested in Master the FreeRTOS Real Time Kernel?

 

  1. Tracealyzer - Getting started with Tracealyzer for FreeRTOS on Xilinx Zynq
  2. ThreadSpy - listed in Master the FreeRTOS Real Time Kernel pg. 354 for Eclipse so it may work, but I don't see any specific references to Zynq, only MicroBlaze.
    • Note: There are also other FreeRTOS aware IDEs available if using something other than Xilinx SDK is an option.
  3. Trace Hook Macros - Master the FreeRTOS Real Time Kernel pg. 349 lists the most commonly used ones, but there are actually many more than can be found in FreeRTOS.h

I am only beginning to use FreeRTOS, so I do not have personal experience with the above.  But if you try any of them, please report back as it would be helpful to myself and others to learn what works or does not.

 

Best Regards,

Joe

0 Kudos
1,517 Views
Registered: ‎02-06-2019

Re: How to debug FreeRTOS?

Hi guys!

My initial project to enable RTOS-aware debugging with GDB-servers that does not provides RTOS threads support:

Currently only initial release, looks like MicroBlaze + FreeRTOS (Little-Endian without FPU) work well.

Yes, it can only work with GDB debugger. Not with System debuger. Due to it is closed-sources, and complex in extend/modify by engineers like me.

To run, follow build instruction in README.md to build code. Asio standalone, system-wide installation is needed.

After that, configure XSDK/Eclipse to run GDB-client (md-gdb) that tries to connect to non-standard port. For example - 4002 (default one - 3002 for MicroBlaze). Now, you can just run gdbproxy with target mb_freertos:

./gdbproxy --port 4002 --remote-port 3002 --remote-host localhost mb_freertos

Ok. Go to back XSDK and run debugging session using GDB (non System debugger!).  I think, that you can run it automatically from gdb init script, but I didn't find any way to point gdbinit script from XSDK. I any case, gdbproxy can be run only one and handle multiple debug sessions with right handling disconnects.

Note, thread #1 (with id "1.1") - always "additional thread" that related to current execution. In additional... Seems you need to rebuilg FreeRTOS with "-g" flag and without optimization (-O2) to avoid global symbols dropping. I am not sure, just make experiments.

Also, theoretically gdbproxy designed to support other targets (CPU+RTOS) and can be extended to support them. A lot of ideas taken from OpenOCD RTOS support (In past, I added ThreadX on ARM926E-JS support to OpenOCD to debug threads on Cypress FX3).

Xilinx guys, hello from Epiphan Video! And, be community friendly, improube GDB debugging and do not drop it support in future!

PS be patient, code base current so dirty, only one week of heavy development, R&D and researches. There is known issues, for example, ugly request hooking when GDB ACK mode active. In any case, any improuvements is welcomed. Issues reports also good, but be ready, that it will be handled with long (possible soooooooo long) delay. Push Requests more acceptible ;-)

image.pngFreeRTOS, MicroBlaze threading support

Adventurer
Adventurer
243 Views
Registered: ‎09-05-2018

Re: How to debug FreeRTOS?

It was difficult to achieve but I test it and still work on 2019.1

Just that you should precise how to config the proxy don't change the connection param keep the "Local" setup

Screenshot from 2019-12-03 19-12-47.png

Just you need to change "Use default gdb port" to 4002

Screenshot from 2019-12-03 19-14-12.png

and launch from a terminal this command
./gdbproxy --port 4002 --remote-port 3002 --remote-host localhost mb_freertos
0 Kudos