Hello World!
I'm using Mac OSX and I'm not fan of `brew`ing everything so in this part I'm going to show how to install the tools necessary to develop for AVR microcontrollers from the sources. So let's start!
Here is an alternative link to show how to do that:
https://www.nongnu.org/avr-libc/user-manual/install_tools.html
I was following the steps but it didn't quite help me. So I came up with my own steps.
AVR
We need to define couple variables in the beginning. In case anything goes wrong, or you want to reinstall your AVR you'll be able to just remove the avr directory. Let's say it's /usr/local/ directory.PREFIX - folder with all avr related stuff.
INITDIR - folder where you're going to download and configure the sources.
# Initialize useful variables & create directories.
export PREFIX="/usr/local/avr"
export INITDIR="/anywhere/on/your/computer/"
export PATH:"$PREFIX/bin/:$PATH" # including binaries in the `PATH`
mkdir $PREFIX
mkdir $EXTRAS
You might want to use sudo.Installing BINUTILS:
You can choose the binutils version over here.
cd $INITDIR
# replace `*` with appropriate version.
# Download
curl -OL https://mirror.freedif.org/GNU/binutils/binutils-*.tar.gz .
# Extract
tar xzf binutils-*.tar.xz -
# Configure
cd binutils-*
mkdir build-avr
cd build-avr
../configure --prefix=$PREFIX --target=avr --disable-nls
# Build & Install
make
make install # use `sudo` or `chmod/chown` on the /usr/local/avr/
Installing GCC for AVR:
Choose the GCC version over here or straight here.
cd $INITDIR
# replace `*` with appropriate version.
# Download
curl -OL http://mirrors.concertpass.com/gcc/releases/gcc-*/gcc-*.tar.gz .
# Extract
tar xf gcc-*.tar.xz -
cd gcc-*
# Download dependencies
./contrib/download_prerequisites
# Configure
mkdir build-avr
cd build-avr
../configure --prefix=$PREFIX --target=avr --enable-languages=c,c++ --disable-nls --disable-libssp --with-dwarf2
# Build & Install
make
make install
The rest of the setup requires some additional tools like autoconf and automake.
Installing Autoconf and Automake:
Choose the Autoconf version over here.
Choose the Automake version over here.
# -- Autoconf --
cd $INITDIR
curl -OL https://ftp.gnu.org/gnu/autoconf/autoconf-*.tar.gz .
tar xzf autoconf-*.tar.gz
cd autoconf-*
./configure --prefix=$PREFIX
make
make install
# -- Automake --
cd $INITDIR
curl -OL https://ftp.gnu.org/gnu/automake/automake-*.tar.gz .
tar xf automake-*.tar.xz
cd automake-*
mkdir build
cd build
../configure --prefix=$PREFIX
make
make install
Next, we want to install AVR libs and a tools to be able to upload the program to the board.
Installing AVR-LibC:
AVR-LibC Documentation
Choose the AVR-LibC version over here.
cd $INITDIR
# replace `*` with appropriate version.
# Download
curl -OL http://download.savannah.gnu.org/releases/avr-libc/avr-libc-*.tar.bz2 .
# Extract
tar xf avr-libc-*.tar.bz2 -
cd avr-libc-*
# Configure
mkdir build
cd build
../configure --prefix=$PREFIX --build=`./config.guess` --host=avr
# Build & Install
make
make install
Installing AVRDUDE:
http://savannah.nongnu.org/projects/avrdude
https://www.nongnu.org/avrdude/
AVRDownloaderUploaDEr is a utility to download, upload, and manipulate the ROM and EEPROM contents of AVR micro controllers using the ISP (in-system programming technique)
Choose the AVRDUDE version over here.
cd $INITDIR
# replace `*` with appropriate version.
# Download
curl -OL http://download.savannah.gnu.org/releases/avrdude/avrdude-6.3.tar.gz .
# Extract
tar xzf avrdude-*
cd avrdude-*
# Configure
mkdir build
cd build
../configure --prefix=$PREFIX
# Build & Install
make
make install
Here we are. We must be all setup by now to start developing on AVR MCUs.
In the next post I will try to show how to build and upload a sample program for the Arduino UNO (with ATmega328p on it).
No comments:
Post a Comment