Skip to content

Instantly share code, notes, and snippets.

@mryndzionek
Created June 20, 2024 06:47
Show Gist options
  • Save mryndzionek/59f68f3ce04e744969a763ea3e2571bb to your computer and use it in GitHub Desktop.
Save mryndzionek/59f68f3ce04e744969a763ea3e2571bb to your computer and use it in GitHub Desktop.
Full instructions on how to build AVR gcc toolchain
  • Install pre-packaged toolchain

     apt install avr-libc binutils-avr gcc-avr
    
  • Download and unpack gcc (e.g. https://mirror.sunred.org/archlinux/extra/os/x86_64/avr-gcc-14.1.0-1-x86_64.pkg.tar.zst)

  • Build gcc

     cd gcc-14.1.0
     mkdir objdir
     cd objdir
     $PWD/../gcc-14.1.0/configure --prefix=$HOME/AVR-GCC-14.1.0 --target=avr --enable-languages=c,c++ \
                                  --disable-nls --disable-libssp
     make -j8
     make install
    
  • Download and unpack binutils (e.g. https://ftp.gnu.org/gnu/binutils/binutils-2.42.tar.xz)

  • Build binuitls

     cd binutils-2.42
     ./configure --prefix=$HOME/AVR-GCC-14.1.0 --target=avr
     make -j8
     make install
    
  • Clone avr-libc (git@github.com:avrdudes/avr-libc.git)

  • Build avr-libc

     cd avr-libc
     export PATH=/home/molcos/AVR-GCC-14.1.0/bin:$PATH
     ./bootstrap
     ./configure --prefix=/home/molcos/AVR-GCC-14.1.0 --build=`./config.guess` --host=avr
     make -j8
     make install
    
  • Remove the pre-packaged toolchain

     apt remove avr-libc binutils-avr gcc-avr
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment