Writing assembly code using avr-gcc
Solution 1
The best documentation I could find is the avr-gcc assembler tutorial.This explains that:
One can use the interrupt vectors using the avr-libc.In order to do it without external libraries, one can reference the source, as Brett Hale suggested.
It mentions the avr-specific directives.
It also comes with a simple example.
Solution 2
I suggest you look the avr-libc library. Don't let the name mislead you. Most of it's highly optimized AVR assembler, with linker scripts, low level HW access, etc.
byrondrossos
Updated on June 04, 2022Comments
-
byrondrossos almost 2 years
I have recently bought an Arduino Uno, which is basically an atMega328 avr processor with all the details such as I/O and connection to the computer taking care of for you.
I have successfully written code using the Arduino IDE and the avr-gcc collection.However, I would like to write pure assembly code for it, and I have hit a dead-end, since there seems to be close to none documentation on that.That is, I would like to write 'pure' assembly, no inline c assembly and the like.I would like instructions on doing so and, if possible, an example program(the assembly output of gcc-avr was not that helpful, being incomprehensible and all ).
In particular:- How can one instruct avr-as to put that code in eg the interrupt vectors ?
- What directives are available?
- Where do .data and .bss sections go?
Pointing me to appropriate examples is appreciated.