Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Programming arduino using makefile

2,839 views

Published on

Slides used for my talk about Programming Arduino using makefile at Arduino Day 2015.

Details at http://hardwarefun.com/news/programming-arduino-using-makefile

Published in: Software
  • Be the first to comment

Programming arduino using makefile

  1. 1. Programming Arduino using Makefile Sudar Muthu Arduino Day 2015 http://hardwarefun.com
  2. 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 ;)
  3. 3. Why look for alternatives to Arduino IDE
  4. 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. 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. 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. 7. Targets • make - Compile • make upload - Upload to Arduino • make monitor - Open Serial monitor • make clean - Clean the build • make size - Run avr-size
  8. 8. Demo
  9. 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. 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. 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. 12. Full List of Options All options are documented at https://github.com/sudar/Arduino-Makefile/blob/master/arduino-mk-vars.md
  13. 13. Interfacing with external programs/IDE’s • Vi/Vim • Emacs/Flymake • Code:Blocks • Eclipse
  14. 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
  15. 15. Contributions are welcome https://github.com/sudar/Arduino-Makefile
  16. 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
  17. 17. Thank You

×