From ArchWiki
Revision as of 17:10, 6 November 2007 by PenguinFlavored (Talk | contribs) (Initial commit, based on notes in my memory.)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Tango-document-new.pngThis article is a stub.Tango-document-new.png

Notes: please use the first argument of the template to provide more detailed indications. (Discuss in Talk:Arduino#)


This article is in no way complete. I have successfully built the avr toolchain and written and uploaded some sample code to the Arduino. All this information are notes from my memory. I plan to go back, look at my changes, and rebuild the toolchain taking more detailed notes so I can make this page more accurate and complete.

On that note, feel free to edit this page if you have something to contribute, it needs a lot of work. If you do edit it please let me know what changes you've made.


Download AUR packages

  • binutils-avr
  • gcc-avr
  • avr-libc
  • avrdude

Edit the PKGBUILDs

These packages were last updated about 10-12 months ago in the AUR, so you may have to do some tweaking. I will submit patches to the maintainers while in the process of completing this guide.


  • bump pkgver up to 2.18


  • bump pkgver up to 1.4.7


  • bump pkgver up to 4.2.2
  • add c++ to --enable-languages on the ./configure line
../configure --target=avr --prefix=/opt/avr --disable-nls --enable-languages=c,c++ --disable-libssp


  • bump pkgver up to 5.5

Build the packages

Run makepkg and install the resulting package in this order:

  • binutils-avr
  • gcc-avr
  • avr-libc
  • avrdude

As a user

Congrats, you've built the toolchain for the AVR microcontroller. Now we need an environment to work in. The Arduino team wrote a nice IDE to write your programs in (aka sketches). I choose not to use this IDE. Instead I opt for my favorite text editor, and Arduino's makefile.

Set up a directory to program your Arduino. Then download their Makefile[1]

You will have to modify this a little bit to reflect your settings. The makefile should be pretty self explainatory. Here are some lines you may have to edit.

PORT = usually /dev/ttyUSBx, where x is the usb serial port your arduino is plugged into
TARGET = your sketch's name
ARDUINO = /usr/share/arduino/lib/targets/arduino

Depending on which library functions you call in your sketch, you may need to compile parts of the library. To do that you need to edit your SRC and CXXSRC to include the required libraries.

Now you should be able to make && make upload to your board to execute your sketch.