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,

and another bug here,

and it's scary to think that gcc 4.4 support for the mega2560 was only recently added because I noticed this comment here,

To make things worse, I'm still have issues compiling gcc from scratch on Mac. From a post here,

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.


No comments: