AVR-GCC 8.2.0 for Windows 32 and 64 bit

This is where I’ll be uploading builds of AVR-GCC for Windows 32 and 64 bit, which will also include Binutils, AVR-LibC, AVRDUDE and Make. I’ll be trying to keep the builds up to date with the latest tool releases when I can.

The binaries are built from source on an Arch Linux virtual machine with MinGW, apart from AVRDUDE where the pre-built binaries are obtained from the official download area. Both 32 bit and 64 bit Windows binaries are provided. There’s probably no benefit from using the 64 bit stuff, but all the cool kids are doing it so why not.
A bash script for building AVR-GCC, AVR-Binutils and AVR-LibC from source is also provided below, making it super easy to build these tools for yourself.

Included tools

Tool Version
GCC 8.2.0
Binutils 2.31.1
AVR-LibC 2.0.0
AVRDUDE 6.3 (Not included in Linux release)
Make 4.2.1 (Not included in Linux release)

Downloads

LATEST
Download
avr-gcc-8.2.0-x64-mingw.zip (56.3 MB)
AVG-GCC 8.2.0 Windows x64 (64 bit)
Downloaded 399 times
MD5: E1D24CA03FA437A3A2D3B879200696E6

LATEST
Download
avr-gcc-8.2.0-x86-mingw.zip (54.14 MB)
AVG-GCC 8.2.0 Windows x86 (32 bit)
Downloaded 133 times
MD5: 44978C6EFD6344687AA0EFE5190B9509

LATEST
Download
avr-gcc-8.2.0-x64-linux.tar.bz2 (43.48 MB)
AVG-GCC 8.2.0 Linux x64
Downloaded 54 times
MD5: 9A7D31F9474626B5F033C536FA8D8244

Upgrading the Arduino IDE

* NOTICE: There seem to be some issues with GCC 8, binutils and Ardunio when dealing with library archives. For now you should use GCC 7.3.0 which can be found at the bottom of the blog post past the build script, click on the “View History” button *
Upgrading the Arduino IDE is pretty easy, though there could be some incompatibilities with certain libraries. I’ve only tested this with Arduino 1.8.2.

  1. Download and extract one of the downloads above
  2. Navigate to your Arduino IDE folder
  3. Go to hardware/tools
  4. Move the avr folder somewhere else, like to your desktop (renaming the folder won’t work, Arduino has some auto-detect thing which sometimes gets confused)
  5. Move the extracted folder from earlier to the tools folder and rename it to avr
  6. Copy the builtin_tools_versions.txt file and etc folder from the old avr folder to the new one
  7. Done! Open up the Arduino IDE, load up the Blink example, upload it to your Arduino and make sure the LED is blinking!

Known Issues

GCC 8 and binutils seem to be having some problems when dealing with library archives, you’ll get error messages like “unable to rename ‘core.a’; reason: File exists” when adding to library archives and “file not recognized: file truncated” linker errors.

Build Script

This build script will install the required packages, create directories and build the tools from source. This should work on Debian 8, Ubuntu 16.04, CentOS 7 and Arch.

Building takes about 30 minutes on an Arch Linux virtual machine with 4 cores i5 2500K @ 4GHz and 2GB RAM.


38 comments

2 pings

Skip to comment form

    • Fridolin on May 2, 2016 at 10:55 pm
    • Reply

    Hi,

    compiling with

    -xc *.c

    results in

    avr-gcc: error: *.c: Invalid argument

    1. Hey Fridolin, I also saw your post on mikrocontroller.net about it being available in previous versions, but none of the GCC versions I tried (4.7.2, 4.9.2, 5.3.0) accept *.c as a valid argument :/

    • Fridolin on May 2, 2016 at 11:16 pm
    • Reply

    Please try an official version, for example the one included in Atmel Studio. It works ok with -xc *.c

    -xc *.c is needed to be able to use -flto (which optimizes the code much better than when compiling the files one-by-one).

      • Fridolin on May 2, 2016 at 11:26 pm
      • Reply

      This is what an official Atmel Studio

      avr-gcc -v

      outputs (compile parameters). Maybe in your build something is missing?

      Using built-in specs.
      COLLECT_GCC=C:\Program Files (x86)\Atmel\Atmel Toolchain\AVR8 GCC\Native\3.4.1061\avr8-gnu-toolchain\bin\avr-gcc.exe
      COLLECT_LTO_WRAPPER=c:/program\ files\ (x86)/atmel/atmel\ toolchain/avr8\ gcc/native/3.4.1061/avr8-gnu-toolchain/bin/../
      libexec/gcc/avr/4.8.1/lto-wrapper.exe
      Target: avr
      Configured with: /home/jenkins/workspace/avr8-gnu-toolchain/src/gcc/configure LDFLAGS=-L/home/jenkins/workspace/avr8-gnu
      -toolchain/avr8-gnu-toolchain-win32_x86/lib CPPFLAGS= –target=avr –host=i686-pc-mingw32 –build=x86_64-pc-linux-gnu —
      prefix=/home/jenkins/workspace/avr8-gnu-toolchain/avr8-gnu-toolchain-win32_x86 –libdir=/home/jenkins/workspace/avr8-gnu
      -toolchain/avr8-gnu-toolchain-win32_x86/lib –enable-languages=c,c++ –with-dwarf2 –enable-doc –disable-shared –disab
      le-libada –disable-libssp –disable-nls –with-avrlibc=yes –with-mpfr=/home/jenkins/workspace/avr8-gnu-toolchain/avr8-
      gnu-toolchain-win32_x86 –with-gmp=/home/jenkins/workspace/avr8-gnu-toolchain/avr8-gnu-toolchain-win32_x86 –with-mpc=/h
      ome/jenkins/workspace/avr8-gnu-toolchain/avr8-gnu-toolchain-win32_x86 –enable-win32-registry=avrtoolchain –enable-fixe
      d-point –with-pkgversion=AVR_8_bit_GNU_Toolchain_3.4.5_1522 –with-bugurl=http://www.atmel.com
      Thread model: single
      gcc version 4.8.1 (AVR_8_bit_GNU_Toolchain_3.4.5_1522)

      1. I have that same version of Atmel’s version of GCC, but mine still stays that *.c is invalid. [This] seems to say that you can specify all the files individually, during compile or after once the object files have been created.

      2. Ah my bad, *.c does work, I didn’t have any .c files in the working directory! I’ll post an update in a bit…

      3. Ok, I can’t seem to find anything obvious that I might have missed, so I’m not sure why *.c isn’t working on my 6.1.0 build. I guess a workaround for now would be specify each individual .c file -xc file1.c file2.c file3.c.

          • Fridolin on May 3, 2016 at 5:28 pm
          • Reply

          Do you know what’s strange? The order in which I specify all the .c files makes a difference in the binary size (that is also the case in the older versions).

          • Fridolin on May 7, 2016 at 12:45 am
          • Reply

          http://www.mikrocontroller.net/topic/396402?goto=4569504#4569522

          Summary:

          Default configuration of mingw-w64 misses wildcard support.

          Two solutions:

          You can recompile mingw-w64 from source with configure –enable-wildcard

          or

          Use Arch Linux. Their mingw-w64 has wildcard support enabled.

          1. Ah thanks! I’ve rebuilt everything using Arch Linux, *.c now works, the download links have been updated 🙂

    • Felix on May 3, 2016 at 11:48 am
    • Reply

    Have you tried to add “lto” to the list of languages so it reads: c,c++,lto? I read about that in this article: https://www.mikrocontroller.net/articles/AVR-GCC

    1. LTO is enabled by default, so no need for any extra build options.

    • Kshitij on May 17, 2016 at 6:51 am
    • Reply

    Hello Zak,

    This is a commendable effort. However, its missing AVR specific patches. For your next build, would you please apply the binutils-patches for avr and some avr-gcc specific updates, which are available at http://distribute.atmel.no/tools/opensource/Atmel-AVR-GNU-Toolchain// ? Off the top of my head, without the avr-size patch, the avr-size –mcu option will not work. There are also some fixes for ATtiny, iirc. Their GCC fixes do get merged upstream occasionally, but for a custom built toolchain, the binutils fixes do need to be looked into.

    Either way, nice job.

    1. Thanks for the link, though there seems to be a lot of patch failures for the latest GCC and things. I’ll have to go through them sometime, the few I looked at where because they’ve already been merged.

    • Fridolin on September 23, 2016 at 10:04 am
    • Reply

    Hi, have you tried compiling avr-gcc 6.2?

    1. Oh! I didn’t know 6.2 was out, I’ll get it compiled sometime soon.

        • Fridolin on April 16, 2017 at 7:41 pm
        • Reply

        Any news?

        6.3 has been out for quite some time now.

        1. Oh, 7.1 is out now lol, I’ll probably get an updated download sorted this weekend.

    • Stefan on October 12, 2016 at 12:08 pm
    • Reply

    Where is make.exe?

    1. You can download make [here]. Though, I think I’ll include it with future AVR-GCC builds.

    • SigmaN on March 9, 2017 at 8:25 pm
    • Reply

    AVR Toolchain GCC 6.3.0, binutils 2.28, avr-libc 2.0.0

    Bug with string constant is FIXED.

    Real worjing LTO(add -flto to compiler AND linker)

    Win32, Win64, Linux64, avr-libc in separate folders https://drive.google.com/file/d/0B7dMRxCEo4yhV283QVJUYlpBRW8/view?usp=sharing

    Win32 Build ready for integration in Atmel Studio 7
    https://drive.google.com/file/d/0B7dMRxCEo4yhWHJaT0plZFluUkU/view?usp=sharing
    View README inside zip

  1. I got this to work with gcc 7.1.0.

    I had a few problems:
    * in your build script, the PREFIX_LIBC variable points to a different location than the rest of the tools. It should be the same.
    * avrdude is missing in the build script. it also needs to be installed in the same prefix path.

    Then, after building, and replacing the Arduino.app/Contents/Java/hardware/tools/avr directory, it almost works.
    Except that i initially got this error when linking:

    core/core.a: error adding symbols: Malformed archive

    Somehow this is solved by changing the -std commandline option in platform,txt to: -std=gnu++1z.

    The string bug mentioned seems to be solved.

    I now use this shell script for switching: https://gist.github.com/nlitsme/04f33ec27cafd8678fddc66ecad9e828

    1. Oh nice, I hadn’t realized GCC 7.1 was out already!
      PREFIX_LIBC is supposed to go to its own directory, so the contents can then be easily copied to the x86 and x64 builds.
      I didn’t include avrdude in the build script as official pre-built windows binaries are readily available here, unlike GCC. The official binaries are the the ones I included in the download packages.

      I’ll have to see about getting the download updated to 7.1.

  2. Hello,

    Forgive me for being very stupid. I don’t know what AVR-GCC 7.1.0 for Windows 32 and 64 bit is. Is this software for the “N l Watch”?

    1. Hey Rob, AVR-GCC is a set of tools used to compile source code (C and C++ code) into a format that can be loaded onto an AVR microcontroller, usually a .hex file. AVR-GCC isn’t specially made for the N|Watch, it can be used by any project that needs to compile some code for AVR.

    • Henning on July 8, 2017 at 10:59 pm
    • Reply

    Out of the box libwinpthread-1.dll is missing, it was present in the 6.1 release. Without it executing gcc fails.

    Some kind of integrated coreutils would be really nice, I think.

    1. Thanks for telling me about the missing dll! I’ve updated the downloads to include it now. I’ll have a think about including coreutils in the next release then.

      1. Great work! Thank you very much for these updated components!

        Unfortunately, the package is still incomplete, I had to copy libwinpthread-1.dll to .\avr\libexec\gcc\avr\7.1.0\ as well.

        1. Hah, I’ve updated the downloads again :p

            • Henning on July 13, 2017 at 4:04 pm

            Thank you very much!

    • Wouter van Ooijen on March 3, 2018 at 10:05 am
    • Reply

    Great work, it enables me to use modern C++ (C++17, concepts) for avr8 chips, both within Arduino and with my stand-alone makescripts.

    But.. is anyone aware of a similar effort for Linux distro’s? All I can find is very old avr8-gcc versions.

    1. Hey Wouter, I’ve just added a 7.3.0 release for Linux, see how it works for you.

    • Alexander Kokushkin on September 6, 2018 at 4:53 pm
    • Reply

    Hello, thank you! I tried 32bits build on Win7 and 64bits on Win10 running as Admin, with disabled antiviruses and using various Arduino folders compiling empty project but got this error:

    c:\arduino-pr-beta1.9-build-80\hardware\tools\avr\bin../lib/gcc/avr/8.2.0/../../../../avr/bin/ar.exe: unable to rename ‘C:\Users\Support\AppData\Local\Temp\arduino_build_442983\core\core.a’; reason: File exists

    Do you have any suggestions how to fix it? Thank you!

    1. Hi Alex, I think this might be a bug with GCC 8. It looks like it has problems with adding new members to existing library archives. GCC 7.3.0 is the latest version that works, there’s a download for it at the bottom of the blog post, click on the ‘View History’ button.

        • Henning on September 7, 2018 at 11:30 am
        • Reply

        Thanks for your constant updates! You can work around the above core.a error by starting Arduino as admin and or disabling the virus scanner this sometimes helps. Using a portable version of Arduino or installing it into an unprivileged folder should work best. The problem seems to be widespread and not limited to GCC8. However after working around that I am met with “cc1.exe*: error: -fno-fat-lto-objects are supported only with linker plugin.” Arduino failed with GCC 8.1 with another error I did not investigate.

        1. No problem! I still have the core.a error when running the portable version of Arduino from desktop as admin without any antivirus. With GCC 8.2 or 8.1 and binutils 2.31.1 I get the core.a rename error and with bintuils 2.30 I get a “file not recognized: file truncated” linker error. I think there might be some incompatibility with the AVR version of GCC 8 and binutils when dealing with library archives?

          • Snek on September 24, 2018 at 12:52 pm
          • Reply

          Had the same problem with latest ARM embedded toolchain. If you want to get LTO working properly you need to pass LTO plugin to ar. In boards.txt find ar flags and add –plugin=D:\path\to\toolchain\liblto_plugin-0.dll to it (plugin extension and path format depends on what OS you’re using).
          I didn’t manage to pass the core.a problem with 8+ toolchain, but since you mentioned run as admin I’ll give it a try again. But still this problem has something to do with ar, just like LTO (since I was able to build without it).

    • Shobai on September 11, 2018 at 9:53 pm
    • Reply

    Thanks for doing this!

  1. […] tip to Zak Kemble for providing this single-package download for Windows 32/64 and a bash script file for building from source for GCC, Binutils, and […]

  2. […] the help from: Zak’s Electronics Blog ~* and AVR LIBC user’s manual I have compilied Download from Dropbox: avr-linux-toolchain.tar.gz […]

Leave a Reply

Your email address will not be published.

Are you human? *