This repository contains all required infrastructure to allow you to build your Arduino projects without actually having an IDE nearby.
You are free to forget about *.ino files and Arduino IDE, just setup the toolchain, use main.cpp
as a skeleton and you are free to go.
NOTE: only Arduino Nano board were tested (I only have this guy). But the base Makefile should work for any Arduino-based libraries.
In order to be able to compile under GCC and upload firmware files you need:
avr-binutils
avr-gcc
avr-libc
avr-dude
Our installation directory will be /usr/local/avr/
and OS is Fedora
.
Linux (Fedora) Prerequisites
sudo dnf install gmp gmp-devel mpfr mpfr-devel libmpc libmpc-devel flex
avr-binutils
wget https://ftp.gnu.org/gnu/binutils/binutils-2.29.tar.bz2
tar -xvjf binutils-2.29.tar.bz2
cd binutils-2.29
mkdir build && cd build
../configure --prefix=/usr/local/avr/ --target=avr --disable-nls
make -j8
sudo make install
avr-gcc
wget http://ftpmirror.gnu.org/gcc/gcc-7.1.0/gcc-7.1.0.tar.bz2
tar -xvjf gcc-7.1.0.tar.bz2
cd gcc-7.1.0
mkdir build && cd build
../configure --prefix=/usr/local/avr/ --target=avr --enable-languages=c,c++ --disable-nls --disable-libssp --with-dwarf2
make -j8
sudo make install
avr-libc
wget https://download.savannah.gnu.org/releases/avr-libc/avr-libc-2.0.0.tar.bz2
tar -xvjf avr-libc-2.0.0.tar.bz2
cd avr-libc-2.0.0
mkdir build && cd build
../configure --prefix=/usr/local/avr/ --build=`../config.guess` --host=avr
make -j8
# Note: because `install` target that runs `/bin/sh` can't find `avr-ranlib` no matter what
# (expanding PATH doesn't work), we do `make install` from root
su -h
cd PATH_TO_AVR_LIBC
sudo make install