Recent

Author Topic: How do you debug avr code on non-windows platforms  (Read 3830 times)

MiR

  • Sr. Member
  • ****
  • Posts: 275
How do you debug avr code on non-windows platforms
« on: July 01, 2019, 08:46:01 am »
I recently received an xplaind atmega4809 board and wanted to do source level debugging inside of lazarus like I do with the xplaind atmega328p board.

I am using a Mac so everything related to Atmel Studio does unfortunately not work for me.

But I found out the hard way that avarice does not support the 4809, so besides some very crude debugging with the mdb script from MPLab-X I seem to be out of options.

The 4809 debugger is of the medbg type, same as the debugger on the atmega328p board.

So the question is, how do you guys do source level debugging, perhaps I have missed a tool in my google searches that is able to do the job...

Michael

ccrause

  • Hero Member
  • *****
  • Posts: 1007
Re: How do you debug avr code on non-windows platforms
« Reply #1 on: July 01, 2019, 10:18:04 am »
That controller family is somewhat "new", so opensource alternatives will take a while to catch up.  I use debugwire for debugging, but that is of course limited to the smaller (and slightly older) chip families.

A completely different approach could be to adapt Jan Dolinay's avr_debug project for your controller.  This project embeds a remote gdb stub on the controller which communicates directly with gdb over serial. The stub also needs controller cycles to function, so it will affect performance. Not ideal if there is already on-chip debug functionality, but avoids the mess of different debug protocol stacks...

d.ioannidis

  • Full Member
  • ***
  • Posts: 229
    • Nephelae
Re: How do you debug avr code on non-windows platforms
« Reply #2 on: July 01, 2019, 11:03:04 am »
If you're on Windows you could use the atbackend.exe from Atmel Studio 7. It has a gdb-proxy mode which you can use with avr-gdb.

i.e. "atbackend.exe /avr8-gdb-ports=2345"

see here for instructions on Microchip web site.

AFAIK, fpc doesn't have support for this MCU family ( 0-series a.k.a. avrxmega3 ). But Christo has an utility which translates the ADTF files and was kind enough to send me the translated files for this family to see if I can work with them. For me those units works ! ( mind you that I didn't test the board, I mostly use bare IC's on breakout boards on  breadboards. I'm just a hobbyist ).

Also I use avr-gdb 8.3 ( patched also from Christo ) and cross compiled to windows from Michael Ring .

All and all, I use mcu -> m/n/edbg -> atbackend.exe -> avr-gdb -> Lazarus (remote gdbmidebugger) which works ( with some hiccups here and there ) and I can debug all the avr mcu that I use.

EDIT: Apologies ... I missed the "I am using a Mac ..." . You could use a windows vm though ...

EDIT2: I missed also the title " .. non-windows platforms" ... I need a break ...
« Last Edit: July 01, 2019, 11:11:28 am by Dimitrios Chr. Ioannidis »

MiR

  • Sr. Member
  • ****
  • Posts: 275
Re: How do you debug avr code on non-windows platforms
« Reply #3 on: July 01, 2019, 10:17:29 pm »
Thank you for your hints, I did a little checking on avr_debug, from what I can see this is currently only working for atmega328p and atmega1280/2560.
The idea is interesting but it looks like quite some effort to make this work with 4808/4809.

The idea of using a vm (and running the gdbserver inside of the vm while connecting from my mac) may work, I will check that later tonight, although it feels a little like overkill.
So far I'd still prefer to make mdb work as a gdbserver, this should secure support for future chips as this is something that comes with MPLabX, I already see that latest processor packs are not available anymore in Atmel Studio and only show up in MPLabX.

Michael

 

TinyPortal © 2005-2018