GCC-AVR Compilation error

Jan 14, 2006 3 Replies

Hi,



I used GCC-AVR to compile an example, but there are some errors as in the following. The errors are of the same types. I felt that the compiler cannot substitute the definitions to the variables.So I tried to directly substitute r16 to x1 at the first error. The corresponding error then vanishes after compilation.



Could anyone suggest me how to make the substitutions possible? Do I need to set compilation options in the makefile? Thanks!



#define x1 r16 #define x2 r17 #define shift r18 #define cnt r19 #define x3 r20 #define x4 r21 .text .global SIG_INTERRUPT0 .type SIG_INTERRUPT0, @function SIG_INTERRUPT0: push x1;


You're actually using the avr-gcc driver to assemble the code - right?

If you want the pre-processor substitution mechanism on assembly source code, please name the file with the file name extension of '.S'. Note that a lower case '.s' won't go through the pre-processor.

HTH

Tauno Voipio tauno voipio (at) iki fi

The example below is mixed C and assembler.

On the version of GCC, using GAS (assembler) I have used MACROs not defines try .MACRO x2 r17 .ENDM

But then again I was using a different port as possibly DIFFEREENT version of GCC .

As far as I remember GAS treats # as a comment line on many ports.

Macro substitution has not occured.

Paul Carpenter | paul@pcserviceselectronics.co.uk PC Services GNU H8 & mailing list info For those web sites you hate

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required