Tell me more ×
Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. It's 100% free, no registration required.

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).

share|improve this question

3 Answers

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.

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

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.

share|improve this answer
AVR development on Linux with eclipse-avr can be pretty decent. – joeforker May 19 '12 at 4:22
there is also avra.sourceforge.net which is what I use. – noah1989 May 23 '12 at 10:19

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!

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.