Preparation
|
My firmware comes as a source code archive. To compile it we need
a toolchain, that means a compiler, assembler and linker. Also
we need a basic library to gain access to processor's peripherals.
There are various ways to get a toolchain. Perhaps you can
install a binary one from your distribution. Or you can build one by
your own. And this way I want to use.
But don't be afraid. I will not boring you with entering endless
command lines, configuring, building and installing all parts.
|
PTXdist
|
|
Instead I'm using a tool that does all the required steps for me.
This tool is intended to build root file systems for Linux targets from
source archives. But it uses always cross toolchains for this job, and
it makes no difference if this toolchain creates code for ARM, PorwerPC
or Atmega CPUs. So we let it build our Atmega toolchain.
|
Where to get and how to install?
|
Its easy to install PTXdist on your linux host. Simply follow this
manual.
Or in shortform:
~$ wget http://www.pengutronix.de/software/ptxdist/download/v1.99/ptxdist-1.99.10.tgz
~$ wget http://www.pengutronix.de/software/ptxdist/download/v1.99/ptxdist-1.99.10-patches.tgz
~$ tar xf ptxdist-1.99.10.tgz
~$ tar xf ptxdist-1.99.10-patches.tgz
~$ cd ptxdist-1.99.10
~/cd ptxdist-1.99.10$ ./configure
~/cd ptxdist-1.99.10$ make
~/cd ptxdist-1.99.10$ sudo make install
|
|
AVR Toolchain
|
|
To get a cross toolchain is also very easy, because PTXdist does it for us.
PTXdist works on projects, so now we need a toolchain project. This is called
OSELAS.Toolchain. Just follow this manual.
And build the avr/avr_gcc-4.3.2_libc-1.6.2_binutils-2.19.ptxconfig toolchain instead of the default one.
Or in shortform:
~$ wget http://www.pengutronix.de/oselas/toolchain/download/OSELAS.Toolchain-1.99.2.tar.bz2
~$ tar xf OSELAS.Toolchain-1.99.2.tar.bz2
~$ cd OSELAS.Toolchain-1.99.2
~/OSELAS.Toolchain-1.99.2$ ptxdist select ptxconfigs/avr/avr_gcc-4.3.2_libc-1.6.2_binutils-2.19.ptxconfig
~/OSELAS.Toolchain-1.99.2$ ptxdist go
|
Now you must be patient. Building a toolchain can take 20 minutes up to several hours.
Experts may download/install a binary toolchain from their Linux distribution.
The final toolchain gets installed to /opt/OSELAS.Toolchain-1.99.2.
You can remove the local build directory, when building is finished.
~/OSELAS.Toolchain-1.99.2$ cd ..
~$ rm -rf OSELAS.Toolchain-1.99.2
|
|
|
Note: Most of the PTXdist projects do not come with the source archives they
are using. Instead they will download them from the web on demand. Thats why you need
an internet connection (as fast as possible) and the tool wget.
|
|
It can happen that some source archives are no more present at their default
location in the web. PTXdist will emit an error and stop. One solution can be
to manually search for this archive and download it by hand. Store this archive
into the global source archive directory (refer ptxdist setup). Next time
PTXdist will use it, instead of trying to download it again. If there are archives
gone on their web place, please drop me a note. I can change the URL or store a
copy of it on my website instead.
|
Note: I tested all my AVR projects with exactely this toolchain built by
PTXdist. If your are using a different toolchain I can't test and
comment any strage behaviour you may see on your system.
|