avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] can't compile simple test.c


From: Christian Vogel
Subject: Re: [avr-gcc-list] can't compile simple test.c
Date: Sun, 24 Aug 2003 22:17:46 +0200
User-agent: Mutt/1.2.5.1i

Hi Gregory,

> If I add -E to the CFLAGS, as suggested by Joerg Wunsch so that I may
> see the preprocessor output, the code compiles and I get no errors but
> the linker doesn't recognize the file format of the object file.

Of course. Because the linker wants to link object files... and by using
-E you are giving him C-Code :-)

So if you convert yout test.c to the preprocessor output-file (test.e)
with this command:

        avr-gcc -g -Os -mmcu=atmega103 -I/usr/local/avr/include/ -E -o test.E 
test.c

you will notice, that the line where the compiler complains:

        float foo(float SP);

was converted after the pre-processor did his work (look at test.E) to:

        float foo(float (*(volatile unsigned int *)((0x3D) + 0x20)));

this is, because SP is defined to be a macro for the stack pointer (which
in avr's unified memory/register space is at address 0x3D+0x20!

If you rename all SP-variables to, for example, _SP, your code compiles!

        Chris

-- 
[KMR] The earth consists primarily of protons, electrons, neutrons, and morons.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]