Arduino

Building things from source

I use M J Oldfield's Arduino Makefile to makefile to build arduino code without using the fine GUI. When the Arduino moved to version 1 then some things changed that need to be adjusted in order to make the script work.

It works by adding some headers to your .pde file and then compiling it with the right includes and the like.

First the file name. Before v1 .pde was the given extension now they have switched to .ino. I just created a link between the two file names.

Then I added this to my Makefile

ARDUINO_DIR = /usr/share/arduino

TARGET = mycode ARDUINO_LIBS = ../hardware/arduino/variants/standard/ DHT

BOARD_TAG = atmega328 ARDUINO_PORT = /dev/ttyUSB0

AVR_TOOLS_PATH = /usr/bin
AVRDUDE_CONF   = /etc/avrdude.conf

ARDUINO = 101

include Arduino.mk

.PHONY: listen

listen:
    screen ${ARDUINO_PORT}  115200

The main changes are setting the Arduino dir for the Debian package then adding in the standard libs dir so that it can find the pins_arduino.h

Then you may need to change some of the includes where it asked for WProgram.h to use Arduino.h. I had to change the Arduino.mk file at about 294.

Assuming you have put your libs in /usr/share/arduino/libraries you can then just build it and off you go.

make upload
blog comments powered by Disqus