1
\$\begingroup\$

I've got the following program, in AVR assembly:

.DEF WR = R16 .ORG 0 SER WR OUT 0x24, WR 

When I call avr-as beeep.s, where beeep.s contains the previous code, I get an error message:

beeep.s: Assembler messages: beeep.s:1: Error: unknown pseudo-op: `.def' beeep.s:5: Error: constant value required beeep.s:5: Error: register number above 15 required beeep.s:6: Error: constant value required 

I can't find the origin of my error... What did I do wrong ?

\$\endgroup\$
10
  • 1
    \$\begingroup\$ It looks like you are trying to compile the code written for avrasm with GNU as, which seem to have a different directives (which are not machine instructions but "pseudo-ops"). \$\endgroup\$ Commented Jun 9, 2015 at 21:34
  • \$\begingroup\$ @EugeneSh. So what instructions should I use ? Or, what Assembler ? \$\endgroup\$ Commented Jun 9, 2015 at 21:35
  • \$\begingroup\$ Take a look here. Or just use the Atmel's provide assembler. \$\endgroup\$ Commented Jun 9, 2015 at 21:39
  • \$\begingroup\$ @EugeneSh. But .dev is in this instructions set, and the same error message occurs when I replace .DEV with .dev... \$\endgroup\$ Commented Jun 9, 2015 at 21:41
  • \$\begingroup\$ Yes, but the meaning and usage are completely different. \$\endgroup\$ Commented Jun 9, 2015 at 21:43

2 Answers 2

1
\$\begingroup\$

Change .DEF with .EQU:

.EQU WR, R16 .ORG 0 SER WR OUT 0x24, WR 
\$\endgroup\$
0
\$\begingroup\$

As described on http://www.nongnu.org/avr-libc/user-manual/assembler.html one should NOT be using avr-as directly but use avr-gcc instead.

E.g: avr-gcc -mmcu=atmega8 -x assembler-with-cpp example.s

See Note [2] of the example program on the page to see how to assign symbolic name to register.

\$\endgroup\$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.