Once again: Debugging with GDB

Go To Last Post
166 posts / 0 new

Pages

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

JohanEkdahl wrote:
Still, if someone has any light to shed on the "exit a debugWire session properly" subject, I'm all ears..
avrdude has a command line option for this now I believe.

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

I now have NetBeans debugging working with AVARICE and my newly acquired Dragon.  AVR support in OpenOCD with the Atmel-ICE is not complete yet according what I have read.  I haven't tried hard to get OpenOCD working with the AVR so it might be possible.  AVARICE seems to work fine so no need to look any further at this stage.  I was concerned that the NetBeans gdbserver plugin was not going to be compatible with AVARICE but so far it seems to work.

 

Now all I have to do is clean up my configurations and directory structure a bit and get myself more familiar with NetBeans.  I haven't used NetBeans before this exercise but I like what I've seen so far.

 

@JohanEkdahl: How are you getting on with your set up?  Maybe I will try and duplicate my set up on my Win 7 laptop once I am happy with it to check if there's any gotchas.

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

TT_ZX wrote:
@JohanEkdahl: How are you getting on with your set up?  Maybe I will try and duplicate my set up on my Win 7 laptop once I am happy with it to check if there's any gotchas.
 

 

Since I have some completely different things to tend to besides this (e.g. a fair bit of house-renovation), and to avoid going insane ;-) , I'm trying to limit work on this to two times a week. In longer passes. (The sunday stint above was 8 hrs including breaks..). Where it's at right now, short stints are not the best. E.g. I need to repeat things from scratch "to make sure", take notes to know and remember what I have done etc.

 

Without looking at my notes I can't even tell where I'm at re the Dragon and an 8-bit AVR.

 

What I did after Sunday was to test the PID for the SAM D20 Xplained EDBG that Morten gave, and it seemed to work. For the moment, I stopped there. The SAM/OpenOCD track is very interesting eventually, but for now it only serv es as "additional learning experiences" re GDB. The first real goal is to get 8-bit AVR OCD going.

 

So, no, I have not given up. Next stint tomorrow, hopefully..

 

The plan ATM: Test out the SAM/OpenOCD stack  - just to not leave that at an open end - and then perhaps see if I can tack NetBeans onto that. But then definitively back to AVaRICE and the Dragon.

"He used to carry his guitar in a gunny sack, or sit beneath the tree by the railroad track. Oh the engineers would see him sitting in the shade, Strumming with the rhythm that the drivers made. People passing by, they would stop and say, "Oh, my, what that little country boy could play!" [Chuck Berry]

 

"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, looking through the sunday posts in this thread it seems I've lost a post there..

 

Problem is to get an AVaRICE  build for Windows.

  • Of-course it's not in the Atmel AVR Toolchain for Windows - I never expected that.. ;-) 
  • There seems to be a build here: https://sourceforge.net/projects... , but that says "requires Cygwin" and that is something I avoid like the plague [1].

 

So a bit of a dead end here. I'd like not to go into a siding here, trying to build AVaRICE myself (using MinGW/MSYS, which IMO is the modern(ish) way to do things like this).

 

I do have a MinGW/MSYS setup with a C/C++ toolchain targeting Windows working, if this becomes necessary. But I'd rather try to have focus on one thing, rather than juggling a lot of different things at the same time. And there's always the possibility that my own build introduces a problem that isn't in official builds and that no-one can repeat, understand or help in the matter..

 

So, if anyone knows where to find a recent AVaRICE build for Windows, not requiring Cygwin, I'm all ears!

 


 

[1] For many years Microsoft was critiqued for creating the foundations for "DLL hell". The problem was well known, and you'd think people had learned.. Then when Cygwin surfaced and some thick-head(s) decided (?) to produce several versions of Cygwin1.dll over time, and make them incompatible with each other. Stupid or plain evil. I won't touch Cygwin1.dll with a ten-foot pole if I can avoid it. I certainly will not write any HOWTO or recommendation that says "Use Cygwin". Ever. Period.

"He used to carry his guitar in a gunny sack, or sit beneath the tree by the railroad track. Oh the engineers would see him sitting in the shade, Strumming with the rhythm that the drivers made. People passing by, they would stop and say, "Oh, my, what that little country boy could play!" [Chuck Berry]

 

"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

I downloaded the source tree for AVaRICE, and found a note from Eric Weddington, dated 2003-09-26. A very old note for sure, but it says:

To build avarice for Windows requires the use of Cygwin
<http://www.cygwin.com/> Specifically, this was built using the Previous
package of Cygwin. In the Cygwin installer, select the Prev radio button up
top when installing the packages. This should install cygwin 1.3.22-1, from
the Base tree in the Cygwin setup.

If that still holds it illustrates perfectly the problem with Cygwin..

"He used to carry his guitar in a gunny sack, or sit beneath the tree by the railroad track. Oh the engineers would see him sitting in the shade, Strumming with the rhythm that the drivers made. People passing by, they would stop and say, "Oh, my, what that little country boy could play!" [Chuck Berry]

 

"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:
Then when Cygwin surfaced and some thick-head(s) decided (?) to produce several versions of Cygwin1.dll over time, and make them incompatible with each other. Stupid or plain evil. I won't touch Cygwin1.dll with a ten-foot pole if I can avoid it.
But Microsoft have been doing that for years. How many different copies of gdi.dll or kernel.dll are there for example? The "DLL hell" thing is *supposed* to be solved by WinSxS (Windows Side by Side). Each similarly named DLL now contains a "manifest" (block of XML) embedded in the binary of the DLL and then Windows DLL loader now not only tried to LoadLibrary("gdi.dll") but a very specifically version numbered copy of the same.

 

Cygwin1.dll's should have manifests these days.

 

The only thing is you can't just copy such a DLL onto a PC an expect it to be found. It has to be properly installed into the WinSxS cache (sometimes known as "the aassembly") so that the DLL loader is aware of its manifest in the lookup database when it make a load attempt. For example these are all the copies of gdi.dll on my machine:

C:\Windows\winsxs>dir | grep windows-gdi_
21/11/2010  04:24    <DIR>          amd64_microsoft-windows-gdi_31bf3856ad364e35_6.1.7601.17514_none_07f91de77125e78d
24/04/2016  20:26    <DIR>          amd64_microsoft-windows-gdi_31bf3856ad364e35_6.1.7601.18946_none_07da9f87713c7c4b
25/04/2016  03:04    <DIR>          amd64_microsoft-windows-gdi_31bf3856ad364e35_6.1.7601.18985_none_07ae5f8d715dd2b8
25/04/2016  03:38    <DIR>          amd64_microsoft-windows-gdi_31bf3856ad364e35_6.1.7601.19146_none_07da798f713cacb4
24/04/2016  20:26    <DIR>          amd64_microsoft-windows-gdi_31bf3856ad364e35_6.1.7601.23149_none_086715528a579b5c
25/04/2016  03:04    <DIR>          amd64_microsoft-windows-gdi_31bf3856ad364e35_6.1.7601.23188_none_083ad5588a78f1c9
25/04/2016  03:38    <DIR>          amd64_microsoft-windows-gdi_31bf3856ad364e35_6.1.7601.23346_none_086418408a5a49a5
05/08/2016  17:47    <DIR>          amd64_microsoft-windows-gdi_31bf3856ad364e35_6.1.7601.23453_none_0856495c8a6516b8
17/11/2016  12:35    <DIR>          amd64_microsoft-windows-gdi_31bf3856ad364e35_6.1.7601.23587_none_0839dca68a79cd0e
19/04/2017  21:40    <DIR>          amd64_microsoft-windows-gdi_31bf3856ad364e35_6.1.7601.23717_none_08858fe68a4103c5
26/06/2017  18:05    <DIR>          amd64_microsoft-windows-gdi_31bf3856ad364e35_6.1.7601.23807_none_089061b88a38e4fb
21/11/2010  04:24    <DIR>          wow64_microsoft-windows-gdi_31bf3856ad364e35_6.1.7601.17514_none_124dc839a586a988
24/04/2016  20:26    <DIR>          wow64_microsoft-windows-gdi_31bf3856ad364e35_6.1.7601.18946_none_122f49d9a59d3e46
25/04/2016  03:04    <DIR>          wow64_microsoft-windows-gdi_31bf3856ad364e35_6.1.7601.18985_none_120309dfa5be94b3
25/04/2016  03:38    <DIR>          wow64_microsoft-windows-gdi_31bf3856ad364e35_6.1.7601.19146_none_122f23e1a59d6eaf
24/04/2016  20:26    <DIR>          wow64_microsoft-windows-gdi_31bf3856ad364e35_6.1.7601.23149_none_12bbbfa4beb85d57
25/04/2016  03:04    <DIR>          wow64_microsoft-windows-gdi_31bf3856ad364e35_6.1.7601.23188_none_128f7faabed9b3c4
25/04/2016  03:38    <DIR>          wow64_microsoft-windows-gdi_31bf3856ad364e35_6.1.7601.23346_none_12b8c292bebb0ba0
05/08/2016  17:47    <DIR>          wow64_microsoft-windows-gdi_31bf3856ad364e35_6.1.7601.23453_none_12aaf3aebec5d8b3
17/11/2016  12:35    <DIR>          wow64_microsoft-windows-gdi_31bf3856ad364e35_6.1.7601.23587_none_128e86f8beda8f09
19/04/2017  21:40    <DIR>          wow64_microsoft-windows-gdi_31bf3856ad364e35_6.1.7601.23717_none_12da3a38bea1c5c0
26/06/2017  18:05    <DIR>          wow64_microsoft-windows-gdi_31bf3856ad364e35_6.1.7601.23807_none_12e50c0abe99a6f6

 

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

I'm aware of Microsofts sins, Cliff. That does not excuse Cygwin to commit the same sins.

 

All the way back when COM (Component Object Model) was introduced by Microsoft there was provisions for having such DLLs being backwards compatible. At the time, one of the arguments for COM was to get out of  DLL Hell. Somewhere, quite early,  down the line from COM the whole idea was sidestepped, backwards compatibility lost and DLL Hell re-introduced - now on the COM level.

 

I can't recall the exact wording, but even in the early days of COM one rule was (my formulation) : "Never break a published interface".

 

Since COM there has been a technique available to avoid DLL hell. Before that people whined, but when COM was actually introduced "nobody" cared.

 


 

Back to the actual subject matter: Digging more into AVaRICE stuff, the WinAVR-20100110 installer brings a Cygwin1.dll, so I suppose it's the one that is needed for the avarice.exe that comes with the same installer.

 

And looking at

> avarice /?

it seems to support the Dragon, which is what I have on the bench.

 

If this works, then it'll do for the time being. Somewhere down the line a recent AVaRICE will be needed, but that can wait ass long as I can experiment with the Dragon and a mega2560.

 

I'll give this a try. Tomorrow..

"He used to carry his guitar in a gunny sack, or sit beneath the tree by the railroad track. Oh the engineers would see him sitting in the shade, Strumming with the rhythm that the drivers made. People passing by, they would stop and say, "Oh, my, what that little country boy could play!" [Chuck Berry]

 

"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: Tue. Jul 18, 2017 - 12:32 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I was going to say that I can't help thinking there must be others using avarice and Atmel-ICE somewhere but when you add "Windows" to that perhaps you do find yourself in a subset of 1 ? :-O

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

clawson wrote:

I was going to say that I can't help thinking there must be others using avarice and Atmel-ICE somewhere but when you add "Windows" to that perhaps you do find yourself in a subset of 1 ? :-O

Yes. Most likely. Studio serves the AVR-development-on-Windows community very well. I have never argued with that. And as long as I'm on Windows that will be my AVR environment also.

 

The whole thing with getting AVaRICE running on Windows is about the "small steps" principle, and that I have no running GNU/Linux system ATM, and that on GNU/Linux I will have to build AVaRICE myself (if I understand things correctly). Anything but small steps will likely make me fail or just get overwhelmed and abandon the idea.

 

The ultimate goal is to have a coding/programming/debugging solution that runs on any platform, where any = {GNU/Linux, MacOS, Windows}. I still suspect that the number of people using such a setup on Windows will be a single-digit number. Someone might be very affectionate of a specific IDE, e.g. Eclipse. But it's kind of a honorary quest to make it truly cross-platform, just for the sake ofg it. Practically, the important thing for me is to have it running in GNU/Linux. And since MacOS is based on BSD then it should be possible to run the same setup there.

"He used to carry his guitar in a gunny sack, or sit beneath the tree by the railroad track. Oh the engineers would see him sitting in the shade, Strumming with the rhythm that the drivers made. People passing by, they would stop and say, "Oh, my, what that little country boy could play!" [Chuck Berry]

 

"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:
and that on GNU/Linux I will have to build AVaRICE myself (if I understand things correctly).
true that but the difference is that this is just "natural" on Linux so it's probably very little more than config/make , no messing about with "build systems" and stuff because Linux has all that natively.

 

In fact one approach for building the Windows exe is actually to build it (as a cross compile) on Linux ;-)

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

clawson wrote:
In fact one approach for building the Windows exe is actually to build it (as a cross compile) on Linux ;-)

Tell me more - I'm all ears! (Especially if MinGW/MSYS qualifies as "a cross-compiler on Linux, targeting Windows".)

"He used to carry his guitar in a gunny sack, or sit beneath the tree by the railroad track. Oh the engineers would see him sitting in the shade, Strumming with the rhythm that the drivers made. People passing by, they would stop and say, "Oh, my, what that little country boy could play!" [Chuck Berry]

 

"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

As you'll see it comes back to mingw again:

 

https://stackoverflow.com/questi...

 

but you may find things more "manageable" coming at it from a Linux direction.

 

PS some of the other links for "build windows exe  on Linux":

 

http://www.blogcompiler.com/2010...

https://arrayfire.com/cross-comp... (gotta love the GIF anim alone!)

Last Edited: Tue. Jul 18, 2017 - 02:07 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

OK, I can build a Windows executable using the MinGW stuff. (I've already done that more times than I can count. Simple/trivial code only. E.g. every tested C++ example I've posted the last few weeks has been done using that setup on my main Windoes system).

 

So, I guess I'm asking - is Cygwin contributing anything special that MinGW does not? (Yes, a very open question, and not specifically @clawson).

 

I'm on my way to Google "build avarice on gnu/linux" now.. (E.g. I'm somewhat oriented about 'configure', Autotools stuff etc - but have not (yet!) used it to the point that I'm confident with it.)

"He used to carry his guitar in a gunny sack, or sit beneath the tree by the railroad track. Oh the engineers would see him sitting in the shade, Strumming with the rhythm that the drivers made. People passing by, they would stop and say, "Oh, my, what that little country boy could play!" [Chuck Berry]

 

"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

So there is a gotcha.  OpenOCD doesn't do debug wire and AVaRICE is only distributed in source form and needs Cygwin to run on Windoze.  Have I got that right?

 

I built AVaRICE from SVN using a custom ebuild on Gentoo.  The ebuild took me a while to get working as I'm not that familiar with making my own.  Especially not with SVN sources.

 

According to this wiki https://wiki.gentoo.org/wiki/Mingw I can build a Windoze binary on Gentoo.  I've had a look through it but I'm sceptical that this is going to work for me.  I've failed to get crossdev working for ARM and AVR targets so far.  I've just been using binaries tools provided by Arduino for AVR and https://launchpad.net/gcc-arm-embedded for ARM.

 

If you don't get anywhere with this I might have a go at crossdev.  Like you, I too want a cross platform IDE with all the trimmings.

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

Sad status report:

 

I was about to run another stint on this. My plan was to try the AVaRICE from WinAVR-20100110 out and see how far I could get. Not far at all, it turned out..

 

I connected my Dragon and made sure it was seen from Atmel Studio. Affirmative. So I close Studio to avoid fighting over the Dragon.

 

Now, I look in the AVaRICE documentation, and I see that I must specify where my Dragon is. In all documentation and tutorials I've seen it should be on a (virtual) com port, so I go into device manager and.. Nothing!

 

I'm pretty sure the Dragon was updated with firmware from Studio when I attached it a few days ago, and I'm on the latest version of Studio (i.e. 7.0.1417). [*]

 

So, just to double-check I attach my SAM D20 Xplained board, and DOES immediately shows up as a COM port in Windows Device Manager.Next check is to attach my Atmel-ICE. It does NOT show up as a COM port. 

 

Looking harder the Dragon does show up, but not as a COM port. Neither does the Atmel ICE. Only the Xplained EDBG does that. And no, the Dragon and the Atmel-ICE does not show up in the same way. Obviously, the different Atmel debuggers do not share at all how they connect to the host system - it's a mess, but I guess it saves jobs somewhere... :rolling eyes:

 

So.. This is what I think the situation is: Older firmware of the Dragon, and drivers on the host, made the Dragon appear as a COM port on the host. This went well together with old AVaRICEs. Current Dragon firmware and host drivers does things differently. There exists no download of AVaRICE for Windows that matches this.

 

I am not prepared to take on building AVaRICE for Windows myself. Not right now, at least.

 

It seems I have come to the end of the road once again, and am starting to mentally prepare to give up. I lack the abilities, knowledge and stamina to penetrate this (and I'm usually quite stubborn..) Dropping this for today, at least.

 

PS. I am kicking myself hard for not thinking before letting Studio upgrade the firmware on the Dragon. Sooo stupid!

"He used to carry his guitar in a gunny sack, or sit beneath the tree by the railroad track. Oh the engineers would see him sitting in the shade, Strumming with the rhythm that the drivers made. People passing by, they would stop and say, "Oh, my, what that little country boy could play!" [Chuck Berry]

 

"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: Wed. Jul 19, 2017 - 07:29 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

No, dragon has NEVER been on COM port. The com port on the EDBG is just a CDC bridge to a usart on the target device. It's not used for debugging.

You need to check what usb driver avarice expects. I would assume libusb0. Studio in the latest version binds the dragon to WinUSB.

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

Should also mention that such an old avarice won't support anything in the JTAGICE3, Atmel-ICE and equivalent debuggers...

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

I'm aware that this post is not very structured and "stringent". Sorry for that, but its a good reflection of my state of mind right now. Ignore at will.

 


 

meolsen wrote:
Should also mention that such an old avarice won't support anything in the JTAGICE3, Atmel-ICE and equivalent debuggers...

Well, from what I read in (old!) documentation for AVaRICE it uses Cygwin and from the WinAVR-20100110 user manual:

If you use avarice, when you specify a serial port to use with the —jtag flag, you must specify it in the form of:

--jtag /dev/comX

where X is the COM port number you are using. This is due to the fact that avarice is linked to the Cygwin DLL, which requires a Unix-type format for the COM port number.

I'm not sure if that says I must specify a serial port, or if I can specify a serial port.

 

The AVaRICE home page says

 The AVR Dragon is a low-cost offering from Atmel, and is also supported.

but that might be written in context of running on a GNU/Linux system where I assume the Dragon somehow appears under /dev .

 

I still end up with not knowing how to point AVaRICE to the Dragon on a Windows system. It does not, from what I see, "announce itself" in any identifiable and usable  way, e.g. under Device Manager.

 

meolsen wrote:
Studio in the latest version binds the dragon to WinUSB.

I don't know what to make of that. i) I have close to zero knowledge about WinUSB. ii) I'm trying to keep Studio out of the picture. Are you saying that Dragon can only be used by something that "binds the Dragon to WinUSB" - and hence, if AVaRICE does not do that it wont work?

 


 

Looking forward at what possible ways there is forward:

 

  • Trying to use AVaRICE with the Atmel-ICE. Requires a current AVaRICE (see below), and IIRC support for Atmel-ICE is still "dubious".

 

  • Build a current AVaRICE. I am trying to avoid this since it will definitively add several full days of work, study and learning. For something that, it seems to me, have a low probability to actually work in the end I'm hesitant.

 

Or.. Just scrap the whole idea of trying to understand this with Windows as host, and go for the GNU/Linux setup. But this still involves

  • Building AVaRICE.
  • The possibility that I've upgraded my Dragon to be something that the current AVaRICE does not support.
  • All other setups: Toolchain, GDB, some IDE at least..

This might be the way, but then it'll have to wait. I have no machine to run GNU/Linux on ATM.

 

The goal was always to end up on GNU/Linux, but I hoped I could learn and verify all this stuff on Windows. Turns out I was probably wrong. I'll sleep on this and decide later if/how to proceed.

 

"He used to carry his guitar in a gunny sack, or sit beneath the tree by the railroad track. Oh the engineers would see him sitting in the shade, Strumming with the rhythm that the drivers made. People passing by, they would stop and say, "Oh, my, what that little country boy could play!" [Chuck Berry]

 

"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,

 

avrdude is "more up to date" than avarice when it comes to talking to devices like Dragon so you may want to look at how it "sees" the Dragon but I believe the way it handles USB for most devices is that it treats them like UART/COM ports but some special setting (it might be a weird baud value?) says "actually handle this as USB not serial". It then goes searching for know VID/PIDs to locate the device. As quite a lot of the stuff is common (or was) between avrdude and avarice you may find something similar going on there.

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

Cliff, and others!

 

Last thing I did last night was to

  1. Decide to try to switch to GNU/Linux - but since I have no free machine for that ATM I set up a Ubuntu VM in VirtualBox, and
  2. Decide to start out just trying to get AVRDUDE running since my suspicion was exactly what you state above, and
  3. Realizing that then I could just as well go for using my Atmel-ICE (which comes up as a COM port on Windows so I'm hoping it'll make for less trouble connecting to it)

 

So..

 

  • I got Ubuntu up.
  • I installed AVRDUDE by apt-get install'ing [1]. Turns out I didn't get the latest (i.e. 7.3) but 7.2 - with no support for Atmel-ICE. Not a big surprise since we know "the repos" are often somewhat behind.
  • Downloaded the latest .tar.gz source bundle of AVRDUDE and followed the instructions for building:

 

gunzip -c avrdude-6.3.tar.gz | tar xf -
cd avrdude-6.3
./configure
make
su root -c 'make install'
From configure I got this summary
Configuration summary:
----------------------
DON'T HAVE libelf
DON'T HAVE libusb
DON'T HAVE libusb_1_0
DON'T HAVE libftdi1
DON'T HAVE libftdi
DON'T HAVE libhid
DO HAVE    pthread
DISABLED   doc
ENABLED    parport
DISABLED   linuxgpio

so I clearly have some preparatory installing to do.. Nevertheless I couldn't resist seeing what an actual build would end in, so...

johan@UbuntuAvrDebugging:~/Downloads/avrdude-6.3$ make
/bin/bash ./ylwrap config_gram.y y.tab.c config_gram.c y.tab.h `echo config_gram.c | sed -e s/cc$/hh/ -e s/cpp$/hpp/ -e s/cxx$/hxx/ -e s/c++$/h++/ -e s/c$/h/` y.output config_gram.output -- yacc -d 
./ylwrap: line 111: yacc: command not found
Makefile:1927: recipe for target 'config_gram.c' failed
make: *** [config_gram.c] Error 1

Apart from the stuff that configure told about, I obviously need yacc.

 


 

Re the VM it seems to be able to access USB ddevices attached to the host. I see the Atmel-ICE in the VirtualBox list of devices and can select it. When I do it disappears from Windows Device Manager, so VirtualBox seems to "steal" it correctly.

 

And when testing that I realized that Atmel-ICE does not appear as a COM port (it's the EDBG that does so). Just a proof of my confusion and how immensely complex this stuff is for me ATM. (I usually don't consider myself stupid, but this thing seems to be able to convince me of it..)

 


 

I stopped there since it was clear that I had several hours before getting close and it was getting "a wee bit nippy of late" [2].

 


Footnote:

 

[1] Like this:

sudo apt-get update
sudo apt-get install avrdude

but that gives me 7.2 with no Atmel-ICE support.

 


 

[2] One extra point for anyone who can point correctly to the live recording where this wording is part of the announcement for the last number of the evening. Group and record title, please.

 

"He used to carry his guitar in a gunny sack, or sit beneath the tree by the railroad track. Oh the engineers would see him sitting in the shade, Strumming with the rhythm that the drivers made. People passing by, they would stop and say, "Oh, my, what that little country boy could play!" [Chuck Berry]

 

"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: Thu. Jul 20, 2017 - 10:41 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Just be warned (and Morten will confirm where the line is) but early Atmel programmers/debuggers were USB 1.1 and I think that was up to Dragon, beyond that the devices are USB 2.0, I think that is from JTAGICE3 onwards. I have had success in the past talking to USB 1.1 devices from a VirtualBox but even after installing the "USB 2.0 extension pack" I have had less success with USB 2.0 devices.

 

So you may be better off trying to get it to all talk to the Dragon not an Atmel-ICE first if that's coming out of a VirtualBox.

 

While I haven't switched back yet there is a suggestion that VMWare may be better at this these days than VirtualBox.

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

Perhaps..

 

My last thought on this was to, again, first try with the D20 Xplained board since the EDBG on that shows up as a COM port.

 

I am at a loss trying to sort out the USB stuff - I just don't have enough knowledge about that.

 

E.g. this thing with the Dragon "being bound to WinUSB when on Windows". What does that imply when trying it on GNU/Linux?

 

Similar re

clawson wrote:
I believe the way [AVRDUDE] handles USB for most devices is that it treats them like UART/COM ports but some special setting (it might be a weird baud value?) says "actually handle this as USB not serial"

I can't make heads or tails of that. I've been trying to find some info about this but I'm surely missing something. Possibly obvious.

 

The current online documentation for AVRDUDE does not even mention Atmel-ICE. It only mentions the  Dragon in the list of possible values to pass with the -c option (dragon_dw, dragon_isp, dragon_jtag...).

 

The only thing I've found re USB is

For the JTAG ICE mkII, if AVRDUDE has been built with libusb support, port may alternatively be specified as usb[:serialno]. In that case, the JTAG ICE mkII will be looked up on USB. If serialno is also specified, it will be matched against the serial number read from any JTAG ICE mkII found on USB.

But that is for JTAGICE mkII, something that I don't have in my collection of programmers and debuggers. And, it seems this implies a mkII uses yet another way of connecting so I don't dare try to "superimpose" the above quote onto any other programmer/debugger.

 

I might have a (clone) USBasp lying around somewhere that I might try also, but all this about programmers is just a step away from what is the real target here: On Chip Debugging.

 


 

The more I dig the more complexities, variants, bad or missing documentation and just plain strangenesses I encounter. Instead of the picture slowly clearing up it just gets more convoluted, confusing and impenetrable. It's "fractal"...

 

While it of-course is Atmel/Microchips right to take any descision, and while we should be very grateful that we can get the Studio for free on Windows, I loathe the non-cross-platform decision they made for AS5 more than ever. One thing is sure - if I have to ditch AVRs when eventually ditching Windows (when my W7 is at EOL) I'll do it. I've seen enough report about how W10 behaves on non-corporate installs to be absolutely sure about that.

 

I need a break.. See you later.

"He used to carry his guitar in a gunny sack, or sit beneath the tree by the railroad track. Oh the engineers would see him sitting in the shade, Strumming with the rhythm that the drivers made. People passing by, they would stop and say, "Oh, my, what that little country boy could play!" [Chuck Berry]

 

"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: Thu. Jul 20, 2017 - 11:55 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

JohanEkdahl wrote:
What does that imply when trying it on GNU/Linux?
"libusb" presumably?
JohanEkdahl wrote:
I can't make heads or tails of that. I've been trying to find some info about this but I'm surely missing something. Possibly obvious.
When you read the code it looks like it was originally designed for only UART and it ultimately has a get_byte/put_byte thing going on then the USB stuff appears to be "hacked in" afterwards so it shares a lot of structure with serial and some of the USB support even appears in the serial files. But somthing in the "device" details says "this isn't really a UART, it's a USB", and at the last minute it heads off in a USB direction.It makes the code very difficult to follow!

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

Stop thinking about the com port Johan!! It's not for programming/debugging!

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

I did not follow this thread closely and have not much experience in debugging under linux, but I just happened to type this search term:

+gdb +linux +frontend into duckduck:

 

https://duckduckgo.com/html?q=%2...

 

and the results look intriguing. Especially the link to using GDB with QtCreator, which is my favourite IDE for developing AVR stuff on my Linux Box.

https://chromium.googlesource.co...

Paul van der Hoeven.
Bunch of old projects with AVR's:
http://www.hoevendesign.com

Last Edited: Thu. Jul 20, 2017 - 04:25 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

meolsen wrote:
Stop thinking about the com port Johan!! It's not for programming/debugging!

Not aimed at you, Morten - and I certainly do not expect you to straighten out my misunderstanding of AVRDUDE/AVaRICE. (You're one of my heroes for all of the other stuff you've hinted at, though! (-: )

But I sort of see some light with that.. Thank you!

 

 

OTOH: I'm sure I've seen a AVRDUDE or AVaRICE command line somewhere with something looking suspiciously like a BPS value, "115200" IIRC. (I'll try to locate it again.) It might be a trick, like Cliff hintedd at above..

 

I'll spend some time trying to build AVRDUDE on Linux tonight...

"He used to carry his guitar in a gunny sack, or sit beneath the tree by the railroad track. Oh the engineers would see him sitting in the shade, Strumming with the rhythm that the drivers made. People passing by, they would stop and say, "Oh, my, what that little country boy could play!" [Chuck Berry]

 

"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: Thu. Jul 20, 2017 - 04:50 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This evenings progress:

 

think I've managed to build AVRDUDE on GNU/Linux. The optimistic description is:

 

$ gunzip -c avrdude-6.0.tar.gz | tar xf -
$ cd avrdude-6.0
$ ./configure
$ make
$ su root -c 'make install'

In practice, on a newly set up Ubuntu, there will be a bunch of problems. A lot of libraries not installed. I managed to resolve everything but 'libhid'. Also YACC/Lex or equivalents were needed (resolved with Bison+Flex). I have a 150 line text file with notes on how I did it.´If needed and I find the time I could clean it up and post it.

 

It builds without errors despite ./configure marking 'libhid' as a DON'T HAVE. I'm hoping for that to be benign..

 

Not that it has gotten me much closer, but it was really nice to ave success with something. (If nothing else, the notes holds 30 lines of explanation of what the configure script is and does and a very brief overview of "Autotools ".)

 

 

N.B.: I actually have not tested it yet..

 


 

With that success, I of-course had to have a go at building AVaRICE too. Looks like an older version of Autotools was used for that. The configure script does not leave the same nice summary at the end.

 

But ./configure ended with only one warning, so I actually tried to 'make'. There my luck ended, something wrong with a pragma..

 


 

That's enough for now.. (This took 4 hours.)

"He used to carry his guitar in a gunny sack, or sit beneath the tree by the railroad track. Oh the engineers would see him sitting in the shade, Strumming with the rhythm that the drivers made. People passing by, they would stop and say, "Oh, my, what that little country boy could play!" [Chuck Berry]

 

"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

Modern AVR debuggers use HID I believe (Morten?) so I have a feeling a missing libhid could be an issue.

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

Thanks Cliff!

 

The problem here is to know the name of the package to 'apt-get install'.

 

The configure script just says

DON*T HAVE libhid

but this;

sudo apt-get install libhid

fails with "E: Unable to locate package libhid". For some other packages I managed to figure out that appending "-dev" to the package name solved it. Not so for libhid. I also find things like this: https://www.howtoinstall.co/en/u... , but that is not the package the configure script craves..

 

I'm not a master re apt-get. Is there any way to do wildcard searches or some such for what packages exists? Not that this is the correct syntax but Im thinking something like "apt-get search libhid*"..

"He used to carry his guitar in a gunny sack, or sit beneath the tree by the railroad track. Oh the engineers would see him sitting in the shade, Strumming with the rhythm that the drivers made. People passing by, they would stop and say, "Oh, my, what that little country boy could play!" [Chuck Berry]

 

"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

avrdude uses libusb to talk hid

 

 "apt-get search libhid*"..

meolsen@:~$ apt-cache search libhid
libhidapi-dev - Multi-Platform library for communication with HID devices (development files)
libhidapi-hidraw0 - Multi-Platform library for communication with HID devices (hidraw backend)
libhidapi-hidraw0-dbg - Debugging symbols for libhidapi-hidraw0
libhidapi-libusb0 - Multi-Platform library for communication with HID devices (libusb backend)
libhidapi-libusb0-dbg - Debugging symbols for libhidapi-libusb0

 

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

JohanEkdahl wrote:
I'm not a master re apt-get. Is there any way to do wildcard searches or some such for what packages exists? Not that this is the correct syntax but Im thinking something like "apt-get search libhid*"..
Don't know about apt-get, but you can do it online: https://packages.ubuntu.com/search?keywords=libhid

Stefan Ernst

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

@Morten:

 

THANK YOU! (-:

 

I get

johan@UbuntuAvrDebugging:~/Downloads/avrdude-6.3$ apt-cache search libhid
libhidapi-dev - Multi-Platform library for communication with HID devices (development files)
libhidapi-hidraw0 - Multi-Platform library for communication with HID devices (hidraw backend)
libhidapi-hidraw0-dbg - Debugging symbols for libhidapi-hidraw0
libhidapi-libusb0 - Multi-Platform library for communication with HID devices (libusb backend)
libhidapi-libusb0-dbg - Debugging symbols for libhidapi-libusb0
libhidrd0 - runtime library for parsing and generating USB HID reports
libhidrd0-dbg - detached debugging symbols for libhidrd0
libhidrd0-dev - development files for parsing and generating USB HID reports
python-hidapi - Python bindings for the HID API
python3-hidapi - Python bindings for the HID API

I know the first hit doe NOT solve the "DON'T HAVE libhid" from ./configure. I'm not keen to just try the others one after the other in sequence...

 

How do people know which one of those "maps" to the short name "libhid"? I'm sure they're not just guessing!

 


 

EITHER the configure script actually looks for a more specific name than the "linhid" it outputs in the message,

OR the packages names are not the same as the final library they install.

 

Is there any way to "easily" drill into the configure script or the package to see what it actually looks for / installs?

"He used to carry his guitar in a gunny sack, or sit beneath the tree by the railroad track. Oh the engineers would see him sitting in the shade, Strumming with the rhythm that the drivers made. People passing by, they would stop and say, "Oh, my, what that little country boy could play!" [Chuck Berry]

 

"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:
I'm not keen to just try the others one after the other in sequence...

But that is what I did, more or less.

 

I didn't install the *-dbg packages. And not the python packages. I'm not as cool as Morten. I could argue that I'm instead hot because of Groovy, but that's another story..

 

Anyway, I installed all non debug-symbol packages apart from the Python ones, but it does not solve the problem.

 

I found this, though: http://libhid.alioth.debian.org/ . Seems to me that it's been 10 years since libhid was "replaced" by "hidapi"... A bit down on that page there is a link to d/l the libhid source tarball, but you must register and get an email and... Sigh!

 

So now it's really enough for tonight - four hours just became close to six..

"He used to carry his guitar in a gunny sack, or sit beneath the tree by the railroad track. Oh the engineers would see him sitting in the shade, Strumming with the rhythm that the drivers made. People passing by, they would stop and say, "Oh, my, what that little country boy could play!" [Chuck Berry]

 

"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: Thu. Jul 20, 2017 - 09:10 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

but, you wont need libhid as long as you have libusb

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

but, you wont need libhid as long as you have libusb

Thank you, Morten! That is reassuring. Since that is the only DON'T HAVE that I have ;-) , there seems to be a possibility that what I've built will work once I test it..

 

Just out of curiosity, and to learn something from a real guru (grovel, grovel...): How do you know this (don't need libhid if have libusb)? How would I know?

"He used to carry his guitar in a gunny sack, or sit beneath the tree by the railroad track. Oh the engineers would see him sitting in the shade, Strumming with the rhythm that the drivers made. People passing by, they would stop and say, "Oh, my, what that little country boy could play!" [Chuck Berry]

 

"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

Btw do yourself a favour and "apt-get install synaptic" then searching for packages you want is 1,000 times easier.

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

Ah yes.. I knew I had a GUI packet installer in a (by now scrapped) machine way back some time. That's the one. Thanks Cliff!

 

(Still, if I will incorporate such stuff in a possible write-up I might there go for the very basic thing that every Debian-derivate has. And that the apt command line..)

"He used to carry his guitar in a gunny sack, or sit beneath the tree by the railroad track. Oh the engineers would see him sitting in the shade, Strumming with the rhythm that the drivers made. People passing by, they would stop and say, "Oh, my, what that little country boy could play!" [Chuck Berry]

 

"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
$ apt-cache-search libusb
libftdi1 - Library to control and program the FTDI USB controller
libusb-1.0-0 - userspace USB programming library
libusb-1.0-0-dev - userspace USB programming library development files
libusbmuxd-dev - USB multiplexor daemon for iPhone and iPod Touch devices - devel
libusbmuxd1 - USB multiplexor daemon for iPhone and iPod Touch devices - library
libusbmuxd1-dbg - USB multiplexor daemon for iPhone and iPod Touch devices - debug
ekeyd-uds - Simtec Electronics UDEKEY01 Entropy Key Daemon (UDS variant)
libdjconsole-data - Hercules DJ Console access library - data files
libdjconsole-dev - Hercules DJ Console access library - development headers
libdjconsole0 - Hercules DJ Console access library
libftdipp1 - Library to control and program the FTDI USB controller
libhid-dev - userspace USB HID development files
libhid0 - userspace USB HID access library
libusb-ruby - libusb binding for the Ruby language
libusb-ruby1.8 - libusb binding for Ruby
libusb-ruby1.9.1 - libusb binding for Ruby
libusbip-dev - USB device sharing system over IP network (development files)
libusbip0 - USB device sharing system over IP network (shared library)
libusbprog-dev - Development files for libusbprog
libusbprog0 - Library for programming the USBprog hardware
python-ftdi - Python module to control and program the FTDI USB controller
python-hid - Python wrapper for USB HID access library
spectools - Utilities for using the Wi-Spy USB spectrum analyzer hardware
libhpmud-dev - HP Multi-Point Transport Driver (hpmud) development libraries
libhpmud0 - HP Multi-Point Transport Driver (hpmud) run-time libraries
libusb++-0.1-4c2 - userspace C++ USB programming library
libusb++-dev - userspace C++ USB programming library development files
libusb-0.1-4 - userspace USB programming library
libusb-dev - userspace USB programming library development files

 

"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."

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

"Fast.  Cheap.  Good.  Pick two."

"Read a lot.  Write a lot."

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

 

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

JohanEkdahl wrote:

With that success, I of-course had to have a go at building AVaRICE too. Looks like an older version of Autotools was used for that. The configure script does not leave the same nice summary at the end.

 

But ./configure ended with only one warning, so I actually tried to 'make'. There my luck ended, something wrong with a pragma..

 

 

You might need a couple of patches.

Description: Fix FTBFS for GCC 5
Author: Tobias Frost <tobi@debian.org>
Bug: <URL to the upstream bug report if any, implies patch has been forwarded, optional>
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=777789
Forwarded: <URL|no|not-needed, useless if you have a Bug field, optional>
Last-Update: 2015-05-18
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/src/pragma.h
+++ b/src/pragma.h
@@ -28,9 +28,10 @@
  */
 #if defined(__GNUC__)
 #  if __GNUC__ > 4
-#      define PRAGMA_DIAG_PUSH       _Pragma(GCC diagnostic push)
-#      define PRAGMA_DIAG_POP        _Pragma(GCC diagnostic pop)
-#      define PRAGMA_DIAG_IGNORED(x) _Pragma(GCC diagnostic ignored x)
+#      define PRAGMA_DIAG_PUSH       _Pragma("GCC diagnostic push")
+#      define PRAGMA_DIAG_POP        _Pragma("GCC diagnostic pop")
+#      define PRAGMA_(x)             _Pragma(#x)
+#      define PRAGMA_DIAG_IGNORED(x) PRAGMA_(GCC diagnostic ignored x)
 #  elif __GNUC__ == 4
 #    if __GNUC_MINOR__ >= 6
 #      define PRAGMA_DIAG_PUSH       _Pragma("GCC diagnostic push")
From a6f4e5e771a9fa766e2b15b99a945203d0ec05e6 Mon Sep 17 00:00:00 2001
From: Martin Hofmann <martin.hofmann@studium.uni-erlangen.de>
Date: Fri, 14 Mar 2014 15:41:26 +0100
Subject: [PATCH] Fix build error if ENABLE_TARGET_PROGRAMMING is on                                                                                                                                               

New versions of bfd.h break build on Linux and Mac OS systems. Including
bfd.h requires constants to be defined, that are provided by autoconf.
Including autoconf.h into the files fixes the error.
---
 jtag2prog.cc | 1 +
 jtagprog.cc  | 1 +
 2 files changed, 2 insertions(+)                                                                                                                                                                                 

diff --git a/src/jtag2prog.cc b/src/jtag2prog.cc
index 1c75a80..a374818 100644
--- a/src/jtag2prog.cc
+++ b/src/jtag2prog.cc
@@ -38,6 +38,7 @@
 #include <math.h>                                                                                                                                                                                                

 #if ENABLE_TARGET_PROGRAMMING
+#  include "autoconf.h"
 #  include <bfd.h>
 #endif

diff --git a/src/jtagprog.cc b/src/jtagprog.cc
index bc573ef..7f701fb 100644
--- a/src/jtagprog.cc
+++ b/src/jtagprog.cc
@@ -37,6 +37,7 @@
 #include <math.h>

 #if ENABLE_TARGET_PROGRAMMING
+#  include "autoconf.h"
 #  include <bfd.h>
 #endif

--
1.9.0

Why not use the Dragon instead of the Atmel-ICE?  This is how I am flashing the AVR.

../arduino-1.8.3/hardware/tools/avr/bin/avrdude -C../arduino-1.8.3/hardware/tools/avr/etc/avrdude.conf -v -patmega328p -cdragon_isp -Pusb -Uflash:w:$(TMPDIR)/$(PROJNAME).hex:i

And this is how I start a GDB server using the Dragon.

avarice -2 -g -w -j usb -P atmega328p :3333

I'm using avrdude version 6.3 from Arduino-1.8.3.

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

Here is a binary package of my AVaRICE version 2.13svn20160229, Jul 12 2017 21:22:29

Attachment(s): 

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

The Atmel-ICE seems to work fine for programming.

avrdude -v -C$(AVRDCONF) -patmega328p -catmelice_isp -Pusb -Uflash:w:$(TMPDIR)/$(PROJNAME).hex:i

And debugging.

avarice -2 -g -w -4 -P atmega328p :3333

So, I didn't need to get the Dragon after all.  It's nice to have in my collection so I'm not complaining.

Last Edited: Fri. Jul 21, 2017 - 06:33 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

JohanEkdahl wrote:

OTOH: I'm sure I've seen a AVRDUDE or AVaRICE command line somewhere with something looking suspiciously like a BPS value, "115200" IIRC.

 

You need to specify the baud rate when upload via the Arduino boot loader.  Maybe this was what you are remembering.

avrdude -v -C$(AVRDCONF) -patmega328p -carduino -P/dev/$(PORT) -b57600 -D -Uflash:w:$(TMPDIR)/$(PROJNAME).hex:i

 

Last Edited: Fri. Jul 21, 2017 - 06:34 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well, whaddyaknow.. With my own build of AVRDUDE:

johan@UbuntuAvrDebugging:~/Downloads/avrdude-6.3$ avrdude -patmega2560 -catmelice
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.08s

avrdude: Device signature = 0x1e9801 (probably m2560)

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

avrdude done.  Thank you.

Yeah, I'm not pointing to any configuration file, I know...

 

BUT: It reads the device signature, i.e. the whole chain/stack works! The point? This: I now have proof that I can access a USB device (well, at least my AtmelICE) from a Ubuntu VM running under VirtualBox hosted on Windows. This removes one big uncertainty from my endeavours.

 

It's onto AVaRICE then! I'll sort my build problems out eventually (e.g. need to read up on how to apply patches on GNU/Linux if TT_ZX is right about patching needed). For now I'll try with the binary that TT_ZX supplied above.

 

Yes, I'm trying to follow my own advice: Small steps, small steps. Divide and conquer.

 

If that isn't clear: I am very grateful for all help and advice I've gotten! I'll probably need more eventually..

 

[BTW my Ubuntu is sluggish as hell. I'll probably need to set up a better VM (more RAM? bigger disk?). It'll probably be "Mint".]

"He used to carry his guitar in a gunny sack, or sit beneath the tree by the railroad track. Oh the engineers would see him sitting in the shade, Strumming with the rhythm that the drivers made. People passing by, they would stop and say, "Oh, my, what that little country boy could play!" [Chuck Berry]

 

"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

I think I might have misled you with the patches above.  I remember having problems when trying to build AVaRICE and applying the GCC 5 to fix the same error you had.  It would then build but I was left with what appeared to be an old version that didn't support the Atmel-ICE.  It turned out to be an issue with Autotools which might be Gentoo specific.  Just make sure run ./Bootstrap before ./configure.

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

JohanEkdahl wrote:

[BTW my Ubuntu is sluggish as hell. I'll probably need to set up a better VM (more RAM? bigger disk?). It'll probably be "Mint".]

 

Better yet, install Mint on the bare metal and demote Windoze to KVM. wink

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

Thanks, but have no "bare metal" ATM. I am not intending to scrap my W7 system, and have no other machine available.

 

Worse, temporarily, is that my Ubuntu VM broke down in pieces! Lost it's disk. On the surface it looks more like a VirtualBox malfunction than a Ubuntu crash. I was going to re-do the AVRDUDE build anyway since practice makes perfect, and I need to check that my notes are complete.

 

Still, here we where just a forthnight ago talking about backups, and I have neither snapshot'ted nor backed up my successes above. Shame on me.

 

Re ./bootstrap :  Noted!

"He used to carry his guitar in a gunny sack, or sit beneath the tree by the railroad track. Oh the engineers would see him sitting in the shade, Strumming with the rhythm that the drivers made. People passing by, they would stop and say, "Oh, my, what that little country boy could play!" [Chuck Berry]

 

"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

For those that don't already know (I didn't), you can't use hardware breakpoints with debugWIRE.

http://www.atmel.com/webdoc/GUID-DDB0017E-84E3-4E77-AAE9-7AC4290E5E8B/index.html?GUID-3D3FB217-0BFE-4E45-B77F-1FFE7D58C79E

 

Also AVaRICE cannot upload the elf file over debugWIRE either.  This means you need to set a software breakpoint, exit you debug session, upload the new elf over ISP and then start a new debug session.  I have to detach and the reattach my AtmelICE when using ISP after a debug session otherwise I get:

avrdude: jtag3_edbg_prepare(): failed to read from serial port (-1)
avrdude: failed to sync with the JTAGICE3 in ISP mode

So far debugging with the AVR is quite limited.  It's better than nothing I suppose, which is what I have had up to this point.  I think I will go with ARM on any future projects unless they are very simple.

 

Compiling AVaRICE for Windoze on my Gentoo system was a fail as well.  The cross development setup went well but AVaRICE needs header files from Cygwin to compile.  I tried to install these into my cross development setup but couldn't get it right.  Considering the limitations of debugging over debugWIRE I'm not going to spend any more time on this.  At least I can still develop, build and load my AVR code from Windoze, which is all I ever had anyway.

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

TT_ZX wrote:
For those that don't already know (I didn't), you can't use hardware breakpoints with debugWIRE. http://www.atmel.com/webdoc/GUID...

Well, I for one didn't know.. Thanks for the heads-up!

"He used to carry his guitar in a gunny sack, or sit beneath the tree by the railroad track. Oh the engineers would see him sitting in the shade, Strumming with the rhythm that the drivers made. People passing by, they would stop and say, "Oh, my, what that little country boy could play!" [Chuck Berry]

 

"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

The data sheet for every AVR with  debugWire has that standard warning about wearing out the flash when you use dW and how you shouldn't use a development chip in production. 

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

Status report: Been busy socializing, so this effort has been more or less paused.

 

Some small peripheral progress: I had a Minux Mint VM running under VirtualBox, but it was sloooow (could only run with emulated graphics for some reason, so very sluggish and couldn't use full physical screen).

 

Then I stumbled upon an unused 32 GB USB3 memory stick and decided to put a bootable Mint on it. (Am posting this using Chromium on that Mint stick.)

 

Laptop has USB3 and the Mint on the stick fast and works like a charm. Connected the Atmel-ICE and it shows up as /dev/usb/hiddev0 . Promising!

 

More socializing to come, so this will have to wait for a week or so. I have not given up.

"He used to carry his guitar in a gunny sack, or sit beneath the tree by the railroad track. Oh the engineers would see him sitting in the shade, Strumming with the rhythm that the drivers made. People passing by, they would stop and say, "Oh, my, what that little country boy could play!" [Chuck Berry]

 

"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]

Pages