From b45a163b9d9c58d14f170ae386fc8377997cefbc Mon Sep 17 00:00:00 2001 From: Simon John Date: Sat, 29 Nov 2014 22:31:49 +0000 Subject: [PATCH 01/12] Removed all double-quoting except for comments/echo's Double-quoting was added in 7618da7 to allow for spaces in paths, that was a bad idea as: 1. most GNU Make functions can't handle spaces 2. it breaks variable expansion on Linux/OSX e.g. ~/sketchbook 3. Windows doesn't like double-quotes - see d5c7ed1 So basically, don't put spaces in your paths, as most Make functions can't handle them, even if escaped, and its a bit dangerous when shelling out to grep etc. Single-quoting is no better either. --- Arduino.mk | 20 ++++++++++---------- HISTORY.md | 1 + 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/Arduino.mk b/Arduino.mk index e007b19..74c28c1 100644 --- a/Arduino.mk +++ b/Arduino.mk @@ -276,7 +276,7 @@ ifndef ARDUINO_VERSION # Remove all the decimals, and right-pad with zeros, and finally grab the first 3 bytes. # Works for 1.0 and 1.0.1 VERSION_FILE := $(ARDUINO_DIR)/lib/version.txt - AUTO_ARDUINO_VERSION := $(shell [ -e "$(VERSION_FILE)" ] && cat "$(VERSION_FILE)" | sed -e 's/^[0-9]://g' -e 's/[.]//g' -e 's/$$/0000/' | head -c3) + AUTO_ARDUINO_VERSION := $(shell [ -e $(VERSION_FILE) ] && cat $(VERSION_FILE) | sed -e 's/^[0-9]://g' -e 's/[.]//g' -e 's/$$/0000/' | head -c3) ifdef AUTO_ARDUINO_VERSION ARDUINO_VERSION = $(AUTO_ARDUINO_VERSION) $(call show_config_variable,ARDUINO_VERSION,[AUTODETECTED]) @@ -343,8 +343,8 @@ ifndef ARDUINO_SKETCHBOOK endif ifneq ($(ARDUINO_PREFERENCES_PATH),) - ARDUINO_SKETCHBOOK := $(shell grep --max-count=1 --regexp="sketchbook.path=" \ - "$(ARDUINO_PREFERENCES_PATH)" | \ + ARDUINO_SKETCHBOOK := $(shell grep --max-count=1 --regexp='sketchbook.path=' \ + $(ARDUINO_PREFERENCES_PATH) | \ sed -e 's/sketchbook.path=//' ) endif @@ -549,7 +549,7 @@ endif ifndef PARSE_BOARD # result = $(call READ_BOARD_TXT, 'boardname', 'parameter') - PARSE_BOARD = $(shell grep -v "^\#" "$(BOARDS_TXT)" | grep $(1).$(2) | cut -d = -f 2 ) + PARSE_BOARD = $(shell grep -v '^\#' $(BOARDS_TXT) | grep $(1).$(2) | cut -d = -f 2 ) endif # If NO_CORE is set, then we don't have to parse boards.txt file @@ -777,11 +777,11 @@ endif ifndef ARDUINO_LIBS # automatically determine included libraries ARDUINO_LIBS += $(filter $(notdir $(wildcard $(ARDUINO_DIR)/libraries/*)), \ - $(shell sed -ne "s/^ *\# *include *[<\"]\(.*\)\.h[>\"]/\1/p" $(LOCAL_SRCS))) + $(shell sed -ne 's/^ *\# *include *[<\"]\(.*\)\.h[>\"]/\1/p' $(LOCAL_SRCS))) ARDUINO_LIBS += $(filter $(notdir $(wildcard $(ARDUINO_SKETCHBOOK)/libraries/*)), \ - $(shell sed -ne "s/^ *\# *include *[<\"]\(.*\)\.h[>\"]/\1/p" $(LOCAL_SRCS))) + $(shell sed -ne 's/^ *\# *include *[<\"]\(.*\)\.h[>\"]/\1/p' $(LOCAL_SRCS))) ARDUINO_LIBS += $(filter $(notdir $(wildcard $(USER_LIB_PATH)/*)), \ - $(shell sed -ne "s/^ *\# *include *[<\"]\(.*\)\.h[>\"]/\1/p" $(LOCAL_SRCS))) + $(shell sed -ne 's/^ *\# *include *[<\"]\(.*\)\.h[>\"]/\1/p' $(LOCAL_SRCS))) endif ######################################################################## @@ -1416,10 +1416,10 @@ size: $(TARGET_HEX) $(call avr_size,$(TARGET_ELF),$(TARGET_HEX)) show_boards: - @$(CAT) "$(BOARDS_TXT)" | grep -E "^[a-zA-Z0-9_]+.name" | sort -uf | sed 's/.name=/:/' | column -s: -t + @$(CAT) $(BOARDS_TXT) | grep -E '^[a-zA-Z0-9_]+.name' | sort -uf | sed 's/.name=/:/' | column -s: -t monitor: -ifneq ("$(MONITOR_CMD)", "putty") +ifneq ($(MONITOR_CMD), 'putty') $(MONITOR_CMD) $(call get_monitor_port) $(MONITOR_BAUDRATE) else ifneq ($(strip $(MONITOR_PARMS)),) @@ -1449,7 +1449,7 @@ generated_assembly: generate_assembly @$(ECHO) "\"generated_assembly\" target is deprecated. Use \"generate_assembly\" target instead\n\n" help_vars: - @$(CAT) "$(ARDMK_DIR)/arduino-mk-vars.md" + @$(CAT) $(ARDMK_DIR)/arduino-mk-vars.md help: @$(ECHO) "\nAvailable targets:\n\ diff --git a/HISTORY.md b/HISTORY.md index 80c48b5..cc563f6 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -37,6 +37,7 @@ I tried to give credit whenever possible. If I have missed anyone, kindly add it - Fix: Changed IDE download URL *again* for Travis-CI. (https://github.com/sej7278) - Fix: Allow avrdude to erase the chip before programming during ispload (https://github.com/tchebb) - Fix: Fix speed regression. Thanks ladislas (Issue #280) (https://github.com/sej7278) +- Fix: Removed some double quotes that were breaking variable expansion. (https://github.com/sej7278) ### 1.3.4 (2014-07-12) - Tweak: Allow spaces in "Serial.begin (....)". (Issue #190) (https://github.com/pdav) From 9c9491d1cc32d2751833182d30d265bd1b9126a9 Mon Sep 17 00:00:00 2001 From: Simon John Date: Wed, 3 Dec 2014 22:38:50 +0000 Subject: [PATCH 02/12] Moved location of avrdude and avrdude.conf for 1.5.8 on Linux (only!) Subject to change during the beta phase, as its already different than 1.5.6, also may change when packaged for Debian (usually symlinked) Fixes issue #301 --- Arduino.mk | 13 +++++++++++-- HISTORY.md | 1 + 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Arduino.mk b/Arduino.mk index 74c28c1..1e17109 100644 --- a/Arduino.mk +++ b/Arduino.mk @@ -403,11 +403,20 @@ ifndef AVR_TOOLS_DIR ifeq ($(CURRENT_OS),LINUX) ifndef AVRDUDE - AVRDUDE = $(AVR_TOOLS_DIR)/../avrdude + ifeq ($(shell expr $(ARDUINO_VERSION) '>' 157), 1) + # 1.5.8 has different location than all prior versions! + AVRDUDE = $(AVR_TOOLS_DIR)/bin/avrdude + else + AVRDUDE = $(AVR_TOOLS_DIR)/../avrdude + endif endif ifndef AVRDUDE_CONF - AVRDUDE_CONF = $(AVR_TOOLS_DIR)/../avrdude.conf + ifeq ($(shell expr $(ARDUINO_VERSION) '>' 157), 1) + AVRDUDE_CONF = $(AVR_TOOLS_DIR)/etc/avrdude.conf + else + AVRDUDE_CONF = $(AVR_TOOLS_DIR)/../avrdude.conf + endif endif else diff --git a/HISTORY.md b/HISTORY.md index cc563f6..9a8f8cd 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -23,6 +23,7 @@ I tried to give credit whenever possible. If I have missed anyone, kindly add it - Tweak: Update travis-ci to test against Arduino 1.0.6. (https://github.com/sej7278) - Tweak: Updated package instructions for Arch/Fedora/Raspbian. (https://github.com/sej7278) - Tweak: Remove $(EXTRA_XXX) variables (Issue #234) (https://github.com/ladislas) +- Tweak: Moved location of avrdude for 1.5.8 on Linux (Issue #301) (https://github.com/sej7278) - Fix: Improved Windows (Cygwin/MSYS) support (https://github.com/PeterMosmans) - Fix: Change "tinyladi" username to "ladislas" in HISTORY.md. (https://github.com/ladislas) From d998de8d84a29f1c7d5e1d9c541051ab29950b47 Mon Sep 17 00:00:00 2001 From: Phil Hord Date: Sun, 7 Dec 2014 18:40:03 -0500 Subject: [PATCH 03/12] Do not add '.' to gcc includes search path Include files are searched for in the include search path made up from, among other places, the -I switches given to the gcc compiler. The . (dot) used for the current directory is not in the search path when the IDE builds the project and does not seem to be needed in any reasonable case. Maybe it was included because someone thought it meant to "search in the same directory as the file being compiled", but I cannot tell because the switch was already included in the first commit in this repo. In any case, the current file directory is already searched by gcc before the search path is consulted, in any case, so this switch is not needed to cause this behavior. Including the "-I." switch causes compiles to fail when libraries include a header which is coincidentally named the same as one of the user headers. For example, if the user has a Udp.h file in his sketch folder, the compile will fail if it includes the EthernetUdp.h file. A simple example is the examples/WebServer code. It fails if you do this: touch examples/WebServer/Udp.h make -C examples/WebServer But it builds ok from the IDE which does not include "." in the search path. Similarly, HelloWorld fails for the same reason if you do this: touch examples/HelloWorld/Print.h make -C examples/HelloWorld Remove the -I. switch from the CPPFLAGS directive altogether to prevent this include filename confusion and to more closely model the behavior of the IDE. Fixes #303. It may also work to move the -I. to the end of the search path, but this still would compile differently from the IDE and so it is considered not to be a useful feature to retain in any case. -- I did not add a test case here because it's not clear to me how it should be added. Should I modify HelloWorld as described above, or should I add examples/TestSearchPath/ with the same files explicitly for this test? It would be clearer for me if there was an explicit "tests" directory independent from "examples". --- Arduino.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Arduino.mk b/Arduino.mk index 1e17109..b0bac01 100644 --- a/Arduino.mk +++ b/Arduino.mk @@ -967,7 +967,7 @@ endif # Using += instead of =, so that CPPFLAGS can be set per sketch level CPPFLAGS += -$(MCU_FLAG_NAME)=$(MCU) -DF_CPU=$(F_CPU) -DARDUINO=$(ARDUINO_VERSION) $(ARDUINO_ARCH_FLAG) -D__PROG_TYPES_COMPAT__ \ - -I. -I$(ARDUINO_CORE_PATH) -I$(ARDUINO_VAR_PATH)/$(VARIANT) \ + -I$(ARDUINO_CORE_PATH) -I$(ARDUINO_VAR_PATH)/$(VARIANT) \ $(SYS_INCLUDES) $(PLATFORM_INCLUDES) $(USER_INCLUDES) -Wall -ffunction-sections \ -fdata-sections From 3754e5c0126cf1989be3e70bc879d8b66ab3b65b Mon Sep 17 00:00:00 2001 From: Gabrielius Mickevicius Date: Sun, 28 Dec 2014 23:13:56 +0200 Subject: [PATCH 04/12] Let user skip MONITOR_PORT existance check Define FORCE_MONITOR_PORT to enable. Useful if one uses 'ssh root@remotemachine avrdude' instead of the usual AVRDUDE command. --- Arduino.mk | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Arduino.mk b/Arduino.mk index b0bac01..014f69b 100644 --- a/Arduino.mk +++ b/Arduino.mk @@ -1031,11 +1031,16 @@ else $(call show_config_variable,DEVICE_PATH,[AUTODETECTED]) endif -# Returns the Arduino port (first wildcard expansion) if it exists, otherwise it errors. -ifeq ($(CURRENT_OS), WINDOWS) - get_monitor_port = $(COM_STYLE_MONITOR_PORT) +ifdef FORCE_MONITOR_PORT + # Skips the DEVICE_PATH existance check. + get_monitor_port = $(DEVICE_PATH) else - get_monitor_port = $(if $(wildcard $(DEVICE_PATH)),$(firstword $(wildcard $(DEVICE_PATH))),$(error Arduino port $(DEVICE_PATH) not found!)) + # Returns the Arduino port (first wildcard expansion) if it exists, otherwise it errors. + ifeq ($(CURRENT_OS), WINDOWS) + get_monitor_port = $(COM_STYLE_MONITOR_PORT) + else + get_monitor_port = $(if $(wildcard $(DEVICE_PATH)),$(firstword $(wildcard $(DEVICE_PATH))),$(error Arduino port $(DEVICE_PATH) not found!)) + endif endif # Returns the ISP port (first wildcard expansion) if it exists, otherwise it errors. From 3442ef8e6d5170d5acb8c987c135ec6d890b045b Mon Sep 17 00:00:00 2001 From: Gabrielius Mickevicius Date: Mon, 29 Dec 2014 00:24:51 +0200 Subject: [PATCH 05/12] Let 'build.core' from boards.txt change ARDUINO_CORE_PATH This is support for https://code.google.com/p/arduino-tiny The arduino-tiny project provides a boards.txt file and a whole separate Arduino core modified to work with attinies. Arduino.mk will now switch to that core if it finds a 'build.core' parameter in boards.txt and a folder in $(ALTERNATE_CORE_PATH)/cores by that name. --- Arduino.mk | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/Arduino.mk b/Arduino.mk index 014f69b..825bc3e 100644 --- a/Arduino.mk +++ b/Arduino.mk @@ -458,12 +458,6 @@ endif ARDUINO_LIB_PATH = $(ARDUINO_DIR)/libraries $(call show_config_variable,ARDUINO_LIB_PATH,[COMPUTED],(from ARDUINO_DIR)) -ifndef ARDUINO_CORE_PATH - ARDUINO_CORE_PATH = $(ARDUINO_DIR)/hardware/$(VENDOR)/$(ARCHITECTURE)/cores/arduino - $(call show_config_variable,ARDUINO_CORE_PATH,[DEFAULT]) -else - $(call show_config_variable,ARDUINO_CORE_PATH,[USER]) -endif # 1.5.x platform dependent libs path ifndef ARDUINO_PLATFORM_LIB_PATH @@ -565,6 +559,13 @@ endif # But the user might have to define MCU, F_CPU etc ifeq ($(strip $(NO_CORE)),) + # Select a core from the 'cores' directory. Two main values: 'arduino' or + # 'robot', but can also hold 'tiny', for example, if using + # https://code.google.com/p/arduino-tiny alternate core. + ifndef CORE + CORE = $(call PARSE_BOARD,$(BOARD_TAG),build.core) + endif + # Which variant ? This affects the include path ifndef VARIANT VARIANT = $(call PARSE_BOARD,$(BOARD_TAG),build.variant) @@ -689,6 +690,25 @@ else $(call show_config_variable,OBJDIR,[USER]) endif +# Now that we have ARDUINO_DIR, VENDOR, ARCHITECTURE and CORE, +# we can set ARDUINO_CORE_PATH. +ifndef ARDUINO_CORE_PATH + ifeq ($(strip $(CORE)),) + ARDUINO_CORE_PATH = $(ARDUINO_DIR)/hardware/$(VENDOR)/$(ARCHITECTURE)/cores/arduino + $(call show_config_variable,ARDUINO_CORE_PATH,[DEFAULT]) + else + ARDUINO_CORE_PATH = $(ALTERNATE_CORE_PATH)/cores/$(CORE) + ifeq ($(wildcard $(ARDUINO_CORE_PATH)),) + ARDUINO_CORE_PATH = $(ARDUINO_DIR)/hardware/$(VENDOR)/$(ARCHITECTURE)/cores/$(CORE) + $(call show_config_variable,ARDUINO_CORE_PATH,[COMPUTED],(from ARDUINO_DIR, BOARD_TAG and boards.txt)) + else + $(call show_config_variable,ARDUINO_CORE_PATH,[COMPUTED],(from ALTERNATE_CORE_PATH, BOARD_TAG and boards.txt)) + endif + endif +else + $(call show_config_variable,ARDUINO_CORE_PATH,[USER]) +endif + ######################################################################## # Reset From a930c9983f0265247cc867ceba6e2c84f44b2889 Mon Sep 17 00:00:00 2001 From: Gabrielius Mickevicius Date: Mon, 29 Dec 2014 01:05:50 +0200 Subject: [PATCH 06/12] Example: set fuses and upload hex on remote programmer Implements two new make rules: 'net_set_fuses' executes a single ssh command, 'net_upload' pipes hex through ssh connection. The example also showcases the FORCE_MONITOR_PORT feature. --- examples/BlinkNetworkRPi/ATtinyBlink.ino | 23 +++++++++++++ examples/BlinkNetworkRPi/Makefile | 44 ++++++++++++++++++++++++ tests/script/runtests.sh | 2 +- 3 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 examples/BlinkNetworkRPi/ATtinyBlink.ino create mode 100644 examples/BlinkNetworkRPi/Makefile diff --git a/examples/BlinkNetworkRPi/ATtinyBlink.ino b/examples/BlinkNetworkRPi/ATtinyBlink.ino new file mode 100644 index 0000000..1d1566d --- /dev/null +++ b/examples/BlinkNetworkRPi/ATtinyBlink.ino @@ -0,0 +1,23 @@ +/* + Blink + Turns on an LED on for one second, then off for one second, repeatedly. + + This example code is in the public domain. + */ + +// Connect a LED to Pin 3. It might be different in different ATtiny micro controllers +int led = 3; + +// the setup routine runs once when you press reset: +void setup() { + // initialize the digital pin as an output. + pinMode(led, OUTPUT); +} + +// the loop routine runs over and over again forever: +void loop() { + digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level) + delay(1000); // wait for a second + digitalWrite(led, LOW); // turn the LED off by making the voltage LOW + delay(1000); // wait for a second +} diff --git a/examples/BlinkNetworkRPi/Makefile b/examples/BlinkNetworkRPi/Makefile new file mode 100644 index 0000000..499afd0 --- /dev/null +++ b/examples/BlinkNetworkRPi/Makefile @@ -0,0 +1,44 @@ +# Arduino Make file. Refer to https://github.com/sudar/Arduino-Makefile + +# Tested and working with a linuxspi programmer on a remote Raspberry Pi +# Refer to https://github.com/kcuzner/avrdude for linuxspi. +# Should work with ISP as well if you replace $(AVRDUDE_ARD_OPTS) with +# $(AVRDUDE_ISP_OPTS) in the net_set_fuses rule. + +# Alternate core from https://code.google.com/p/arduino-tiny +ALTERNATE_CORE = tiny +BOARD_TAG = attiny85at8 + +# Avrdude config path on the remote Raspberry Pi +AVRDUDE_CONF=/usr/local/etc/avrdude.conf + +# Skip the monitor port existance check since it's not on our machine. +FORCE_MONITOR_PORT=(defined) +MONITOR_PORT=/dev/spidev0.0 + +include ../../Arduino.mk + + +# Additional rules to use a remote Raspberry Pi programmer + +HOST = root@alarmpi +SSH_AVRDUDE = ssh $(HOST) /usr/local/bin/avrdude + +CAT_HEX = cat $(TARGET_HEX) +AVRDUDE_UPLOAD_PIPE = -U flash:w:-:i + +.PHONY: net_upload net_set_fuses + +net_upload: $(TARGET_HEX) verify_size + $(CAT_HEX) | $(SSH_AVRDUDE) $(AVRDUDE_COM_OPTS) $(AVRDUDE_ARD_OPTS) \ + $(AVRDUDE_UPLOAD_PIPE) + +net_set_fuses: +ifneq ($(strip $(AVRDUDE_ISP_FUSES_PRE)),) + $(SSH_AVRDUDE) $(AVRDUDE_COM_OPTS) $(AVRDUDE_ARD_OPTS) -e \ + $(AVRDUDE_ISP_FUSES_PRE) +endif +ifneq ($(strip $(AVRDUDE_ISP_FUSES_POST)),) + $(SSH_AVRDUDE) $(AVRDUDE_COM_OPTS) $(AVRDUDE_ARD_OPTS) \ + $(AVRDUDE_ISP_FUSES_POST) +endif diff --git a/tests/script/runtests.sh b/tests/script/runtests.sh index f45fa3f..1c54836 100755 --- a/tests/script/runtests.sh +++ b/tests/script/runtests.sh @@ -7,7 +7,7 @@ failures=() # These examples cannot be tested easily at the moment as they require # alternate cores. The MakefileExample doesn't actually contain any source code # to compile. -NON_TESTABLE_EXAMPLES=(ATtinyBlink MakefileExample TinySoftWareSerial BlinkTeensy) +NON_TESTABLE_EXAMPLES=(ATtinyBlink MakefileExample TinySoftWareSerial BlinkTeensy BlinkNetworkRPi) for dir in $TESTS_DIR/*/ do From ecb05452f789da714bf6dcdb8ddecf8d6cc4029d Mon Sep 17 00:00:00 2001 From: Gabrielius Mickevicius Date: Mon, 29 Dec 2014 01:26:55 +0200 Subject: [PATCH 07/12] Update changelog --- HISTORY.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/HISTORY.md b/HISTORY.md index 9a8f8cd..8e995f4 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -16,6 +16,7 @@ I tried to give credit whenever possible. If I have missed anyone, kindly add it - New: Support for Teensy 3.x (https://github.com/stepcut) - New: Support for PuTTY under Windows (https://github.com/PeterMosmans) - New: Add support for installation using homebrew(https://github.com/ladislas) +- New: Add support and example for flashing on a remote RPi. (https://github.com/Gaboose) - Tweak: Update Malefile-example.mk with STD flags (https://github.com/ladislas) - Tweak: Allow remove of any OBJDIR with `$(REMOVE) $(OBJDIR)`. (https://github.com/ladislas) @@ -24,6 +25,7 @@ I tried to give credit whenever possible. If I have missed anyone, kindly add it - Tweak: Updated package instructions for Arch/Fedora/Raspbian. (https://github.com/sej7278) - Tweak: Remove $(EXTRA_XXX) variables (Issue #234) (https://github.com/ladislas) - Tweak: Moved location of avrdude for 1.5.8 on Linux (Issue #301) (https://github.com/sej7278) +- Tweak: Allow 'build.core' param as found in [arduino-attiny](https://code.google.com/p/arduino-tiny/) Prospective Boards.txt. (https://github.com/Gaboose) - Fix: Improved Windows (Cygwin/MSYS) support (https://github.com/PeterMosmans) - Fix: Change "tinyladi" username to "ladislas" in HISTORY.md. (https://github.com/ladislas) From 4b4592ac3e8c941ee45db40ff1d5b6ca3bc3683d Mon Sep 17 00:00:00 2001 From: Gabrielius Mickevicius Date: Mon, 29 Dec 2014 16:23:41 +0200 Subject: [PATCH 08/12] Note on using root in BlinkNetworkRPi --- examples/BlinkNetworkRPi/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/BlinkNetworkRPi/Makefile b/examples/BlinkNetworkRPi/Makefile index 499afd0..02b7a2b 100644 --- a/examples/BlinkNetworkRPi/Makefile +++ b/examples/BlinkNetworkRPi/Makefile @@ -21,6 +21,8 @@ include ../../Arduino.mk # Additional rules to use a remote Raspberry Pi programmer +# Note that it's recommended not to use root for this task, +# but to setup spidev access on a normal user instead. HOST = root@alarmpi SSH_AVRDUDE = ssh $(HOST) /usr/local/bin/avrdude From 6d549c89aa941b2f3dd4e99de553d38223e6a06a Mon Sep 17 00:00:00 2001 From: Gabrielius Mickevicius Date: Mon, 29 Dec 2014 19:34:45 +0200 Subject: [PATCH 09/12] Tidy new arduino mk vars Add CORE and FORCE_MONITOR_PORT to arduino-mk-vars.md and FORCE_MONITOR_PORT to config print. --- Arduino.mk | 6 +++++ arduino-mk-vars.md | 42 +++++++++++++++++++++++++++++++ examples/BlinkNetworkRPi/Makefile | 2 +- 3 files changed, 49 insertions(+), 1 deletion(-) diff --git a/Arduino.mk b/Arduino.mk index 825bc3e..8c878a4 100644 --- a/Arduino.mk +++ b/Arduino.mk @@ -1051,6 +1051,12 @@ else $(call show_config_variable,DEVICE_PATH,[AUTODETECTED]) endif +ifndef FORCE_MONITOR_PORT + $(call show_config_variable,FORCE_MONITOR_PORT,[DEFAULT]) +else + $(call show_config_variable,FORCE_MONITOR_PORT,[USER]) +endif + ifdef FORCE_MONITOR_PORT # Skips the DEVICE_PATH existance check. get_monitor_port = $(DEVICE_PATH) diff --git a/arduino-mk-vars.md b/arduino-mk-vars.md index 73bed78..4003a6c 100644 --- a/arduino-mk-vars.md +++ b/arduino-mk-vars.md @@ -316,6 +316,25 @@ MONITOR_PORT = com3 ---- +### FORCE_MONITOR_PORT + +**Description:** + +Skip the MONITOR_PORT existance check. + +**Example:** + +```Makefile +# Enable +FORCE_MONITOR_PORT = true +# Disable (default) +undefine FORCE_MONITOR_PORT +``` + +**Requirement:** *Optional* + +---- + ### USER_LIB_PATH **Description:** @@ -392,6 +411,29 @@ ARDUINO_VAR_PATH = ~/sketchbook/hardware/arduino-tiny/cores/tiny ---- +### CORE + +**Description:** + +Name of the core *inside* the ALTERNATE_CORE or the standard core. + +Usually can be auto-detected as `build.core` from `boards.txt`. + +**Example:** + +```Makefile +# standard Arduino core (undefine ALTERNATE_CORE) +CORE = arduino +# or +CORE = robot +# tiny core (ALTERNATE_CORE = arduino-tiny) +CORE = tiny +``` + +**Requirement:** *Optional* + +---- + ### VARIANT **Description:** diff --git a/examples/BlinkNetworkRPi/Makefile b/examples/BlinkNetworkRPi/Makefile index 02b7a2b..15e565e 100644 --- a/examples/BlinkNetworkRPi/Makefile +++ b/examples/BlinkNetworkRPi/Makefile @@ -13,7 +13,7 @@ BOARD_TAG = attiny85at8 AVRDUDE_CONF=/usr/local/etc/avrdude.conf # Skip the monitor port existance check since it's not on our machine. -FORCE_MONITOR_PORT=(defined) +FORCE_MONITOR_PORT=true MONITOR_PORT=/dev/spidev0.0 include ../../Arduino.mk From de602e8b616469652731515adcdcd64794805670 Mon Sep 17 00:00:00 2001 From: Gabrielius Mickevicius Date: Mon, 29 Dec 2014 19:40:47 +0200 Subject: [PATCH 10/12] Typo --- HISTORY.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HISTORY.md b/HISTORY.md index 8e995f4..b7ccdd3 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -25,7 +25,7 @@ I tried to give credit whenever possible. If I have missed anyone, kindly add it - Tweak: Updated package instructions for Arch/Fedora/Raspbian. (https://github.com/sej7278) - Tweak: Remove $(EXTRA_XXX) variables (Issue #234) (https://github.com/ladislas) - Tweak: Moved location of avrdude for 1.5.8 on Linux (Issue #301) (https://github.com/sej7278) -- Tweak: Allow 'build.core' param as found in [arduino-attiny](https://code.google.com/p/arduino-tiny/) Prospective Boards.txt. (https://github.com/Gaboose) +- Tweak: Allow 'build.core' param as found in [arduino-tiny](https://code.google.com/p/arduino-tiny/) Prospective Boards.txt. (https://github.com/Gaboose) - Fix: Improved Windows (Cygwin/MSYS) support (https://github.com/PeterMosmans) - Fix: Change "tinyladi" username to "ladislas" in HISTORY.md. (https://github.com/ladislas) From e639f81b6c52b2092a4682cdc93efe5832c3e879 Mon Sep 17 00:00:00 2001 From: Gabrielius Mickevicius Date: Tue, 30 Dec 2014 17:40:15 +0200 Subject: [PATCH 11/12] Fix build.core parsing Disregard anything before first colon. E.g. build.core = arduino:arduino results in CORE = arduino Print CORE. --- Arduino.mk | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Arduino.mk b/Arduino.mk index 8c878a4..a5b9bba 100644 --- a/Arduino.mk +++ b/Arduino.mk @@ -563,7 +563,10 @@ ifeq ($(strip $(NO_CORE)),) # 'robot', but can also hold 'tiny', for example, if using # https://code.google.com/p/arduino-tiny alternate core. ifndef CORE - CORE = $(call PARSE_BOARD,$(BOARD_TAG),build.core) + CORE = $(shell echo $(call PARSE_BOARD,$(BOARD_TAG),build.core) | cut -d : -f 2) + $(call show_config_variable,CORE,[COMPUTED],(from build.core)) + else + $(call show_config_variable,CORE,[USER]) endif # Which variant ? This affects the include path From a6505e6da83f85c5a365ff7729775954bd5d51e7 Mon Sep 17 00:00:00 2001 From: Simon John Date: Thu, 1 Jan 2015 01:25:23 +0000 Subject: [PATCH 12/12] Change CXX_NAME to CXX as per the EmacsWiki for Flymake instructions. Makes it a bit more standard too. --- HISTORY.md | 1 + README.md | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/HISTORY.md b/HISTORY.md index b7ccdd3..f879f2d 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -26,6 +26,7 @@ I tried to give credit whenever possible. If I have missed anyone, kindly add it - Tweak: Remove $(EXTRA_XXX) variables (Issue #234) (https://github.com/ladislas) - Tweak: Moved location of avrdude for 1.5.8 on Linux (Issue #301) (https://github.com/sej7278) - Tweak: Allow 'build.core' param as found in [arduino-tiny](https://code.google.com/p/arduino-tiny/) Prospective Boards.txt. (https://github.com/Gaboose) +- Tweak: Replace CXX_NAME with CXX as per the Emacs Flymake Wiki (Issue #309) (https://github.com/sej7278) - Fix: Improved Windows (Cygwin/MSYS) support (https://github.com/PeterMosmans) - Fix: Change "tinyladi" username to "ladislas" in HISTORY.md. (https://github.com/ladislas) diff --git a/README.md b/README.md index 7f017b0..0d3477f 100644 --- a/README.md +++ b/README.md @@ -259,7 +259,7 @@ Then, the following line must be added to the project Makefile : ``` check-syntax: - $(CXX_NAME) -c -include Arduino.h -x c++ $(CXXFLAGS) $(CPPFLAGS) -fsyntax-only $(CHK_SOURCES) + $(CXX) -c -include Arduino.h -x c++ $(CXXFLAGS) $(CPPFLAGS) -fsyntax-only $(CHK_SOURCES) ``` ## Test Suite