Script for building AVR-GCC 4.5.1 on Linux

323 posts / 0 new
Last post
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

[Moderator's note: as that thread is sticky now, please
avoid followups here. Rather open your own new thread
instead.]

Quote:
*** YOU MUST LOG IN TO DOWNLOAD THE SCRIPTS ***

Quote:
*** Experimental DEBUGGING of XMEGA's is supported on Linux. But the full protocol is still an Atmel secret.

See : http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=114940

Quote:
Now also as a .deb install package ... Read further on below

Quote:

Here is a list of Linux tools & tips i use on Ubuntu
http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&p=654163#654163

Guyzz i have succeded in building avr-gcc-4.3.4 w. avr-libc-1.6.8 , and Jörg's latest patches on my Ununtu 10.04

Quote:
I'm only testing on the latest Ubuntu LTS.
All other version & distro's , are not guaranteed to work/compile. I'll try to help out , and so will the forum i'm sure. But don't demand support if it doesn't work , just ask nicely in the forum

I am enclosing the scripts i use (credits of A. Erasmus) , if they could be of any use

The steps are these:

Read Readme.txt
Then install the packages listed in pre-reqs.txt.

Note !!
Don't try to call the scripts from another directory location , always execute from same directory where the scripts are located.
The current scripts uses recursive deletes , that could erase the harddisk if the above isn't honored.

Then....

1: Make sure you are root (blushing) , or use sudo
2: Make a working directory , where you extract the files from the archive.
3: If desired edit the buildavr-no-insight.sh file , to change the prefix .. default is : prefix=/usr/local/avr
4: Make sure that the prefix dir is empty or nonexisting
5: Run : chmod +x *.sh
6: Run : ./getfiles.sh
7: Run : ./get-patches.sh
8: Run : ./buildavr-gdb.sh
9: Run: ./buildavr-toolchain.sh

You just answer yes to the existing directory question in step 9.

When building is done , you might want to free around 500MB of diskspace by removing the sources and binaries used to make avr-gcc.
To do so Run: ./buildavr-cleanup.sh

Note this little script expects the "build prefix" to be /usr/local/avr/

Edit:2
I have an avr user on my Linux-box for doing avr development , i have added this to my .bash_profile in my /home/avr directory , it sets up the path to avr-gcc.

Quote:

# User specific environment and startup programs
PREFIX=/usr/local/avr
export PREFIX

PATH=$PATH:$HOME/bin:$PREFIX/bin
export PATH

Quote:

The script builds avr-gcc-4.3.4 w. binutils2.20 and then avr-libc-1.6.8
The script now also automaticly builds avarice-2.10 and avrdude-5.9 , as per request of Jörg.

Note : gcc-4.3.x uses the GMP & MPFR libs , in order to function. So make sure to install the packets mentioned pre-reqs.txt

avr-insight is upgraded to ver 6.8 witch builds ok on 64-bit machines , and it has its own buildscript (buildinsight.sh) , as it takes ages to build.

Use: tar xvzf to extract it if it's a .tgz file, or unzip if it's a zipfile.

Just ansver yes if any of the scripts says that /usr/local/avr exists (ie. when building insight after gcc or the other way around.

But always delete /usr/local/avr before you are making a total/new rebuild.

Quote:

Updated the scriptfiles to build binutils and insight without the -Werror flag. This was caused by GCC 4.3.x (on Ubuntu 8.10) being unable to build the targets. And was due to a lot of new warnings being enabled by default.

Quote:

@20-jun-2009
Upgraded the "old" script building avr-gcc-4.2.2 to build avr-gcc-4.2.4 ... "Jörg did all the patches".
4.2.2 could produce more compact code in some cases.

Quote:

@14-jul-2009
Upgraded the script to build avr-libc-1.6.7 and avrdude-5.8 , no changes to avr-gcc.
As usual "Jörg & the others" did all the hard work.

Quote:

@12-aug-2009
Upgraded the avr-gcc-4.2.4 script to build avr-libc-1.6.7 and avrdude-5.8.
Also applied a "Hotfix patch" to binutils , to avoid a relocation error in the AVR25 architecture (tiny85 etc).
Everybody is urged to rebuild their toolchain

Quote:
@29-0ct-2009
Updated the avr-gcc-4.1.2 binutils 1-17 avr-libc-1.46
script , as it failed in makeinfo.
Moved the updated script to this post
http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&p=632653#632653

Quote:
@03-Nov-2009
Updated the avr-gcc-4.3.3 script , with an avarice patch , to fix a problem when building with "native" gcc 4.4.1

Quote:
@01-Dec-2009
Made a Debian/Ubuntu ".deb" install package containing the binaries build with the above 03-Nov-2009 script.
Read more here
http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=86953

Quote:
@17-Dec-2009
Updated the ".deb" install package , w. a new avrdude binary , containing a PDI patch. (See .txt file in the download site)
Read more here
http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=86953

Quote:
@16-Jan-2010
Updated the avr-gcc-4.3.3 script , to build avrdude-5.9
Removed the two "interrim avrdude patches" , as 5.9 should fix that.
All other remains unchanged.
The script still includes the "AVR25 relocation fix" patch , and the avarice patch

Quote:
@18-Jan-2010
Updated the ".deb" install package (named 16-jan-2010) , w. avrdude-5.9. (See .txt file in the download site)
Read more here
http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=86953

Get the package here.
http://www.wrightflyer.co.uk/avr-gcc/

Quote:
@26-Jan-2010
Updated the scriptfiles and the ".deb" install package to 26-jan-2010 , Added avrdude-5.10 , all other unchanged.

Get the package here.
http://www.wrightflyer.co.uk/avr-gcc/

Quote:
@25-Feb-2010
Made a "Special Static" version , with the patches from WinAVR-20100110-install.exe , so it should be compatible.

Should be installable on both 32-bit & 64-bit versions.
See http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=90241

Get the package here.
http://www.wrightflyer.co.uk/avr-gcc/

Quote:
@09-Mar-2010
Updated the avr-gcc script , to build avr-gcc-4.3.4 and binutils-2.20.
Added 2 patches to avr-insight/avr-gdb.
Added a builtins.h file in the builddir , see readme for use

Added a package-versions file , now versions are only maintained in that file.
Added a new "automatic" way to patch binutils , gcc & insight.

Thanx to Jörg the linux (FreeBSD) build , now has the same patches as WinAVR-2010. A big thankyou to Jörg & EW.

Also uploaded as .deb package avr-gcc-4.3.4-avrfreaks-09-mar-2010.deb
Get the package here.
http://www.wrightflyer.co.uk/avr-gcc/

Quote:
@30-apr-2010
Rebuild the 09-mar-2010 packages on Ubuntu 10.04 LTS
This time i have a x64 system , so i build both 32bit (i386) and 64bit x64 packages.

Uploaded as .deb packages here
http://www.wrightflyer.co.uk/avr-gcc/
Only toolchain change is : Updated insight from 6.8 to 6.8-1

Quote:
@04-jun-2010
Updated buildscript to build avr-insight to 6.8-1
No other changes , and no new .deb's as the 30-apr deb's allready contains that.

Quote:
@12-sep-2011
Did a rebuild of the old trusty avr-gcc-4.3.4 toolchain , with avr-libc-1.7.1 and avrdude-5.11 - avr-insight has switched from 6.8-1 to 6.8-1a

Had to do a "kludge" in order to build avr-insight , ad the file is named 6.8-1a , but it extracts to 6.8-1 directory
Run ./repack-insight.sh , before ./buildinsight.sh

Removed all the rm -fr * , from the buildscript

See readme in zipfile

Also uploaded .deb files to http://www.wrightflyer.co.uk/avr-gcc/

Quote:
@20-sep-2011
Updated the 12-sep-2011 package (see install instructions there)

avrdude updated from 5.11 to 5.11.1 (Serious Bugfix)
avarice updated from 2.10 to 2.11 )minor compilation issues)

See readme in zipfile

Also uploaded .deb files to http://www.wrightflyer.co.uk/avr-gcc/

Quote:
@29-dec-2011
Updated the buildscript with the latest patches from the FreeBSD repos (Thanx Jörg)

avr-gcc updated to 4.5.1
avr-libc updated to 1.8.0
binutils updated to 2.20.1
avarice updated to 2.12
insight replaced with gdb 7.3.1

See readme in zipfile

More info & comments should go here
http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=115567

05-jan-2012
Also uploaded .deb files to http://www.wrightflyer.co.uk/avr-gcc/

Quote:
@08-mar-2012
Updated the buildscript with suggestions/patches from Axel W. (Uracoli)
The suggestions makes the get-patches.sh script more secure , and improves on the buildavr-cleanup.sh script.

The resulting toolchain is the same as the 29-dec-2011 TC.

Thanx Axel.

Quote:
@26-feb-2013
Updated the buildscript with working file mirrors

Quote:
@30-nov-2013
Updated the buildscript to build :
avrdude 6.0.1 (Thanx Jörg)
avr-gdb 7.6.1

Quote:
@26-apr-2014
Updated the buildscript to build :
avrdude 6.1 (Thanx Jörg)
and included the patches in the zipfile
So skip the get-patches.sh step

/Bingo
.
.
.

Attachment(s): 

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

This appears to have become an at least occasionally requested item.

Is there any interest of making this thread `sticky'?

(Please stop replying if you see there's an unanimous vote; I'll
have to split the thread otherwise to decouple the `noise' from
the actual content otherwise before making it sticky.)

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.
Please read the `General information...' article before.

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

dl8dtl wrote:

Is there any interest of making this thread `sticky'?

I think that would be a good idea. In particular, I find the information about patches (and where to get them) very useful.

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

I'm a relative newbie to Linux, used SUSE a little. Just today I installed UBUNTU. Looks like it will help me brake that bad Windose and commercial-Linux habit.

Have played around with WINAVR a little and like it. Would like to go to GNU GCC on Linux.

Making this thread sticky has my vote.

Mike

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

Just "Touching the date"

/Bingo

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

Hello,

compiling binutils with the your scripts failed for me with the following error message (using a current gentoo box with gcc 4.1.1):

gcc -DHAVE_CONFIG_H -I. -I../../../source/binutils-2.17/binutils -I. -D_GNU_SOURCE -I. -I../../../source/binutils-2.17/binutils -I../bfd -I../../../source/binutils-2.17/binutils/../bfd -I../../../source/binutils-2.17/binutils/../include -I../../../source/binutils-2.17/binutils/../intl -I../intl -DLOCALEDIR="\"/usr/local/avr/share/locale\"" -Dbin_dummy_emulation=bin_vanilla_emulation   -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Werror -g -O2 -c ../../../source/binutils-2.17/binutils/wrcoff.c
cc1: warnings being treated as errors
../../../source/binutils-2.17/binutils/wrcoff.c: In Funktion »coff_start_struct_type«:
../../../source/binutils-2.17/binutils/wrcoff.c:2277: Warnung: berechneter Wert ist unbenutzt
make[4]: *** [wrcoff.o] Fehler 1
make[4]: Leaving directory `/usr/local/avr/build/binutils-2.17/binutils'
make[3]: *** [all-recursive] Fehler 1
make[3]: Leaving directory `/usr/local/avr/build/binutils-2.17/binutils'
make[2]: *** [all] Fehler 2
make[2]: Leaving directory `/usr/local/avr/build/binutils-2.17/binutils'
make[1]: *** [all-binutils] Fehler 2
make[1]: Leaving directory `/usr/local/avr/build/binutils-2.17'
make: *** [all] Fehler 2
(./buildavr-no-insight.sh) binutils build failed

Any idea?

Regards:

Uwe Fechner

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

Drop the -Werror. I'm not going to do anything about the COFF patch
anymore, given that AVR-COFF is close to be dead.

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.
Please read the `General information...' article before.

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

Hello,

thank you very mutch. Your script run successfully with Mandriva 2005. I made a little remark, it don't run with Mandriva 2007. There are some errors with "binutils build failed" message.

Regards.

Monmon :D

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

Hi,

Is there an easy way to drop the -Werror using the script? It fails on a ubuntu 6.10 and I have tried to remove the -Werror but somehow it pops back again...

/Mikael

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

> Is there an easy way to drop the -Werror using the script? It fails
> on a ubuntu 6.10 ...

"Is there a way to get rid off these seat belts? They are always in
my way."

The correct solution is not to remove the -Werror but to remove the
warning triggering your problem. Not having Ubuntu Linux, and you not
quoting it, I can only guess, but I assume it's:

wrcoff.c: In function 'coff_start_struct_type':
wrcoff.c:2277: warning: value computed is not used

FreeBSD's CVS version recently also switched to GCC 4.x, and thus also
stumbled across that one.

I have just updated the COFF patch for this in my FreeBSD port. The
solution was much simpler than your attempt to get rid of the -Werror:
a "(void)" cast had to be placed before a function call that returned
a value that was not used. (Upon thinking of it, I'm asking myself
whether ignoring the return value is actually the right thing to do,
but at least, it's been that way all the time, and I don't really see
the Big Picture of all this anymore after that many years.)

I also updated the ATmega256x patch in binutils to get rid of that
annoying "operation is dangerous with linker stubs" warning that was
triggered by large C switch() statements. In a discussion with Björn
Haase, we agreed that this was a regression (it wasn't really
dangerous in the switch() situation anyway), and also not all that
useful as Björn initially believed, as there are many more other ways
to shoot into your feet with the linker stubs which cannot be warned
about anyway. So that warning is gone now. (This matches the patch
Eric is using for his most recent WinAVR.)

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.
Please read the `General information...' article before.

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

Thanks Jörg!

The void cast did the trick in Ubuntu 6.10 as well.

/Mikael

Pages