Tuesday, January 28, 2014

Debugging mbed, progress so far

I've been working on the code for Data Bus, my autonomous rover, in particular inserting FreeRTOS into the mix. Doing so made hardware debugging a necessity.

I've made a little progress with that and thought I'd share. Ideally I'd like to integrate debugging with Eclipse but have had to settle for command line for now.

You may recall I'm using the LPC1768 mbed. The mbed project recently implemented CMSIS-DAP which is a standardized interface to the ARM core's debugging hardware.

One can use a fork of OpenOCD that speaks CMSIS-DAP (until they merge those changes in). I used this fork. OpenOCD implements a gdb server to which your gdb command line client can connect.

I also found it immensely helpful to use pyOCD which takes care of launching the OpenOCD gdbserver for you. Follow the readme instructions on the pyOCD repo. You'll need python, of course, libusb (apt-get install python libusb for distros using APT), and pyUSB.

Apparently you can also write python scripts with pyOCD to interact with CMSIS-DAP (details here).

I haven't gotten Eclipse integration sorted out just yet...

Some of the question marks pertain to how Eclipse communicates with the gdb server, what commands it issues. I haven't dug in beyond "it doesn't work in Eclipse" to find out what is going wrong, let alone what the cause is. I'm sure I'll figure it out eventually. Probably someone else already has and I just need to find their blog post. :) (EDIT: Like this one submitted by Matthew)

Alternatively my plans to migrate to LPCXpresso means I could just use CodeRed and not worry about all this. :)  But that limits me to very few ARM MCUs. There's a lot of popularity growing around STM32 and Kinetis ARM MCUs lately. ARM is destined to become the primary hobbyist MCU of choice in the next few years and we need full, open source toolchains and IDE integration to get there.

2 comments:

  1. See if my blog has anything that can help you with Eclipse/OpenOCD integration:http://thehackerworkshop.com/?p=602

    It can be a tough nut to crack but I have had it working with my STM32Fx parts.

    ReplyDelete
    Replies
    1. Thanks! That looks promising re: Eclipse. I suspect the halt/reset checkboxes have something to do with it. Talking to another guy it seems like Eclipse tries to issue some commands that may not work with OpenOCD / CMSIS-DAP. We'll see. I edited the post to point to your blog for the tips.

      Delete

Note: Only a member of this blog may post a comment.