-
Notifications
You must be signed in to change notification settings - Fork 0
Arduino the Unix way
License
kmart/libarduino
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Arduino the Unix way
--------------------
Compiles and installs the Arduino source files and standard libraries as Unix
library archive files, together with header files.
USAGE
-----
The rules for building an Arduino application has been offloaded into an
external makefile (inc.mk). The "Makefile" needed for an Arduino project is then
reduced to a few lines. An example:
TARGET = blink
SRCS = blink.ino
include /usr/local/lib/arduino/inc.mk
If the project requires additional libraries, these can be added to the build
using the DEPS variable, e.g. by adding the line:
DEPS = SPI Ethernet
to the Makefile (in the above case the "SPI" and "Ethernet" libraries are added
to the build).
To compile just run the "make" command like this:
$ make
If the build should be done for a board different from the default one
(atmega328), either add the BOARD variable to the Makefile, like this:
BOARD = leonardo
or include the BOARD variable as a parameter to the "make" command when
building:
$ make BOARD=leonardo
To upload the resulting application, run the command:
$ make upload
(the actual upload will be done with "avrdude" command and the correct parametes
will be given by the specified BOARD type).
If the upload should be done to a different port than the default one
(/dev/ttyUSB0), add the PORT variable to the Makefile or include the PORT
variable as a parameter to the "make" command when building:
$ make PORT=/dev/ttyS0
Currently the default values for the BOARD and PORT variables are:
BOARD = atmega328
PORT = /dev/ttyUSB0
These can be changed during installation (see next section).
INSTALLING
----------
Prerequisites:
# apt-get install gcc-avr
# apt-get install avr-libc
# apt-get install avrdude
(Uses the standard 'avrdude' rather that the version that comes with Arduino.)
Build and install:
$ wget http://arduino.googlecode.com/files/arduino-1.0.5-src.tar.gz
$ tar zxf arduino-1.0.5-src.tar.gz
$ ./conv.sh ./arduino-1.0.5/hardware/arduino/boards.txt
$ ./build.sh
Will install the Arduino "core", the "inc.mk" makefile, the converted 'board'
configuration files and the standard libraries, for all the boards defined in
the "boards.txt" file.
Configurations for additional boards can be added by running the "conv.sh"
script with the "boards.txt" file for the additional boards as parameter. For
example for the Sanguino board (http://sanguino.cc/):
$ wget https://sanguino.googlecode.com/files/Sanguino-0101r1.zip
$ unzip -q Sanguino-0101r1.zip
$ ./conv.sh sanguino/boards.txt
(Remember to run the "build.sh" script to actually compile libraries for the
added boards.)
The default installation directory is "/usr/local/include/arduino" for header
files and "/usr/local/lib/arduino' for libraries and support files.
By default an Arduino project will be built for the "atmega328" (Duemilanove
and similar) board, which has the following parameters set:
PROTOCOL = arduino
MAXIMUM_SIZE = 30720
SPEED = 57600
MCU = atmega328p
F_CPU = 16000000L
CORE = arduino
VARIANT = standard
For an overveiw of the board configurations installed, look in the
"/usr/local/lib/arduino/boards" directory. It contains one configuration file
for each board.
The default board can be set by updating the line
BOARD := atmega328
near the top of the the "/usr/local/lib/arduino/inc.mk" file. Similarily the
default PORT (for uploads) can be changed by updating the PORT variable in the
same file.
ADDITIONAL LIBRARIES
--------------------
Extra libraries can be installed by using the "build-addons.sh". By default the
script installs the following libraries:
Adafruit-Thermal-Printer-Library:
https://github.com/adafruit/Adafruit-Thermal-Printer-Library.git
Adafruit fork of Peter Knight's Cryptosuite library for Arduino:
https://github.com/adafruit/Cryptosuite
LedControl:
http://playground.arduino.cc/Main/LedControl
TM1638 library:
http://code.google.com/p/tm1638-library/
USB_Host_Shield_2.0:
https://github.com/felis/USB_Host_Shield_2.0.git
The script will need to be adapted for other libraries.
2013-08-25 <kmyksvo(at)online.no>