|
Embedded
programming on Mac OS X (not completely tested yet)
Installing
the GNU gcc compiler, AVR-libc and AVRDUDE
The guide below should help on installing the software needed to
compile and program an AVR (please check for the availability of
newer version).
1)
Download binutils-2.16.tar.bz2 from http://ftp.gnu.org/gnu/binutils/.
2) Decompress the downloaded file, compile and install it (you'll
need an admin password):
./configure
--target=avr
make
sudo make install
3) If you plan using AVaRICE you need to build libbfd.a from
binutils, do as follows (installs into "/usr/local/powerpc-apple-darwinX.X.X/avr/lib"
depending on your Mac OS X version, e.g. in 10.4 X.X.X would
be 8.0.0):
cd bdf
./configure --target=avr --disable-nls --enable-install-libbfd
make
sudo make install
4)
Download gcc-3.4.3.tar.bz2 from http://ftp.gnu.org/gnu/gcc/gcc-3.4.3/.
5) Again, decompress the downloaded file, compile and install
it (you'll need an admin password):
./configure
--target=avr --enable-languages=c
make CC="cc -no-cpp-precomp"
sudo make install
6)
Download avr-libc-1.2.0.tar.bz2 from http://savannah.nongnu.org/projects/avr-libc/.
7) Again, decompress the downloaded file, compile and install
it (you'll need an admin password):
./doconf
./domake
sudo ./domake install
8)
If you plan on using avrdude, download avrdude-4.4.0.tar.gz
from http://savannah.nongnu.org/projects/avrdude/.
9) You guessed it, decompress the downloaded file, compile
and install it (you'll need an admin password):
./configure
make
sudo make install
10)
If you plan to debug your AVR download gdb-6.0.tar.gz
(had no luck making 6.3 compile) from http://ftp.gnu.org/gnu/gdb/.
11) Decompress, compile and install (you'll need an admin
password):
./configure
--target=avr
make
sudo make install
12)
You would probably also want to install AVaRICE (can also
be used to program the devices, see below). Download avarice-2.3.tar.gz
from http://avarice.sourceforge.net/.
13) Now, decompress, compile and install (you'll need an
admin password):
./configure
"LDFLAGS=-L/usr/local/powerpc-apple-darwinX.X.X/avr/lib
-lbfd" "CPPFLAGS=-I/usr/local/powerpc-apple-darwinX.X.X/avr/include"
make
sudo make install
14)
You are now ready to program AVR's. Please see the guide
below for sample programs and makefiles.
|
Programming
the AVR using an USB port
My initial idea was to make a cheap In-System-Programmer (ISP) like
the pony-stk200 cable. Lack of time, led to purchase of the Propox
JTAGcable II (http://www.propox.com/) which is reasonable
priced at 47 USD.
I
got some updated drivers from FTDI Chip (great support!!!) which
you can download from here (FTDIUSBSerialDriver.pkg.hqx)
which support the device. The
AVR's can now be programmed using AVaRICE, someway like this,
avarice
--erase --program --file $(FILENAME).elf --jtag /dev/cu.usbserial-FTL5XFYQ
In
order to program both the Flash and the EEPROM you need to use the
.elf file. This file should generated auto-magically if you use
the makefile from Jörg Wunsch's Mfile (http://www.sax.de/~joerg/mfile/).
|
Debugging
using the serial port
If you wish to debug or log using the serial port, a USB-Serial
adapter is adaquate. It can be hard to find one that support Mac
OS X. I bought a cheap adapter (kr. 129,-) from TJ Data. Unfortunetely
the driver CD didn't include a Mac OS X drivers. But after doing
some detective work (looking in some C and header files) I found
out that the chip used was manufactured by Prolific (PL-2303). This
chip is actually used in many of the cheap USB-Serial (or PDA, RS232,
...) adapters. Mac OS X drivers can be downloaded below
- Download
Mac OS X v10.3.x drivers (v1.0.8)
The
serial port should now be accessible as something like "/dev/cu.usbserial0".
|
|