Setting up Arduino with CrunchBang Linux for pure C projects

I’m powering the Arduino Mega 2560 board using USB. However, I’m going to program the Arduino using an AVRISP mkii programmer. This site shows the pinout of the programmer, and upon comparison with the Arduino schematic, I’ve decided to use the programmer this way:

Arduino Setup

Use apt-get to install packages

sudo apt-get install gcc-avr binutils-avr gdb-avr avr-libc avrdude

To use avr-gcc to compile

avr-gcc -DF_CPU=16000000UL -mmcu=atmega2560 -Os -o blink.out blink.c
avr-objcopy -O ihex -R .eeprom blink.out blink.hex
sudo avrdude -V -F -c avrisp2 -p m2560 -P usb -U flash:w:blink.hex
comments powered by Disqus