GCC-AVR Compilation error

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
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;<---error: constant value required
    in    x1, SREG    ;<---error: constant value required
    push    x1;<---error: constant value required
:


Re: GCC-AVR Compilation error
Quoted text here. Click to load it

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

Re: GCC-AVR Compilation error
Thanks! You are right!


Re: GCC-AVR Compilation error
On 14 Jan, in article

Quoted text here. Click to load it

The example below is mixed C and assembler.

Quoted text here. Click to load it

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 .

Quoted text here. Click to load it

As far as I remember GAS treats # as a comment line on many ports.
 
Quoted text here. Click to load it

Macro substitution has not occured.

--
Paul Carpenter          | snipped-for-privacy@pcserviceselectronics.co.uk
<http://www.pcserviceselectronics.co.uk/ PC Services
We've slightly trimmed the long signature. Click to see the full one.

Site Timeline