Atmel-ICE, avarice, Eclipse and debugging in Ubuntu

Go To Last Post
52 posts / 0 new

Pages

Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Hi,

 

it seems it is finally there. I managed to install the newest avarice with Atmel-ICE support, easy:

svn checkout svn://svn.code.sf.net/p/avarice/code/trunk avarice-code

./Bootstrap
./configure
make
sudo make install

 

 

 

I configure Atmel-ICE in Eclipse, two flavours - debugwire and isp. Also, debug is configured for gdp.

 

The avarice is run like this:

avarice --edbg --debugwire --ignore-intr  :4242

 

The moment where ICE fails is when I try to read processor config in Properties->AVR->Target Hardware

 

There is no answer from processor and I cannot set debugWire fuse.

 

Any ideas?

 

Greetings,

Tom

 

 

Greetings, Tom

Last Edited: Sat. Mar 12, 2016 - 01:41 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ok it works - avarice requires working hidapi, so it is beneficial to install it.
http://www.signal11.us/oss/hidapi/

Greetings, Tom

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

You wouldn't consider writing a tutorial about all this and how to setup Eclipse for AVR debugging would you? This comes up quite a lot.

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

clawson wrote:

You wouldn't consider writing a tutorial about all this and how to setup Eclipse for AVR debugging would you? This comes up quite a lot.


+1!

"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

Yes, I will - I record all my actions anyway.
I am stuck on avr-gdb right now, when I debug from eclipse it connects, but I see no source code - when I sort it out, I will summarize what needs to be done.

Greetings, Tom

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

clawson wrote:
You wouldn't consider writing a tutorial about all this and how to setup Eclipse for AVR debugging would you? This comes up quite a lot.

+MAXINT!

 

I've been tinkering on and off with this in the past, but got stuck. With the scary forecast of being forced into Windows10 only to have debugging for AVRs any progress on a stable setup for Linuxes and Macs would be quite welcome!

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

Johan, this is exactly my sentiment! 

 

I stuck a bit, maybe  someone could help me. 

Basically, I can debug, i.e. avarice runs, avr-gdb connects via local host:4242. 

Connection is stable. 

When I start to debug I get an error attached. Then, when I pause, I get info that there are no source codes.... 

I checked everything outside out, and I am lost :( 

 

Greetings,

Tom

Attachment(s): 

Greetings, Tom

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

From my experience with simulavr, this was related to the version of avr-gdb.  Newer versions didn't work correctly w.r.t source level debugging.  I used an earlier avr binutils and it worked.  I can't remember the exact details, but perhaps this is a new scent for you and Johan to pick up.

"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 wonder if it may help to try different variants of -g?

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

I tried -gstabs and -gstabs+
I'll try older avr-gdb - good idea.
I think I will prepare a cookbook, maybe someone will try to get to the same point where I am now.

Greetings, Tom

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

Hi

 

I post a short tutorial, it is still work in progress.

 

Installing avarice and connecting to avr-dbg - Atmel-ICE

 

Special thanks to Joerg Wunsch for his great work on avarice!

 

I use Ubuntu 14.04

 

Linux A300 3.13.0-79-generic #123-Ubuntu SMP Fri Feb 19 14:27:58 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

 

I assume you are able to use avrdude with atmel-ice, it is fairly easy for avrdude >= 6.1

 

The process I went through:

 

I recommend reinstall of hidapi. Even if you have hidapi, ./configure shows you have no hidapi.

 

Main web page with instructions:

http://www.signal11.us/oss/hidapi/

 

Installation

 

Optional step, if you seldom compile. If you compiled avrdude, you should have everything ready, apart from libfox.

sudo apt-get install build-essential libftdi1 libelf-dev libusb-dev
sudo apt-get install libudev-dev libusb-1.0-0-dev libfox-1.6-dev flex
sudo apt-get install autotools-dev autoconf automake libtool

HidApi install

git clone git://github.com/signal11/hidapi.git
cd hidapi
./boostrap
.configure --enable-testgui
make
sudo make install

Then, check if it worked:
 

cd testgui
./testgui

Click connect, if it works, you can go ahead and install avarice,  rev. 365 or newer

svn checkout svn://svn.code.sf.net/p/avarice/code/trunk avarice-code
cd avarice-code/avarice
./Bootstrap
./configure
make
sudo make install

Then, you must build your project in eclipse in Debug mode, as usual. Flash the chip, it is no longer done in avarice, use avrdude to flash.

 

Then, set the fuse bits for debugWire. Take care, it is dangerous step, you can brick chips.

 

For atmega 328P only:
 

avrdude -pm328p -catmelice_isp -v -U hfuse:w:0x9E:m

Then, run avarice
 

avarice --edbg --debugwire  --ignore-intr  :4242

If you have an error like this:

AVaRICE version 2.13svn20160229, Mar  3 2016 14:04:24

$avarice --edbg --debugwire  --ignore-intr  :4242
JTAG config starting.
Found a device, serial number: J41800031019
initJtagBox() failed: JTAG ICE timeout exception

Check if your debugWire fuse is set properly, like in the attached picture.

 

If it is ok, you must cycle power, first switch on the processor, or reset, then put atmel-ice back in USB port.

 

You can have an error like this, too:

 

tom@A300:~/avarice $ avarice --edbg  --debugwire  --ignore-intr  :4242
AVaRICE version 2.13svn20160229, Mar  4 2016 21:14:23

openhid(): device not responding to DAP_Info

Check fuses, cycle power then as well.

 

If all works, you see this, if not - try to change usb port of ice, it is too cool for one of my usb ports.

tom@A300:~/avarice $ avarice --edbg  --debugwire  --ignore-intr  :4242
AVaRICE version 2.13svn20160229, Mar  4 2016 21:14:23

JTAG config starting.
Found a device, serial number: J41800031019
Reported device ID: 0x950F
Configured for device ID: 0x950F atmega328p
JTAG config complete.
Preparing the target device for On Chip Debugging.
Waiting for connection on port 4242.

So, you can run avr-gdb to check connection, easiest directly from your project Debug directory:

tom@A300:~/Dropbox/atmel/Enkoder/Debug$ ls
display.d  Enkoder.eep  Enkoder.lss  main.o      OLED
display.o  Enkoder.elf  Enkoder.map  makefile    sources.mk
ENCODER    Enkoder.hex  main.d       objects.mk  subdir.mk

tom@A300:~/Dropbox/atmel/Enkoder/Debug$ ~/avr8-gnu-toolchain-linux_x86_64/bin/avr-gdb Enkoder.elf
GNU gdb (AVR_8_bit_GNU_Toolchain_3.5.0_1662) 7.8
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
......
This GDB was configured as "--host=x86_64-pc-linux-gnu --target=avr".
.......
Type "apropos word" to search for commands related to "word"...
Reading symbols from Enkoder.elf...done.
(gdb) target remote localhost:4242
Remote debugging using localhost:4242
0x00007e00 in ?? ()
(gdb) list
warning: Can not parse XML memory map; XML support was disabled at compile time
(gdb) list
11    #define BITRATE 400
12
13    void twi_set_bitrate(uint16_t bitrateKHz) {
14        uint8_t bitrate_div;
15
16        bitrate_div = ((F_CPU/1000l)/bitrateKHz);
17        if(bitrate_div >= 16)
18            bitrate_div = (bitrate_div-16)/2;
19
20        TWBR = bitrate_div;
(gdb) step
Cannot find bounds of current function

There are still some issues -

Cannot find bounds of current function error
warning: Can not parse XML memory map; XML support was disabled at compile time

Some more work is needed.

 

I attach eclipse debugging effort, two terminals with avarice and avr-gb and view of fuses used in the project.

 

To remove debugWire fuse, use this:

 

avrdude -pm328p -catmelice_isp -v -U hfuse:w:0xde:m

Good luck !!
Tom

 

Attachment(s): 

Greetings, Tom

Last Edited: Sat. Mar 12, 2016 - 01:39 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi again,

 

I checked with standard Ubuntu repository toolchain:

 

 binutils-avr (2.23.1-2.1) ...
 gcc-avr (1:4.8-2.1) ...
 avr-libc (1:1.8.0-4.1) ...
 gdb-avr (7.6-1) ...

What shows in console: gdb-avr GNU gdb (GDB) 7.6.50.20131218-cvs

 

Still no sources, if I try in debug console load Debug/Enkoder.elf, I get this in avarice console:

 

buffering data, 48 bytes @ 0x19e0
buffering data, 48 bytes @ 0x1a10
buffering data, 48 bytes @ 0x1a40
buffering data, 48 bytes @ 0x1a70
buffering data, 24 bytes @ 0x1aa0
committing to flash
Failed to write target memory space: debugWIRE failed

Avarice drops to prompt :(

 

I investigated another possible threat, I had some warnings due to use of delay functions, so I removed delay functions and there are no warnings in my build..

 

I can debug, only it has no symbols  - it must be something stupid - how to load symbols without loading anything to the avr? It breaks avarice then...

 

(gdb) ni
0x00007e02 in ?? ()
(gdb) ni
0x00007e04 in ?? ()
(gdb) ni
0x00007e06 in ?? ()
(gdb) ni
0x00007e08 in ?? ()
(gdb) 

I started like this:

 

avr-gdb Enkoder.elf

 

I could see symbols, and the program can be run

 

(gdb) ni
The program is not being run.
(gdb) target remote localhost:4242
Remote debugging using localhost:4242
0x00007e00 in ?? ()
(gdb) ni
0x00007e02 in ?? ()
(gdb) ni
0x00007e04 in ?? ()
...... more ni 
(gdb) ni
0x00007e0e in ?? ()
(gdb) ni
0x00007e10 in ?? ()
(gdb) ni
0x00007e12 in ?? ()
(gdb) ni
0x00007e14 in ?? ()
(gdb) list
31	
32	void twi_stop(void) {
33		TWCR = (1<<TWINT)|(1<<TWEN)|(1<<TWSTO);
34		while ( (TWCR&(1<<TWSTO)));
35	}
36	
37	void twi_write(uint8_t bajt) {
38		TWDR = bajt;
39		TWCR = (1<<TWINT)|(1<<TWEN);
40		while ( !(TWCR&(1<<TWINT)));
(gdb) 

Hmm....

Greetings, Tom

Last Edited: Sun. Mar 6, 2016 - 07:06 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well, Tomasz, all this is still so new to AVaRICE, so better keep the debugging work on the avarice-user mailinglist right now.

As I wrote you there, flash downloads through debugWIRE are currently broken, both in AVRDUDE as well as in AVaRICE (through GDB's "flash" command).

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
svn checkout svn://svn.code.sf.net/p/avarice/code/trunk avarice-code
cd avarice-code/avarice
./Bootloader
./configure
make
sudo make install

 

Should it not be ./Bootstrap ?

Regards
Vidar (Z)

----------------------------------------------------------

"The fool wonders, the wise man asks"

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

Uh of course thank you very much for spotting it !!! I corrected everywhere

 

Tom

Greetings, Tom

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

Hey guys,

 

Kudos to Jorg and his team, as well as sq5rix!

I've just successfully adopted this setup to Windows environment.

All you need to do that is different from above is:

 

1) Install Cygwin (I tested x86 setup on an x64 system, but amd64 may also work).

2) Install stock libusb-devel, libhidapi-devel, automake and autoconf packages in Cygwin manager.

3) Follow the rest of instructions for compiling AVaRICE sources from SVN.

 

(I've also tried MinGW/MSYS prior to that but it failed at finding termios.h, which is only fully supported in Cygwin)

 

Atmel-ICE and programmed device should now be detected automatically with '--edbg' flag.

There's no need to fuss around with libusb filters as suggested at the end of the installation, it just works!

It's also helpful to keep Atmel Studio open in case an upload or debugging session 'bricks' the device (the installation steps from above don't break its compatibility).

I tested it with JTAG connection (i.e. by NOT specifying '--debugwire' option) and it appears to start just fine.

Still trying to figure out how to properly handle XML memory maps, but that's for another day.

 

Happy hacking!

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

In addition to the above, to solve GDB symbol resolution you need to have GDB compiled with libexpat (which provides support for XML memory maps).

 

Example for Windows:

 

1) Install MinGW/MSYS. Cygwin could also work, but it doesn't treat paths with double-backslashes ('\\') very well and they are used by some client software, e.g. Eclipse.
2) Install 'mingw-developer-toolkit' meta-package and 'mingw32-libexpat' from within its package manager.
3) Create file named 'fstab' in C:\MinGW\msys\1.0\etc containing

    c:/mingw  /mingw

    with a blank line at the end(!)

4) Download and unpack gdb source from http://ftp.gnu.org/gnu/gdb/
5) In the source directory, create and cd to a subdir named e.g. 'obj-avr'
6) ../configure --prefix=$PREFIX --target=avr && make && make install
7) Copy C:\MinGW\bin\libexpat-1.dll, C:\MinGW\bin\libgcc_s_dw2-1.dll and C:\MinGW\msys\1.0\bin\avr-gdb.exe to a path you'd like to use avr-gdb from.

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

denvlad wrote:
I've just successfully adopted this setup to Windows environment. All you need to do

[...]

1) Install Cygwin (I tested x86 setup on an x64 system, but amd64 may also work).

[...]

(I've also tried MinGW/MSYS prior to that but it failed at finding termios.h, which is only fully supported in Cygwin)

That's a shame.. Any details on "termios.h only fully supported in Cygwin"?

 

Background: After countless frustrations with conflicting versions of Cygwin1.dll's I loathe Cygwin more than most things, and have sworn never to touch it again. If you try to be an alternative to "classic Windows" and intriduce MS' "speciality" ("DLL-hell") in the alternative, then what's the point? MinGW always seemed the more decent alternative.

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: 1

I also was wary of using Cygwin, but in this case MinGW just doesn't work.

There's a 'newlib' package that supplies termios.h that one could try to compile for MinGW, but it didn't work for me.

 

Cygwin is supposed to have a more complete POSIX system anyway, unlike MinGW that is only a "partial compatibility layer".

Also, I haven't touched on Cygwin for a number of years, and it seems to have improved substantially since then.

It also has a nicer package manager IMHO. I haven't had any issues with it other than the double-backslash problem (and that likely can be solved as well).

I'd suggest giving it another shot, but choosing a new dedicated directory for a clean installation.

 

Also, you don't have to add it to your PATH. In fact, that might be unsafe.

All you need is to copy a few DLLs together with your avarice.exe:

cyggcc_s-1.dll

cyghidapi-0.dll

cygncursesw-10.dll

cygstdc++-6.dll

cygusb0.dll

cygwin1.dll

 

That works well on my system.

 

One other option would be to install Linux on a VM (e.g. using Vagrant to speed up the setup)

and attach your programmer and/or board to it using "USB-passthrough".

I think that should work even on VirtualBox.

 

Yet another option is to wait for the new Ubuntu subsystem (!) coming out for Windows 10 anniversary update:

https://blogs.windows.com/buildi...

 

Edit: The point of it all is to provide GDB shell functionality on Windows and use alternative IDEs (e.g. Eclipse).

GDB is supposed to be available through AS shell but there's little/no documentation on how to make a connection from other software (please update me if you figure that out!)

That being said, unfortunately GDB connection through AVaRICE is not very stable yet, so I'll wait till further updates before using it.

AS provides a very nice debugging interface overall, I just wish it resolves remaining issues with syntax highlighting and a few other things.

Last Edited: Fri. Apr 1, 2016 - 03:18 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you.

 

denvlad wrote:
GDB is supposed to be available through AS shell but there's little/no documentation on how to make a connection from other software ...
Likely easier via Visual Studio :

  • Visual Micro very recently added  Arduino Zero (SAM D21 and EDBG) and GDB.
  • VisualGDB with some effort.  ARM mbed has a few Atmel boards.

Visual Micro

Arduino IDE for Visual Studio and Atmel Studio

Extended Debugging Tutorial

http://www.visualmicro.com/page/User-Guide.aspx?doc=Arduino-gdb-Tutorial.html

...

Visual Micro Extended Debugging uses the gdb debugger in the background.

Therefore, it requires the Visual Studio gdb Debugger Extension to be installed.

...

Visual Micro

Arduino 3rd Party Hardware GDB Configuration Guide

17. January 2016 17:40

http://www.visualmicro.com/post/2016/01/17/3rd-Party-Hardware-GDB-Configuration-Guide.aspx

Sysprogs

VisualGDB

Device Support Packages

http://visualgdb.com/hwsupport/devices/

...

If your debug probe is not listed here, you may still be able to use it with VisualGDB:

  • If it is supported by OpenOCD, you will be able to use it by selecting its OpenOCD script in VisualGDB debug settings.
  • If it comes with a vendor-supplied GDB stub, you can configure VisualGDB to use the custom stub

...

Appears some or most of SAM is already in OpenOCD.

The only mention of AVR at the VisualGDB site :

http://visualgdb.com/toolchains/embedded

and the AVR mention (AVaRICE) at the parent site :

https://sysprogs.com/w/forums/topic/pass-environment-variable-to-gdb-server/

 

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

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

Thanks - all of those are for ARM/32-bit AVR though. I'm mainly concerned about 8-bit AVR so there are no other solutions at the moment..

 

OpenOCD is supposed to add more support for them in the future, but currently it's listed as "preliminary and incomplete"..

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

Also, Visual Micro appears to support Atmel-ICE as an add-on to AS only, and/or through ISP only. So not a real alternative..

Last Edited: Fri. Apr 1, 2016 - 07:01 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Visual Micro

.INO GDB for the Arduino Zero and M0 Pro

http://www.visualmicro.com/post/2016/01/03/GDB-for-Arduino-INO-Initial-Beta-Notes.aspx

25th January 2016 - Gdb is out of beta but these notes are still draft - ...

...

Final release will be simpler and more standard configure.

...

The tools listed below must be installed into Visual Studio.

...

Key features

...

  • Automatic/background conversion between cpp and Arduino format .ino source code

...

Visual Micro uses the standard C++ tools of Visual Studio to provide Arduino programming.

...

Last year Microsoft added support for Crosss Platform C++ projects ...

...

In November 2015 Microsoft released the "Microsoft Gdb Debugger" extension into the Visual Studio gallery.

...

Known issues

...

  • Microsoft are working on a new release with improved visual display and better support for mcu's

...

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

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

Right, and at the end of VS GDB extension page (https://visualstudiogallery.msdn...) it says:

The OCD Debugger Executcable will be the GDB executable for the MCU you are using, e.g. arm-none-eabi-gdb.exe from the ARM GCC tools if you are using an ARM based MCU. Specify the GDB server address provided by your OCD, and the location of your firmware binary that was compiled with debug symbols

Before launching your debug session you will need to launch your GDB server that bridges to your MCU. The ones we have tried are SeggerOpenOCD and pyOCD.

So, unless Microsoft releases their own GDB server that moreover has support for 8-bit AVR (unlikely), or OpenOCD works on the full support (more likely, but still lacking given their focus on ARM), or Atmel opens up GDB use outside of AS (likely?) - with specific support for communication with Atmel-ICE (we're talking JTAGICE3 over EDBG) - AVaRICE would be the only GDB server that could enable the use of any third-party IDE debugger. So far all they've been doing is creating nice front-ends and that has already been available in Eclipse for a long time.

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

denvlad wrote:
... AVaRICE would be the only GDB server that could enable the use of any third-party IDE debugger. So far all they've been doing is creating nice front-ends and that has already been available in Eclipse for a long time.
VisualGDB is out of the AVR gate ahead of Visual Micro and Microsoft.

The AVR GCC toolchain is from GCC 5.3

The AVaRICE mentioned is the old one; debuggers are JTAGICE, JTAGICE mkII, and AVR Dragon.

The Atmel board is MEGA-1284P Xplained.

Sysprogs

VisualGDB Tutorials

Developing firmware for AVR devices with Visual Studio

http://visualgdb.com/tutorials/avr/

This tutorial shows how to develop and debug firmware for AVR devices with Visual Studio using VisualGDB.

http://www.atmel.com/tools/MEGA-1284PXPLAINED.aspx

 

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

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

Seems like another decent IDE indeed (sorry for overlooking it in the above).

Could we specify a custom-built (e.g. trunk version) AVaRICE executable?

Or maybe add it as a 'beta' version to the list..

 

Still, it looks like pretty much any current IDE can be configured to support AVR through AVaRICE (with more or less user-friendliness).

Configurations can be also automatically generated with an external tool such as Platform.IO

 

I guess we just need to wait and see how it goes with AVaRICE support for Amtel-ICE (in terms of robustness/fullness).

But it'd be nice to see other possible backends (e.g. OpenOCD) also supporting AVR, even just to unify/simplify alternative setups.

Last Edited: Wed. Apr 6, 2016 - 02:41 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

denvlad wrote:
Seems like another decent IDE indeed (sorry for overlooking it in the above).
No problem.

Some do prefer the Visual Micro method (relatively).

denvlad wrote:
Could we specify a custom-built (e.g. trunk version) AVaRICE executable?
Very likely yes for the instructions there do not state how to install AVaRICE.

denvlad wrote:
Or maybe add it as a 'beta' version to the list..
Their AVR toolchain package does not contain an AVaRICE; might be a good addition to it.

Or not, for their toolchain packages have the GDB client with a note to download the matching GDB server from elsewhere.

denvlad wrote:
Still, it looks like pretty much any current IDE can be configured to support AVR through AVaRICE (with more or less user-friendliness).
I'm feeling that this line of thought is polluting this thread.

Propose creating a similar titled thread for Visual Studio; intents are cohesiveness, to make such more visible, and a possible place to put URLs for AVaRICE on Windows (or, is Atmel Spaces better for AVaRICE on Windows?)

Do you want to create that thread?

denvlad wrote:
But it'd be nice to see other possible backends (e.g. OpenOCD) also supporting AVR, even just to unify/simplify alternative setups.
Ones at Atmel might consider making the Atmel Studio backend more visible via a DLL as Texas Instruments did for CCS.

Sysprogs

VisualGDB Tutorials

Using Visual Studio to develop MSP430 firmware

http://visualgdb.com/tutorials/msp430/

...

... to demonstrate the integration with debugging tools; however, you can use any of those tools/programmers supported by the MSP430.DLL provided by TI.

...

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

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

gchapman wrote:
The AVR GCC toolchain is from GCC 5.3

Thanks for this link by the way. I'm not that interested in using Visual Studio as an IDE for AVR but I was very interested in getting the 5.3 compiler and 2.0 Libc for Windows. It'll let me explore what's new in an "early" release. (I notice there are 242 io*.h files in the include directory so it's perhaps not quite as extensive as the Atmel builds - but Atmel are pushing their stuff back so I guess it's getting closer).

 

Also interesting that their package has "part description" XML files for all the devices in a different (easier to parse) format than the Atmel .atdf files - I wonder if they wrote them themselves or used a generator to parse the Atmel data to create them?

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

Nice. :)
 

ɴᴇᴛɪᴢᴇᴎ

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

hey everybody VS2015 + VisualMicro + Atmel ICE user here

 

i've used adafruit's uploader as well as others but i would prefer to use the Atmel ICE that cost me all that dough...

 

i've been getting "Did not find any device matching VID 0x03eb and PID list: 0x2141" errors, so i d/l'ed hidapi and built it using VS2015 and copied the hidapi dll in \windows\system32.  yet avrdude still can't find the programmer even after a reboot:

 

C:\Users\xyz>avrdude -c atmelice_isp -p atmega328p
avrdude: jtag3_open_common(): Did not find any device matching VID 0x03eb and PID list: 0x2141

avrdude done.  Thank you.

 

C:\Users\xyz>dir \windows\system32\hidapi.dll
 Volume in drive C is CAD_C
 Volume Serial Number is 5EFC-FE0C

 Directory of C:\windows\system32

06/21/2016  08:32 AM            46,080 hidapi.dll
               1 File(s)         46,080 bytes
               0 Dir(s)  781,171,429,376 bytes free

 

can somebody please tell me what i've done wrong?  is the hidapi dll supposed to live in the same library as avrdude?  one would think \w\s32 would be the correct place for it...

 

tia!

 

"Rather than trying to stay on top of things, I am trying to get to the bottom of things."
--Dr. Donald Knuth

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

sorry forgot to mention that avrtest.exe (a tester for hidapi.dll, comes with the download) works fine:

 

C:\tempForZipExtraction\hidapi-0.7.0\windows\Debug>hidtest
Device Found
  type: 03eb 2141
  path: \\?\hid#vid_03eb&pid_2141&mi_00#7&27329857&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
  serial_number: J41800042***
  Manufacturer: Atmel Corp.
  Product:      Atmel-ICE CMSIS-DAP
  Release:      101
  Interface:    0

 

so a device exists with a VID of 0x03eb and a PID of 0x2141.

 

thanks again!

TOU

 

"Rather than trying to stay on top of things, I am trying to get to the bottom of things."
--Dr. Donald Knuth

 

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

Did this but the option for --edbg still isn't there?

 

EDIT: Followed instructions to the letter, now have Avarice working with ATMEL-ICE
:3

Last Edited: Thu. Mar 8, 2018 - 09:49 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi.. Sorry for bumping this old thread but I run into  on obstacle following this guide.

 

I am required  to run avrdude and avarice in root mode (ie using sudo) to be able to attach to a device

Guess this is related to the hidapi since I also had to run the testgui with sudo before being able to connect anything.

 

This is fine when running from shell but when I try to automate things in code::blocks I run into problems when sudo asks for password.

I am using "sudo -S" inside the debug settings for the code::blocks project. and there is a inline shell where I am prompted to give password

but it does not seem to take any input and C::B gets stuck.

 

 

Regards
Vidar (Z)

----------------------------------------------------------

"The fool wonders, the wise man asks"

Last Edited: Fri. Aug 3, 2018 - 09:58 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You need to add yourself to the group used by the device you're trying to connect to.

 

For example (although it's just a serial port not a debugger), the Arduino UNO shows up under Ubuntu Mate 18.04 as /dev/ttyACM0:

$ ls -l /dev/ttyACM0 
crw-rw---- 1 root dialout 166, 0 Aug  3 18:01 /dev/ttyACM0

So it belongs to group 'dialout'.

 

I am a member of it:

$ groups 
joeymorin adm dialout cdrom sudo dip plugdev lpadmin sambashare vboxusers

... so I can access it.

 

Were I not a member, I could add myself to it with:

$ sudo usermod -a -G groupName userName

See here:

https://askubuntu.com/questions/79565/how-to-add-existing-user-to-an-existing-group

 

"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

Well I am already member of both plugdev and dialout.

Thing is that i did not know which other group I should add myself to.

 

But, you pointed me into the correct direction though I did not find the answer

Figured out that avarice are using /dev/hidraw

[   93.519576] hid-generic 0003:03EB:2141.0005: hiddev0,hidraw4: USB HID v1.11 Device [Atmel Corp. Atmel-ICE CMSIS-DAP] on usb-0000:00:14.0-4.3/input0

but ls -l /dev/hidraw shows it belongs to root group and I kinda do not want to add myself permanently here

hiddev is not present in /dev

 

 

 

 

Regards
Vidar (Z)

----------------------------------------------------------

"The fool wonders, the wise man asks"

Last Edited: Fri. Aug 3, 2018 - 10:52 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

hiddev is not present in /dev

Likely handled by udev.  I don't own an ICE (Well, I do, but it's buried in a box in another building, because I never could get it working under Linux... that was three years ago), so I can't do any testing for you, but a quick Google found this:

https://vk5tu.livejournal.com/56648.html?nojs=1

 

More:

https://www.google.com/search?q=linux+atmel+ice+"usermod"

"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

AVaRICE version 2.13svn20160229, Nov 26 2017 20:43:27

Defaulting JTAG bitrate to 250 kHz.

Failed to open /dev/avrjtag

 

Hi, I am blocked at this line.

Anybody can help>?

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

Is there any option still to connect ATMEL ICE in Linux and do some debugging over JTAG?

It seems the avarice compiling is not working anymore as the svn repository is not there anymore.

I tried also to install OpenOCD but I don't know if it has support for my device which is AT90CAN128.

Any ideas?

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

bbogdanmircea wrote:
I tried also to install OpenOCD but I don't know if it has support for my device which is AT90CAN128.
It doesn't - avarice is the "comms proxy" that "talks" avr-gdb on one side and "Atmel" on the other.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
avarice --edbg --part at90can128 -r
AVaRICE version 2.13svn20160229, Nov 26 2017 20:43:27

Defaulting JTAG bitrate to 250 kHz.

JTAG config starting.
Found a device, serial number: J41800111301
Reported device ID: 0x9781
Configured for device ID: 0x9781 at90can128 -- Matched with at90can128
JTAG config complete.

Reading Fuse Bytes:
  Extended Fuse byte -> 0xff
      High Fuse byte -> 0x90
       Low Fuse byte -> 0xff

After recompiling the hidapi it seems avarice works and I can connect to the device.

Now how do I connect avr-gdb to avarice?

LE: I could connect also avr-gdb to avarice, it seems to work, I can stop the uC, set breakpoints, step in the code. Only thing that is missing is a gui :D. I think I saw something about ddd a gui for avr-gdb, if I could install that would be really cool.

Also when I do step or ni, it seems that the jumps are a little too big, for example I have 3 function calls and it jumps to the next function call, but not inside the function. How can I make to jump inside the function, maybe the .elf needs to be generated with more details?

Or there is some other instruction to step inside?

Last Edited: Thu. Jul 18, 2019 - 11:31 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The avr-gdb to avarice link is made by a shared TCP port - you usually pick a very high number to keep it out of the way of other stuff.

 

This has always been a pretty good explanation I think:  http://winavr.sourceforge.net/AVR-GDB_and_AVaRICE_Guide.pdf

 

(in that they use :4242 as the TCP connection).

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

bbogdanmircea wrote:
It seems the avarice compiling is not working anymore as the svn repository is not there anymore.
https://sourceforge.net/p/avarice/code/HEAD/tree/trunk/avarice/

currently r375 which was copied into a Debian package (source) then patched and make'd :

Debian Package Tracker - avarice via Debian -- Details of package avarice in buster

AVaRICE appears to be either in Fedora or a Fedora Spin though don't know what AVaRICE revision; likewise for Slackware.

AVaRICE r375 is apparently in Ubuntu.

bbogdanmircea wrote:
I tried also to install OpenOCD but I don't know if it has support for my device which is AT90CAN128.
OpenOCD AVR JTAG has apparently been maintained for programming; I didn't follow the debug path in the directories.

https://sourceforge.net/p/openocd/code/ci/263deb3802a515ba8155b6c59146f0f539de4e43/log/?path=/src/flash/nor/avrf.c

via

https://sourceforge.net/p/openocd/code/ci/master/tree/src/flash/nor/avrf.c

bbogdanmircea wrote:
Any ideas?

  • there may be patches for a specific Linux distribution
  • VM a Linux distribution on your Linux instance (USB can be pass-through)
  • container?

 

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

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

Hello, thanks for the replies, I managed to make avarice work with avr-gdb.

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

The first GUI front end I ever used for gdb was ddd so I've always had a soft spot for it ;-)

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

I tried to install ddd yesterday, but couldn't understand which/how to get sources and compile the thing.

Or can I just sudo install it in Ubuntu?

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

bbogdanmircea wrote:
Or can I just sudo install it in Ubuntu?
I'd be very surprised if you cannot simply "apt-get install ddd". There is not much reason to have to build things from source in Linux these days - the major distros have repos full of everything pre-built.

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

Ok, I am having some issues with avarice and avrdude and avr-gdb

More exactly, after some time I get a

Target went out of sleep

Target went to sleep

in the avarice terminal, and if it takes enough time then avr-gdb looses connection to avarice as it seems avarice disconnects

Then I have to disconnect the atmel ice and then restart both the avarice and the avr-gdb

 

Also if I try to flash with avrdude after closing avarice, I get some error related to serial port not available, if I disconnect the USB then it works, looks like the usb is not properly released or something.

I will try then to install ddd in this way, hopefully it is more helpful, but probably will still not solve the problems that I have, as these are not cause by the ability to not debug anymore ...

 

I installed ddd, how do I attach it to avarice on port :4242 ?

The interface looks really old style, but as long as I can see all the data at once I guess no problem.

Last Edited: Fri. Jul 19, 2019 - 10:27 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
Got message seqno 167 (command_sequence == 167)
response: 12 80 00 

command "go" [0x12, 0x32]
0E 00 A8 00 12 32 00 
Querying for response: hid_read() failed (0)
Querying for event: hid_read() failed (0)
Querying for event: hid_read() failed (0)
Querying for event: hid_read() failed (0)
Querying for event: unexpected response (0x81)
read() timed out

Is this related to avarice not being the latest compiled version, or more to the unstable usb drivers?

I keep getting disconnects from the USB, also when switching from avarice closed to avrdude the usb crashes and I need to replug the debugger

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

bbogdanmircea wrote:
Is this related to avarice not being the latest compiled version, or more to the unstable usb drivers?
no answer as I didn't browse your earlier posts wrt AVaRICE version.

https://sourceforge.net/p/avarice/code/375/log/?path=/trunk

...

 

r373 ...

Bump timeout in HID reads a bit.

...

 

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

Last Edited: Fri. Jul 19, 2019 - 01:51 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I downloaded and extracted the latest source, but then I try to do ./configure it gives an error saying that libbfd for binutils is missing.

Also if I manage to make it and install will this override my current avarice?

If I have problems can I go back to my old avarice?

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

bbogdanmircea wrote:
but then I try to do ./configure it gives an error saying that libbfd for binutils is missing.
This is the whole point of .configure's. You now need to pull the source for libbfd-dev and build that first. You may well find that when you run the .configure for that it then tells you of other things it relies on that must be pulled/built first. This can continue to several levels deep.

 

This is why it's far better to pull prebuilts from the distro repo if you can as the distro manager will have built and provided all the dependencies and dpkg/apt-get/etc will just pull and install all that is required.

Pages