I'm starting learn AVR microcontrollers. But my OS is Linux. I have installed
avr-as. But I can't find documentation on it; especially, avr syntax (for example, for x86 standrd intel and as syntax differ).
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.
The avr assembler commands are always the same: AVR instruction set. Here is a simple workflow.
- Write your program in a file filename.
- avr-as filename program.out
- 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.
- 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!
I am using two simple AVR assembler under my Ubuntu. They are up to date and open source and work fine.