Interactive debug on Raspberry Pi by using FreeRTOS

shaobol wrote on Thursday, October 02, 2014:

Hi,

I am a student from University of Michigan, and I am now taking an independent course with professor Mark Brehob.
What we want to do is to implement interactive debugging on Raspberry Pi by using FreeRTOS. The interactive debug is just like gdb.
Is that possible? If it is not possible, why? If it is possible, how long you think it will take for me to achieve that (if you can provide a specific steps, I will appreciate your help).

BTW, if you have any other ideas that what’s more can achieve on Raspberry Pi by using FreeRTOS, I will be more than happy to here from your ideas.

Thanks,
Shaobo Liu

rtel wrote on Thursday, October 02, 2014:

So you want to use FreeRTOS in some kind of debug stub?

I don’t fully understand your requirements so couldn’t off an opinion as to its feasibility - but in any case the first step would be to get FreeRTOS running on the Pi. I believe you will find some project on the web that do just that, although we don’t have anything official here.

Regards.

shaobol wrote on Thursday, October 02, 2014:

Thanks for your reply.
Yes I want to use FreeRTOS in debug stub like gdb.
I have already got FreeRTOS running on Pi. The problem now is I need to use some output tag like JTAG to show something that can be used for debugging.

hobit222 wrote on Monday, October 27, 2014:

Hi,
Let me clarify a bit. What we’d like to do is be able to remotely debug (on a PC host) code running on the Pi under FreeRTOS. We do have FreeRTOS running on the Pi (http://www.eecs.umich.edu/courses/eecs473/Labs/Lab3_F14.pdf is a lab we have students doing in fact). But right now we are doing all of our programming by moving an SD card back-and-forth. We’d like to be able to program the board remotely (as we can using FreeRTOS on other platforms) and get an interactive debugger working from a host.

We’ve zero experience trying to do anything like this and are looking where to start (or if people think this just isn’t reasonable). Any and all feedback welcome, and we’d be happy to clarify what we are trying to do if it’s unclear.

Mark

rtel wrote on Monday, October 27, 2014:

I’m not familiar with the Pi (about the only person in the world who isn’t, but my life is extremely full with >30 other architectures!), but generally when I work on larger platforms that don’t have their own specialist bare metal tools I would use the hardware debugging plug-in for the Eclipse CDT. That will start up a local (on the host) GDB server that you can connect to, and have the GDB server control the target via JTAG (or whatever is available). With the JTAG connection you then have to options:

  1. Use the SD card to boot the system such that the memory interfaces and any other hardware are configured, followed by the program just sitting in a NULL loop. Then use GDB to download your application directly into the pre-configured RAM, set the program counter to the start of the program, and away you go with the Eclipse debug environment.

  2. Similar to 1, but use a GDB start up script to peek and poke registers in order to get the hardware into a state that allows you to download your application via GDB (or OpenOCD, or whatever) into RAM.

Does that help at all?

Regards.

apullin2 wrote on Wednesday, October 29, 2014:

I’m unsure if this would address quite what the project is intending to do, but:
Segger supplies a gdb server with their debuggers, and their top-of-the-line unit works with ARM11’s (which is in the Rpi, I believe).

Pretty much the same that the RTE fellow is saying: you could just attach and use an IDE that SEGGER supports directly to compile/debug/upload/run. Or write a script that can communicate with the gdb server, and upload & run.

This looks like it touches on it, although they use the nightmarish OpenOCD:
http://sysprogs.com/VisualKernel/tutorials/raspberry/jtagsetup/

That might also allow you to use FreeRTOS+Trace directly. Or have the students write their own version of live trace that polls the PC via gdb-server, and look up the active task via the compiler symbol table. I’d give someone an A if they implemented that.

hobit222 wrote on Wednesday, October 29, 2014:

Thanks to both of you. I think we are trying to bite off more than we can manage, but we’ll look a bit closer for a while!

Thanks!

shaobol wrote on Thursday, October 30, 2014:

Thanks for your reply.
It helps a lot!

shaobol wrote on Monday, November 24, 2014:

Hi,
Thanks for your reply.
I understand your options, but can you describe how to use Eclipse CDT in detail?
I have not use that before, and I have no idea how that can help.
If you can provide a link to that it is also fine.
Thanks,
Shaobo

shaobol wrote on Monday, November 24, 2014:

Hi Andrew,
Thanks for your reply.
The thing now is that we do not have a Segger gdb server.
Do we need to use that? And, what are benefits that the Segger gdb server can provide?
Thanks,
Shaobo