Slides used for my talk about Programming Arduino using makefile at Arduino Day 2015.
Details at http://hardwarefun.com/news/programming-arduino-using-makefile
2. Who am I?
• Hardware Hobbyist
• Used to conduct Arduino and Robotics Workshop
• Long time Arduino User
• Blog at http://hardwarefun.com
• Own more than a dozen Arduino’s ;)
4. What is Arduino Makefile
• Makefile to compile, upload and debug Arduino code
• Highly customizable
• Automatic dependency tracking
• Allows you to use your own IDE / Editor
• Doesn’t require Java ;)
• More than 500 stars in github and 42 contributors
https://github.com/sudar/Arduino-Makefile
5. How to Install it?
• Packages available for most platforms -
Debian/Ununtu/Fedora/homebrew/linuxbrew/
• Installing for source is as easy as doing a git
checkout (bleeding edge)
http://hardwarefun.com/tutorials/compiling-arduino-sketches-using-makefile
6. Basic Usage
Create a file with name Makefile in your sketch directory with the following
variables and then include the Arduino.mk file
ARDUINO_DIR = /Applications/Arduino.app/Contents/Resources/Java
ARDMK_DIR = /usr/local
MONITOR_PORT = /dev/ttyACM0
BOARD_TAG = uno
Except the last one, everything else can be auto-detected
https://github.com/sudar/Arduino-Makefile/blob/master/arduino-mk-vars.md
7. Targets
• make - Compile
• make upload - Upload to Arduino
• make monitor - Open Serial monitor
• make clean - Clean the build
• make size - Run avr-size
9. Using Serial Monitor
It can auto detect both baud rate and port used.
You can also specify it using the following variables.
MONITOR_PORT = /dev/ttyUSB0
MONITOR_BAUDRATE = 57600
10. Including Libraries
Can auto detect the libraries used in most cases.
You can also specify it using the following variable
ARDUINO_LIBS = Ethernet SPI
11. More Demos
• Using plain AVR C code
• Using Arduino as ISP
• Using Alternate Cores (like Attiny etc)
• Using ChipKT
• Using Teensyduino
• Using Arduino from Raspberry Pi
12. Full List of Options
All options are documented at
https://github.com/sudar/Arduino-Makefile/blob/master/arduino-mk-vars.md
14. Limitations
• You have to declare your functions
• Arduino 1.5.x is still not fully supported
• Native Windows support is patchy. You can use
Cygwin
• Supports only AVR based boards. Others WIP
• You would still need to install the IDE
16. Other projects that may be of
interest
• Arduino syntax files for vim -
https://github.com/sudar/vim-arduino-syntax
• Arduino Snippets for vim -
https://github.com/sudar/vim-arduino-snippets