Merge pull request #640 from tuna-f1sh/travis

Fix Travis CI, add SAMD test support, support GNU grep on macOS
This commit is contained in:
Sudar Muthu 2020-09-03 07:22:54 +05:30 committed by GitHub
commit e6881e2a43
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 311 additions and 100 deletions

View file

@ -1,6 +1,15 @@
sudo: required os: linux
dist: xenial
language: c language: c
compiler: compiler:
- gcc - gcc
script: tests/script/runtests.sh script: tests/script/runtests.sh
before_install: tests/script/bootstrap.sh before_install: tests/script/bootstrap.sh
addons:
apt:
packages:
- "python3"
- "python3-pip"
env:
global:
- ARDMK_DIR=$TRAVIS_BUILD_DIR

View file

@ -853,15 +853,15 @@ endif
# Reset # Reset
ifndef RESET_CMD ifndef RESET_CMD
ARD_RESET_ARDUINO := $(shell which ard-reset-arduino 2> /dev/null) ARD_RESET_ARDUINO := $(PYTHON_CMD) $(shell which ard-reset-arduino 2> /dev/null)
ifndef ARD_RESET_ARDUINO ifndef ARD_RESET_ARDUINO
# same level as *.mk in bin directory when checked out from git # same level as *.mk in bin directory when checked out from git
# or in $PATH when packaged # or in $PATH when packaged
ARD_RESET_ARDUINO = $(ARDMK_DIR)/bin/ard-reset-arduino ARD_RESET_ARDUINO = $(PYTHON_CMD) $(ARDMK_DIR)/bin/ard-reset-arduino
endif endif
ifneq (,$(findstring CYGWIN,$(shell uname -s))) ifneq (,$(findstring CYGWIN,$(shell uname -s)))
# confirm user is using default cygwin unix Python (which uses ttySx) and not Windows Python (which uses COMx) # confirm user is using default cygwin unix Python (which uses ttySx) and not Windows Python (which uses COMx)
ifeq ($(shell which python),/usr/bin/python) ifeq ($(PYTHON_CMD),/usr/bin/python)
RESET_CMD = $(ARD_RESET_ARDUINO) $(ARD_RESET_OPTS) $(DEVICE_PATH) RESET_CMD = $(ARD_RESET_ARDUINO) $(ARD_RESET_OPTS) $(DEVICE_PATH)
else else
RESET_CMD = $(ARD_RESET_ARDUINO) $(ARD_RESET_OPTS) $(call get_monitor_port) RESET_CMD = $(ARD_RESET_ARDUINO) $(ARD_RESET_OPTS) $(call get_monitor_port)
@ -1227,15 +1227,24 @@ CFLAGS += $(CFLAGS_STD)
CXXFLAGS += -fpermissive -fno-exceptions $(CXXFLAGS_STD) CXXFLAGS += -fpermissive -fno-exceptions $(CXXFLAGS_STD)
ASFLAGS += -x assembler-with-cpp ASFLAGS += -x assembler-with-cpp
DIAGNOSTICS_COLOR_WHEN ?= always DIAGNOSTICS_COLOR_WHEN ?= always
ifeq ($(shell expr $(CC_VERNUM) '>' 490), 1)
ASFLAGS += -flto # Flags for AVR
CXXFLAGS += -fno-threadsafe-statics -flto -fno-devirtualize -fdiagnostics-color=$(DIAGNOSTICS_COLOR_WHEN) ifeq ($(findstring avr, $(strip $(CC_NAME))), avr)
CFLAGS += -flto -fno-fat-lto-objects -fdiagnostics-color=$(DIAGNOSTICS_COLOR_WHEN) ifeq ($(shell expr $(CC_VERNUM) '>' 490), 1)
ASFLAGS += -flto
CXXFLAGS += -fno-threadsafe-statics -flto -fno-devirtualize -fdiagnostics-color=$(DIAGNOSTICS_COLOR_WHEN)
CFLAGS += -flto -fno-fat-lto-objects -fdiagnostics-color=$(DIAGNOSTICS_COLOR_WHEN)
LDFLAGS += -flto -fuse-linker-plugin
endif
# Flags for ARM (most set in Sam.mk)
else
ifeq ($(shell expr $(CC_VERNUM) '>' 490), 1)
CXXFLAGS += -fdiagnostics-color=$(DIAGNOSTICS_COLOR_WHEN)
CFLAGS += -fdiagnostics-color=$(DIAGNOSTICS_COLOR_WHEN)
endif
endif endif
LDFLAGS += -$(MCU_FLAG_NAME)=$(MCU) -Wl,--gc-sections -O$(OPTIMIZATION_LEVEL) LDFLAGS += -$(MCU_FLAG_NAME)=$(MCU) -Wl,--gc-sections -O$(OPTIMIZATION_LEVEL)
ifeq ($(shell expr $(CC_VERNUM) '>' 490), 1)
LDFLAGS += -flto -fuse-linker-plugin
endif
SIZEFLAGS ?= --mcu=$(MCU) -C SIZEFLAGS ?= --mcu=$(MCU) -C
# for backwards compatibility, grab ARDUINO_PORT if the user has it set # for backwards compatibility, grab ARDUINO_PORT if the user has it set

View file

@ -8,8 +8,8 @@ dir_if_exists = $(if $(wildcard $(1)$(2)),$(1))
# result = $(call READ_BOARD_TXT, 'boardname', 'parameter') # result = $(call READ_BOARD_TXT, 'boardname', 'parameter')
PARSE_BOARD = $(shell if [ -f $(BOARDS_TXT) ]; \ PARSE_BOARD = $(shell if [ -f $(BOARDS_TXT) ]; \
then \ then \
grep -Ev '^\#' $(BOARDS_TXT) | \ $(GREP_CMD) -Ev '^\#' $(BOARDS_TXT) | \
grep -E "^[ \t]*$(1).$(2)=" | \ $(GREP_CMD) -E "^[ \t]*$(1).$(2)=" | \
cut -d = -f 2- | \ cut -d = -f 2- | \
cut -d : -f 2; \ cut -d : -f 2; \
fi) fi)
@ -45,15 +45,24 @@ $(call arduino_output,$(call ardmk_include) Configuration:)
######################################################################## ########################################################################
# #
# Detect OS # Detect OS
ifeq ($(OS),Windows_NT) ifeq ($(OS),Windows_NT)
CURRENT_OS = WINDOWS CURRENT_OS = WINDOWS
GREP_CMD = grep
else else
UNAME_S := $(shell uname -s) UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux) ifeq ($(UNAME_S),Linux)
CURRENT_OS = LINUX CURRENT_OS = LINUX
GREP_CMD = grep
endif endif
ifeq ($(UNAME_S),Darwin) ifeq ($(UNAME_S),Darwin)
CURRENT_OS = MAC CURRENT_OS = MAC
ifeq (, $(shell which ggrep))
echo $(info Using macOS BSD grep, please install GNU grep to avoid warnings)
GREP_CMD = grep
else
GREP_CMD = ggrep
endif
endif endif
endif endif
$(call show_config_variable,CURRENT_OS,[AUTODETECTED]) $(call show_config_variable,CURRENT_OS,[AUTODETECTED])
@ -64,12 +73,20 @@ $(call show_config_variable,CURRENT_OS,[AUTODETECTED])
ifneq ($(TEST),) ifneq ($(TEST),)
DEPENDENCIES_DIR = /var/tmp/Arduino-Makefile-testing-dependencies DEPENDENCIES_DIR = /var/tmp/Arduino-Makefile-testing-dependencies
DEPENDENCIES_MPIDE_DIR = $(DEPENDENCIES_DIR)/mpide-0023-linux64-20130817-test DEPENDENCIES_MPIDE_DIR := $(shell find $(DEPENDENCIES_DIR) -name 'mpide-0023-*' -type d -exec ls -dt {} + | head -n 1)
ifeq ($(MPIDE_DIR),) ifeq ($(MPIDE_DIR),)
MPIDE_DIR = $(DEPENDENCIES_MPIDE_DIR) MPIDE_DIR = $(DEPENDENCIES_MPIDE_DIR)
endif endif
DEPENDENCIES_ARDUINO_DIR = $(DEPENDENCIES_DIR)/arduino-1.0.6 ifndef ARDUINO_IDE_DIR
ifeq ($(CURRENT_OS),MAC)
ARDUINO_IDE_DIR = Arduino.app/Contents/Resources/Java
else
ARDUINO_IDE_DIR := $(shell basename $(basename $(basename $(lastword $(wildcard $(DEPENDENCIES_DIR)/arduino*)))))
endif
endif
DEPENDENCIES_ARDUINO_DIR = $(DEPENDENCIES_DIR)/$(ARDUINO_IDE_DIR)
ifeq ($(ARDUINO_DIR),) ifeq ($(ARDUINO_DIR),)
ARDUINO_DIR = $(DEPENDENCIES_ARDUINO_DIR) ARDUINO_DIR = $(DEPENDENCIES_ARDUINO_DIR)
endif endif
@ -98,3 +115,24 @@ ifeq ($(CURRENT_OS),WINDOWS)
echo $(error On Windows, ARDUINO_DIR and other defines must use forward slash and not contain spaces, special characters or be cygdrive relative) echo $(error On Windows, ARDUINO_DIR and other defines must use forward slash and not contain spaces, special characters or be cygdrive relative)
endif endif
endif endif
########################################################################
# System Python
ifndef PYTHON_CMD
# try for Python 3 first
PYTHON_CMD := $(shell which python3 2> /dev/null)
ifdef PYTHON_CMD
$(call show_config_variable,PYTHON_CMD,[AUTODETECTED])
else
# fall-back to any Python
PYTHON_CMD := $(shell which python 2> /dev/null)
ifdef PYTHON_CMD
$(call show_config_variable,PYTHON_CMD,[AUTODETECTED])
else
echo $(error "Unable to find system Python! Utility scipts won't work. Override this error by defining PYTHON_CMD")
endif
endif
else
$(call show_config_variable,PYTHON_CMD,[USER])
endif

View file

@ -12,12 +12,14 @@ I tried to give credit whenever possible. If I have missed anyone, kindly add it
- Fix: recognize serial monitors with full path in MONITOR_CMD - Fix: recognize serial monitors with full path in MONITOR_CMD
- Fix: Grab USB_PRODUCT and USB_MANUFACTURER from boards.txt for 32u4 boards (issue #594). - Fix: Grab USB_PRODUCT and USB_MANUFACTURER from boards.txt for 32u4 boards (issue #594).
- Fix: Show the configuration when ARDUINO_QUIET=0 - Fix: Show the configuration when ARDUINO_QUIET=0
- Fix: Travis build and bring Arduino IDE upto date
- Tweak: Move chip erase flag from set_fuses to ispload to prevent sketch being nuked when setting fuses - Tweak: Move chip erase flag from set_fuses to ispload to prevent sketch being nuked when setting fuses
- Tweak: Set ARDMK_VERSION to 1.6 (https://github.com/sej7278) - Tweak: Set ARDMK_VERSION to 1.6 (https://github.com/sej7278)
- Tweak: Move non-standard-related items from CxxFLAGS_STD to CxxFLAGS (issue #523) (https://github.com/sej7278) - Tweak: Move non-standard-related items from CxxFLAGS_STD to CxxFLAGS (issue #523) (https://github.com/sej7278)
- Tweak: Update Windows usage documentation and allow non-relative paths (issue #519) (https://github.com/tuna-f1sh) - Tweak: Update Windows usage documentation and allow non-relative paths (issue #519) (https://github.com/tuna-f1sh)
- Tweak: Support Cygwin Unix Python and Windows installation on Windows to pass correct port binding. (https://github.com/tuna-f1sh) - Tweak: Support Cygwin Unix Python and Windows installation on Windows to pass correct port binding. (https://github.com/tuna-f1sh)
- Tweak: Update how avr-size is called on Sam, also moved to gnu11 std (issue #602) (https://github.com/tuna-f1sh) - Tweak: Update how avr-size is called on Sam, also moved to gnu11 std (issue #602) (https://github.com/tuna-f1sh)
- Tweak: Detect most recent toolchain if multiple found, add `*_VER` variable to override (issue #611) (https://github.com/tuna-f1sh)
- New: Added -fdiagnostics-color to \*STD flags (https://github.com/sej7278) - New: Added -fdiagnostics-color to \*STD flags (https://github.com/sej7278)
- New: Made -fdiagnostics-color take a variiable DIAGNOSTICS_COLOR_WHEN: never, always, auto. (https://github.com/wingunder) - New: Made -fdiagnostics-color take a variiable DIAGNOSTICS_COLOR_WHEN: never, always, auto. (https://github.com/wingunder)
- New: Add generation of tags file using ctags, which automatically includes project libs and Arduino core. (https://github.com/tuna-f1sh) - New: Add generation of tags file using ctags, which automatically includes project libs and Arduino core. (https://github.com/tuna-f1sh)
@ -32,6 +34,7 @@ I tried to give credit whenever possible. If I have missed anyone, kindly add it
- New: Updated Arch instructions. (https://github.com/Akram-Chehaima) - New: Updated Arch instructions. (https://github.com/Akram-Chehaima)
- New: Add support for Robotis OpenCR 1.0 boards. - New: Add support for Robotis OpenCR 1.0 boards.
- New: Build the ArduinoCore API - New: Build the ArduinoCore API
- New: Support for Python 3 and multi-os Python installation using new PYTHON_CMD variable.
### 1.6.0 (2017-07-11) ### 1.6.0 (2017-07-11)
- Fix: Allowed for SparkFun's weird usb pid/vid submenu shenanigans (issue #499). (https://github.com/sej7278) - Fix: Allowed for SparkFun's weird usb pid/vid submenu shenanigans (issue #499). (https://github.com/sej7278)

View file

@ -83,14 +83,14 @@ installer or download the distribution zip file and extract it.
The Makefile also delegates resetting the board to a short Python program. The Makefile also delegates resetting the board to a short Python program.
You'll need to install [`pySerial`](https://pypi.python.org/pypi/pyserial) to use it though. You'll need to install [`pySerial`](https://pypi.python.org/pypi/pyserial) to use it though.
On most systems you should be able to install it using either `pip` or `easy_install`. On most systems you should be able to install it using either `pip3` or `easy_install3`.
```sh ```sh
pip install pyserial pip3 install pyserial
# or if you prefer easy_install # or if you prefer easy_install
easy_install -U pyserial easy_install3 -U pyserial
``` ```
If you prefer to install it as a package, then you can do that as well. If you prefer to install it as a package, then you can do that as well.
@ -98,23 +98,19 @@ If you prefer to install it as a package, then you can do that as well.
On Debian or Ubuntu: On Debian or Ubuntu:
```sh ```sh
apt-get install python-serial apt-get install python3-serial
``` ```
On Fedora: On Fedora:
```sh ```sh
yum install pyserial dnf install python3-pyserial
# or on Fedora 22+
dnf install pyserial
``` ```
On openSUSE: On openSUSE:
```sh ```sh
zypper install python-serial zypper install python3-serial
``` ```
On Arch: On Arch:
@ -123,15 +119,16 @@ On Arch:
sudo pacman -S python-pyserial sudo pacman -S python-pyserial
``` ```
On Mac using MacPorts: On macOS using Homebrew (one can install to System Python but this is not recommend or good practice):
```sh ```sh
sudo port install py27-serial brew install python
pip3 install pyserial
``` ```
On Windows: On Windows:
You need to install Cygwin and its packages for Make, Perl, Python2 and the following Serial library. You need to install Cygwin and its packages for Make, Perl, Python3 and the following Serial library.
Assuming you included Python in your Cygwin installation: Assuming you included Python in your Cygwin installation:
@ -141,15 +138,15 @@ Assuming you included Python in your Cygwin installation:
4. build and install Python module: 4. build and install Python module:
``` ```
python setup.py build python3 setup.py build
python setup.py install python3 setup.py install
``` ```
Alternatively, if you have setup Cygwin to use a Windows Python installation, Alternatively, if you have setup Cygwin to use a Windows Python installation,
simply install using pip: simply install using pip:
``` ```
pip install pyserial pip3 install pyserial
``` ```
Arduino-Makefile should automatically detect the Python installation type and Arduino-Makefile should automatically detect the Python installation type and

42
Sam.mk
View file

@ -31,6 +31,16 @@ ifndef COMMON_INCLUDED
include $(ARDMK_DIR)/Common.mk include $(ARDMK_DIR)/Common.mk
endif endif
ifneq ($(TEST),)
CORE_VER = 1.8.6
CMSIS_VER = 4.5.0
CMSIS_ATMEL_VER = 1.2.0
ALTERNATE_CORE_PATH = $(DEPENDENCIES_DIR)/samd
CMSIS_DIR = $(DEPENDENCIES_DIR)/CMSIS/CMSIS
CMSIS_ATMEL_DIR = $(DEPENDENCIES_DIR)/CMSIS-Atmel/CMSIS
ARM_TOOLS_DIR := $(basename $(basename $(firstword $(wildcard $(DEPENDENCIES_DIR)/gcc-arm-none-eabi*))))
endif
ifndef ARDUINO_PACKAGE_DIR ifndef ARDUINO_PACKAGE_DIR
# attempt to find based on Linux, macOS and Windows default # attempt to find based on Linux, macOS and Windows default
ARDUINO_PACKAGE_DIR := $(firstword \ ARDUINO_PACKAGE_DIR := $(firstword \
@ -160,14 +170,6 @@ ifeq ($(findstring arduino_due, $(strip $(VARIANT))), arduino_due)
SAM_CORE_C_SRCS += $(wildcard $(SAM_SYSTEM_PATH)/source/*.c) SAM_CORE_C_SRCS += $(wildcard $(SAM_SYSTEM_PATH)/source/*.c)
endif endif
# Use arm-toolchain from Arduino install if exists and user has not defined global version
ifndef ARM_TOOLS_DIR
ARM_TOOLS_DIR = $(call dir_if_exists,$(wildcard $(ARDUINO_PACKAGE_DIR)/$(ARDMK_VENDOR)/tools/$(TOOL_PREFIX)-gcc/*))
$(call show_config_variable,ARM_TOOLS_DIR,[COMPUTED],(from ARDUINO_PACKAGE_DIR))
else
$(call show_config_variable,ARM_TOOLS_DIR,[USER])
endif
# define plaform lib dir from Arduino ARM support # define plaform lib dir from Arduino ARM support
ifndef ARDUINO_PLATFORM_LIB_PATH ifndef ARDUINO_PLATFORM_LIB_PATH
ARDUINO_PLATFORM_LIB_PATH := $(ALTERNATE_CORE_PATH)/libraries ARDUINO_PLATFORM_LIB_PATH := $(ALTERNATE_CORE_PATH)/libraries
@ -179,6 +181,20 @@ endif
TOOL_PREFIX = arm-none-eabi TOOL_PREFIX = arm-none-eabi
# Use arm-toolchain from Arduino package install if exists and user has not defined global version
# if undefined, AVR_TOOLS_DIR will resolve in Arduino.mk as a last resort as Arduino now installs with arm-gcc
ifndef ARM_TOOLS_DIR
ifndef ARM_TOOLS_VER
ARM_TOOLS_VER := $(shell basename $(lastword $(wildcard $(ARDUINO_PACKAGE_DIR)/$(ARDMK_VENDOR)/tools/$(TOOL_PREFIX)-gcc/*)))
endif
ARM_TOOLS_DIR = $(ARDUINO_PACKAGE_DIR)/$(ARDMK_VENDOR)/tools/$(TOOL_PREFIX)-gcc/$(ARM_TOOLS_VER)
ifdef ARM_TOOLS_DIR
$(call show_config_variable,ARM_TOOLS_DIR,[COMPUTED],(from ARDUINO_PACKAGE_DIR))
endif
else
$(call show_config_variable,ARM_TOOLS_DIR,[USER])
endif
ifndef GDB_NAME ifndef GDB_NAME
GDB_NAME := $(call PARSE_BOARD,$(BOARD_TAG),build.command.gdb) GDB_NAME := $(call PARSE_BOARD,$(BOARD_TAG),build.command.gdb)
ifndef GDB_NAME ifndef GDB_NAME
@ -246,7 +262,9 @@ ifndef OPENOCD
BUNDLED_OPENOCD_DIR := $(call dir_if_exists,$(ARDUINO_PACKAGE_DIR)/$(ARDMK_VENDOR)/tools/openocd) BUNDLED_OPENOCD_DIR := $(call dir_if_exists,$(ARDUINO_PACKAGE_DIR)/$(ARDMK_VENDOR)/tools/openocd)
# Try Arduino support package first # Try Arduino support package first
ifdef BUNDLED_OPENOCD_DIR ifdef BUNDLED_OPENOCD_DIR
OPENOCD_VER := $(shell basename $(wildcard $(BUNDLED_OPENOCD_DIR)/*)) ifndef OPENOCD_VER
OPENOCD_VER := $(shell basename $(lastword $(wildcard $(BUNDLED_OPENOCD_DIR)/*)))
endif
OPENOCD = $(BUNDLED_OPENOCD_DIR)/$(OPENOCD_VER)/bin/openocd -s $(BUNDLED_OPENOCD_DIR)/$(OPENOCD_VER)/share/openocd/scripts/ OPENOCD = $(BUNDLED_OPENOCD_DIR)/$(OPENOCD_VER)/bin/openocd -s $(BUNDLED_OPENOCD_DIR)/$(OPENOCD_VER)/share/openocd/scripts/
$(call show_config_variable,OPENOCD,[AUTODETECTED],(from ARDUINO_PACKAGE_DIR)) $(call show_config_variable,OPENOCD,[AUTODETECTED],(from ARDUINO_PACKAGE_DIR))
else else
@ -271,7 +289,9 @@ ifndef BOSSA
BUNDLED_BOSSA_DIR := $(call dir_if_exists,$(ARDUINO_PACKAGE_DIR)/$(ARDMK_VENDOR)/tools/bossac) BUNDLED_BOSSA_DIR := $(call dir_if_exists,$(ARDUINO_PACKAGE_DIR)/$(ARDMK_VENDOR)/tools/bossac)
# Try Arduino support package first # Try Arduino support package first
ifdef BUNDLED_BOSSA_DIR ifdef BUNDLED_BOSSA_DIR
BOSSA_VER := $(shell basename $(wildcard $(BUNDLED_BOSSA_DIR)/*)) ifndef BOSSA_VER
BOSSA_VER := $(shell basename $(lastword $(wildcard $(BUNDLED_BOSSA_DIR)/*)))
endif
BOSSA = $(BUNDLED_BOSSA_DIR)/$(BOSSA_VER)/bossac BOSSA = $(BUNDLED_BOSSA_DIR)/$(BOSSA_VER)/bossac
$(call show_config_variable,BOSSA,[AUTODETECTED],(from ARDUINO_PACKAGE_DIR)) $(call show_config_variable,BOSSA,[AUTODETECTED],(from ARDUINO_PACKAGE_DIR))
else else
@ -394,7 +414,7 @@ CFLAGS_STD += -std=gnu11
CPPFLAGS += -DMD -D$(USB_TYPE) '-DUSB_PRODUCT=$(USB_PRODUCT)' '-DUSB_MANUFACTURER=$(USB_MANUFACTURER)' CPPFLAGS += -DMD -D$(USB_TYPE) '-DUSB_PRODUCT=$(USB_PRODUCT)' '-DUSB_MANUFACTURER=$(USB_MANUFACTURER)'
# Get extra define flags from boards.txt # Get extra define flags from boards.txt
EXFLAGS := $(shell echo $(call PARSE_BOARD,$(BOARD_TAG),build.extra_flags) | grep -oE '(-D)\w+') EXFLAGS := $(shell echo $(call PARSE_BOARD,$(BOARD_TAG),build.extra_flags) | $(GREP_CMD) -oE '(-D)\w+')
# Strip only defines from extra flags as boards file appends user {build.usb} # Strip only defines from extra flags as boards file appends user {build.usb}
CPPFLAGS += $(EXFLAGS) CPPFLAGS += $(EXFLAGS)

View file

@ -97,6 +97,25 @@ ARM_TOOLS_DIR =
---- ----
### ARM_TOOLS_VER
**Description:**
Sub-directory where the arm toolchain is installed - usually the tool version.
Can usually be detected from `$ARDUINO_PACKAGE_DIR` /tools subdirectory when ARM
device support is installed. Will resolve latest version if multiple found.
**Example:**
```Makefile
ARM_TOOLS_VER = 7-2017q4
```
**Requirement:** *Optional*
----
### RESET_CMD ### RESET_CMD
**Description:** **Description:**
@ -115,6 +134,38 @@ RESET_CMD = $(HOME)/gertduino/reset
---- ----
### PYTHON_CMD
**Description:**
Path to Python binary. Requires pyserial module installed. Makefile will error if unable to auto-find as utility scripts will not work. To override this, give it an empty define.
**Example:**
```Makefile
PYTHON_CMD = /usr/bin/python3
```
**Requirement:** *Optional*
----
### GREP_CMD
**Description:**
Path to GNU grep binary. Only added for macOS, which has BSD grep by default but results in some parsing warnings. macOS users should install GNU grep using Homebrew.
**Example:**
```Makefile
GREP_CMD = /bin/grep
```
**Requirement:** *Optional*
----
## Arduino IDE variables ## Arduino IDE variables
### ARDUINO_DIR ### ARDUINO_DIR
@ -1816,6 +1867,16 @@ device support is installed.
---- ----
### BOSSA_VER
**Description:**
`bossa` sub-directory - usually the tool version. Will auto-detect to highest version found.
**Requirement:** *Optional*
----
### BOSSA_OPTS ### BOSSA_OPTS
**Description:** **Description:**
@ -1841,6 +1902,16 @@ device support is installed.
---- ----
### OPENOCD_VER
**Description:**
`openocd` sub-directory - usually the tool version. Will auto-detect to highest version found.
**Requirement:** *Optional*
----
### OPENOCD_OPTS ### OPENOCD_OPTS
**Description:** **Description:**

View file

@ -1,18 +1,11 @@
#!/usr/bin/env python #!/usr/bin/python3
from __future__ import print_function
import serial import serial
import serial.tools.list_ports import serial.tools.list_ports
import os.path import os.path
import argparse import argparse
from time import sleep from time import sleep
pyserial_version = None
try:
pyserial_version = int(serial.VERSION[0])
except:
pyserial_version = 2 # less than 2.3
parser = argparse.ArgumentParser(description='Reset an Arduino') parser = argparse.ArgumentParser(description='Reset an Arduino')
parser.add_argument('--zero', action='store_true', help='Reset Arduino Zero or similar Native USB to enter bootloader') parser.add_argument('--zero', action='store_true', help='Reset Arduino Zero or similar Native USB to enter bootloader')
parser.add_argument('--caterina', action='store_true', help='Reset a Leonardo, Micro, Robot or LilyPadUSB.') parser.add_argument('--caterina', action='store_true', help='Reset a Leonardo, Micro, Robot or LilyPadUSB.')
@ -65,11 +58,7 @@ if args.zero:
ser = serial.Serial(args.port[0], 57600) ser = serial.Serial(args.port[0], 57600)
ser.close() ser.close()
ser.baudrate = 1200
if pyserial_version < 3:
ser.setBaudrate(1200)
else:
ser.baudrate = 1200
# do the open/close at 1200 BAUD # do the open/close at 1200 BAUD
ser.open() ser.open()
@ -100,7 +89,7 @@ if args.zero:
# check if a new port has attached and return the index if it has # check if a new port has attached and return the index if it has
port_index = new_port(initial_ports, reset_ports) port_index = new_port(initial_ports, reset_ports)
# return the new port if detected, otherwise return passed port # return the new port if detected, otherwise return passed port
if port_index is -1: if port_index == -1:
bootloader_port = args.port[0] bootloader_port = args.port[0]
else: else:
bootloader_port = reset_ports[port_index] bootloader_port = reset_ports[port_index]

View file

@ -1,4 +1,5 @@
#!/usr/bin/env python #!/usr/bin/python3
""" """
Arduino-mk Makefile and project initialiser Arduino-mk Makefile and project initialiser
@ -17,7 +18,6 @@ Example:
See `armk-init --help` for CLI arguments See `armk-init --help` for CLI arguments
""" """
from __future__ import print_function
import os import os
import argparse import argparse
@ -54,7 +54,7 @@ PARSER.add_argument('--cli', action='store_true', help='run with user prompts (r
PARSER.add_argument('-P', '--project', action='store_true', PARSER.add_argument('-P', '--project', action='store_true',
help='create boilerplate project with src, lib and bin folder structure') help='create boilerplate project with src, lib and bin folder structure')
PARSER.add_argument('-t', '--template', action='store_true', PARSER.add_argument('-t', '--template', action='store_true',
help='create bare minimum Arduino source file') help='create bare minimum Arduino source file')
PARSER.add_argument('-V', '--version', action='version', version='%(prog)s '+ VERSION) PARSER.add_argument('-V', '--version', action='version', version='%(prog)s '+ VERSION)
ARGS = PARSER.parse_args() ARGS = PARSER.parse_args()

View file

@ -1,8 +1,8 @@
#!/usr/bin/python #!/usr/bin/python3
# This script sends a program on a robotis board (OpenCM9.04 or CM900) # This script sends a program on a robotis board (OpenCM9.04 or CM900)
# using the robotis bootloader (used in OpenCM IDE) # using the robotis bootloader (used in OpenCM IDE)
# #
# Usage: # Usage:
# python robotis-loader.py <serial port> <binary> # python robotis-loader.py <serial port> <binary>
# #

View file

@ -1,6 +1,6 @@
Name: arduino-mk Name: arduino-mk
Version: 1.6.0 Version: 1.6.0
Release: 1%{dist} Release: 2%{dist}
Summary: Program your Arduino from the command line Summary: Program your Arduino from the command line
Packager: Simon John <git@the-jedi.co.uk> Packager: Simon John <git@the-jedi.co.uk>
URL: https://github.com/sudar/Arduino-Makefile URL: https://github.com/sudar/Arduino-Makefile
@ -9,8 +9,7 @@ Group: Development/Tools
License: LGPLv2+ License: LGPLv2+
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch BuildArch: noarch
Requires: arduino-core pyserial Requires: arduino-core python3-pyserial
BuildRequires: arduino-core
%description %description
Arduino is an open-source electronics prototyping platform based on Arduino is an open-source electronics prototyping platform based on
@ -60,6 +59,8 @@ rm -rf %{buildroot}
%{_docdir}/%{name}/examples %{_docdir}/%{name}/examples
%changelog %changelog
* Thu Oct 24 2019 Simon John <git@the-jedi.co.uk>
- Removed BuildRequires
* Thu Oct 05 2017 Simon John <git@the-jedi.co.uk> * Thu Oct 05 2017 Simon John <git@the-jedi.co.uk>
- Added ardmk-init binary and manpage - Added ardmk-init binary and manpage
* Tue Jul 11 2017 Karl Semich <fuzzyTew@gmail.com> * Tue Jul 11 2017 Karl Semich <fuzzyTew@gmail.com>

View file

@ -7,3 +7,4 @@ pushd $SCRIPTS_DIR/..
source $SCRIPTS_DIR/bootstrap/chipkit.sh source $SCRIPTS_DIR/bootstrap/chipkit.sh
source $SCRIPTS_DIR/bootstrap/arduino.sh source $SCRIPTS_DIR/bootstrap/arduino.sh
source $SCRIPTS_DIR/bootstrap/samd.sh

View file

@ -8,7 +8,8 @@ if [ -z "$ARDUINO_DIR" ] || ! test -e $ARDUINO_DIR || [ $OS == "cygwin" ]; then
echo "Installing Arduino..." echo "Installing Arduino..."
ARDUINO_BASENAME="arduino-1.0.6" ARDUINO_BASENAME="arduino-1.8.11"
if [ $OS == "cygwin" ]; then if [ $OS == "cygwin" ]; then
ARDUINO_FILE="$ARDUINO_BASENAME-windows".zip ARDUINO_FILE="$ARDUINO_BASENAME-windows".zip
EXTRACT_COMMAND="unzip -q" EXTRACT_COMMAND="unzip -q"
@ -16,8 +17,8 @@ if [ -z "$ARDUINO_DIR" ] || ! test -e $ARDUINO_DIR || [ $OS == "cygwin" ]; then
ARDUINO_FILE="$ARDUINO_BASENAME-macosx".zip ARDUINO_FILE="$ARDUINO_BASENAME-macosx".zip
EXTRACT_COMMAND="unzip -q" EXTRACT_COMMAND="unzip -q"
else else
ARDUINO_FILE="$ARDUINO_BASENAME-linux64".tgz ARDUINO_FILE="$ARDUINO_BASENAME-linux64".tar.xz
EXTRACT_COMMAND="tar -xzf" EXTRACT_COMMAND="tar -xf"
fi fi
ARDUINO_URL=http://arduino.cc/download.php?f=/$ARDUINO_FILE ARDUINO_URL=http://arduino.cc/download.php?f=/$ARDUINO_FILE
@ -33,6 +34,7 @@ if [ -z "$ARDUINO_DIR" ] || ! test -e $ARDUINO_DIR || [ $OS == "cygwin" ]; then
then then
echo "Installing Arduino to local folder..." echo "Installing Arduino to local folder..."
$EXTRACT_COMMAND $ARDUINO_FILE $EXTRACT_COMMAND $ARDUINO_FILE
mv $ARDUINO_BASENAME arduino
echo "Arduino installed" echo "Arduino installed"
fi fi

View file

@ -160,22 +160,14 @@ if [ -z $COMMON_SOURCED ]; then
fi fi
fi fi
if ! command -v python >/dev/null 2>&1; then if ! command -v python3 >/dev/null 2>&1; then
echo "Installing Python..." echo "Installing Python..."
_install "python" _install "python3"
fi fi
if ! command -v pip >/dev/null 2>&1; then if ! command -v pip3 >/dev/null 2>&1; then
echo "Installing Pip..." echo "Installing Pip..."
if ! command -v easy_install >/dev/null 2>&1; then _install "python3-pip"
_install "python-setuptools"
fi
if ! command -v easy_install >/dev/null 2>&1; then
die "easy_install not available, can't install pip"
fi
$SUDO_CMD easy_install pip
fi fi
PIP_SUDO_CMD= PIP_SUDO_CMD=
@ -184,7 +176,7 @@ if [ -z $COMMON_SOURCED ]; then
PIP_SUDO_CMD=$SUDO_CMD PIP_SUDO_CMD=$SUDO_CMD
fi fi
$PIP_SUDO_CMD pip install --src dependencies --pre -Ur $BOOTSTRAP_DIR/pip-requirements.txt $PIP_SUDO_CMD pip3 install --src dependencies --pre -Ur $BOOTSTRAP_DIR/pip-requirements.txt
COMMON_SOURCED=1 COMMON_SOURCED=1
fi fi

View file

@ -1 +1 @@
pyserial==2.7 pyserial==3.4

View file

@ -0,0 +1,46 @@
set -e
BOOTSTRAP_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $BOOTSTRAP_DIR/common.sh
echo "Installing dependencies for building for the SAMD boards"
# these extract to dirs without versions...
SAMD_PACKAGE="samd-1.8.6"
CMSIS_PACKAGE="CMSIS-4.5.0"
CMSIS_ATMEL_PACKAGE="CMSIS-Atmel-1.2.0"
if [ $OS == "mac" ]; then
TOOLCHAIN_PACKAGE="gcc-arm-none-eabi-7-2017-q4-major-mac"
else
TOOLCHAIN_PACKAGE="gcc-arm-none-eabi-7-2017-q4-major-linux"
fi
ARDUINO_URL=https://downloads.arduino.cc
TOOLCHAIN_URL=https://developer.arm.com/-/media/Files/downloads/gnu-rm/7-2017q4
EXTRACT_COMMAND="tar -xjf"
_pushd $DEPENDENCIES_FOLDER
if ! test -e $SAMD_PACKAGE
then
echo "Downloading SAMD packages..."
download $ARDUINO_URL/cores/$SAMD_PACKAGE.tar.bz2 $SAMD_PACKAGE.tar.bz2
download $ARDUINO_URL/$CMSIS_PACKAGE.tar.bz2 $CMSIS_PACKAGE.tar.bz2
download $ARDUINO_URL/$CMSIS_ATMEL_PACKAGE.tar.bz2 $CMSIS_ATMEL_PACKAGE.tar.bz2
download $TOOLCHAIN_URL/$TOOLCHAIN_PACKAGE.tar.bz2 $TOOLCHAIN_PACKAGE.tar.bz2
fi
if ! test -d $SAMD_PACKAGE
then
echo "Installing packages to local folder..."
$EXTRACT_COMMAND $SAMD_PACKAGE.tar.bz2
$EXTRACT_COMMAND $CMSIS_PACKAGE.tar.bz2
$EXTRACT_COMMAND $CMSIS_ATMEL_PACKAGE.tar.bz2
$EXTRACT_COMMAND $TOOLCHAIN_PACKAGE.tar.bz2
echo "SAMD support installed"
fi
_popd
echo
echo "${bldgreen}SAMD dependencies installed.$txtrst"

View file

@ -1,13 +1,45 @@
#!/usr/bin/env bash #!/usr/bin/env bash
SCRIPTS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
TESTS_DIR=examples TESTS_DIR=examples
export ARDMK_DIR="${ARDMK_DIR:-$SCRIPTS_DIR/../..}"
failures=() failures=()
if [[ "$1" == "-q" ]]; then
QUIET=1
fi
runtest() {
if [[ $QUIET ]]; then
make $* TEST=1 > /dev/null 2>&1
else
output=`make $* TEST=1`
fi
}
run() {
if [[ $QUIET ]]; then
"$@" > /dev/null 2>&1
else
"$@"
fi
}
info() {
if [[ $QUIET ]]; then
return
fi
echo "$@"
}
run pushd $SCRIPTS_DIR/../..
# These examples cannot be tested easily at the moment as they require # These examples cannot be tested easily at the moment as they require
# alternate cores. The MakefileExample doesn't actually contain any source code # alternate cores. The MakefileExample doesn't actually contain any source code
# to compile. # to compile.
NON_TESTABLE_EXAMPLES=(ATtinyBlink MakefileExample TinySoftWareSerial BlinkOpenCM BlinkOpenCR BlinkTeensy BlinkNetworkRPi BlinkInAVRC MZeroBlink ZeroBlink DueBlink) NON_TESTABLE_EXAMPLES=(ATtinyBlink MakefileExample TinySoftWareSerial BlinkOpenCM BlinkOpenCR BlinkTeensy BlinkNetworkRPi BlinkInAVRC DueBlink)
for dir in $TESTS_DIR/*/ for dir in $TESTS_DIR/*/
do do
@ -22,46 +54,47 @@ do
done done
if ! $example_is_testable; then if ! $example_is_testable; then
echo "Skipping non-testable example $example..." info "Skipping non-testable example $example..."
continue continue
fi fi
pushd $dir run pushd $dir
echo "Compiling $example..." info "Compiling $example..."
make_output=`make clean TEST=1` runtest clean
make_output=`make TEST=1` runtest
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
failures+=("$example") failures+=("$example")
echo "Example $example failed" info "Example $example failed"
fi fi
make_output=`make disasm TEST=1` runtest disasm
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
failures+=("$example disasm") failures+=("$example disasm")
echo "Example $example disasm failed" info "Example $example disasm failed"
fi fi
make_output=`make generate_assembly TEST=1` runtest generate_assembly
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
failures+=("$example generate_assembly") failures+=("$example generate_assembly")
echo "Example $example generate_assembly failed" info "Example $example generate_assembly failed"
fi fi
make_output=`make symbol_sizes TEST=1` runtest symbol_sizes
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
failures+=("$example symbol_sizes") failures+=("$example symbol_sizes")
echo "Example $example symbol_sizes failed" info "Example $example symbol_sizes failed"
fi fi
popd run popd
done
for failure in "${failures[@]}"; do
echo "Example $failure failed"
done done
if [[ ${#failures[@]} -eq 0 ]]; then if [[ ${#failures[@]} -eq 0 ]]; then
echo "All tests passed." echo "All tests passed."
else else
exit 1 for failure in "${failures[@]}"; do
echo "Example $failure failed"
done
exit 1
fi fi