Hi everybody,

Here is my contribution to solve this problem. I am attaching a very
simple patch for Arduino.mk and an updated Makefile example.

What I have changed to the ones in arduino-core package:
- Change the "sketchs" files to be ".ino" instead of ".pde"
- Add a variant variable to select the right pins
- Change the include to replace WProgram by Arduino

On the simple test I have made it is working very well I was able to use
Emacs as a full Arduino IDE.

Please find attached the diff file and the updated Makefile.

Antoine

--- /usr/share/arduino/Arduino.mk	2011-12-27 17:38:20.000000000 +0000
+++ Arduino.mk	2012-01-20 22:19:36.442390951 +0000
@@ -139,7 +139,7 @@
 
 ARDUINO_LIB_PATH  = $(ARDUINO_DIR)/libraries
 ARDUINO_CORE_PATH = $(ARDUINO_DIR)/hardware/arduino/cores/arduino
-
+ARDUINO_VARIANT_PATH = $(ARDUINO_DIR)/hardware/arduino/variants/$(ARDUINO_VARIANT)
 endif
 
 # Everything gets built in here
@@ -151,10 +151,10 @@
 LOCAL_C_SRCS    = $(wildcard *.c)
 LOCAL_CPP_SRCS  = $(wildcard *.cpp)
 LOCAL_CC_SRCS   = $(wildcard *.cc)
-LOCAL_PDE_SRCS  = $(wildcard *.pde)
+LOCAL_PDE_SRCS  = $(wildcard *.ino)
 LOCAL_AS_SRCS   = $(wildcard *.S)
 LOCAL_OBJ_FILES = $(LOCAL_C_SRCS:.c=.o) $(LOCAL_CPP_SRCS:.cpp=.o) \
-		$(LOCAL_CC_SRCS:.cc=.o) $(LOCAL_PDE_SRCS:.pde=.o) \
+		$(LOCAL_CC_SRCS:.cc=.o) $(LOCAL_PDE_SRCS:.ino=.o) \
 		$(LOCAL_AS_SRCS:.S=.o)
 LOCAL_OBJS      = $(patsubst %,$(OBJDIR)/%,$(LOCAL_OBJ_FILES))
 
@@ -209,6 +209,7 @@
 
 CPPFLAGS      = -mmcu=$(MCU) -DF_CPU=$(F_CPU) \
 			-I. -I$(ARDUINO_CORE_PATH) \
+			-I$(ARDUINO_VARIANT_PATH) \
 			$(SYS_INCLUDES) -g -Os -w -Wall \
 			-ffunction-sections -fdata-sections
 CFLAGS        = -std=gnu99
@@ -217,7 +218,7 @@
 LDFLAGS       = -mmcu=$(MCU) -lm -Wl,--gc-sections -Os
 
 # Rules for making a CPP file from the main sketch (.cpe)
-PDEHEADER     = \\\#include \"WProgram.h\"
+PDEHEADER     = \\\#include \"Arduino.h\"
 
 # Expand and pick the first port
 ARD_PORT      = $(firstword $(wildcard $(ARDUINO_PORT)))
@@ -269,7 +270,7 @@
 	$(CC) -MM $(CPPFLAGS) $(ASFLAGS) $< -MF $@ -MT $(@:.d=.o)
 
 # the pde -> cpp -> o file
-$(OBJDIR)/%.cpp: %.pde
+$(OBJDIR)/%.cpp: %.ino
 	$(ECHO) $(PDEHEADER) > $@
 	$(CAT)  $< >> $@
 
ARDUINO_DIR = /usr/share/arduino
ARDUINO_VARIANT = standard

#TARGET       = CLItest
#ARDUINO_LIBS = LiquidCrystal

MCU          = atmega328p
F_CPU        = 16000000
ARDUINO_PORT = /dev/ttyACM*

AVRDUDE_ARD_PROGRAMMER = arduino
AVRDUDE_ARD_BAUDRATE   = 115200
#AVRDUDE_ARD_EXTRAOPTS  = -F

include /usr/share/arduino/Arduino.mk

Reply via email to