AVRdude rebuilt with patch

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

Hi all,

 

I'm not an expert with software building. But I'm looking for a tutorial that describes how to make an own built for avrdude.

I have an AVRispmkII from olimex and avrdude is not working on my windows 7 machine in combination with the XMEGA128A4U.

I notices the bug report, but I have no clue how to apply the patch and how to rebuilt avrdude 6.3 with the patch applied. Can somebody help me?

 

thx!

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

Windows or Linux? Latter should be trivial, former will make you weep blood!

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

First: While I have not built AVRDUDE on Windows I recently did so on Linux Mint. OTOH I have done e lot of other development work on Windows.. So what follows is a "vague extrapolation" based on those two experiences:

 

You need a C/C++ tool chain that runs on, and targets, Windows. I assume it should be GCC. You can get that, and the eco-system it can work in, by installing MinGW (Minimal GNU for Windows), probably including (or amended by) MSYS. It's been too long since I did set up a MinGW environment on Windows, so I'll direct you to the MinGW wiki for this. WithMinGW/MSYS in place you can attempt an actual build. 

 

AVRDUDE uses the GNU build system ("Autotools"). I.e. it comes with a configure script that, when run, will probe the system for functionality needed/supported and create a makefile. Thiss makefile can be used to do the build.

 

Looking in my notes from my build on Linux it goes like this:

 

First, in the root of the source tree

 

prompt> ./configure

to create the makefile. Keep a lookout for reports of errors or things missing. You'll have to fix any of those before proceeding. (On my Mint I had a lot of library stuff missing that I had to d/l and install at this stage).

 

After that the actual build is accomplished by this:

 

prompt> make

 

As for how to apply the patch, it depends on what form this patch has. If it is a .patch (or .diff (?)) file then you apply it by using the patch command.

 

Also note this terse stuff in the AVRDUDE docs on building on Windows: http://www.nongnu.org/avrdude/us... . It focuses on using Cygwin, which I (for possibly biased reasons) discourage. Alas, the note on the alternative ("use MinGW/MSYS directly") is not fleshed out in any detail.

 


 

If you tell us more about the problem with current AVRDUDE and the ATXmega128A4U we might be able to toss in some detailed advice. It could be that it is only a matter of patching the config file of AVRDUDE, not the executable as such. If you actually link to the bug-report/patch you are hinting at things might become clearer.

 

 

Happy 75th anniversary to one of the best movies ever made! Rick Blane [Bogart]: "Of all the gin joints, in all the towns, in all the world, she walks into mine."

 

"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 wish to apply this patch in order to get it to work. http://savannah.nongnu.org/bugs/...

I have cygwin installed. Further steps are unknown for me.

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

MathieuMH wrote:
I have cygwin installed.

Is the GCC tool chain in good working order? What happens if you simply type

gcc --version

on a command line?

 

Note the remark in the AVRDUDE doc page I linked to above that says

 recent versions of Cygwin (starting with 1.7) removed the MinGW support from the compiler that is needed in order to build a native Win32 API binary that does not require to install the Cygwin library cygwin1.dll at run-time

This might, or might not, be something that will influence your descision on if to use Cygwin or "use MinGW directly". Main difference, as I understand it is that building with Cygwin requires the Cygwin1.dll present when running the program while building directly with MinGW/MSYS does not.

 

MathieuMH wrote:
Further steps are unknown for me.

The patch you want to apply is actually a .patch file, so the patch command should be used. Any manpage should tell you how to use the patch command, e.g. https://linux.die.net/man/1/patch .

 

As for the build, I would hope that the aforementioned steps should suffice, e.g.

 

./configure

make

 


 

As I hinted at above I am not a fan of Cygwin, but use MinGW/MSYS without groaning too much. I'm sorry I thus can't help you more explicitly with Cygwin. Let us know if you go down the "direct MinGW/MSYS" route. I believe I still have MinGW/MSYS installed on my Windows 7 system and might  be able to follow/help you with the build.

Happy 75th anniversary to one of the best movies ever made! Rick Blane [Bogart]: "Of all the gin joints, in all the towns, in all the world, she walks into mine."

 

"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

MathieuMH wrote:
I have cygwin installed. Further steps are unknown for me.

http://download.savannah.gnu.org/releases/avrdude/avrdude-doc-6.3.pdf

(page 39)

There are two options to build avrdude from source under Windows.

(Cygwin + MinGW, MinGW)

 

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

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

@gchapman: Same text as I linked to in my first post.

Happy 75th anniversary to one of the best movies ever made! Rick Blane [Bogart]: "Of all the gin joints, in all the towns, in all the world, she walks into mine."

 

"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 reason I don't recall I have the Cygwin on my system. I recall something on Msys or MinGW. I just don't know if it is still installed. This is also done through the Cygwin right? Both path are possible for me. I'm just looking for the most efficient way to get a complied version of avrdude for windows with the patch included.

 

FYI: GCC is working.

 

 

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

Well, JohanEkdahl brought MinGW to my attention. Therefor I started looking on the internet. I found this guide to compile avrdude.

 

http://tomeko.net/other/avrdude/...

 

Using this command I applied the patch.

patch < endpointdetect_pass1.patch

Unfortunatly the make failed with the following response which leaves me clueless.

make[2]: *** [libavrdude_a-lexer.o] Error 1
make[2]: *** Leaving directory '/c/MinGW/msys/1.0/home/hebbrem/avrdude-6.3'
make[1]: *** [all-recursive] Error 1
make[1]: *** Leaving directory '/c/MinGW/msys/1.0/home/hebbrem/avrdude-6.3'
make: *** [all] Error 2

Any suggestions?

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

MathieuMH wrote:
Any suggestions?
Work further back up the output - that final error is the consequence, not the reason.

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

Oke, I'll try to be more complete. There seems to be an issue is the usleep instance.

Bellow a screenshot of the whole result of the make command.

 

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

Apparently nothing in this life is ever really new. That was happening back in 2008 (9 years go) too...

 

https://lists.gnu.org/archive/ht...

 

EDIT: The curious thing though is back then the fix was:

-void usleep(unsigned long us);
+int usleep(unsigned int us);

yet this now seems to be the cause of the error. Sounds a lot like a 32 bit versus 64 bit thing to me.

 

(which is EXACTLY why God invented stdint.h). You might want to determine how your headers define useconds_t I guess.

 

EDIT2: apparently useconds_t is in <sys/types.h>. I guess you need to modify the .h in avrdude source to match.

 

One day someone will push a change to avrdude source to remove use of nasty things like "int".

Last Edited: Fri. Sep 29, 2017 - 11:08 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Forgive my ignorance but is there a reason why it's not possible for someone to post a "link to" or "copy of"  avrdude compiled with the patch to allow it to work with the Olimex avrispmkii  ??

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

sb wrote:
Forgive my ignorance but is there a reason why it's not possible for someone to post a "link to" or "copy of"  avrdude compiled with the patch to allow it to work with the Olimex avrispmkii  ??

 

Se clawsons post #2!

 

But I'll flesh out anyway..

 

Windows, Linux or Mac?


Windows: It is a half-beast-from-hell to set up a proper build environment to do a build of AVRDUDE on Windows. The intersection of the set of people that are prepared to do that and the set of people using the Olimex dongle is likely likely very small. Perhaps even an empty set. If you're after a Windows build your best bet surely is to ask nicely on the AVRDUDE mailing list.


Linux: Not all Linux'es are the same. The best bet is to do your own build. The first step of that is to run an automated configure process that will hone and tweak the build to suit the variant of Linux you are running).

 

Depending on Linux variant and what is already installed the build can be as simple  as (i) apply patches and (ii) issue two simple commands to configure and build. When I did my build I had to install several libraries, and also "Bison" (a "parser generator"). While this is not trivial (you need to have some knowledge about building software on Linux) it is not the beast-from-hell that it is on Windows.

 

The remaining problem is that installation is not just putting the executable somewhere. Also the config file should go into a separate directory, and there might be other things that needs tweaking. But this is all handled by another one-line command ("make install") when you do the build yourself. 

 

Yes, some software for Linux'es still require you to know how to do the build yourself - especially so when you need to apply patches that are not present in the official software repo for your Linux variant. AVRDUDE with patches is one example.


Mac: Speculation: Very limited demand. Possibly not trivial to set up a build environment.

Happy 75th anniversary to one of the best movies ever made! Rick Blane [Bogart]: "Of all the gin joints, in all the towns, in all the world, she walks into mine."

 

"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

And, of-course, if the problem/bug is only present for the Olimex avrispmkii then one solution/workaround is to order a Chinese USBasp from EBay for less than $5, wait three weeks for it to arrive and be done with it. Probably a much quicker solution that to persuade someone to do a build and distribute it.

Happy 75th anniversary to one of the best movies ever made! Rick Blane [Bogart]: "Of all the gin joints, in all the towns, in all the world, she walks into mine."

 

"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

 

Thanks for the reply. I have been discussing this on the Olimex forum and had come to the conclusion that the root problem is the Olimex interface but I don't understand how Olimex can get away with selling a product that is, to be blunt, "not fit for purpose" and then expecting the users to sort it out. The basic reply from Olimex was "it works for me".

 

I only use AVR's for the occasional project, have never learnt C  and don't really have the time to start now so recompiling AVR in windows is not an option.

 

I have access to an Atmel ICE which works well with Atmel studio (and should work OK with AVRDude) but the connections are not very user friendly. I've ordered adapters for the ICE from ebay.

 

I also have an older AVR/USB but I cant remember where it came from and cant get avrdude to talk to it (Image below), if anyone recognises it please let me know what it is and what AVRDude -c to use.

 

Thanks

SB

Attachment(s): 

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

Re the image, that is nothing I recognize as a product coming from Atmel.

 

It might be a UABasp programmer.

 

If it is an USBasp, then (again) Studio does not support it intrinsically, but (also again) AVRDUDE can handle it, and you can integrate AVRDUDE into Studio with a simple setup.

 

If it is an USBasp then the -c to use with AVRDUDE is 'usbasp'.

 

For a list of programmer designations in AVRDUDE, do this:

 

prompt> avrdude -c ?

 

Happy 75th anniversary to one of the best movies ever made! Rick Blane [Bogart]: "Of all the gin joints, in all the towns, in all the world, she walks into mine."

 

"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

sb wrote:
I also have an older AVR/USB but I cant remember where it came from and cant get avrdude to talk to it (Image below), ...
(JTAG label next to jumper at far upper right)

mega16L

maybe a USB UART bridge with crystal for it

two AVR 10-pin connectors (JTAG, ISP)

 

An AVRJTAGICE clone can be made with a mega16L.

Might try jtagmkI in AVRDUDE after the USB UART enumerates (virtual COM)

AVaRICE is a possible alternate ... AVR Studio is likely

 


AVRJTAG clone in action

9 January, 2007

http://www.scienceprog.com/avrjtag-clone-in-action/

https://www.olimex.com/Products/AVR/Programmers/AVR-JTAG-USB-A/ 

 

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