2
\$\begingroup\$

I'm starting learn AVR microcontrollers. But my OS is Linux. I have installed avr-binutils with avr-as. But I can't find documentation on it; especially, avr syntax (for example, for x86 standrd intel and as syntax differ).

\$\endgroup\$
3
\$\begingroup\$

The documentation, such as it is, is at http://www.nongnu.org/avr-libc/

The basic AVR syntax is pretty much the same as you will find in the Atmel datasheets (unlike the way GCC uses a different x86 assembler syntax than some other x86 compilers). You can also use avr-gcc -S file.c to see the assembly gcc generates for a file.

|improve this answer|||||
\$\endgroup\$
  • \$\begingroup\$ A slightly oftopic question: are avr-gcc and avr-as compatible with C and Assembler compiler from AVR studio? \$\endgroup\$ – user54579 May 18 '12 at 15:47
  • \$\begingroup\$ And thanks. I found documentation on nongnu.org/avr-libc/user-manual/index.html \$\endgroup\$ – user54579 May 18 '12 at 16:06
0
\$\begingroup\$

How about using Atmel Studio inside a virtualbox machine? Both are free. You also need a Windows (XP/Vista/7) license and installation disk, but maybe you can get one, easily.

|improve this answer|||||
\$\endgroup\$
  • \$\begingroup\$ AVR development on Linux with eclipse-avr can be pretty decent. \$\endgroup\$ – joeforker May 19 '12 at 4:22
  • 1
    \$\begingroup\$ there is also avra.sourceforge.net which is what I use. \$\endgroup\$ – Stefan Paul Noack May 23 '12 at 10:19
0
\$\begingroup\$

The avr assembler commands are always the same: AVR instruction set. Here is a simple workflow.

  1. Write your program in a file filename.
  2. avr-as filename program.out
  3. avr-objcopy -j .text -j .data -O ihex program.out program.hex

The hex file contains the opticodes of the compiled instructions (it is a text file, you can open and look at it). It is to be uploaded to the avr.

  1. avrdude -p partname -c programmer program.hex

I'm not sure, you might need to add -mmcu=partname to the assembler command line. Experiment.

Btw congrats for starting out with the assembler. Later on you will move to programming in C, but the experience will be valuable for you.

Another note: check this out AVR makefile. You can just use it for now, compiling C and assembly projects alike.

Yet another note: I didn't check the fourth (4) instruction I gave you - here I don't have a programmer. It ... could be wrong :D

Good luck and have fun!

|improve this answer|||||
\$\endgroup\$
0
\$\begingroup\$

I am using two simple AVR assembler under my Ubuntu. They are up to date and open source and work fine.

gavrasm http://www.avr-asm-tutorial.net/gavrasm/index_en.html

avra http://avra.sourceforge.net/

|improve this answer|||||
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy