ports/156143: New port: devel/arduino-mk: Build Arduino sketches from the command line

Craig Leres leres at ee.lbl.gov
Sun Apr 3 00:30:12 UTC 2011


>Number:         156143
>Category:       ports
>Synopsis:       New port: devel/arduino-mk: Build Arduino sketches from the command line
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun Apr 03 00:30:11 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator:     Craig Leres
>Release:        FreeBSD 8.2-RELEASE amd64
>Organization:
Lawrence Berkeley National Laboratory
>Environment:
	FreeBSD hot.ee.lbl.gov 8.2-RELEASE FreeBSD 8.2-RELEASE #0 r8: Tue Feb
22 19:50:59 PST 2011
leres at hot.ee.lbl.gov:/usr/src/8.2-RELEASE/sys/amd64/compile/LBLSMPIPV6
amd64

>Description:
	This new port installs a makefile that makes it possible to
	build Arduino sketches from the FreeBSD command line using
	gmake. It includes a example demo sketch that shows how to use
	it.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (FreeBSD)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk2XvksACgkQWxlAhAje3JuL0ACgjquYmyqacAxhQZUtyicgXatz
JIgAn3C+uKU76sIGO3IAoEQT9h1Y+VOS
=qhs2
-----END PGP SIGNATURE-----

--------------060301010200070600090404
Content-Type: text/plain;
 name="arduino-mk.shar"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="arduino-mk.shar"

# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	arduino-mk
#	arduino-mk/files
#	arduino-mk/files/patch-Arduino.mk
#	arduino-mk/files/Makefile
#	arduino-mk/files/blink2.pde
#	arduino-mk/Makefile
#	arduino-mk/pkg-descr
#	arduino-mk/distinfo
#
echo c - arduino-mk
mkdir -p arduino-mk > /dev/null 2>&1
echo c - arduino-mk/files
mkdir -p arduino-mk/files > /dev/null 2>&1
echo x - arduino-mk/files/patch-Arduino.mk
sed 's/^X//' >arduino-mk/files/patch-Arduino.mk << '6bd31c959ef6d251f24cf8fd4cca7681'
XThis patch:
X
X - Adds ARDUINO_LIBS support
X - Allows the user's Makefile to add to CPPFLAGS (e.g. -Werror)
X - Fixes ARDUINO_LIB_PATH
X
XEnumerating each of the libraries directories isn't elegant but it
Xworks.
X
X--- Arduino.mk	2010/07/06 03:43:35	1.1
X+++ Arduino.mk	2011/01/24 06:05:23
X@@ -5,7 +5,7 @@
X #
X # Copyright (C) 2010 Martin Oldfield <m at mjo.tc>, based on work that is
X # Copyright Nicholas Zambetti, David A. Mellis & Hernando Barragan
X-# 
X+#
X # This file is free software; you can redistribute it and/or modify it
X # under the terms of the GNU Lesser General Public License as
X # published by the Free Software Foundation; either version 2.1 of the
X@@ -58,7 +58,7 @@
X #                   this would match the .pde file, but it's not needed
X #                   here: you could always set it to xx if you wanted!
X #    ARDUINO_LIBS - A list of any libraries used by the sketch (we assume
X-#                   these are in $(ARDUINO_DIR)/hardware/libraries
X+#                   these are in $(ARDUINO_DIR)/libraries
X #    MCU,F_CPU    - The target processor description
X #    ARDUINO_PORT - The port where the Arduino can be found (only needed
X #                   when uploading
X@@ -85,7 +85,7 @@
X #
X # ARDUINO WITH OTHER TOOLS
X #
X-# If the tools aren't in the Arduino distribution, then you need to 
X+# If the tools aren't in the Arduino distribution, then you need to
X # specify their location:
X #
X #    AVR_TOOLS_PATH = /usr/bin
X@@ -100,7 +100,7 @@
X #
X #     ISP_PROG	   = -c stk500v2
X #     ISP_PORT     = /dev/ttyACM0
X-#     
X+#
X #     ISP_LOCK_FUSE_PRE  = 0x3f
X #     ISP_LOCK_FUSE_POST = 0xcf
X #     ISP_HIGH_FUSE      = 0xdf
X@@ -109,7 +109,7 @@
X #
X # I think the fuses here are fine for uploading to the ATmega168
X # without bootloader.
X-# 
X+#
X # To actually do this upload use the ispload target:
X #
X #    make ispload
X@@ -133,9 +133,11 @@
X AVRDUDE_CONF     = $(ARDUINO_ETC_PATH)/avrdude.conf
X endif
X 
X-ARDUINO_LIB_PATH  = $(ARDUINO_DIR)/hardware/libraries
X+ARDUINO_LIB_PATH  = $(ARDUINO_DIR)/libraries
X ARDUINO_CORE_PATH = $(ARDUINO_DIR)/hardware/arduino/cores/arduino
X 
X+LOCAL_LIB_PATH	= $(ARDUINO_DIR)/local/libraries
X+
X endif
X 
X # Everything gets built in here
X@@ -168,8 +170,24 @@
X endif
X endif
X 
X+# lib sources
X+ifdef ARDUINO_LIBS
X+LIB_C_SRCS	= $(wildcard $(patsubst %,$(ARDUINO_LIB_PATH)/%/*.c,$(ARDUINO_LIBS)))
X+LIB_CPP_SRCS	= $(wildcard $(patsubst %,$(ARDUINO_LIB_PATH)/%/*.cpp,$(ARDUINO_LIBS)))
X+LIB_OBJ_FILES	= $(LIB_C_SRCS:.c=.o) $(LIB_CPP_SRCS:.cpp=.o)
X+LIB_OBJS	= $(patsubst %,$(OBJDIR)/%,$(notdir $(LIB_OBJ_FILES)))
X+endif
X+
X+# local lib sources
X+ifdef LOCAL_LIBS
X+LOCAL_LIB_C_SRCS = $(wildcard $(patsubst %,$(LOCAL_LIB_PATH)/%/*.c,$(LOCAL_LIBS)))
X+LOCAL_LIB_CPP_SRCS = $(wildcard $(patsubst %,$(LOCAL_LIB_PATH)/%/*.cpp,$(LOCAL_LIBS)))
X+LOCAL_LIB_OBJ_FILES = $(LOCAL_LIB_C_SRCS:.c=.o) $(LOCAL_LIB_CPP_SRCS:.cpp=.o)
X+LOCAL_LIB_OBJS	= $(patsubst %,$(OBJDIR)/%,$(notdir $(LOCAL_LIB_OBJ_FILES)))
X+endif
X+
X # all the objects!
X-OBJS            = $(LOCAL_OBJS) $(CORE_OBJS)
X+OBJS            = $(LOCAL_OBJS) $(CORE_OBJS) $(LOCAL_LIB_OBJS) $(LIB_OBJS)
X 
X ########################################################################
X # Rules for making stuff
X@@ -201,8 +219,9 @@
X SYS_INCLUDES  = $(patsubst %,-I%,$(SYS_LIBS))
X SYS_OBJS      = $(wildcard $(patsubst %,%/*.o,$(SYS_LIBS)))
X 
X-CPPFLAGS      = -mmcu=$(MCU) -DF_CPU=$(F_CPU) \
X+CPPFLAGS      += -mmcu=$(MCU) -DF_CPU=$(F_CPU) \
X 			-I. -I$(ARDUINO_CORE_PATH) \
X+			-I$(ARDUINO_DIR) -I$(LOCAL_LIB_PATH) \
X 			$(SYS_INCLUDES) -g -Os -w -Wall \
X 			-ffunction-sections -fdata-sections
X CFLAGS        = -std=gnu99
X@@ -275,6 +294,74 @@
X $(OBJDIR)/%.o: $(ARDUINO_CORE_PATH)/%.cpp
X 	$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
X 
X+# lib files
X+$(OBJDIR)/%.o: $(ARDUINO_LIB_PATH)/EEPROM/%.c
X+	$(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
X+
X+$(OBJDIR)/%.o: $(ARDUINO_LIB_PATH)/EEPROM/%.cpp
X+	$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
X+
X+$(OBJDIR)/%.o: $(ARDUINO_LIB_PATH)/Ethernet/%.c
X+	$(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
X+
X+$(OBJDIR)/%.o: $(ARDUINO_LIB_PATH)/Ethernet/%.cpp
X+	$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
X+
X+$(OBJDIR)/%.o: $(ARDUINO_LIB_PATH)/Firmata/%.c
X+	$(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
X+
X+$(OBJDIR)/%.o: $(ARDUINO_LIB_PATH)/Firmata/%.cpp
X+	$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
X+
X+$(OBJDIR)/%.o: $(ARDUINO_LIB_PATH)/LiquidCrystal/%.c
X+	$(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
X+
X+$(OBJDIR)/%.o: $(ARDUINO_LIB_PATH)/LiquidCrystal/%.cpp
X+	$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
X+
X+$(OBJDIR)/%.o: $(ARDUINO_LIB_PATH)/Matrix/%.c
X+	$(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
X+
X+$(OBJDIR)/%.o: $(ARDUINO_LIB_PATH)/Matrix/%.cpp
X+	$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
X+
X+$(OBJDIR)/%.o: $(ARDUINO_LIB_PATH)/Servo/%.c
X+	$(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
X+
X+$(OBJDIR)/%.o: $(ARDUINO_LIB_PATH)/Servo/%.cpp
X+	$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
X+
X+$(OBJDIR)/%.o: $(ARDUINO_LIB_PATH)/SoftwareSerial/%.c
X+	$(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
X+
X+$(OBJDIR)/%.o: $(ARDUINO_LIB_PATH)/SoftwareSerial/%.cpp
X+	$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
X+
X+$(OBJDIR)/%.o: $(ARDUINO_LIB_PATH)/Sprite/%.c
X+	$(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
X+
X+$(OBJDIR)/%.o: $(ARDUINO_LIB_PATH)/Sprite/%.cpp
X+	$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
X+
X+$(OBJDIR)/%.o: $(ARDUINO_LIB_PATH)/Stepper/%.c
X+	$(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
X+
X+$(OBJDIR)/%.o: $(ARDUINO_LIB_PATH)/Stepper/%.cpp
X+	$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
X+
X+$(OBJDIR)/%.o: $(ARDUINO_LIB_PATH)/Wire/%.c
X+	$(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
X+
X+$(OBJDIR)/%.o: $(ARDUINO_LIB_PATH)/Wire/%.cpp
X+	$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
X+
X+# local lib files
X+$(OBJDIR)/%.o: $(LOCAL_LIB_PATH)/IRremote/%.c
X+	$(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
X+
X+$(OBJDIR)/%.o: $(LOCAL_LIB_PATH)/IRremote/%.cpp
X+	$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
X+
X # various object conversions
X $(OBJDIR)/%.hex: $(OBJDIR)/%.elf
X 	$(OBJCOPY) -O ihex -R .eeprom $< $@
X@@ -364,13 +451,13 @@
X # stty on MacOS likes -F, but on Debian it likes -f redirecting
X # stdin/out appears to work but generates a spurious error on MacOS at
X # least. Perhaps it would be better to just do it in perl ?
X-reset:		
X+reset:
X 		for STTYF in 'stty --file' 'stty -f' 'stty <' ; \
X 		  do $$STTYF /dev/tty >/dev/null 2>/dev/null && break ; \
X 		done ;\
X 		$$STTYF $(ARD_PORT)  hupcl ;\
X 		(sleep 0.1 || sleep 1)     ;\
X-		$$STTYF $(ARD_PORT) -hupcl 
X+		$$STTYF $(ARD_PORT) -hupcl
X 
X ispload:	$(TARGET_HEX)
X 		$(AVRDUDE) $(AVRDUDE_COM_OPTS) $(AVRDUDE_ISP_OPTS) -e \
6bd31c959ef6d251f24cf8fd4cca7681
echo x - arduino-mk/files/Makefile
sed 's/^X//' >arduino-mk/files/Makefile << 'de4f9b762917c2ea3355d4c4fc834977'
X# @(#) $Id: Makefile 75 2011-04-03 00:15:10Z leres $ (XSE)
X
XTARGET=	blink2
X
XCPPFLAGS+= -Werror
X
XMCU=	atmega328p
XF_CPU=	16000000
XAVRDUDE_ARD_PROGRAMMER= arduino
XAVRDUDE_ARD_BAUDRATE= 57600
XARDUINO_PORT=	/dev/arduino
X
X
XARDUINO_DIR=	/usr/local/arduino
XAVR_TOOLS_PATH=	/usr/local/bin
XAVRDUDE_CONF=	/usr/local/etc/avrdude.conf
X
Xinclude /usr/local/arduino-mk/Arduino.mk
de4f9b762917c2ea3355d4c4fc834977
echo x - arduino-mk/files/blink2.pde
sed 's/^X//' >arduino-mk/files/blink2.pde << '3edf1311e573efc90ce5090258bed968'
X#include <avr/io.h>
X#include <util/delay.h>
X
X/* This is a example sketch that blinks the LED like a heartbeat */
X
Xvoid
Xsetup()
X{
X	/* set PORTB for LED output */
X	DDRB = 0xFF;
X}
X
Xvoid
Xloop()
X{
X	while (1) {
X		/* set PORTB.6 high */
X		PORTB = 0x20;
X
X		delay(25);
X
X		/* set PORTB.6 low */
X		PORTB = 0x00;
X
X		delay(50);
X
X		/* set PORTB.6 high */
X		PORTB = 0x20;
X
X		delay(25);
X
X		/* set PORTB.6 low */
X		PORTB = 0x00;
X
X		delay(900);
X	}
X}
3edf1311e573efc90ce5090258bed968
echo x - arduino-mk/Makefile
sed 's/^X//' >arduino-mk/Makefile << '569d5c63b963f28d96033288ef2ed8bf'
X# New ports collection makefile for:	arduino-mk
X# Date created:		27 Feb 2011
X# Whom:			Craig Leres <leres at ee.lbl.gov>
X#
X# $FreeBSD$
X#
X
XPORTNAME=	arduino-mk
XPORTVERSION=	0.4
XCATEGORIES=	devel
XMASTER_SITES=	http://mjo.tc/atelier/2009/02/acli/
XDISTNAME=	${PORTNAME}_${PORTVERSION}
X
XMAINTAINER=	leres at ee.lbl.gov
XCOMMENT=	Build Arduino sketches from the command line
X
X# Uses gmake at run time but not for building
XRUN_DEPENDS=	gmake:${PORTSDIR}/devel/gmake \
X		avr-libc:${PORTSDIR}/devel/avr-libc
X
XWRKSRC=		${WRKDIR}/${PORTNAME}-${PORTVERSION}
X
XNO_BUILD=	yes
X
XPLIST_FILES=	${PORTNAME}/Arduino.mk
XPLIST_DIRS=	${PORTNAME}
X
X.if !defined(NOPORTEXAMPLES)
XPLIST_FILES+=	${EXAMPLESDIR_REL}/Makefile \
X		${EXAMPLESDIR_REL}/blink2.pde
XPLIST_DIRS+=	${EXAMPLESDIR_REL}
X.endif
X
Xdo-install:
X	${MKDIR} ${PREFIX}/${PORTNAME}
X	${INSTALL_DATA} ${WRKSRC}/Arduino.mk ${PREFIX}/${PORTNAME}
X.if !defined(NOPORTEXAMPLES)
X	${MKDIR} ${EXAMPLESDIR}
X	${INSTALL_DATA} ${FILESDIR}/Makefile ${EXAMPLESDIR}
X	${INSTALL_DATA} ${FILESDIR}/blink2.pde ${EXAMPLESDIR}
X.endif
X
XLICENSE=	LGPL21
X
X.include <bsd.port.mk>
569d5c63b963f28d96033288ef2ed8bf
echo x - arduino-mk/pkg-descr
sed 's/^X//' >arduino-mk/pkg-descr << 'eb067cb6f699b1abb623b1b22a95dd07'
XArduino from the command line
X
XThis is a makefile that makes it possible to build Arduino sketches
Xwith gmake. An example sketch that is built from a makefile is
Xinclude; it is installed in share/examples/arduino-mk
X
XWWW: http://mjo.tc/atelier/2009/02/arduino-cli.html
eb067cb6f699b1abb623b1b22a95dd07
echo x - arduino-mk/distinfo
sed 's/^X//' >arduino-mk/distinfo << '1348d74bd6af156be5aa4ec47e213d7a'
XSHA256 (arduino-mk_0.4.tar.gz) = faa384a71c649d689b71241613227fc7b5f4c91920a002d0fb76ed47b269aae8
XSIZE (arduino-mk_0.4.tar.gz) = 13152
1348d74bd6af156be5aa4ec47e213d7a
exit


--------------060301010200070600090404
Content-Type: application/octet-stream;
 name="arduino-mk.shar.sig"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
 filename="arduino-mk.shar.sig"

iEYEABECAAYFAk2XvksACgkQWxlAhAje3JskrwCggPzd4B7qhEuqWAifhascmd8h0O8Amwfu
qPBz29il5E5r6HDcTqInz1mo
--------------060301010200070600090404--
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
 This is a multi-part message in MIME format.
 --------------060301010200070600090404
 Content-Type: text/plain; charset=ISO-8859-1
 Content-Transfer-Encoding: 7bit
 
 -----BEGIN PGP SIGNED MESSAGE-----
 Hash: SHA1
 



More information about the freebsd-ports-bugs mailing list