This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: May need to update avr-as [Was: [Solved] GAS: Register equates ?]

Hi Erik.

On ARM, I've used this...

rVars   .req    r12

...Which *does* work, but when trying...

rColor	.req		17

...I get...

RegTest.S:14: Error: unknown opcode `rcolor'

...adding a colon does not help either...

rColor:	.req		17

RegTest.S:14: Error: unknown pseudo-op: `.req'

...So unfortunately, it seems that '.req' is not available for AVR.

I believe that the right way to fix the 'rXXX' problem would to enable .req for AVR targets (I do not know, however, what this would involve).
Trying to 'quick-guess' a register in the way it's done by comparing the first character to 'r' or 'R' is not the way I would write an assembler. ;)

-So I think the best way to do it for you, is to continue using .equ.


On Sun, 19 May 2013 22:51:52 +1000, Erik Christiansen wrote:
> On 18.05.13 18:54, Jens Bauer wrote:
>> Hi Erik.
>> Are you sure this works ?
>> Try using the register...
> Ahhh ... err, let's check a little more thoroughly. The example didn't
> actually try it as a register. First, directly confirming Andreas'
> observation:
>    ldi 17,42      ; = r17 , immediate value.
> produces this in the objdump:
>  154: 1a e2          ldi   r17, 0x2A   ; 42
> So AVR is one of those which accept plain numbers for
> registers, thereby allowing (almost) arbitrarily named registers.
> But you're right, as this:
>    rColor = 17
>    ldi rColor,42
> generates:
> Error: register name or number from 0 to 31 required
> The parser grammar apparently wants a recognised register name if it
> begins with r/R. (That's what I incorrectly thought had been fixed.)
> There is an unintrusive workaround, at the cost of an extra keystroke:
>    _rColor = 17
>    ldi _rColor,42
> That does produce the same result, shown by objdump. 
> It would take a lexer tweak to do better than that, I figure.
> (One unlikely to be favoured for a multi-target assembler, I'm
> guessing.)
> Looking more closely at the:
>    .equ r0, 0
>    ...
>    .equ r31, 31
> in the include file I've used for many years, I realise that they are
> not being used in simple assembler commands, but I needed them
> "To allow (r16, r16+1) in macros". (I had convinced myself that they
> were effective in more than the macro invocations. :(
> That just leaves the question whether _rColor is close enough for your
> use case?
> møjn,
> Erik
> -- 
> Wizards had always known that the act of observation changed the thing that
> was observed, and sometimes forgot that it also changed the observer too.
>                                    Terry Pratchett  -  Interesting times

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]