Question

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.

Was it helpful?

Solution

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.

OTHER TIPS

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.

The Arduino Wiki at http://www.cs.nmsu.edu/~jcook/arduino/index.php gives a way to do just that. It requires modifying and rebuilding the Arduino IDE to allow the assembly code (.s files) to be used.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top