Author Topic: [Newbie] ARM Cortex-M0+ (SAM D20 part from Atmel) debugging  (Read 22540 times)

Offline pozzugno

  • Multiple posting newcomer
  • *
  • Posts: 39
I'm actually using Atmel Studio monster from Atmel to compile and debug applications for their SAM D20 parts (Cortex-M0+). Atmel distributes a ARM toolchain derived from the project on launchpad.

Everything works in Atmel Studio (compilation, linking, debugging), but I don't like it. I'd like to move to Code::Blocks.

I know how to configure a new compiler (this should be simple, because it is always a gcc) so I think I won't encounter big isseus on this task.

The problem is with debugging. I don't know how to configure gdb, what is gdb client and gdb server and so on. I understand I need two pieces: a server that manages the target board and the debugger dongle (I use JTAGICE3 from Atmel) and communicates, through local TCP connections, with the gdb client.
How to configure all of this? Is the server open OCD? At last, will I reach the same functionalities of Atmel Studio (breakpoints, step into, step over, reset target, run, halt, ...)?

Thank you for any suggestions.

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: [Newbie] ARM Cortex-M0+ (SAM D20 part from Atmel) debugging
« Reply #1 on: July 13, 2014, 11:27:16 am »
Regarding CB, you only need to launch the gdb-server before the debugging session. No other configurations necessary by the CB side (of course you will need to configure the gdb-server as necessary). A simple command line launcher (ie a .bat file on Windows) should be enough to start the gdb-server. At your preference, you can make a 'tools' entry in CB to start it manually before the debug session. It is also possible to use the gdb's shell commands to start it automatically before the debug session but unfortunately they don't work at the moment and I can't comment on when they will be fixed as it's been a while since it's reported here:
http://forums.codeblocks.org/index.php/topic,19279.0.html
You can check the topic above for some guidance on how to start the gdb-server.

For the gdb part you have to configure it inside CB but that can be a long story. For a starter just copy the options that Atmel Studio uses and give it a try. In case you need more detail, you can check some tutorials for debugging AVRs from CB and try to modify it for ARM.

Offline pozzugno

  • Multiple posting newcomer
  • *
  • Posts: 39
Re: [Newbie] ARM Cortex-M0+ (SAM D20 part from Atmel) debugging
« Reply #2 on: July 14, 2014, 11:49:09 am »
gdb-server... is it a different executable than arm-none-eabi-gdb.exe that I found in the ARM toolchain from Atmel?

Should I use open OCD as gdb server? What is the server that Atmel Studio use? Can't I use the server from Atmel Studio (if any) directly in Code::Blocks?

I'm sorry if those questions are too dumb.

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: [Newbie] ARM Cortex-M0+ (SAM D20 part from Atmel) debugging
« Reply #3 on: July 14, 2014, 02:43:11 pm »
Your questions are completely normal for a beginner but the problem is these kinds of questions are not allowed in CB forum as they are not related to CB. I'll give you basic answers and for the rest you'll have to do your own research over the net. CB related questions are welcome though.

gdb-server is the bridge between gdb and the hardware. OpenOCD is an example gdb-server and there may be others out there which I'm not aware of. Afaik Atmel Studio has its own interface for AVRs to act like a gdb-server and I don't think it is usable anywhere outside Atmel Studio. I believe it's the same for ARMs but you'll have to check it out.

Offline pozzugno

  • Multiple posting newcomer
  • *
  • Posts: 39
Re: [Newbie] ARM Cortex-M0+ (SAM D20 part from Atmel) debugging
« Reply #4 on: July 15, 2014, 09:41:00 am »
And another complication is CMSIS-DAP for ARM parts.

I know my questions aren't strictly related to C::B, I hoped I found some user that currently uses C::B for debugging Atmel ARM Cortex-M, just to have some suggestions.