I've added some Flymake support to Arduino-Makefile. It allows on the fly syntax checking using flymake by calling gcc with arduino-compatible options in the background.

The Makefile for the project must be edited to add a check-syntax target :

BOARD_TAG    = uno
ARDUINO_LIBS =

include ../../Arduino.mk

check-syntax:
        $(CXX_NAME) -c -include Arduino.h   -x c++ $(CXXFLAGS)   $(CPPFLAGS)  -fsyntax-only $(CHK_SOURCES)

See https://github.com/rbarzic/Arduino-Makefile/blob/master/examples/Blink/Makefile for a complete example.

Emacs flymake mode must be configured to accept Arduino ino files :

M-x customize-option RET flymake-allowed-file-name-masks RET (using auto completion !)

Add the line :

("\\.ino\\'" flymake-simple-make-init)

Then click on "Apply and Save" button

Then when editing an ino file, turn-on flymake-mode with M-x flymake-mode

blog comments powered by Disqus