How to start debugging

Asked by Pozz Pozz

I'd like to move from Atmel Studio to Code::Blocks. The Atmel ARM toolchain is based on the toolchain from launchpad.
I have a SAM D20 (Cortex-M0+) Xplained development board from Atmel that provides an embedded debugger. In the future, I'll design a new custom board that I'd like to debug with my JTAGICE3 from Atmel (through SWD interface).

I know how to create a custom makefile to use Atmel ARM toolchain and compile my project, but I don't know where to start to configure and setup debugging. I think I have to use arm-none-eabi-gdb.exe as the gdb client and I've to setup and use openOCD as gdb server, but it's just in my imagination.

Please, point me to some resources and documentations that help me debugging Cortex-M0+ with a generic IDE. I know there are some parts in the process that are IDE-related, but I've no knowledge about how happens behind the scenes.

Question information

Language:
English Edit question
Status:
Answered
For:
GNU Arm Embedded Toolchain Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Terry Guo (terry.guo) said :
#1

I think your imagination is correct. About the IDE for MCU, I know some free ones like Eclipse and CoIDE. For the Eclipse based, you just google with key words "Eclipse MCU", you should find something. Here is the website I just found: http://mcuoneclipse.com/.

The CoIDE can be found at http://www.coocox.org/index.html.

Revision history for this message
TM (tm1234) said :
#2

Have you considered using the GNU ARM Eclipse plugins which, among other things, facilitate integration of OpenOCD debugging into the Eclipse/CDT environment?

http://gnuarmeclipse.livius.net/blog/

Revision history for this message
Andreas Fritiofson (andreas-fritiofson) said :
#3

Hi!

You are right about the software tools you could use. Your Xplained board is apparently supported in OpenOCD, though I haven't used these chips myself. I suggest using a recent OpenOCD, preferably the latest git HEAD.

So start the following and see if it finds your chip:

openocd -f board/atmel_samd20_xplained_pro.cfg

If it does, launch command line gdb in a separate terminal and try out basic functionality:

arm-none-eabi-gdb your.elf

(gdb) target extended-remote :3333
(gdb) load
(gdb) tb main
(gdb) c

If all works, exit gdb and continue to integrate it in your favorite IDE. I've never used Code::Blocks so can't help you there. Basically you need to tell the IDE to launch the correct gdb and emit the above commands to it. I suggest you keep OpenOCD running in a separate terminal instead of trying to integrate that too.

If you're going to move away from the Xplained board in the future, note that I don't think JTAGICE3 is, or ever will be, supported as a debug adapter in OpenOCD, since AFAIK it's using a proprietary non-documented protocol. Your best bet is probably one of the cheap FTDI dongles with SWD support (such as JTAG-lock-pick Tiny 2 or Bus Blaster) or a standalone CMSIS-DAP unit (perhaps you can use the one integrated on the Xplained board).

Can you help with this problem?

Provide an answer of your own, or ask Pozz Pozz for more information if necessary.

To post a message you must log in.