Tuesday, December 23, 2008

Mac AVR-GCC part 1

On a Mac, the deck is almost always stacked against you. This is especially true for compiling mega2560 code using avr-gcc.

What I'm finding is that if you don't configure, compile, and build your own AVR GCC compiler, then you can't be sure all the correct patches are applied for your processor.

Scanning through the bug lists for the avr-libc, I can see some bugs fixes for the mega2560,
http://www.nongnu.org/avr-libc/NEWS.txt

and another bug here,
http://sourceware.org/bugzilla/show_bug.cgi?id=5523

and it's scary to think that gcc 4.4 support for the mega2560 was only recently added because I noticed this comment here,
http://savannah.nongnu.org/task/?3693#comment12

To make things worse, I'm still have issues compiling gcc from scratch on Mac. From a post here,
http://www.mail-archive.com/avr-gcc-list@nongnu.org/msg05281.html

I should be able to compile this using,

> - Compile binutils (go into the binutils top directory):
>
> $ ./configure --target=avr --prefix=/home/avr
> $ make maybe-configure-bfd
> $ pushd bfd
> $ make headers
> $ popd
> $ make all install
>
> - Compile GCC (go into the gcc top directory):
>
> $ mkdir obj
> $ cd obj
> $ ../configure --target=avr --prefix=/home/avr --disable-nls
> --enable-languages=c
> $ make
> $ make install
>
> - Compile avr-libc (go into the top avr-libc directory):
>
> $ ./configure --build=`./config.guess` --host=avr --prefix=/home/avr
> $ make
> $ make install
>
> - Compile avrdude (go into the top avrdude directory):
>
> $ ./configure --prefix=/home/avr
> $ make

> $ make install

It's probably something I'm doing wrong, but this just won't work on my Mac!

I really hope Santa can bring my present early this year and that's why I'm chatting with Christian from obdev.net who maintains the most complete mac avr-gcc packages to date. We're trying to spot how the assembly code is generated differently and why it breaks interrupts.

Chris

No comments: