AVR Assembler 1.73 - Warning caused of redefinition of regi

Go To Last Post
9 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I got problems with the new Assembler 1.73. I redefine registers like R23 with the command .DEF in subroutines and get warnings like "Register already defined by the .DEF directive". In the old version 1.3 the warnings doesn't exist. is there any possibility to switch of the warnings or to change the code. I got more than 30 Warnings!!! And don't find errors in the notification when one occurs!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I use 1.30, no problems. Can be a bug.

admin's test signature
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

doe you not need to use set for redifining a reg
maybe I'm wrong

admin's test signature
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

The second noname is correct. Use ".set" instead of ".def". You might want to download a copy of the AVR Assembler User Guide found here:

http://www.atmel.com/dyn/resourc...

This document does not cover all the new features of 1.73 (at least it didn't a week or so ago) but will cover .def and .set. Read it.

Regards,
Steve

admin's test signature
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Marc:

.equ and .set will define constant(s, associate a value with a name),
.set will allow a re-allocation of the value to the same name during run-time, with .equ the value can't be redefined.

.def associates a (physical) register with a name, e.g. .def r23=temp -> use the name 'temp' instead of 'r23': 'ldi temp,3' will be the same as 'ldi r23,3'.

".equ/.set" and ".def" are different animals.

Talking about .DEF: If you use

.def r23,temp1
.def r23,temp2

the assembler will issue a warning ("... already used ..."), this is standard behaviour for versions 1.3 as well as for 1.73.

Even though you receive this warning, your source code can utilize both names (temp1 and temp2 in the example) to refer to the same register, r23 - or, in other words, multiple register definitions may be used. As several different names may actually specify the same physical register, IMHO the warning given is correct - watch your pushs and pops and whatever else your code is doing when you do this - you'll be walking on thin ice ...

admin's test signature
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What exactly is the syntax you guys are talking about for redefining a register with .SET? The following won't work

.def MoveCount = r25
.set MyTest = r25

neither will this:

.def MoveCount = r25
.set MyTest = MoveCount

admin's test signature
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanx for all the help!

To Jim/Sally: I use .def to define "local variables" in subroutines. So I have to define shared registers in more than one subroutine for the same register like

.def MyTest = r25
..
.
.def MyTest = r25

To Steve: Instead of the example above I can write

.set MyTest = 0x25
..
.
.set MyTest = 0x25

This cause no warnings but several commands like mov or clr don't work!

To Andreas:
I think the same as you. And i'm sure that I walk on thin Ice, but I have to. I only want to avoid the warnings to find get a simple notification after compiling.

To Noname:
Your right in version 1.30 there are no warnings like this!

Marc

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The example show that you assign the same name twice to one register, is that true for your application as well? In that case, it should be enough to assign the name once. I performed a small test which suggests that one .def is enough, even if it is at the very bottom of the source, or in the last included asm-file.

If you're using different names for one register I would join the club and caution you against that.

-Geir

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Sorry Geir - copy and paste error. The right example:

def MyTest = r25
..
.
.def Another_Test = r25

.set MyTest = 0x25
..
.
.set Another_Test = 0x25