[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-gcc-list] Use of autoconf/automake with avr-gcc
From: |
Nick Downing |
Subject: |
[avr-gcc-list] Use of autoconf/automake with avr-gcc |
Date: |
10 Jun 2003 19:41:34 +1000 |
dear List,
Can anyone point me towards a simple example of a program which is
portable between PC (linux-gnu) and AVR (avr-libc) ?? I am trying to
set up "autoconf" and "automake" but I'm really tearing my hair out.
Being a beginner with the GNU compile system I've spent almost a whole
week on it now, and I managed to create a program which compiles under
Linux correctly. So far, so good. Now for the tricky part:
I want to introduce the needed CFLAGS and the avr-objcopy steps, but
they should only be executed for an AVR target. For Linux I want the
behaviour to be autoconf's default, so this shouldn't need any change.
Probably the best example I found so far, is "avr-libc" itself - it's
the only AVR package I know of, that uses the full GNU build system (ie.
autoconf, automake, autoheader, as well as the ubiquitous GNU make).
However the "configure.in" provided with avr-libc is a particularly
complicated example, seeing as it has a lot of "enable-multilib" stuff
in it, presumably so that it can build libraries for all hosts. For my
situation I just want to specify the host in the beginning and use that.
So, does anyone know of a sample "configure.ac" or "Makefile.am" that
would correctly build an AVR executable? At the moment I only have
Volker Oth's makefiles and gcctest* programs, they are excellent but
unfortunately the makefiles are intended for "make", not "automake".
Note: "autoconf" seems to get it substantially right, ie. it finds the
avr-gcc executable and attempts to run tests using it. With a basic
"configure.ac" all the tests succeed, although it still can't build
anything because the mcu and associated compiler switches aren't set.
When I try a more complicated "configure.ac" which tries to guess and
pass the correct settings to avr-gcc, I get a strange error from the
linker, which I hope someone can help me to resolve. I will have to
paste the verbatim output from "config.log" to show the problem:
--- cut here ---
configure:1984: checking for C compiler default output
configure:1987: avr-gcc -Wall -W -Wstrict-prototypes -mmcu=avr2
conftest.c >&5
configure:1971: warning: function declaration isn't a prototype
/usr/lib/gcc-lib/avr/3.3/libgcc.a(_copy_data.o)(.init4+0x0): In function
`__do_copy_data':
: undefined reference to `__data_end'
/usr/lib/gcc-lib/avr/3.3/libgcc.a(_copy_data.o)(.init4+0x6): In function
`__do_copy_data':
: undefined reference to `__data_load_start'
/usr/lib/gcc-lib/avr/3.3/libgcc.a(_copy_data.o)(.init4+0x8): In function
`__do_copy_data':
: undefined reference to `__data_load_start'
/usr/lib/gcc-lib/avr/3.3/libgcc.a(_copy_data.o)(.init4+0x12): In
function `.do_copy_data_start':
: undefined reference to `__data_end'
configure:1990: $? = 1
configure: failed program was:
#line 1961 "configure"
#include "confdefs.h"
#ifdef F77_DUMMY_MAIN
# ifdef __cplusplus
extern "C"
# endif
int F77_DUMMY_MAIN() { return 1; }
#endif
int
main ()
{
;
return 0;
}
configure:2017: error: C compiler cannot create executables
--- cut here ---
Experiments indicate that it's something to do with the "-mmcu=avr2"
switch. If I remove this switch, it works better, but I also have to
remove the "-g" and "-Os" switches too. Why??? Anyway, I can run
without the "-g" and "-Os" switches, but I need to use "-mmcu" !!!!
Thanks for reading this far!! I hope you can help with my problem!!
cheers,
Nick
- [avr-gcc-list] Use of autoconf/automake with avr-gcc,
Nick Downing <=