Weird asm code error...

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

Hi there,

I'm running AVR-GCC under Mac OSX and I get a couple of weird errors I can't explain. Anybody know what it is? The line of code is (initial numbers are linrnr's):

80 ldi      tempval, 0x00

The 'tempval' is defined with the following line:

60 #define     tempval r16

The error messages I get is:

CL.S:80: Error: `,' required
CL.S:80: Warning: expression possibly out of 8-bit range
CL.S:80: Error: garbage at end of line

The compilation:

avr-gcc -c -g -Os -Wall -Wstrics-prototypes -Wa,-ahlms=CL.lst -mmcu=at90s1200 CL.S -o 

Also, it'd be great if anybody knew where to find the reference manual for the asm-commands under AVR-GCC/AVR-AS, my searches hasn't had a positive outcome. Any help appreciated!!

/Gert

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

What makes you assume the assembler could do anything with your
line numbers? Omit them, and you should be fine.

> Also, it'd be great if anybody knew where to find the reference
> manual for the asm-commands under AVR-GCC/AVR-AS, my searches hasn't
> had a positive outcome.

What does "asm command" mean to you exactly?

If it's the opcodes, this is explained in an Atmel document:

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

(It's a bit hard to find on the web page. It used to be listed as an
application note, but now it's under "Other documents" -> "User
guides".)

Register and bit names are explained in appnote AVR000.

The pseudo instructions are specific to each individual assembler, so
for the GNU assembler (GAS), they can be found in the GAS reference
manual. If you've got WinAVR, this one ought to be straight on your
disk.

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.

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

Hello

dl8dtl wrote:
What makes you assume the assembler could do anything with your
line numbers? Omit them, and you should be fine.

The linenumbers are put into the code for your convenience! they are not in the actual code, but for you guys to understand the error messages etc, hence the problem remains.

Yes with "asm command" I ment the "instruction set"/"opcodes", sorry about that, I thought I was being clear, obviously not.

The document you linked was very good but I'm also interested in the pseudo instructions and as I said before I'm running avr-gcc on a mac os x machine.

Thanks!

/G

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

> The linenumbers are put into the code for your
> convenience! they are not in the actual code

Sorry, then I simply don't understand your issue at all. When
I put your two lines into a file CL.S:

#define     tempval r16

ldi      tempval, 0x00

and fix the typo and the omission of the -o argument in your
command-line, it compiles/assembles well.

Perhaps you want to review the code after preprocessing, by
replacing the -c by a -E (and tweaking the name after the -o
option).

> but I'm also interested in the pseudo instructions and as I said
> before I'm running avr-gcc on a mac os x machine.

Sorry for missing the MacOS X reference. In that case, either ask the
person who built your package for the GAS reference, or view it online

http://www.gnu.org/software/binu...

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.

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

Hi,

>Sorry, then I simply don't understand your issue at all. When
>I put your two lines into a file CL.S:
>and fix the typo and the omission of the -o argument in your
>command-line, it compiles/assembles well.

Yet another error from my side. This is how i compile my code.

avr-gcc -c -g -Os -Wall -Wstrics-prototypes -Wa,-ahlms=CL.lst -mmcu=at90s1200 CL.S -o CL.o

I guess thats how you do it as well. The weird thing is that the code generates errors for me.

I'm gonna try the -E option and see how it looks.

Thanks!

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

Quote:
Yet another error from my side. This is how i compile my code.

Code:
avr-gcc -c -g -Os -Wall -Wstrics-prototypes -Wa,-ahlms=CL.lst -mmcu=at90s1200 CL.S -o CL.o

At least one typo is still not fixed :shock: .

Stop messing about. Give us the facts instead of trying to type into the forum what you think you have. ZIP your project and post it here and let us have a look at what your computer and avr-gcc sees, rather than what you think you are seeing. This is just a waste of everybodys time.

Quote:
I guess thats how you do it as well. The weird thing is that the code generates errors for me.

Instead of you guessing how we do things, and us guessing why you get errors, based on guesses of what source, makefile etc you have, why can't you just zip up your complete project and attach it to a post here. That would probably reduce the guesswork, and increase the usefulness of the answers, a great deal.

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

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

Well hello,

Stop messing about. Give us the facts instead of trying to type into the forum what you think you have. ZIP your project and post it here and let us have a look at what your computer and avr-gcc sees, rather than what you think you are seeing. This is just a waste of everybodys time.

JohanEkdahl: I don't mess about! Also I did give you the facts you needed to help me, as well as the facts I had. As a matter of fact, Jörg did help me more than you might think. I wouldn't post the hole project if I didn't think it would help!

Jörg: Thank you for helping me! compiling the code I put out here works exactly like you said. So, it left me with some other code to look through. I have no Idea what it might be though. Whatever it is, it isn't listed as an error. Thanks again!

/Gert

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

Hi again,

I just want to clearify what happened. It seams my compiler (AVR-GCC) didn't accept me defining the the tempvar as r16 etc, or I defined the wrong way. However, using registers instead of my defined names may be a bit harder but it works.

/Gert

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

It's supposed to work though. Again, that's where the trick with using -E
might really help: it lets you snoops at the output of the preprocessor, so
this usually makes the problems more obvious.

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.

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

Gert!

Sorry if I came across in a not to flattering way. It was not my intention. Oh, OK, I was a bit sarcastic...

Anyhow: The point was that ther might be all kinds of things going wrong, and instead of having to guess one thing after another, and having the correspondence about it spread out over maybe several days, we could ry out your code ourselves and maybe solve the problem in a much shorter time. And there was also the confusion woith the mis-spelled compiler switch ("-Wstrics-prototypes"), which I assume would cause the compiler to abort rather than get to the compilation proper at all. We all understood that it was meant to be "strict", but those things makes at least me suspicious about what other things that might be erroneously quoted in a post.

All this would easily have been solve if we have gotten hold on a verbatim copy of what gave you the problems.

Nothing more - nothing less. Again, sorry if you felt offended.

If I get it right you still cant get the #define to work. You should not be forced to use register names, so here are a few things that you might test:
- Check that the number sign '#' is in the first position of the line
- If this define is in a include file, and on the last line, add an extra blank line after it (yes, really!)
- Change the name (in the unlikely event that you have found a preprocessor/assembler bug that is dependent on the particular name that you are having trouble with.

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

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

Hey again!

Jörg: Thanks again, I'm gonna check closer on that!

Johan: Hmm, I wasn't aware of that error, so thanx very much for pointing that out. I will take a look at that in the near future as well.

/Gert