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

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

[avr-gcc-list] More Problems with AVR-AS v2.11


From: Bruce D. Lightner
Subject: [avr-gcc-list] More Problems with AVR-AS v2.11
Date: Fri, 20 Jul 2001 09:15:27 -0700

Denis or ????,

Thank you for your hints on adapting to the "new and improved" assembler
"avr-as" v2.11, although I don't understand why the changes were made.  Does
anyone know the answer?

Anyway, in switching over to the lastest AVR-GCC release, we of couse would
like to include the AVR assembly code that we are using today without a
bunch of re-writes.  We have a number of macros that allow us to manipulate
16-bit quantities, for example "movw r24,r16", which moves a 16-bit quantity
from r16/r17 to r24/r25.  

In trying to switch from the older AVR register notation (e.g., r24) to the
new "number" based scheme, as Denis Chertykov suggested, we added a number
of "equates" of the form "r24=24", etc.  However, it seems that AVR-GCC is
giving us problems.  Here is a simple test file that exposes the problem:

;
;  AVR assembly code shows unexpected
;  syntax error with GNU assembler
;  version 2.11 (avr) using BFD
;  version 2.11
;
    r30 = 30
    r31 = 31

    r30l = 30
    r30h = 31

    x30 = 30
    x31 = 31

    x30l = 30
    x30h = 31

    zl = 30
    zh = 31

    z = 30

.macro movw p0 ,p1, l=l, h=h
    mov \p0\l,\p1\l
    mov \p0\h,\p1\h
.endm

    movw z,z      ; works
    movw x30,x30  ; works
    movw r30,r30  ; assembly error!!

When this is assembled with AVR-AS 2.11, syntax errors result for the last
line.  Based on my understanding of the "new scheme", this does not make
sense to me.  Here is the output from running "avr-as" (under Win32)...

  % /avrgcc/bin/avr-as --verbose -aml=test.lst -o test.o test.s
  GNU assembler version 2.11 (avr) using BFD version 2.11
  test.s: Assembler messages:
  test.s:32: Error: register name or number from 0 to 31 required
  test.s:32: Error: register name or number from 0 to 31 required
  test.s:32: Error: register name or number from 0 to 31 required
  test.s:32: Error: register name or number from 0 to 31 required

and here is the assembly listing...

GAS LISTING test.s                page 1

   1                  .arch avr2
   2              ;
   3              ;  AVR assembly code shows unexpected
   4              ;  syntax error with GNU assembler
   5              ;  version 2.11 (avr) using BFD
   6              ;  version 2.11
   7              ;
   8                  r30 = 30
   9                  r31 = 31
  10
  11                  r30l = 30
  12                  r30h = 31
  13
  14                  x30 = 30
  15                  x31 = 31
  16
  17                  x30l = 30
  18                  x30h = 31
  19
  20                  zl = 30
  21                  zh = 31
  22
  23                  z = 30
  24
  25              .macro movw p0 ,p1, l=l, h=h
  26                  mov \p0\l,\p1\l
  27                  mov \p0\h,\p1\h
  28              .endm
  29
  30                  movw z,z      ; works
  30 ???? EE2F    > mov zl,zl
  30 ???? FF2F    > mov zh,zh
  31                  movw x30,x30  ; works
  31 ???? EE2F    > mov x30l,x30l
  31 ???? FF2F    > mov x30h,x30h
  32                  movw r30,r30  ; assembly error!!
  32 ???? FF2F    > mov r30l,r30l
  ****  Error:register name or number from 0 to 31 required
  32 ???? FF2F    > mov r30h,r30h
  ****  Error:register name or number from 0 to 31 required

I am puzzled!  Note that changing the definition of"r30l" and "r30h" to...

    r30l = r30
    r30h = r31

...does not make any difference.  Clearly "r30l" is treated very differently
than "x30l"!

Any help in making sense of this would be most appreciated.

Best regards,

Bruce

-- 
 Bruce D. Lightner
 La Jolla, California
 Email: address@hidden
 URL: http://www.lightner.net/lightner/bruce/



reply via email to

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