Once again: Debugging with GDB

Go To Last Post
166 posts / 0 new

Pages

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

Everyone got on "a day out" except me so managed to find a few hours for this today.

 

Have successfully built AVRDUDE again. About to test it with the Atmel-ICE soon.

 

But first, I thought I'd have a go at building AVaRICE. I get the following:

 

mint@mint ~/AVR/avarice-2.13 $ make
Making all in scripts
make[1]: Entering directory '/home/mint/AVR/avarice-2.13/scripts'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/mint/AVR/avarice-2.13/scripts'
Making all in src
make[1]: Entering directory '/home/mint/AVR/avarice-2.13/src'
make  all-am
make[2]: Entering directory '/home/mint/AVR/avarice-2.13/src'
gcc -DHAVE_CONFIG_H -I.  -DENABLE_TARGET_PROGRAMMING=0   -g -O2 -MT crc16.o -MD -MP -MF .deps/crc16.Tpo -c -o crc16.o crc16.c
mv -f .deps/crc16.Tpo .deps/crc16.Po
g++ -DHAVE_CONFIG_H -I.  -DENABLE_TARGET_PROGRAMMING=0   -g -O2 -MT devdescr.o -MD -MP -MF .deps/devdescr.Tpo -c -o devdescr.o devdescr.cc
devdescr.cc:36:51: error: _Pragma takes a parenthesized string literal
 PRAGMA_DIAG_IGNORED("-Wmissing-field-initializers")
                                                   ^
In file included from jtag.h:33:0,
                 from devdescr.cc:29:
pragma.h:33:38: error: ‘_Pragma’ does not name a type
 #      define PRAGMA_DIAG_IGNORED(x) _Pragma(GCC diagnostic ignored x)
                                      ^
devdescr.cc:36:1: note: in expansion of macro ‘PRAGMA_DIAG_IGNORED’
 PRAGMA_DIAG_IGNORED("-Wmissing-field-initializers")
 ^
Makefile:385: recipe for target 'devdescr.o' failed
make[2]: *** [devdescr.o] Error 1
make[2]: Leaving directory '/home/mint/AVR/avarice-2.13/src'
Makefile:248: recipe for target 'all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory '/home/mint/AVR/avarice-2.13/src'
Makefile:297: recipe for target 'all-recursive' failed
make: *** [all-recursive] Error 1

I've been searching and digging, and found e.g. https://stackoverflow.com/questi... but am not really sure of what happens there. Will think/search more though.

 

Meanwhile, it seems the possible that there is a need for patches , as noted in #90 by TT_ZX. I'm not entirely sure what TT_ZX is saying though. His post seems to have two (unnamed) patch files and then some diffs. Are the latter some kind of confirmation or do I apply what he shows in the diffs also?

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

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

Don't you just copy those entire texts each to a separate file called avrarice1.diff and avarice2.diff then use the Linux "patch" command to have it apply the patches?

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

I don't know. There's both a "bona-fide" patch file and two diffs. This makes me uncertain abut what TT_ZX means should be done.

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

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

OK. After tinkering a bit with the patchy stuff from  #90 by TT_ZX I got a successful build (make) and installation (make install). Verified this far:

 

mint@mint ~/AVR/avarice-2.13 $ which avarice
/usr/local/bin/avarice


mint@mint ~/AVR/avarice-2.13 $ avarice
AVaRICE version 2.13, Jul 28 2017 19:47:49

Defaulting JTAG bitrate to 250 kHz.

Failed to open /dev/avrjtag

mint@mint ~/AVR/avarice-2.13 $

So this really looks promising. (I've thought and said that before.. This time it looks even better. Let's hope it does not end up even worse.. ;-) )

 

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

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

A bit more progress!

 

AVRDUDE verified a bit further. Have Atmel-ICE, STK600 with ATmega2560:

 

mint@mint ~/AVR/avarice-2.13 $ sudo avrdude -c atmelice -p ATmega2560
avrdude: usbdev_open(): WARNING: failed to set configuration 1: could not set config 1: Device or resource busy

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.07s

avrdude: Device signature = 0x1e9801 (probably m2560)

avrdude: safemode: Fuses OK (E:FF, H:11, L:E0)

avrdude done.  Thank you.

Yeah, still no config file pointed out, I know. But It's talking all the way down to the AVR chip.

 

And...

 

AVARICE tested with the same setup, but it fails.

mint@mint ~/AVR/avarice-2.13 $ avarice -j /dev/usb/hiddev0
AVaRICE version 2.13, Jul 28 2017 19:47:49

Defaulting JTAG bitrate to 250 kHz.

Failed to open /dev/usb/hiddev0

mint@mint ~/AVR/avarice-2.13 $

I am, sure the device name is correct. It comes/goes under /dev when I connect/disconnect the Atlmel-ICE.

 

This could be something I'm not doing right, i.e. not telling AVARICE what debugger I have. Or even that AVARICE does not support the Atmel-ICE. Can't remember the details on support ATM. I will fall back and tet the Dragon, which AVARICE is explicit with supporting.

 

Anyway I need to RTFM for AVARICE agan now, I know.

 

Enough experimenting for tonight! Need to make sure my PM/notes are in good order - I constantly remind myself I've promised a write-up eventually.

 


 

I'm talking muxh to meyself here lately. Are you guys getting tired of me? Please say and I'll try to be more quiet. Try.. ;-)

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

Last Edited: Fri. Jul 28, 2017 - 07:31 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Failed to open could be permissions, try sudo-ing it.
.
(and if that works use udev to set up more permissive permissions)

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

PS don't forget strace. It can be very useful to find out what's going on.

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

@clawson:

 

Funny.. I couldn't restrain myself (another mug of coffee helped...) so I dug out the Dragon. Tried and it also failed, and then I thought "sudo!" but no dice:

int@mint ~/AVR/avarice-2.13 $ sudo avarice
AVaRICE version 2.13, Jul 28 2017 19:47:49

Defaulting JTAG bitrate to 250 kHz.

Failed to open /dev/avrjtag

I assumed, since it by default tries to open /deb/avrjtag, that no paremeters/switches where needed for this small test. But this:

mint@mint ~/AVR/avarice-2.13 $ sudo avarice --dragon
AVaRICE version 2.13, Jul 28 2017 19:47:49

Defaulting JTAG bitrate to 250 kHz.

JTAG config starting.
Found a device: AVRDRAGON
Serial number:  00:a2:00:01:46:33
Reported JTAG device ID: 0x9801
Configured for device ID: 0x9801 atmega2560
JTAG config complete.

Sorry for screaming, but... SUCCESS!!!

 

Now it's really time to stop for tonight.

 

Next stint will be:

  • Set up Atmel Toolchain for Linux
  • Write and build a "blinky" of some kind.
  • Test actual flash programming (AVRDUDE)

 

The "big one" will then be

  • Test actual debugging. I expect some frustration and clinch-fighting when I get to that. I'm on my way back to Colin O'Flynns very old tutorial PDF (2003!), and the AVARICE man page.

 

One "interesting" observation:

The Atmel-ICE showed up under /dev on Linux Mit. The Dragon does not show up as far as I can see - still it works...

 

Also, AVRDUDE will not work after the successful bAVARICE start. I guess AVARICE is still running and "holding" the Dragon and I need to stop it so that the Dragon is released. It's been years since I meddled with processes on Linux.. ps and kill, here I come..

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
$ killall avaraice

 

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

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

Hmmm.. AVARICE does not seem to be running. At least it is not in a listing from 'ps'.

 

At first I was stupid and managed to recall the AVRDUDE command for Atmel-ICE while I now have the Dragon on the bench.

 

But even with correct parameters to AVRDUDE it failed. A power cycle of the Dragon and/or target solved this:

 

mint@mint ~ $ sudo avrdude -c dragon_jtag -p ATmega2560

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e9801 (probably m2560)

avrdude: safemode: Fuses OK (E:FF, H:11, L:E0)

avrdude done.  Thank you.

That mistake with trying to drive the Dragon as an Atmel-ICE is the telltale sign of me getting to tired, so it's really time to stop.

 

A very good day it has been, though! Good night in this thread!

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

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

Status:

 

What did I do today?

 

Well, I got tired of running Mint in VMs. They had a tendency to crash.

Then I got tired of running Mint from a bootable USB memory stick. It was slooow (because of lack of hardware acceleration?) 

 

So I decided to take the jump and try setting up a dual boot on my, up until now, Windows 7 dedicsted SSD.

  • I spent a good 2 hours cleaning it out to, and swap things out to external hard disks. It was time for that anyhow.
  • I then went to the grocers while the machine spent 2 hours taking a safety disk image to external disk before I started meddling with partitions and stuff. It was due anyway.
  • I then waited 1 hour while I de-fragmented the disk to try to move files to the beginning of the partition.
  • I then spent a good 3 hours fighting Windows, since it has a tendency to place "unmovable files" at the middle or end of its partition and thus the partition can not be shrinked enough to make room for a new set of partitions for Linux. A lot of disabling services and stuff (e.g. turned off virtual memory! - since Windows swap file was at the end of the partition), deleting files, shrinking attempts (repeat, rinse...) and finally I had 48 GB free. Reset everything disabled in Windows again. Rebbot, and Windows seemed to start up normally.
  • I then spent a whopping 15 minutes creating the needed partitions and installing Mint in the freed up space.

 

Windows still boots (-:

 

Mint boots like lightning! (15 seconds?) Mint "sees" the Windows partition!

 

During the night I will secure this with a new disk image..

 

I did not do anything specific to AVR development on Linux, but I learned a lot today.

 

Tomorrow I'll build and test AVRDUDE and AVARICE for the third time. Practice makes perfect (-:

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

Last Edited: Sun. Jul 30, 2017 - 08:19 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Next time try resizing the NTFS partition from Linux.  No unmovable files when the FS is not mounted.  Boot Mint from CD/DVD/USB and run GParted.  There is also a tiny bootable ISO called GParted Live.

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

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

I read a lot on the net before fishing for disk space. There was talk about a recent bug in GParted handling NTFS partitions.

 

FUD or fact, I didn't dare use GParted, as I am not prepared to lose Windows just yet. (OTOH, I've been on Mint the whole day today.. Heck, I even did a screen shot and edited with GIMP! )

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

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

But you'd already made a disk image backup.  The worst that would happen would be you'd need to restore the backup and try again with a different tool.

 

I've never had any trouble resizing with gparted only any partition/fs type.  Mind you, I'm not an early adopter, so the gparted I use is an older version, perhaps immune to this alleged recent bug.

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

Last Edited: Sun. Jul 30, 2017 - 05:03 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I use gparted professionally a lot in the past. A wonderful tool. Never gave me a moment's worry.

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

Todays progress:

 

On my new "dual booted" Linux Mint

  • "Installed" toolchain (Atmel Toolchain for Linux)
  • Did a build of AVRDUDE
  • Installed NetBeans

and then

  • Did a test build of "blinky" in terminal (i.e. "command prompt"). Success!
  • Set up the toolchain in Netbeans, and a small "LEDs follows switches" was tested there. After a bit of tinkering I got that working.
  • Set up the Dragon and the STK600 with an ATmega2560 and successfully ran AVRDUDE. Reading fuses, writing fuses, programming flash. Success!

 

I'm very happy with that progress for a couple of hours of tinkering!

 

I now feel close to getting into what I was starting out to try (more than 100 posts ago...): On-chip debugging. Yes, finally!

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

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

What is the output of:

avarice --help

 

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

Hello TT_ZX!

 

Haven't seen anything of you here for a while. I'd like to thank you for some invaluable help - specifically the patches to AVARICE but also encouragement in general!

 

What is the output of:

avarice --help

Haven't done a build of AVARICE yet so can't tell right now. I believe I have a build on the Mint memory stick so let me boot from that and have a look..

 

I'm curious about your curiosity ;-) What is it you're looking for?

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

Last Edited: Mon. Jul 31, 2017 - 08:06 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What is the output of:

avarice --help

Nothing. AVARICE starts, that's it. But for

avarice -?

I get

 

AVaRICE version 2.13, Jul 28 2017 19:47:49

Usage: avarice [OPTION]... [[HOST_NAME]:PORT]

Options:
  -h, --help                  Print this message.
  -1, --mkI                   Connect to JTAG ICE mkI (default)
  -2, --mkII                  Connect to JTAG ICE mkII
  -B, --jtag-bitrate <rate>   Set the bitrate that the JTAG box communicates
                                with the avr target device. This must be less
                                than 1/4 of the frequency of the target. Valid
                                values are 1000/500/250/125 kHz (mkI),
                                or 22 through 6400 kHz (mkII).
                                (default: 250 kHz)
  -C, --capture               Capture running program.
                                Note: debugging must have been enabled prior
                                to starting the program. (e.g., by running
                                avarice earlier)
  -c, --daisy-chain <ub,ua,bb,ba> Daisy chain settings:
                                <units before, units after,
                                bits before, bits after>
  -D, --detach                Detach once synced with JTAG ICE
  -d, --debug                 Enable printing of debug information.
  -e, --erase                 Erase target.
  -E, --event <eventlist>     List of events that do not interrupt.
                                JTAG ICE mkII and AVR Dragon only.
                                Default is "none,run,target_power_on,target_sleep,target_wakeup"
  -g, --dragon                Connect to an AVR Dragon rather than a JTAG ICE.
                                This implies --mkII, but might be required in
                                addition to --debugwire when debugWire is to
                                be used.
  -I, --ignore-intr           Automatically step over interrupts.
                                Note: EXPERIMENTAL. Can not currently handle
                                devices fused for compatibility.
  -j, --jtag <devname>        Port attached to JTAG box (default: /dev/avrjtag).
  -k, --known-devices         Print a list of known devices.
  -L, --write-lockbits <ll>   Write lock bits.
  -l, --read-lockbits         Read lock bits.
  -P, --part <name>           Target device name (e.g. atmega16)

  -r, --read-fuses            Read fuses bytes.
  -R, --reset-srst            External reset through nSRST signal.
  -V, --version               Print version information.
  -w, --debugwire             For the JTAG ICE mkII, connect to the target
                                using debugWire protocol rather than JTAG.
  -W, --write-fuses <eehhll>  Write fuses bytes.
  -x, --xmega                 AVR part is an ATxmega device, using JTAG.
  -X, --pdi                   AVR part is an ATxmega device, using PDI.
HOST_NAME defaults to 0.0.0.0 (listen on any interface).
":PORT" is required to put avarice into gdb server mode.

e.g. avarice --erase --program --file test.bin --jtag /dev/ttyS0 :424

Again - what are you interested in? (Is this a misunderstanding/misread ? My "reset awkwardnesses" above is re AVRDUDE, not AVARICE.)

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

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

Thanks for your kind words.  I was working away from home doing big hours last week, so I didn't really have time to post.  This site is one of my regulars now but I don't have a lot of experience in MCU or C/C++ yet so I'm mostly reading and learning.

 

I'm interested to see if you get this in your output:

  -3, --jtag3                 Connect to JTAGICE3 (Firmware 2.x)
  -4, --edbg                  Atmel-ICE, or JTAGICE3 (firmware 3.x), or EDBG Integrated Debugger

I wasn't getting this when I was building AVaRICE and had to use those patches to get it to build at all.  I think it has something to do with needing to run these commands to build correctly:

  ./Bootstrap (once only after checkout)
  ./configure
  make

 

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

I see you don't have support for the new programmers in your build.  Did you run those build commands above?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
 ./configure

But presumably that goes hunting around your Linux to see if you have things like libusb-dev installed or not? I guess it needs to see that to "turn on" support for the devices that require certain libraries? So it's not so much just running ./Bootstrap and ./configure that matters but what is found in the process. The ./configure should be writing a log to say what it found and what (optional bits) are missing.

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

Here is my complete output:

AVaRICE version 2.13svn20160229, Jul 21 2017 19:23:15

Usage: avarice [OPTION]... [[HOST_NAME]:PORT]

Options:
  -h, --help                  Print this message.
  -1, --mkI                   Connect to JTAG ICE mkI (default)
  -2, --mkII                  Connect to JTAG ICE mkII
  -3, --jtag3                 Connect to JTAGICE3 (Firmware 2.x)
  -4, --edbg                  Atmel-ICE, or JTAGICE3 (firmware 3.x), or EDBG Integrated Debugger
  -B, --jtag-bitrate <rate>   Set the bitrate that the JTAG box communicates
                                with the avr target device. This must be less
                                than 1/4 of the frequency of the target. Valid
                                values are 1000/500/250/125 kHz (mkI),
                                or 22 through 6400 kHz (mkII).
                                (default: 250 kHz)
  -C, --capture               Capture running program.
                                Note: debugging must have been enabled prior
                                to starting the program. (e.g., by running
                                avarice earlier)
  -c, --daisy-chain <ub,ua,bb,ba> Daisy chain settings:
                                <units before, units after,
                                bits before, bits after>
  -D, --detach                Detach once synced with JTAG ICE
  -d, --debug                 Enable printing of debug information.
  -e, --erase                 Erase target.
  -E, --event <eventlist>     List of events that do not interrupt.
                                JTAG ICE mkII and AVR Dragon only.
                                Default is "none,run,target_power_on,target_sleep,target_wakeup"
  -g, --dragon                Connect to an AVR Dragon rather than a JTAG ICE.
                                This implies --mkII, but might be required in
                                addition to --debugwire when debugWire is to
                                be used.
  -I, --ignore-intr           Automatically step over interrupts.
                                Note: EXPERIMENTAL. Can not currently handle
                                devices fused for compatibility.
  -j, --jtag <devname>        Port attached to JTAG box (default: /dev/avrjtag).
  -k, --known-devices         Print a list of known devices.
  -L, --write-lockbits <ll>   Write lock bits.
  -l, --read-lockbits         Read lock bits.
  -P, --part <name>           Target device name (e.g. atmega16)                                                                                                                                                  

  -r, --read-fuses            Read fuses bytes.
  -R, --reset-srst            External reset through nSRST signal.
  -V, --version               Print version information.
  -w, --debugwire             For the JTAG ICE mkII, connect to the target
                                using debugWire protocol rather than JTAG.
  -W, --write-fuses <eehhll>  Write fuses bytes.
  -x, --xmega                 AVR part is an ATxmega device, using JTAG.
  -X, --pdi                   AVR part is an ATxmega device, using PDI.
HOST_NAME defaults to 0.0.0.0 (listen on any interface).
":PORT" is required to put avarice into gdb server mode.                                                                                                                                                          

e.g. avarice --erase --program --file test.bin --jtag /dev/ttyS0 :4242 

See the svn<date> after the version number?  I think what Johan is building is just the release version 2.13 not with all the changes since then.  I don't know anything about SVN and I don't build the package using the commands above.  I use Gentoo's package manager to build the package for me.  Originally I was having the same issue (release version being built).  Once I figured out how to get the Gentoo package manager to run the equivalent of the ./Bootstrap command (have look at the contents of this file) I got the latest build with the output above.  I didn't change any of the libraries in my system between builds.  I think the ./Bootstrap generates a new ./configure file.

 

Sorry to be vague but I don't know exactly what goes on during the build process I just know what I did to get it to build correctly on my system.

Last Edited: Mon. Jul 31, 2017 - 08:37 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm interested to see if you get this in your output:

  -3, --jtag3                 Connect to JTAGICE3 (Firmware 2.x)
  -4, --edbg                  Atmel-ICE, or JTAGICE3 (firmware 3.x), or EDBG Integrated Debugger

I wasn't getting this when I was building AVaRICE [...]

I did ./configure, of that I am sure. Can't remember doing the ./Bootstrap, have to look into my memory notes..

 

If you didn't get the above output from your own build, then where did you get it from?

 

Yes, my build is using the sources of the latest release, not the HEAD of the SVN.

 

I know Jörg Wunsch (known here as 'dl8dtl') has done work on implementing EDBG, but am not sure if it is on the AVARICE trunk yet, or still in a branch.

 

Now that I'm getting comfortable with the building process, I could take a stab looking at the AVARICE SVN history and have a go at building from HEAD or some branch with EDBG. I to am very interested in getting JTAGICE3 and EDBG/Atmel-ICE going!

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

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

JohanEkdahl wrote:
Yes, my build is using the sources of the latest release, not the HEAD of the SVN.
I'd pull HEAD. Most of these tools don't seem to go in for regular "releases" so HEAD can be a LONG way ahead of any "last release"

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

Latest commit (r363) on branch jwunsch_edbg is dated 2016-03-03, so that is quite a while since: https://sourceforge.net/p/avaric...

 

That commit (r363) was merged to trunk in (r364) on the same day. This makes me think that, SVN-wise, whatever EDBG/Atmel-ICE support there is is on trunk and in HEAD. Could be some setting before/during build is required..

 

I have other pressing things today, but will try a build from SVNs HEAD at my first convenience!

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

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

clawson wrote:
I'd pull HEAD. Most of these tools don't seem to go in for regular "releases" so HEAD can be a LONG way ahead of any "last release"

 

OK, and yes.

 

I just wanted something known to be stable for my first attempts. Not sure what philosophy Jörg et al has re the trunk - i.e. if the principle is that it is always in a "releaseable state".

 

@TT_ZX:

TT_ZX wrote:
 I use Gentoo's package manager to build the package for me.
 

Does thtis mean tht you don't pull sources from the AVARICE SVN repo at all, but from Gentoo's repo? Linux distros have been known not to be really up-to-date re "exotic" stuff like the AVR tools. The easy, no SVN-knowlege, way to get the head of the SVN repo is to go here: https://sourceforge.net/p/avaric... and click Download snapshot at upper'ish right.

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

Last Edited: Mon. Jul 31, 2017 - 09:46 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

JohanEkdahl wrote:

 

If you didn't get the above output from your own build, then where did you get it from?

 

 

I meant my first attempts at building the package gave me the same output as what you have now.  Now that I have the equivalent of ./Bootstrap working,  I get the output shown above.  I don't believe I changed where the repo was pulled from (if my memory serves me).

 

The Gentoo package manager retrieves the repo from svn://svn.code.sf.net/p/avarice/code/trunk/avarice

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

OK, I gave HEAD a try. Didn't end well. What follows reflects my weak and fragmented knowledge about "Autotools":

 

I pulled the head (downloaded the snapshot) and unpacked it in a separate directory.

 

There's no makefile, so lets try to create that first:

johan@Mint-Latitude-E6330 ~/AVR/avarice/avarice-code-372-trunk $ ./configure
bash: ./configure: No such file or directory

So, clearly, we need to do some preparatory work to create the configure script. The instructions in the file INSTALL are clear that we need to run ./Bootstrap once. But trying

johan@Mint-Latitude-E6330 ~/AVR/avarice/avarice-code-372-trunk $ ./Bootstrap
+ aclocal
./Bootstrap: 23: ./Bootstrap: aclocal: not found

I will need to read up again on Autotools to see what might be needed before Bootstrap. The directory holds some files that are involved in/with Autotools:

johan@Mint-Latitude-E6330 ~/AVR/avarice/avarice-code-372-trunk $ ls -l
total 160
-rw-r--r-- 1 johan johan   551 Jul 10  2003 AUTHORS
-rw-r--r-- 1 johan johan  1449 Dec  7  2003 avarice.spec.in
-rwxr-xr-x 1 johan johan   746 May 27  2005 Bootstrap
-rw-r--r-- 1 johan johan 69222 Apr 18  2016 ChangeLog
-rw-r--r-- 1 johan johan  6525 Feb 29  2016 configure.ac
-rw-r--r-- 1 johan johan 18007 Feb 25  2003 COPYING
drwxr-xr-x 2 johan johan  4096 Jul 31 09:30 doc
-rw-r--r-- 1 johan johan    79 Feb 25  2003 INSTALL
-rw-r--r-- 1 johan johan   762 Jul 23  2007 INSTALL-FROM-CVS
-rw-r--r-- 1 johan johan 12534 Dec 19  2012 m4_ax_pthread.m4
-rw-r--r-- 1 johan johan   915 Oct  8  2006 Makefile.am
-rw-r--r-- 1 johan johan  7719 Mar  2  2016 NEWS
drwxr-xr-x 2 johan johan  4096 Jul 31 09:30 scripts
drwxr-xr-x 2 johan johan  4096 Jul 31 09:30 src
drwxr-xr-x 2 johan johan  4096 Jul 31 09:30 tools

but no aclocal. IIRC this is a file that is created by Autotools, and the "local" in the filename suggests it is to be created on the target machine (rather than on the "maintainer" machine).

 

I did read up quite a bit on Autotools a year ago or so, but memory fades fast, and even more so if not practiced. I have vague memories of 'autoconf'/'autoreconf', but as I recall that is something done by the maintainer, not "me". I do not have 'autoconf' installed, and am reluctant to do so on such a vague "whim"..

 

I will not have the time to read up on Autotools again ATM, so if no-one has a good advice on how to proceed to get the aclocal file then building from HEAD stops here. (And my Dragon stays on the bench, although it would be really nice to see the Atmel-ICE (or JTAGICE3) working!)

 

Again, big thanks to everyone that have contributed so far!

And.. I have not forgotten the promised write-up, but am not in a position yet to begin serious writing.

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

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

No-no-no!

 

After a better web search:

 

The aclocal is a program that needs to be installed! A simple

sudo apt install automake

made this go much better:

johan@Mint-Latitude-E6330 ~/AVR/avarice/avarice-code-372-trunk $ ./Bootstrap
+ aclocal
+ autoheader
+ autoconf
+ [ -d config-aux ]
+ mkdir config-aux
+ automake -a -c
configure.ac:35: installing 'config-aux/compile'
configure.ac:38: installing 'config-aux/config.guess'
configure.ac:38: installing 'config-aux/config.sub'
configure.ac:31: installing 'config-aux/install-sh'
configure.ac:31: installing 'config-aux/missing'
src/Makefile.am: installing 'config-aux/depcomp'
+ rm -f config.cache

and after a

./configure

I now have a Makefile! A make seems to go OK (havent noticed before that the avarice executable ends up in the src subdirectory, but it does. Double checked with 2.13 and that build does the same.)

 

Aaaaannnyyywayyyy, heres the good stuff:

 

johan@Mint-Latitude-E6330 ~/AVR/avarice/avarice-code-372-trunk/src $ ./avarice -?
AVaRICE version 2.13svn20160229, Jul 31 2017 12:33:45

Usage: ./avarice [OPTION]... [[HOST_NAME]:PORT]

Options:
  -h, --help                  Print this message.
  -1, --mkI                   Connect to JTAG ICE mkI (default)
  -2, --mkII                  Connect to JTAG ICE mkII
  -3, --jtag3                 Connect to JTAGICE3 (Firmware 2.x)
  -4, --edbg                  Atmel-ICE, or JTAGICE3 (firmware 3.x), or EDBG Integrated Debugger
  -B, --jtag-bitrate <rate>   Set the bitrate that the JTAG box communicates
                                with the avr target device. This must be less
                                than 1/4 of the frequency of the target. Valid
                                values are 1000/500/250/125 kHz (mkI),
                                or 22 through 6400 kHz (mkII).
                                (default: 250 kHz)
  -C, --capture               Capture running program.
                                Note: debugging must have been enabled prior
                                to starting the program. (e.g., by running
                                avarice earlier)
  -c, --daisy-chain <ub,ua,bb,ba> Daisy chain settings:
                                <units before, units after,
                                bits before, bits after>
  -D, --detach                Detach once synced with JTAG ICE
  -d, --debug                 Enable printing of debug information.
  -e, --erase                 Erase target.
  -E, --event <eventlist>     List of events that do not interrupt.
                                JTAG ICE mkII and AVR Dragon only.
                                Default is "none,run,target_power_on,target_sleep,target_wakeup"
  -g, --dragon                Connect to an AVR Dragon rather than a JTAG ICE.
                                This implies --mkII, but might be required in
                                addition to --debugwire when debugWire is to
                                be used.
  -I, --ignore-intr           Automatically step over interrupts.
                                Note: EXPERIMENTAL. Can not currently handle
                                devices fused for compatibility.
  -j, --jtag <devname>        Port attached to JTAG box (default: /dev/avrjtag).
  -k, --known-devices         Print a list of known devices.
  -L, --write-lockbits <ll>   Write lock bits.
  -l, --read-lockbits         Read lock bits.
  -P, --part <name>           Target device name (e.g. atmega16)

  -r, --read-fuses            Read fuses bytes.
  -R, --reset-srst            External reset through nSRST signal.
  -V, --version               Print version information.
  -w, --debugwire             For the JTAG ICE mkII, connect to the target
                                using debugWire protocol rather than JTAG.
  -W, --write-fuses <eehhll>  Write fuses bytes.
  -x, --xmega                 AVR part is an ATxmega device, using JTAG.
  -X, --pdi                   AVR part is an ATxmega device, using PDI.
HOST_NAME defaults to 0.0.0.0 (listen on any interface).
":PORT" is required to put avarice into gdb server mode.

e.g. ./avarice --erase --program --file test.bin --jtag /dev/ttyS0 :4242

We have JTAGICE3! We have EDBG!

 

Now my guesting family will go whopping mad since I must test this some late evening or night in the coming week!

 

And so I'm over, again, to the PM I'm maintaining to add a few notes on this last "discovery"!

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

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

Here is a build log from my system.  It may shed some light on what is needed.  I know nothing about Autotools unfortunately.

 

Attachment(s): 

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

Congrats, looks like you got it nailed!

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

You probably posted while I composed my last long'ish post with a successful build of HEAD. 

 

I had a look in your log, and I see gets the code from the canonical SVN repo at SourceForge, trunk and revision 372. This is the current HEAD of the trunk and the same that I used in the latest build above.

 

Do I understand it correctly that you do not see the -3 and -4 options/switches in the help?

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

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

Once again, big thanks to everybody that are involved here!

 

Not only have I gotten valuable hard advice and encouragement. It just struck me that without you being my "rubber ducks" I would probably have gotten lost, frustrated and given up about a week ago! So: Once again, thank you all!

 

Stay tuned for an upcoming test run of AVARICE and GDB. And then hopefully NetBeans (or any GDB-enabled IDE) on top of that!

 

Aside: By Golly!, do I like my shiny new Mint! It's almost like a VAX/VMS system... ;-)

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

Last Edited: Mon. Jul 31, 2017 - 11:55 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

JohanEkdahl wrote:

Do I understand it correctly that you do not see the -3 and -4 options/switches in the help?

 

Yes I do.  I pretty much went through the same process as you.  First attempts at building I didn't get those options but once I figured out Autotools (the Gentoo way) the next build was good.

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

Long time..

 

This has been pushed to the backlog for quite a while now, but I've picked it up again, at least temporarily. I should read through the thread to see what I've told, but it's late so here's just a short update and a few questions:

 

  • I am now concentrating fully on getting this to work on Linux Mint (but am using Windows occasionally to verify working hardware etc). 
  • As reported earlier, I have successfully built both AVRDUDE and AVaRICE on Linux Mint.

 

After a quick survey of NetBeans, CodeBlocks and latest Eclipse (Oxygen) I actually ended up with going for Eclipse with the AVR Plugin for now. It was what worked best "out-of-the-box".

 

Current hardware setup is an Atmel-ICE connected to an ATmega2560 on the JTAG interface.

 


 

Regarding AVRDUDE

 

I couldn't get AVRDUDE to actually program the AVR. I went back to Windows and checked the setup using Atmel Studio. It prompted for an update of the Atmel-ICE firmware so did that, and the setup worked. Device signature and fuses read successfully.

 

Next, I tried AVRDUDE on Windows. After installing a filter driver I succeeded.

 

I returned to Linux Mint and foolishly assumed something like a filter driver was necessary there too, but Googling gave nothing. On a whim I then tried running AVRDUDE again and succeeded! I strongly suspect that it was the  firmware upgrade that did it. Foolishly I didn't take good notes on what the old firmware version was but IIRC it was very low i.e. 1.0.0 or some such.

 

Question 1: Can anyone (Morten, are you here?!?) confirm that early versions of the Atmel-ICE firmware will not work with "current" AVRDUDE? If I'm correct re this, does anyone know at what firmware version the "crucial" change was made? (Need this for my eventual "write-up").

 

Question 2: Somewhere (I know, I know..., but I've missed to take notes on where) I've read that to connect AVRDUDE to Atmel-ICE the last four digits of the ICE serial number needs to be given on the command line, like so:

C:\...\avrdude-6.3-mingw32> avrdude -c atmelice -P usb:47:35 -p ATmega2560

By sheer accident I left that out when testing on Linux Mint and AVRDUDE did behave well without it:

~/Build/avr/avarice/avarice-code-372-trunk/src $ avrdude -c atmelice -p m2560

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.07s

avrdude: Device signature = 0x1e9801 (probably m2560)

avrdude: safemode: Fuses OK (E:FF, H:11, L:E2)

avrdude done.  Thank you.

Is this something that was required but is not required with current AVRDUDE? OR is it varying with operating system? (I have not returned to Windows to test there, yet...)

 


 

Regarding AVARICE

 

I'm trying to make sense of the AVaRICE command line. Bear in mind that I'm a total novice using AVaRICE.

 

I was hoping I could verify that AVaRICE connected to the Atmel-ICE and that it in turn communicated with the AVR. The AVaRICE --help about the -r switch says 

-r, --read-fuses                     Read fuses bytes.

 

so I was hoping that by doing e.g.

~/Build/avr/avarice/avarice-code-372-trunk/src $ ./avarice -4 -P atmega2560 -j usb -r

I could verify "the whole chain", but it yields nothing but

AVaRICE version 2.13svn20160229, Aug  2 2017 14:55:02

Defaulting JTAG bitrate to 250 kHz.

~/Build/avr/avarice/avarice-code-372-trunk/src $

i.e. no "reaction" at all indicating any successful attachment/communication, and return immediately to command line. It's not a matter of "sudo" - I've tried that. Also tried specifying a port - same result. Also tried -C for "capture  running program" - same result.

 

Question 3: Am I "mis-assuming" what the -r switch should do? Is there any other way to verify that AVaRICE talks properly to the AVR?

 

I'm not even sure that the above connects even to the Atmel-ICE. I'd like to have some way to verify that, and connection with the AVR, before I move on..

 

(Yes, I've checked the JTAG fuse: Running the fuse bytes, read out with AVRDUDE, through http://www.engbedded.com/fusecalc verifies that JTAG is enabled.)

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

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

Question 1: Can anyone (Morten, are you here?!?) confirm that early versions of the Atmel-ICE firmware will not work with "current" AVRDUDE? If I'm correct re this, does anyone know at what firmware version the "crucial" change was made? (Need this for my eventual "write-up").

No, I can't confirm that... It's not intentional at least (we try to keep the firmware API stable, keeps all of us saner). If you want me to look into it I need the verbose output from avrdude (the one that shows the byte stream) smiley

 

Question 2: Somewhere (I know, I know..., but I've missed to take notes on where) I've read that to connect AVRDUDE to Atmel-ICE the last four digits of the ICE serial number needs to be given on the command line, like so:

Really? I've never seen that... Just skimmed the avrdude source and it look like it takes an optional vid:pid parameter for usb. No mention of serial though...

:: Morten

 

(yes, I work for Atmel, yes, I do this in my spare time, now stop sending PMs)

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

meolsen wrote:
Really? I've never seen that... Just skimmed the avrdude source and it look like it takes an optional vid:pid parameter for usb. No mention of serial though...
I thought the ICE ID thing was when you had more than one ICE connected at the same time (so it knows which one to "talk to").

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

meolsen wrote:
If you want me to look into it I need the verbose output from avrdude (the one that shows the byte stream) 

Well, since I've updated the firmware I would have to downgraded again to see if this "phenomenon" is repeatable. I'll pass, and take your word Morten :-)

 

clawson wrote:
I thought the ICE ID thing was when you had more than one ICE connected at the same time (so it knows which one to "talk to").

Yes, that might be it!

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

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

Testing AVRDUDE programming and AVaRICE debugging

 

I am doing some serious testing using two dongles

  • Dragon
  • Atmel-ICE

and three target systems

  • ATmega88 (sitting on a STK500, but essentially just for power and ease of connection - e.g am not using the STK500 on-board ISP (yet?))
  • ATmega328P (on an Arduion Uno)
  • ATmega2560 (sitting on a STK600, again just for power)

 

I am testing both AVRDUDE and AVaRICE. For AVaRICE I am just trying to get it to the state where it says "waiting for connection on port nnnn", i.e it is ready for GDB to connect.

 

This gives me 14 test cases, since I am testing both AVRDUDE and AVaRICE:

 

AVRDUDE

  • 6 cases using AVRDUDE, ISP programming (3 devices x 2 dongles)
  • 2 cases using AVRDUDE, JTAG programming (1 device x 2 dongles)

 

AVaRICE

  • 4 cases using AVaRICE, DebugWire debugging (2 devices x 2 dongles)
  • 2 cases using AVaRICE, JTAG debugging (1 device x 2 dongles)

 

The (tentative) results

 

AVRDUDE works for all 8 cases.

 

AVaRICE works when using the Dragon doing JTAG debugging on the mega2560, but not for the other 4 cases. It seems to boil down to these two problems:

 

  • debugWire devices can not enter/initiate a debugging session (regardless of dongle and device used).
  • JTAG debugging does not work for the Atmel-ICE (regardless of the device used). AVaRICE just reports version and bitrate and then silently exits.

 

As you can see, these two overlap somewhat, but I believe the latter is a sign of AVaRICE not having support for Atmel-ICE (or it is buggy). I will try to investigate this further (I do have the source, and if I fail I will try to ask Jörg nicely for some help...)

 

For the debugWire problem I still need to cross-check and verify that dW debugging works for my hardware in Atmel Studio. I wonder if it is the case that AVaRICE will not do the enabling of the DWEN fuse? (I just might risk messing with the fuse, having Studio leaving it programmed and then switch back to Linux to test again.)

 

The good part!

 

I have one setup/combo where everything works (both AVRDUDE and AVaRICE): The Dragon + ATmega2560. I will try to proceed to actually getting a GDB on top of AVaRICE using that, so I'm still moving forward! (But by golly, is this tedious... ;-)

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

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

JohanEkdahl wrote:
(But by golly, is this tedious... ;-)

 

As tedious as this may seem, imagine the tedium of having to field questions from hundreds (well, maybe part of a dozen) less adept individuals, each trying to do what you are doing. 99% would get part way and report "this is taking too much time and effort" and silently give up. I could easily be one of those!

 

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

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

Well, Jim..

 

I've been taking this monster on several times, and given up, but this time is different (I hope). The crucial change is that I'm now on Linux 95% of the time. If I can get OCD working it'll be 99% - and a sense of security for the future (no Windows 10!).

 

I've never been this close before, and as long as I'm seeing possible progress I'll stick to it - time permitting.

 

Also, as you may deduce from the 100+ posts above, I'm seldom for doing things "by cook-book". I want to understand and feel that I master what I'm doing. I have this "rule": If I know something well enough that I can explain it to someone else - then I know it. That plays a part in why this takes so long.

 

I'm amazed that some of you are still following this, and not disappointed by the fact(?) that most probably have given up on my ramblings. I still write, since composing a "post of progress" is a way to make sure I my thoughts are in good order. For me, writing just does that..

 

Thanks for the encouragement!

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

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

Sometimes it's fun to document what you're doing with a photograph. So...

 

Left my Dell Latitude E6330 running Linux Mint. (On-screen, top right is a terminal window where I've just tried to run AVaRICE. Behind that is a Libre Office document with my table of tests.)

 

Center the STK600. I've fastened the Atmel-ICE on top of the ATmega2560 top board with a rubber band..

 

Top right the Dagon and the Arduino Uno fastened to a small piece of wood. (The rainbow flat-cable is left from an old display experiment IIRC.)

 

Bottom right the STK500 with and ATmega88.

 

When the picture was taken I was testing AVaRICE trough the Dragon to the ATmega328P on the (old) Arduino Uno.

 

It's a lot of cables and headers to keep track of. More than once I've cursed that something stopped working only to realize that I've just wired the Dragon/ICE to the wrong board, turned a connector the wrong way or have the wrong USB cable attached to the laptop..

 

 

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

Last Edited: Sat. Sep 9, 2017 - 07:54 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

some of you are still following this

Don't doubt it!

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

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

AVR GDB was removed from PlatformIO 3 replaced by a unified debugger for ARM Cortex-M and TI MSP430.

Both AVR GDB and AVaRICE have been restored to an in-work version of PlatformIO 3.

The operator's interface is a terminal (i.e. not a part of PIO Unified Debugger)

 

Add GDB to build environment

valeros committed on Jun 20, 2017

https://github.com/platformio/platform-atmelavr/commit/b593f9e33cbab9337d9e1c6d31594422e70b03fd

Debug probe support for atmel-ice / dragon and atmega328p processor #53

warrenwoolseyiii opened this Issue on Jun 19, 2017

https://github.com/platformio/platform-atmelavr/issues/53

...

debug_server =
  /path/to/avarice
  --edbg
  --debugwire 
  --ignore-intr 
  :4242

Now you can start debugging session from terminal using pio debug --interface gdb -x .pioinit
Some of above commands might not work, especially load (in this case you will need to upload debug version of firmware manually using avrdude)

 

...

PIO Unified Debugger

http://docs.platformio.org/en/latest/plus/debugging.html

It Simply Works. Easier than ever before!

New in version 3.4: (PlatformIO Plus)

...

 

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

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

@gchapman: Thank you! vI'll have a better look at all that when time permits. But at a first glance I see no coverage of debugging for AVRs in "Unified Debugger". I find lots and lots of ARM stuff though, so it is interesting in the longer term! Under Boards, Atmel I see only SAM ARM stuff, and under Boards, Arduino are only ARM-based Arduinos.

 

do have the ambition to get SAM ARM debugging going eventually, and I expect this to not be the same struggle as with AVRs since there is a cross-manufacturer standard (CMSIS-DAP).

 

Let's stay with AVRs here, please. I'll be happy to start an SAM ARM on-chip debugging thread, if you want to contribute more on that matter! As I said, I'm interested in going for the SAM ARMs eventually but need to concentrate on one thing at a time.

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

Last Edited: Sat. Sep 9, 2017 - 08:49 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

JohanEkdahl wrote:
But at a first glance I see no coverage of debugging for AVRs in "Unified Debugger".
There's contact :

https://www.avrfreaks.net/forum/platformio-do-or-do-not-thats-question#comment-2267111

JohanEkdahl wrote:
I'll be happy to start an SAM ARM on-chip debugging thread, if you want to contribute more on that matter!
I'll decline as no need for SAM (yet)

SEGGER has a GDB server for PIC32 and some of the ARM Cortex low price debuggers (OpenOCD) work for PIC32; I'm mulling PIC32MZ DA as MicroPython is in work for PIC32.

Choices wink

Been quite sometime since I've read the SAM side of the Community so when you post there I'll likely miss it.

 


GDB interface utility for MIPS processors, including PIC32

https://github.com/sergev/ejtagproxy

...

EJTAGproxy is a utility for debugging PIC32 microcontrollers with GDB
via JTAG or ICSP adapter.  Supported adapters:

 * Microchip PICkit2
 * Microchip PICkit3 with scripting firmware
 * Olimex ARM-USB-Tiny
 * Olimex ARM-USB-Tiny-H
 * Olimex ARM-USB-OCD-H JTAG adapter
 * Olimex MIPS-USB-OCD-H JTAG adapter
 * Bus Blaster v2/v3 JTAG adapter from Dangerous Prototypes
 * Flyswatter JTAG adapter from TinCanTools

...

List of supported processors:

...

via

Dangerous Prototypes

DangerousPrototypes

Use your PICkit2 or PICkit3 as a debugger for PIC32

http://www.microchip.com/design-centers/32-bit/architecture/pic32mz-da-family

MicroPython Forum

MicroPython & PIC32 chips

 

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

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

gchapman wrote:
SEGGER has a GDB server for PIC32

Nothing but AVRs, please...?

 

Again, I'll be happy to start a thread where we can deal with "the rest". Also, I admit to sometimes being "all over the place", but my concern here is that this thread is at ~150 posts, and there will be more.

 

So.. Please?

 

gchapman wrote:
There's contact : https://www.avrfreaks.net/forum/p...

Perhaps, but seeing is believing. Until then, it's vapour-ware.

And since PlatformIO is open source (yes?) then why do they need contact with Atmel? They could just adopt AVaRICE?

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

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

Will do

JohanEkdahl wrote:
And since PlatformIO is open source (yes?)
Yes (Apache 2.0) for the core, IDE integration, and CI; not FOSS for the value-added portions (PlatformIO Plus) (remote targets, PIO Unified Debugger, unit testing, static analysis)

JohanEkdahl wrote:
... then why do they need contact with Atmel?
PIO Unified Debugger is akin to the proprietary debuggers by Imagecraft, Rowley, and IAR.

An assumption is the response from one at Microchip is it's GDB MI and TCF.

What's likely to be proprietary is Microchip's plan for AVR cross-platform and a certain agreement between ones at Microchip and Microchip partners.

An assumption is Microchip has third party partners as Atmel did.

JohanEkdahl wrote:
They could just adopt AVaRICE?
Am glad AVaRICE is now a part of PlatformIO Core; more operators leads to the addition of more targets and defect correction.

Atmel did not compete against FOSS; Microchip does compete against Texas Instruments (AVR versus MSP430™) (Microchip AVR atbackend.exe versus TI MSP Debug Stack)

 


https://github.com/platformio/platformio-core/blob/develop/LICENSE

http://platformio.org/pricing

https://www.avrfreaks.net/forum/linux-friendly-pcb-design-software#comment-2179406

https://github.com/xoriath/vscode-atmel-debug by meolsen (Morten)

TCF

http://www.atmel.com/about/contact/sales/default.aspx?contactType=Third%20Party%20Support%20-%20AVR#

Texas Instruments

MSP Debug Stack

http://www.ti.com/tool/mspds

 

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

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

Glad to see you are making progress here, Johan!

I gave up earlier and ordered an Olimex MK2, for a hopefully easier debugging setup in linux.

But will continue trying some more with my ICE while I wait for it to arrive.

 

One question though, did you remove the reset circuit on the arduino before trying debugwire?

I also think you need to manually program the DWEN fuse like you said.

 

Well, got to check if I got some more arduino's with ISP lying around, just bricked one (I think) because of the reset capacitor that I forgot to remove before programming DWEN..

Pages