-->
Page 1 of 2

Makefile for Arduino sketches?

PostPosted: Sun May 31, 2015 4:24 pm
by xxcn
First off, huge THANK YOU to Ivan and everyone who contributes to the Arduino IDE. It's definitely the highest quality, most comprehensive and complete collection of libraries for the chip. However, the "IDE" itself is sub-par.

Has anyone worked out how to build against the provided Arduino core and libraries, but using an external Makefile?

Re: Makefile for Arduino sketches?

PostPosted: Sun May 31, 2015 4:33 pm
by igrr
Unfortunately I don't have a Makefile ready. You may take a look at platform.txt — this file has all the build steps defined. Some parameters used for the build (like linker script) are defined in boards.txt. Let me know if you run into any specific issues creating such a Makefile.

Re: Makefile for Arduino sketches?

PostPosted: Thu Jun 04, 2015 6:22 pm
by brettanomyces
Rather than creating a make file you could try using the Arduino IDE command line tool. I've not yet used it for the esp8266 (still waiting for them to arrive in the mail) but I do use it for building and uploading my Arduino projects.

Code: Select all/Applications/Arduino.app/Contents/MacOS/Arduino --verify --verbose /path/to/ino/file \
  --pref build.path=/path/to/build/dir \
  --pref sketchbook.path=/path/to/project/dir \


There are a few issues with it however, I've found it needs full paths and the sketchbook.path needs to be set in the Arduino IDE preferences as well.

Re: Makefile for Arduino sketches?

PostPosted: Fri Jun 05, 2015 10:39 am
by xxcn
brettanomyces, that's what I'm using now:

Code: Select allSERIAL_PORT ?= /dev/tty.nodemcu
SERIAL_BAUD ?= 115200

ARDUINO_BIN ?= ~/src/esp/Arduino/build/linux/work/arduino

TARGET = SketchNameHere

arduino:
   $(ARDUINO_BIN) -v --upload --board esp8266com:esp8266:nodemcu \
      --port $(SERIAL_PORT) --preserve-temp-files \
      --pref build.path=build \
      --pref target_package=esp8266com \
      --pref target_platform=esp8266 \
      --pref board=nodemcu \
      $(TARGET).ino


However, I could not figure out all the preferences (or the correct values thereof) to put on the command line so that settings chosen in the GUI don't affect the makefile build.