GCC-AVR Compilation error

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;

Reply to
eeh
Loading thread data ...

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
 Click to see the full signature
Reply to
Tauno Voipio

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
 Click to see the full signature
Reply to
Paul Carpenter

Thanks! You are right!

Reply to
eeh

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.