Raw C on Arduino Uno

The Arduino Uno is an embedded open-source development platform built around an Atmel ATmega328P, which is usually programmed using their own Arduino IDE. Since there are reasons – maybe you prefer your personal editor, don't like Java or like to stick to pure C – to avoid the intentional IDE it is sometimes easier to develop in your usual embedded environment using avrdude and avr-gcc. First the kernel will be prepared, then the required software installed and afterwards a little piece of software will be compiled and uploaded.

= Preparations =

lsusb output

Kernel configuration
To talk to your Arduino you need to add the USB Communication Device Class Abstract Control Model (CDC ACM) interface.

crossdev
The easiest and most consistent way to get your environment is to use crossdev. After emerging crossdev run the following to achieve an avr-target: You will likely get errors you have to fix. For more information take a look at the generated logfiles under the output will point you to.

avrdude
avrdude is an AVR Downloader/UploaDEr. Since the stable version is quite old and supports neither the MCU ("ATmega328P") nor the programmer ("arduino"), we need to unmask it.

= Compiling and Uploading =

Backup
If you screwed things up or just want to have a look at the preshipped flash content run the following command to get a backup:

Compilation
The SMD LED labeled 'L' can be accessed by PORTB, which is defined in, so we will start with this little demonstration without further wiring. main.c

The following commands will compile the source, link the objects and prepare them for the Arduino Uno.

Uploading
After running this command the LED should immediatly start blinking.

= Weblinks = http://arduino.cc Official Homepage http://arduino.cc/en/Hacking/PinMapping168 Arduino Pin Mapping für ATmegas 168 and 328