avarice with avr-gdb

Go To Last Post
15 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello,

 

I have a problem using avarice with avr-gdb.

Once this was working, but now I tried multiple times and I always receive this "Remote connection closed" message immediately after I start the remote connection to avarice with avr-gdb.

I see that the sw is running on the atmega32, because the LEDs are blinking.

 

avarice command and output:

[faeren@archlinux avarice-svn]$ avarice -1 -j /dev/ttyUSB0 :4242 -P atmega32 -d
AVaRICE version 2.14svn20200906, Sep  9 2020 14:10:27

Defaulting JTAG bitrate to 250 kHz.

JTAG config starting.
Attempting synchronisation at bitrate 115200

command[S, 1]: 53 45 20 20

command[S, 1]: 53 20 20
response: 41 56 52 4E 4F 43 44 41

command[B, 1]: 42 62 FF 20 20
response: 41

command[q, 1]: 71 7A 20 20
Timed out.

command[ , 2]: 20

command[q, 3]: 71 7A 20 20
response: C0 41
Hardware Version: 0xc0

command[q, 1]: 71 7B 20 20
response: 80 41
Software Version: 0x80

command[F, 1]: 46 20 20
response: 00 00 00 41
Automatic device detection:
command[q, 1]: 71 A7 20 20
response: 3F 41

command[F, 1]: 46 20 20
response: 00 00 00 41

command[q, 1]: 71 A8 20 20
response: 20 41

command[q, 1]: 71 A9 20 20
response: 50 41

command[q, 1]: 71 AA 20 20
response: 49 41
JTAG id = 0x4950203F : Ver = 0x4 : Device = 0x9502 : Manuf = 0x1f
Reported JTAG device ID: 0x9502
Looking for device: atmega32
Configured for device ID: 0x9502 atmega32 -- Matched with atmega32

command[�, 1]: A0 FF 6F FF FF FF FF FF FF FF 66 FF FF FF FF BF FA 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 31 57 00 80 00 04 00 3F 00 00 00 20 20
response: 41
JTAG config complete.
Preparing the target device for On Chip Debugging.

command[B, 1]: 42 86 FD 20 20
response: 41
jtagRead
command[R, 1]: 52 B2 02 00 00 00 20 20
response: FF FF FF 00 41

Enabling on-chip debugging:
jtagWrite
command[W, 1]: 57 B2 00 00 00 01 20 20
response:

command[h, 1]: 68 7F 20 20
response: 41

command[x, 1]: 78 20 20
response: 41

command[B, 1]: 42 A0 00 20 20
response: 41

command[x, 1]: 78 20 20
response: 41
Waiting for connection on port 4242.
Connection opened by host 127.0.0.1, port 54286.
GDB: <qSupported:multiprocess+;swbreak+;hwbreak+;qRelocInsn+;fork-events+;vfork-events+;exec-events+;vContSupported+;QThreadEvents+;no-resumed+>
->GDB: qXfer:memory-map:read+
GDB: <vMustReplyEmpty>
->GDB:
GDB: <Hg0>
->GDB:
GDB: <qTStatus>
->GDB:
GDB: <?>
->GDB: S05
GDB: <qfThreadInfo>
->GDB:
GDB: <qL1160000000000000000>
->GDB:
GDB: <Hc-1>
->GDB:
GDB: <qC>
->GDB:
GDB: <qAttached>
->GDB:
GDB: <qOffsets>
->GDB:
GDB: <g>

GDB: (Registers)Read 32 bytes from 0x800000
jtagRead
command[R, 1]: 52 20 1F 00 00 00 20 20
response: 07 07 07 07 07 07 07 07 07 07 07 07 07 07 07 07 07 07 07 07 07 07 07 07 07 07 07 07 07 07 07 07 00 46

 

avr-gdb command and output:

[faeren@archlinux WellAVRsw]$ avr-gdb main.elf
GNU gdb (GDB) 9.2
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "--host=x86_64-pc-linux-gnu --target=avr".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/....
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/....

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from main.elf...
(gdb) target remote localhost:4242
Remote debugging using localhost:4242
Remote connection closed
(gdb)

 

Thanks for you support!

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi!

 

I have same issue and i didn't find any solution. Did you find anything or you succeeded?

 

 

 

Last Edited: Mon. May 3, 2021 - 03:55 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Now there is MPLABX for Linux do you really need to mess with things like avraice/avr-gdb any more? Surely Microchip provide a "complete solution" (and a reasonable IDE) for debugging in MPLABX. I'd try that first.

 

(behind the scenes it must be doing something very similar - certainly using avr-gdb but I think it's Atmel/Microchip's own equivalent of avarice as the GDB to ICE proxy).

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Unfortunately MPLABX isn't available for arm architecture. Btw i find the source of issue, it was simple stupidity...:S I didn't set the OCDEN fuse bit. However come another issue, exactly a gdb internal error.

" internal-error: void insert_symbol_hashed(dictionary*, symbol*): assertion `symbol_language (sym) == dict_language (dict)->la_language' failed. "

Last Edited: Tue. May 4, 2021 - 09:27 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

Kerovits wrote:
Unfortunately MPLABX isn't available for arm architecture.

But the thread is about avrice and avr-gdb!

 

cheeky

 

But MPLABX certainly is available for ARMs: 

 

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Tue. May 4, 2021 - 09:56 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Sry if i was ambiguous  you couldn't install mplabx ide to arm machine

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Oh - I see.

 

Then it really does seem that this is a separate question - nothing to do with the OP ?

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Andy. It was me who suggested MPLABX as the "standard Linux solution". I mistakenly thought the host would be Intel/AMD Linux not ARM Linux - I understand then why it was the wrong suggestion for an alternative.

 

I think gdb may have an option to show the remote traffic so one might be able to get a better idea why the avarice proxy "hung up".

 

EDIT: actually, thinking about it, the connection between the gdp client and server is carried over IP so one might be able to "snoop" using Wireshark to see the conversation they are having?

Last Edited: Tue. May 4, 2021 - 10:26 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
Andy. It was me who suggested MPLABX as the "standard Linux solution".

I know - and I seconded it.

 

But, now knowing that  Kerovits  is on a different  Host to the OP, it really doesn't seem that this is the "same issue" ?

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

awneil wrote:
it really doesn't seem that this is the "same issue" ?
Eh? They are both seeing "remote connection closed" unexpectedly. How is that not the same issue? Surely the architecture of the host doesn't really matter? Indeed the whole point of GDB remote is that the gdb client debugger and the remote proxy host can be on radically different architectures (and miles apart).

 

One thing that could be tried is to replace avarice with simulavr and try and make a "target remote" connection to that. If that link "stays up" when the gdb<->avrarice link doesn't might implicate avarice.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I think the basic issue was the same because avarice printed same response like Faeren03 response, but i think it caused the OCDEN fuse bit.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kerovits wrote:
it caused the OCDEN fuse bit.

but you said you'd fixed that?

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I think, but not sure. Avarice not closed unexpectedly instead gdb drop internal error.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
... but I think it's Atmel/Microchip's own equivalent of avarice as the GDB to ICE proxy).
Microchip Studio's AVR GDB proxy is complete.

Microchip Studio 7.0.2542 | AVR Freaks

 

A short how to :

How do you debug avr code on non-windows platforms (Free Pascal)

atprogram standalone utility

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kerovits wrote:
Unfortunately MPLABX isn't available for arm architecture.
The remote portion of MPLAB X can run on a Raspberry Pi 3.

Remote USB Debugging Plugin Overview - Developer Help

 

"Dare to be naïve." - Buckminster Fuller