20161202T12:30 Programming Arduino with AVR Assembly - OrCarin/CET-3510-1KB-Contest GitHub Wiki
Most of results are from following this tutorial:
http://www.instructables.com/id/Command-Line-Assembly-Language-Programming-for-Ard/
This will be more of a TL:DR kind of summary based on the tutorial.
Prequisites:
Hardware:
- Linux Computer
- Arduino Uno
- LED's Software:
- avra
- avrdude
- "m328Pdef.inc" definitions file
Run the following to install avra and avrdude
sudo apt-get update
sudo apt-get install avra
sudo apt-get install avrdude
Create an .asm file for your code (example: test.asm)
Compile the code into a .hex file with avra:
avra test.asm -o test.hex
Press the reset button on the Arduino Uno, then upload using avrdude:
avrdude -F -p m328p -c stk500v1 -P /dev/ttyACM0 -U flash:w:test.hex
You may need to change some options, such as replacing "/dev/ttyACM0" with the desired serial port.
For ease of use, I've written shell scripts for assembling and for uploading so there's less to type in. You can use ./compile or ./upload instead of those long commands.
After a meeting with Alderick, I've found that there may be permission errors with avrdude on Linux. Run the following commands to fix (replace username with your username):
sudo usermod -a -G dialout [username]
sudo chmod a+rw /dev/ttyACM*