Compare commits
1 commit
Author | SHA1 | Date | |
---|---|---|---|
|
c3dc56bd3a |
71 changed files with 1433 additions and 7853 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,4 +1,3 @@
|
|||
*.o
|
||||
build-cli
|
||||
/.project
|
||||
build-*
|
||||
|
|
15
.travis.yml
15
.travis.yml
|
@ -1,15 +0,0 @@
|
|||
os: linux
|
||||
dist: xenial
|
||||
language: c
|
||||
compiler:
|
||||
- gcc
|
||||
script: tests/script/runtests.sh
|
||||
before_install: tests/script/bootstrap.sh
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- "python3"
|
||||
- "python3-pip"
|
||||
env:
|
||||
global:
|
||||
- ARDMK_DIR=$TRAVIS_BUILD_DIR
|
1917
Arduino.mk
1917
Arduino.mk
File diff suppressed because it is too large
Load diff
|
@ -1,36 +0,0 @@
|
|||
# Contributing To Arduino Makefile
|
||||
|
||||
Community made patches, localizations, bug reports, documentation and contributions are always welcome and are crucial to the success of this project.
|
||||
|
||||
When contributing please ensure you follow the guidelines below so that we can keep on top of things.
|
||||
|
||||
## Getting Started
|
||||
|
||||
Submit a ticket for your issue, assuming one does not already exist.
|
||||
|
||||
- Raise it on our [Issue Tracker](https://github.com/sudar/Arduino-Makefile/issues)
|
||||
- Clearly describe the issue including steps to reproduce the bug.
|
||||
- Make sure you fill in the earliest version that you know has the issue as well as the following
|
||||
- Your operating system (Mac, Linux/Unix, Windows)
|
||||
- Your Arduino IDE version
|
||||
- Snippet of your makefile
|
||||
|
||||
## Making Changes
|
||||
|
||||
- Fork the repository on GitHub
|
||||
- Make the changes to your forked repository
|
||||
- Update the [changelog file](HISTORY.md) and add a note about your change. If possible prefix it with either Fix, Tweak or New
|
||||
- If you are adding or changing the behavior of any variable, then update the corresponding documentation in the [arduino-mk-vars.md](arduino-mk-vars.md) file as well
|
||||
- When committing, reference your issue (if present) and include a note about the fix
|
||||
- If possible (and if makes sense) do atomic commits
|
||||
- Try to follow [this guideline](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) while choosing the git commit message
|
||||
- If it makes sense then add a unit test case for the changes that you are making
|
||||
- Push the changes to your fork and submit a pull request to the 'master' branch of the this repository
|
||||
|
||||
At this point you're waiting on us to merge your pull request. We'll review all pull requests, and make suggestions and changes if necessary.
|
||||
|
||||
# Additional Resources
|
||||
|
||||
- [General GitHub Documentation](http://help.github.com/)
|
||||
- [GitHub Pull Request documentation](http://help.github.com/send-pull-requests/)
|
||||
- [Guide about contributing code in GitHub](http://sudarmuthu.com/blog/contributing-to-project-hosted-in-github)
|
138
Common.mk
138
Common.mk
|
@ -1,138 +0,0 @@
|
|||
COMMON_INCLUDED = TRUE
|
||||
# Useful functions
|
||||
# Returns the first argument (typically a directory), if the file or directory
|
||||
# named by concatenating the first and optionally second argument
|
||||
# (directory and optional filename) exists
|
||||
dir_if_exists = $(if $(wildcard $(1)$(2)),$(1))
|
||||
|
||||
# result = $(call READ_BOARD_TXT, 'boardname', 'parameter')
|
||||
PARSE_BOARD = $(shell if [ -f $(BOARDS_TXT) ]; \
|
||||
then \
|
||||
$(GREP_CMD) -Ev '^\#' $(BOARDS_TXT) | \
|
||||
$(GREP_CMD) -E "^[ \t]*$(1).$(2)=" | \
|
||||
cut -d = -f 2- | \
|
||||
cut -d : -f 2; \
|
||||
fi)
|
||||
|
||||
# Run a shell script if it exists. Stops make on error.
|
||||
runscript_if_exists = \
|
||||
$(if $(wildcard $(1)), \
|
||||
$(if $(findstring 0, \
|
||||
$(lastword $(shell $(abspath $(wildcard $(1))); echo $$?))), \
|
||||
$(info Info: $(1) success), \
|
||||
$(error ERROR: $(1) failed)))
|
||||
|
||||
# For message printing: pad the right side of the first argument with spaces to
|
||||
# the number of bytes indicated by the second argument.
|
||||
space_pad_to = $(shell echo "$(1) " | head -c$(2))
|
||||
|
||||
# Call with some text, and a prefix tag if desired (like [AUTODETECTED]),
|
||||
show_config_info = $(call arduino_output,- $(call space_pad_to,$(2),20) $(1))
|
||||
|
||||
# Call with the name of the variable, a prefix tag if desired (like [AUTODETECTED]),
|
||||
# and an explanation if desired (like (found in $$PATH)
|
||||
show_config_variable = $(call show_config_info,$(1) = $($(1)) $(3),$(2))
|
||||
|
||||
# Just a nice simple visual separator
|
||||
show_separator = $(call arduino_output,-------------------------)
|
||||
|
||||
# Master Arduino Makefile include (after user Makefile)
|
||||
ardmk_include = $(shell basename $(word 2,$(MAKEFILE_LIST)))
|
||||
|
||||
$(call show_separator)
|
||||
$(call arduino_output,$(call ardmk_include) Configuration:)
|
||||
|
||||
########################################################################
|
||||
#
|
||||
# Detect OS
|
||||
|
||||
ifeq ($(OS),Windows_NT)
|
||||
CURRENT_OS = WINDOWS
|
||||
GREP_CMD = grep
|
||||
else
|
||||
UNAME_S := $(shell uname -s)
|
||||
ifeq ($(UNAME_S),Linux)
|
||||
CURRENT_OS = LINUX
|
||||
GREP_CMD = grep
|
||||
endif
|
||||
ifeq ($(UNAME_S),Darwin)
|
||||
CURRENT_OS = MAC
|
||||
ifeq (, $(shell which gggrep))
|
||||
$(info Using macOS BSD grep, please install GNU grep to avoid warnings)
|
||||
GREP_CMD = grep
|
||||
else
|
||||
GREP_CMD = ggrep
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
$(call show_config_variable,CURRENT_OS,[AUTODETECTED])
|
||||
|
||||
########################################################################
|
||||
#
|
||||
# Travis-CI
|
||||
ifneq ($(TEST),)
|
||||
DEPENDENCIES_DIR = /var/tmp/Arduino-Makefile-testing-dependencies
|
||||
|
||||
DEPENDENCIES_MPIDE_DIR := $(shell find $(DEPENDENCIES_DIR) -name 'mpide-0023-*' -type d -exec ls -dt {} + | head -n 1)
|
||||
|
||||
ifeq ($(MPIDE_DIR),)
|
||||
MPIDE_DIR = $(DEPENDENCIES_MPIDE_DIR)
|
||||
endif
|
||||
|
||||
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),)
|
||||
ARDUINO_DIR = $(DEPENDENCIES_ARDUINO_DIR)
|
||||
endif
|
||||
endif
|
||||
|
||||
########################################################################
|
||||
# Arduino Directory
|
||||
|
||||
ifndef ARDUINO_DIR
|
||||
AUTO_ARDUINO_DIR := $(firstword \
|
||||
$(call dir_if_exists,/usr/share/arduino) \
|
||||
$(call dir_if_exists,/Applications/Arduino.app/Contents/Resources/Java) \
|
||||
$(call dir_if_exists,/Applications/Arduino.app/Contents/Java) )
|
||||
ifdef AUTO_ARDUINO_DIR
|
||||
ARDUINO_DIR = $(AUTO_ARDUINO_DIR)
|
||||
$(call show_config_variable,ARDUINO_DIR,[AUTODETECTED])
|
||||
else
|
||||
echo $(error "ARDUINO_DIR is not defined")
|
||||
endif
|
||||
else
|
||||
$(call show_config_variable,ARDUINO_DIR,[USER])
|
||||
endif
|
||||
|
||||
ifeq ($(CURRENT_OS),WINDOWS)
|
||||
ifneq ($(shell echo $(ARDUINO_DIR) | egrep '\\|[[:space:]]|cygdrive'),)
|
||||
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
|
||||
|
||||
########################################################################
|
||||
# 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
|
216
HISTORY.md
216
HISTORY.md
|
@ -1,211 +1,9 @@
|
|||
A Makefile for Arduino Sketches
|
||||
===============================
|
||||
|
||||
The following is the rough list of changes that went into different versions.
|
||||
I tried to give credit whenever possible. If I have missed anyone, kindly add it to the list.
|
||||
The following is the rough list of changes that went into different versions. I tried to give credit whenever possible. If I have missed anyone, kindly add it to the list.
|
||||
|
||||
### In Development
|
||||
- Fix: Moved CORE_LIB to the last position of the defined linked objects. (https://github.com/wingunder)
|
||||
- Fix: Moved ATtiny examples to ATtinyBlink, updated alternate core instructions (issue #537) (https://github.com/sej7278)
|
||||
- Fix: Add -fno-devirtualize flag to workaround g++ segfault bug (issue #486). (https://github.com/sej7278)
|
||||
- Fix: Quote the prefix tag in the space_pad_to function
|
||||
- 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: Show the configuration when ARDUINO_QUIET=0
|
||||
- Fix: Travis build and bring Arduino IDE upto date
|
||||
- Fix: Builds for SAMD-based boards use the C++ compiler for linking (issue #644). (https://github.com/kpfleming)
|
||||
- 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: 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: 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: 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: 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 template Makefile and project boilerplate initialise script, `ardmk-init`. (https://github.com/tuna-f1sh)
|
||||
- New: Support atmelice_isp JTAG tool as ISP programmer. (https://github.com/tuna-f1sh)
|
||||
- New: Compatibility with deprecated pgmspace.h API can now be disabled since it sometimes causes bogus compiler warnings (issue #546)
|
||||
- New: Support Arduino ARM SAMD devices (Zero, M0 Pro, Feather M0). (https://github.com/tuna-f1sh)
|
||||
- New: Support Arduino ARM SAM devices (Due). (https://github.com/tuna-f1sh)
|
||||
- New: Moved the PARSE_BOARD macro to Common.mk and use only this to parse the boards.txt file. (https://github.com/wingunder)
|
||||
- New: Added the TOOL_PREFIX variable for setting up the executable tools centrally and generically. (https://github.com/wingunder)
|
||||
- New: Add support for BOARD_CLOCK for board.menu.speed and board.menu.clock entries in boards.txt files. (https://github.com/dewhisna)
|
||||
- New: Updated Arch instructions. (https://github.com/Akram-Chehaima)
|
||||
- New: Add support for Robotis OpenCR 1.0 boards.
|
||||
- New: Build the ArduinoCore API
|
||||
- New: Support for Python 3 and multi-os Python installation using new PYTHON_CMD variable.
|
||||
- New: Add "ARDUINO_{build.board}" to be able to detect board type.
|
||||
|
||||
### 1.6.0 (2017-07-11)
|
||||
- Fix: Allowed for SparkFun's weird usb pid/vid submenu shenanigans (issue #499). (https://github.com/sej7278)
|
||||
- Fix: Do not include the Arduino header when calling generate_assembly on .cpp files. (https://github.com/Batchyx)
|
||||
- Fix: Auto-detect F_CPU on Teensy from boards.txt (https://github.com/DaWelter)
|
||||
- Fix: params typo in PuTTY section (issue #487) (https://github.com/ericdand)
|
||||
- Fix: Fixed sed expression to properly format show_submenu (issue #488) (https://github.com/cbosdo)
|
||||
- Tweak: Removed tilde from documentation (issue #497). (https://github.com/sej7278)
|
||||
- New: Add support for good old cu as monitor command (issue #492) (https://github.com/mwm)
|
||||
- New: Add a documentation how to setup Makefile for 3rd party boards (issue #499). (https://github.com/MilanV)
|
||||
- New: Add support for Robotis OpenCM boards
|
||||
- Fix: Syntax of inner conditional statements of monitor command evaluated when MONITOR_CMD = putty
|
||||
|
||||
### 1.5.2 (2017-01-11)
|
||||
|
||||
- New: Add LTO support for users with avr-gcc > 4.9 (issue #446 & #456) (https://github.com/sej7278)
|
||||
- Tweak: Updated Linux instructions and sync documentation from the old blog(), README.md and Arduino.mk (https://github.com/az-z)
|
||||
- Tweak: Documentation for Windows updated to include installation of PySerial (https://github.com/sovcik)
|
||||
- Fix: Updated CXXFLAGS_STD to match upstream 1.6 (issue #424) (https://github.com/calvinli)
|
||||
- Fix: Added support for attiny core's use of chip instead of cpu in submenus (https://github.com/straccio)
|
||||
- Fix: ARDUINO_VERSION can cope with the longer 1.6.10 version string (issue #444) (https://github.com/sej7278)
|
||||
- Fix: Changed PARSE_BOARD to handle colons in e.g. CORE or VARIANT (issue #461) (https://github.com/sej7278)
|
||||
- Fix: Changed Teensy.mk to support Arduino 1.6.12 and Teensyduino 1.30 (issues #383 , #431) (https://github.com/georgeharker)
|
||||
|
||||
### 1.5.1 (Debian version: 1.5-3) (2016-02-22)
|
||||
|
||||
- New: Add show_submenu target (https://github.com/drewhutchison)
|
||||
- New: Add AVR Dragon to list of ISP's without a port (https://github.com/mtnocean)
|
||||
- New: Add more board examples to Blink demo (https://github.com/sej7278)
|
||||
- New: Add option to split avrdude MCU from avr-gcc MCU (Issue #357) (https://github.com/hhgarnes)
|
||||
- New: Add support for /dev/tty.wchusbserial* (comes with cheap clones - DCCduino) (https://github.com/biesiad)
|
||||
- New: Add support for picocom as serial monitor (https://github.com/biesiad)
|
||||
- Tweak: Add support for Adafruit trinket3/trinket5/protrinket3/protrinket5 by improved BOARDS_TXT parsing (Issue #393) (https://github/com/zabereer)
|
||||
- Tweak: Looks for submenu items first when parsing BOARDS_TXT (Issue #347) (https://github.com/sej7278)
|
||||
- Tweak: Various spelling/grammar/typo fixes (https://github.com/dcousens)
|
||||
- Tweak: Clarified some 1.5+ issues in docs (Issue #352) (https://github.com/sej7278)
|
||||
- Tweak: Added some more Continuous Integration tests (https://github.com/sej7278)
|
||||
- Tweak: Updated Fedora instructions (https://github.com/sej7278)
|
||||
- Fix: Preserve original extension for object files, support asm sources in core, fixes pulseInASM (Issue #255, #364) (https://github.com/sej7278)
|
||||
- Fix: Make sure TARGET is set correctly when CURDIR contains spaces (https://github.com/svendahlstrand)
|
||||
- Fix: Ensure AVRDUDE_CONF is set when AVR_TOOLS_DIR is, not just on Windows (Issue #381) (https://github.com/sej7278)
|
||||
- Fix: Rename VENDOR to ARDMK_VENDOR to workaround tcsh issue (Issue #386) (https://github.com/sej7278)
|
||||
- Fix: Document OSX 1.0/1.6 ARDUINO_DIR differences (https://github.com/thomaskilian)
|
||||
- Fix: Fix regex to support BOARD_TAGs with hyphens e.g. attiny44-20 (https://github.com/sej7278)
|
||||
- Fix: Remove check for BOOTLOADER_PATH, just check for BOOTLOADER_FILE (Issue #402) (https://github.com/sej7278)
|
||||
- Fix: Port ard-reset-arduino to pyserial 3.0 (#407, #408) (https://github.com/gauteh)
|
||||
|
||||
### 1.5 (2015-04-07)
|
||||
- New: Add support for new 1.5.x library layout (Issue #275) (https://github.com/lukasz-e)
|
||||
- New: Add support for 1.5.x vendor/hardware architecture library location (Issue #276) (https://github.com/lukasz-e)
|
||||
- New: Added test suite and integration with travis CI. (https://github.com/peplin)
|
||||
- New: Add information about `Bare-Arduino–Project` in README. (https://github.com/ladislas)
|
||||
- New: Add information about reporting bugs to the correct project (Issue #231). (https://github.com/sej7278)
|
||||
- New: Add documentation about CFLAGS_STD and CXXFLAGS_STD (Issue #234) (https://github.com/ladislas)
|
||||
- New: Allow "make clean" target to be extended (Issue #239). (https://github.com/sej7278)
|
||||
- New: Add makefile and gcc version info to config output. (https://github.com/sej7278)
|
||||
- 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 Makefile-example.mk with STD flags (https://github.com/ladislas)
|
||||
- Tweak: Allow remove of any OBJDIR with `$(REMOVE) $(OBJDIR)`. (https://github.com/ladislas)
|
||||
- Tweak: Add cpp to extensions supported by "make generate_assembly". (https://github.com/sej7278)
|
||||
- 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)
|
||||
- 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)
|
||||
- Tweak: Ability to override `USB_TYPE` in Teensy.md (Issue #313) (https://github.com/Poofjunior)
|
||||
- Tweak: Integration instructions for CodeBlocks IDE (Issue #321) (https://github.com/fbielejec)
|
||||
- Tweak: Add BOARD_SUB to OBJDIR if defined in 1.5+ (https://github.com/sej7278)
|
||||
- Tweak: Add = to PARSE_BOARD regex to make it less greedy and not match vid.0, vid.1 and vid (https://github.com/sej7278)
|
||||
- Tweak: Added note about clock submenu's being used as F_CPU (https://github.com/sej7278)
|
||||
- Tweak: Better autodetection of ARDUINO_SKETCHBOOK and ARDUINO_DIR on OSX (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)
|
||||
- Fix: Make avr-g++ use CXXFLAGS instead of CFLAGS. (https://github.com/sej7278)
|
||||
- Fix: Allow the use of CFLAGS_STD and CXXFLAGS_STD and set defaults (Issue #234) (https://github.com/ladislas)
|
||||
- Fix: Update "make show_boards" regex to work with the Due in 1.5. (https://github.com/sej7278)
|
||||
- Fix: Allow user libaries/sketches to have the same name as system libs. (Issue #244, #229). (https://github.com/sej7278)
|
||||
- Fix: Remove impact of travis-ci from regular users. (Issue #258). (https://github.com/sej7278)
|
||||
- Fix: objcopy quoting issue on Windows. (Issue #272). (https://github.com/sej7278)
|
||||
- Fix: Add "avrispmkii" to the list of isp that don't have a port. (Issue #279). (https://github.com/sej7278)
|
||||
- Fix: Make CXX compile .cpp files instead of CC. (Issue #285). (https://github.com/sej7278)
|
||||
- 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)
|
||||
- Fix: Fixed PLATFORM_LIB support for 1.5+ and removed duplicate libs (https://github.com/sej7278)
|
||||
- Fix: Added ARCHITECTURE to ALTERNATE_CORE_PATH to support 1.5+ cores like arduino-tiny (https://github.com/sej7278)
|
||||
- Fix: Can now find IDE 1.5+ preferences.txt on Linux and Mac (https://github.com/sej7278)
|
||||
- Fix: Added support for VARIANT being a submenu item in 1.6 cores like attiny (https://github.com/sej7278)
|
||||
- Fix: Replaced copyright symbol causing sed problems on OSX (Issue #335). (https://github.com/sej7278)
|
||||
- Fix: Fix issues with resetting Leonardo and Micro boards(Issue #340) (https://github.com/calvinli)
|
||||
|
||||
### 1.3.4 (2014-07-12)
|
||||
- Tweak: Allow spaces in "Serial.begin (....)". (Issue #190) (https://github.com/pdav)
|
||||
- Add: Add support for compiling assembler code. (Issue #195) (https://github.com/hrobeers)
|
||||
- Add: Try to guess port from wildcards if not specified. (Issue #197) (https://github.com/tuzz)
|
||||
- Fix: Check that on windows ARDUINO_DIR (and MPIDE_DIR) is a relative path. (Issue #201 and #202) (https://github.com/sej7278)
|
||||
- Add: List board name as well as tag in `make show_boards`. (Issue #204) (https://github.com/sej7278)
|
||||
- Fix: Add missing newlines at end of some echo's (Issue #207) (https://github.com/sej7278)
|
||||
- Fix: Add missing/reorder/reword targets in `make help` (https://github.com/sej7278)
|
||||
- New: Arduino.mk is now compatible with Flymake mode (https://github.com/rbarzic)
|
||||
- Fix: MONITOR_PORT detection (Issue #213, #215) (https://github.com/sej7278)
|
||||
- Tweak: Audited regexes/quoting/wildcards (Issue #192) (https://github.com/sej7278)
|
||||
- New: Build core objects in subdirectory (Issue #82) (https://github.com/sej7278)
|
||||
|
||||
### 1.3.3 (2014-04-12)
|
||||
- Fix: Make a new manpage for ard-reset-arduino. Fixes issue #188 (https://github.com/sej7278)
|
||||
|
||||
### 1.3.2 (2014-04-11)
|
||||
- Fix: Add arduino-mk-vars.md file to RPM SPECfile. (https://github.com/sej7278)
|
||||
- Fix: Add avr-libc/malloc.c and realloc.c to included core files. Fixes issue #163 (https://github.com/sej7278)
|
||||
- Fix: Add "gpio" to the list of isp that don't have a port. (Issue #165, #166) (https://github.com/sej7278)
|
||||
- Fix: Add "-D__PROG_TYPES_COMPAT__" to the avr-g++ compiler flags to match IDE. (https://github.com/sej7278)
|
||||
- New: Create `Makefile-example-mk`, a *real life* `Makefile` example, to be used as a reference. (https://github.com/ladislas)
|
||||
- Tweak: Add `OBJDIR` to `arduino-mk-vars.md` (https://github.com/ladislas)
|
||||
- Tweak: *Beautify* `arduino-mk-vars.md` with code blocks. (https://github.com/ladislas)
|
||||
- Fix: AVR tools paths for chipKIT in Linux. (https://github.com/peplin)
|
||||
- Fix: Consider usb or usb:... to be a valid ISP_PORT (https://github.com/geoffholden)
|
||||
- Add: Add phony target to run pre-build hook script (https://github.com/jrid)
|
||||
- Fix: Add BOOTLOADER_PARENT to `arduino-mk-vars.md` and fixed BOOTLOADER_PATH example. (https://github.com/sej7278)
|
||||
- Tweak: Replace perl reset script with Python script. (https://github.com/sej7278)
|
||||
- Tweak: Made choice of Python2/3 interpreter up to the OS. (https://github.com/peplin)
|
||||
- Tweak: Simplified packaging dependencies. (https://github.com/sej7278)
|
||||
- Tweak: Tweak AVRDUDE conf detection in windows. (https://github.com/EAGMnor)
|
||||
|
||||
### 1.3.1 (2014-02-04)
|
||||
- Fix: BUNDLED_AVR_TOOLS_DIR is now set properly when using only arduino-core and not the whole arduino package. (https://github.com/sej7278)
|
||||
- New: Document all variables that can be overridden. (https://github.com/sej7278)
|
||||
- New: Add a new `help_vars` target to display information about variables that can be overridden.
|
||||
|
||||
### 1.3.0 (2014-01-29)
|
||||
- Fix: Use more reliable serial device naming in Windows. Fix issue #139 and #155 (https://github.com/peplin)
|
||||
- Fix: Document that ARDUINO_DIR must be a relative path in Windows. Fix issue #156 (https://github.com/peplin)
|
||||
- Tweak: Don't hard code MONITOR_PORT in examples, for more flexible testing. (Issue #157) (https://github.com/peplin)
|
||||
- Tweak: Silence the stderr output from call to `which`. (Issue #158) (https://github.com/peplin)
|
||||
- Fix: Override complete compiler tool paths for chipKIT. (Issue #159) (https://github.com/peplin)
|
||||
- New: The makefile is compatible with Windows
|
||||
- New: Update `README.md` file about usage and Windows compatibility
|
||||
|
||||
### 1.2.0 (2014-01-14)
|
||||
- Add: Add RPM SPECfile and new `package` directory to store package instructions and files (https://github.com/sej7278)
|
||||
- Fix: Remove use of arduino-mk subdirectory in git. Fix issue #151, #152 and #147 (https://github.com/sej7278)
|
||||
- Fix: Remove `arduino-mk` directory from all examples. Fix #154
|
||||
|
||||
### 1.1.0 (2013-12-26)
|
||||
- Don't append port details to avrdude for usbasp. See #123
|
||||
- Ignore commented lines while parsing boards.txt file. See #124
|
||||
- In ISP mode, read baudrate and programmer from boards.txt. See #125
|
||||
- Add `burn_bootloader` target. See #85
|
||||
- Show correct path to `arduino.mk` file in help message. Fix #120
|
||||
- Change echo for printf. Fix #129 (https://github.com/thomassigurdsen)
|
||||
- Add support for ChipKiT 2013. Fix #136 (https://github.com/peplin)
|
||||
- Auto detect and include libraries specified in `USER_LIB_PATH`. Fix #135 (https://github.com/ladislas)
|
||||
- Use `MAKEFILE_LIST` to get the name of the make file. Fix #130 (https://github.com/cantora)
|
||||
- New: Add option to set fuses without burning a bootloader. Fix #141 (https://github.com/sej7278)
|
||||
- Tweak: Don't append port details to avrdude for usbtiny. Fix #140 and #138 (https://github.com/PPvG)
|
||||
- Fix: Handle relative paths of bootloader file while burning bootloaders. Fix #126 and #142 (https://github.com/sej7278)
|
||||
- New: Add `CONTRIBUTING.md` explaining how to contribute to the project.
|
||||
- New: Force -Os optimization for SoftwareSerial. Add `OPTIMIZATION_FLAGS` and `DEBUG_FLAGS`. (https://github.com/mahoy)
|
||||
- Fix: Use `ARDUINO_HEADER` variable instead of hardcoded file names. Fix #131
|
||||
|
||||
### 1.0.1 (2013-09-25)
|
||||
- Unconditionally add -D in avrdude options. See #114
|
||||
|
||||
### 1.0.0 (2013-09-22)
|
||||
### 0.13.0 (in development)
|
||||
- Add $OBJDIR to the list of configuration that gets printed. Fix issue #77
|
||||
- Add support for specifying optimization level. Fix issue #81
|
||||
- Add support for reseting "Micro" Arduino. Fix issue #80 (https://github.com/sej7278)
|
||||
|
@ -221,7 +19,6 @@ I tried to give credit whenever possible. If I have missed anyone, kindly add it
|
|||
- Replace Leonardo detection with Caterina detection (https://github.com/sej7278)
|
||||
- Autodetect baudrate only if either a .ino/.pde is present
|
||||
- Allow building with Arduino core, without a .ino/.pde file
|
||||
- Ability to support different Arduino cores (https://github.com/sej7278)
|
||||
|
||||
### 0.12.0 (2013-06-20)
|
||||
- Fix "generated_assembly" target, which got broken earlier. Fix issue #76 (https://github.com/matthijskooijman)
|
||||
|
@ -289,7 +86,7 @@ I tried to give credit whenever possible. If I have missed anyone, kindly add it
|
|||
|
||||
### 0.10 17.ix.12 M J Oldfield
|
||||
- Added installation notes for Fedora (ex Rickard Lindberg).
|
||||
- Changed size target so that it looks at the ELF object,
|
||||
- Changed size target so that it looks at the ELF object,
|
||||
not the hexfile (ex Jared Szechy and Scott Howard).
|
||||
- Fixed ARDUNIO typo in README.md (ex Kalin Kozhuharov).
|
||||
- Tweaked OBJDIR handling (ex Matthias Urlichs and Scott Howard).
|
||||
|
@ -309,7 +106,7 @@ I tried to give credit whenever possible. If I have missed anyone, kindly add it
|
|||
- Autodetect ARDMK_DIR based on location of this file
|
||||
- Added support for utility directory within SYS and USER libraries
|
||||
|
||||
### 0.9.3 13.vi.2012
|
||||
### 0.9.3 13.vi.2012
|
||||
|
||||
- Auto detect ARDUINO_DIR, Arduino version (https://github.com/rpavlik/)
|
||||
- Categorize libs into user and system (https://github.com/rpavlik/)
|
||||
|
@ -318,12 +115,12 @@ I tried to give credit whenever possible. If I have missed anyone, kindly add it
|
|||
- Changed bytes option for the head shell command, so that it works in Mac as well
|
||||
- Auto detect Serial Baud rate from sketch if possible
|
||||
|
||||
### 0.9.2 06.vi.2012
|
||||
### 0.9.2 06.vi.2012
|
||||
|
||||
- Allow user to choose source files (LOCAL_*_SRCS flags) (https://github.com/Gaftech)
|
||||
- Modified "make size" behavior: using --mcu option and targeting .elf file instead of .hex file.(https://github.com/Gaftech)
|
||||
|
||||
### 0.9.1 06.vi.2012
|
||||
### 0.9.1 06.vi.2012
|
||||
|
||||
- Corrected the ubuntu package names
|
||||
- Prevent the *file-not-found* error if the depends.mk file is not needed
|
||||
|
@ -360,3 +157,4 @@ Tweaked rules for the reset target on Philip Hands’ advice.
|
|||
- Tidied up the licensing, making it clear that it’s released under LGPL 2.1.
|
||||
- [Philip Hands](http://hands.com/~phil/) sent me some code to reset the Arduino by dropping DTR for 100ms, and I added it.
|
||||
- Tweaked the Makefile to handle version 0018 of the Arduino software which now includes main.cpp. Accordingly we don’t need to—and indeed must not—add main.cxx to the .pde sketch file. The paths seem to have changed a bit too.
|
||||
|
||||
|
|
161
OpenCM.mk
161
OpenCM.mk
|
@ -1,161 +0,0 @@
|
|||
########################################################################
|
||||
#
|
||||
# Support for Robotis OpenCM boards
|
||||
#
|
||||
# http://en.robotis.com/index/product.php?cate_code=131010
|
||||
#
|
||||
# You must install the OpenCM IDE for this Makefile to work:
|
||||
#
|
||||
# http://support.robotis.com/en/software/robotis_opencm/robotis_opencm.htm
|
||||
#
|
||||
# Based on work that is copyright Jeremy Shaw, Sudar, Nicholas Zambetti,
|
||||
# David A. Mellis & Hernando Barragan.
|
||||
#
|
||||
# This file is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Lesser General Public License as
|
||||
# published by the Free Software Foundation; either version 2.1 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# Adapted from Teensy 3.x makefile which was adapted from Arduino 0011
|
||||
# Makefile by M J Oldfield
|
||||
#
|
||||
# Original Arduino adaptation by mellis, eighthave, oli.keller
|
||||
#
|
||||
########################################################################
|
||||
|
||||
ifndef ARDMK_DIR
|
||||
ARDMK_DIR := $(realpath $(dir $(realpath $(lastword $(MAKEFILE_LIST)))))
|
||||
endif
|
||||
|
||||
# include Common.mk now we know where it is
|
||||
include $(ARDMK_DIR)/Common.mk
|
||||
|
||||
ARDUINO_DIR = $(OPENCMIDE_DIR)
|
||||
|
||||
ifndef ARDMK_VENDOR
|
||||
ARDMK_VENDOR = robotis
|
||||
endif
|
||||
|
||||
ifndef ARDUINO_CORE_PATH
|
||||
ARDUINO_CORE_PATH = $(ARDUINO_DIR)/hardware/robotis/cores/robotis
|
||||
endif
|
||||
|
||||
ifndef BOARDS_TXT
|
||||
BOARDS_TXT = $(ARDUINO_DIR)/hardware/$(ARDMK_VENDOR)/boards.txt
|
||||
endif
|
||||
|
||||
ifndef F_CPU
|
||||
F_CPU := $(call PARSE_BOARD,$(BOARD_TAG),build.f_cpu)
|
||||
endif
|
||||
|
||||
# if boards.txt gets modified, look there, else hard code it
|
||||
ARCHITECTURE = $(call PARSE_BOARD,$(BOARD_TAG),build.architecture)
|
||||
ifeq ($(strip $(ARCHITECTURE)),)
|
||||
ARCHITECTURE = arm
|
||||
endif
|
||||
|
||||
AVR_TOOLS_DIR = $(call dir_if_exists,$(ARDUINO_DIR)/hardware/tools/$(ARCHITECTURE))
|
||||
|
||||
# Robotis has moved the platform lib dir to their root folder
|
||||
ifndef ARDUINO_PLATFORM_LIB_PATH
|
||||
ARDUINO_PLATFORM_LIB_PATH = $(ARDUINO_DIR)/libraries
|
||||
$(call show_config_variable,ARDUINO_PLATFORM_LIB_PATH,[COMPUTED],(from ARDUINO_DIR))
|
||||
endif
|
||||
|
||||
ifndef ARDUINO_HEADER
|
||||
ARDUINO_HEADER = wirish.h
|
||||
endif
|
||||
|
||||
########################################################################
|
||||
# command names
|
||||
|
||||
TOOL_PREFIX = arm-none-eabi
|
||||
|
||||
# processor stuff
|
||||
ifndef MCU
|
||||
MCU := $(call PARSE_BOARD,$(BOARD_TAG),build.family)
|
||||
endif
|
||||
|
||||
ifndef MCU_FLAG_NAME
|
||||
MCU_FLAG_NAME=mcpu
|
||||
endif
|
||||
|
||||
########################################################################
|
||||
# FLAGS
|
||||
ifndef USB_TYPE
|
||||
USB_TYPE = USB_SERIAL
|
||||
endif
|
||||
|
||||
CPPFLAGS += -DBOARD_$(call PARSE_BOARD,$(BOARD_TAG),build.board)
|
||||
CPPFLAGS += -DMCU_$(call PARSE_BOARD,$(BOARD_TAG),build.mcu)
|
||||
CPPFLAGS += -DSTM32_MEDIUM_DENSITY -DVECT_TAB_FLASH
|
||||
|
||||
CPPFLAGS += $(call PARSE_BOARD,$(BOARD_TAG),build.option)
|
||||
|
||||
CXXFLAGS += -fno-rtti
|
||||
|
||||
CXXFLAGS += $(call PARSE_BOARD,$(BOARD_TAG),build.cppoption)
|
||||
ifeq ("$(call PARSE_BOARD,$(BOARD_TAG),build.gnu0x)","true")
|
||||
CXXFLAGS_STD += -std=gnu++0x
|
||||
endif
|
||||
|
||||
ifeq ("$(call PARSE_BOARD,$(BOARD_TAG),build.elide_constructors)", "true")
|
||||
CXXFLAGS += -felide-constructors
|
||||
endif
|
||||
|
||||
CPPFLAGS += -mthumb -march=armv7-m -nostdlib -Wl,--gc-sections -Wall
|
||||
|
||||
LDFLAGS += -T$(ARDUINO_DIR)/hardware/robotis/cores/robotis/CM900/flash.ld
|
||||
LDFLAGS += -L$(ARDUINO_CORE_PATH)
|
||||
LDFLAGS += -mthumb -Xlinker --gc-sections -Wall
|
||||
|
||||
OTHER_LIBS += -lstdc++
|
||||
|
||||
########################################################################
|
||||
# Reset is handled by upload script
|
||||
override RESET_CMD =
|
||||
|
||||
########################################################################
|
||||
# Object conversion & uploading magic, modified from Arduino.mk
|
||||
override TARGET_HEX = $(OBJDIR)/$(TARGET).bin
|
||||
|
||||
ifndef AVRDUDE
|
||||
AVRDUDE := $(shell which robotis-loader 2>/dev/null)
|
||||
ifndef AVRDUDE
|
||||
AVRDUDE = $(ARDMK_DIR)/bin/robotis-loader
|
||||
endif
|
||||
endif
|
||||
|
||||
override avr_size = $(SIZE) --target=binary $(2)
|
||||
|
||||
override AVRDUDE_COM_OPTS =
|
||||
ifeq ($(CURRENT_OS), WINDOWS)
|
||||
override AVRDUDE_ARD_OPTS = $(COM_STYLE_MONITOR_PORT)
|
||||
else
|
||||
override AVRDUDE_ARD_OPTS = $(call get_monitor_port)
|
||||
endif
|
||||
|
||||
override AVRDUDE_UPLOAD_HEX = $(TARGET_HEX)
|
||||
|
||||
########################################################################
|
||||
# automatically include Arduino.mk
|
||||
|
||||
include $(ARDMK_DIR)/Arduino.mk
|
||||
|
||||
########################################################################
|
||||
# Object conversion & uploading magic, modified from Arduino.mk
|
||||
|
||||
$(OBJDIR)/%.bin: $(OBJDIR)/%.elf $(COMMON_DEPS)
|
||||
@$(MKDIR) $(dir $@)
|
||||
$(OBJCOPY) -v -Obinary $< $@
|
||||
@$(ECHO) '\n'
|
||||
$(call avr_size,$<,$@)
|
||||
ifneq ($(strip $(HEX_MAXIMUM_SIZE)),)
|
||||
@if [ `$(SIZE) --target=binary $@ | awk 'FNR == 2 {print $$2}'` -le $(HEX_MAXIMUM_SIZE) ]; then touch $@.sizeok; fi
|
||||
else
|
||||
@$(ECHO) "Maximum flash memory of $(BOARD_TAG) is not specified. Make sure the size of $@ is less then $(BOARD_TAG)\'s flash memory"
|
||||
@touch $@.sizeok
|
||||
endif
|
||||
|
||||
# link fails to plug _sbrk into libc if core is a lib, seems a bug in the linker
|
||||
CORE_LIB = $(CORE_OBJS)
|
273
OpenCR.mk
273
OpenCR.mk
|
@ -1,273 +0,0 @@
|
|||
########################################################################
|
||||
#
|
||||
# Support for Robotis OpenCR boards
|
||||
#
|
||||
# Written by Dowhan Jeong, EunJin Jeong
|
||||
#
|
||||
# Based on work that is copyright Jeremy Shaw, Sudar, Nicholas Zambetti,
|
||||
# David A. Mellis & Hernando Barragan.
|
||||
#
|
||||
# This file is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Lesser General Public License as
|
||||
# published by the Free Software Foundation; either version 2.1 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
########################################################################
|
||||
|
||||
ifndef ARDUINO_DIR
|
||||
echo $(error ARDUINO_DIR should be specified)
|
||||
endif
|
||||
|
||||
ifndef BOARD_TAG
|
||||
echo $(error BOARD_TAG should be specified. check board list with 'make show_boards')
|
||||
endif
|
||||
|
||||
ifndef ARDMK_DIR
|
||||
ARDMK_DIR := $(realpath $(dir $(realpath $(lastword $(MAKEFILE_LIST)))))
|
||||
endif
|
||||
|
||||
include $(ARDMK_DIR)/Common.mk
|
||||
|
||||
ifndef ARDUINO_PACKAGE_DIR
|
||||
# attempt to find based on Linux, macOS and Windows default
|
||||
ARDUINO_PACKAGE_DIR := $(firstword \
|
||||
$(call dir_if_exists,$(HOME)/.arduino15/packages) \
|
||||
$(call dir_if_exists,$(ARDUINO_DIR)/packages) \
|
||||
$(call dir_if_exists,$(HOME)/Library/Arduino15/packages) \
|
||||
$(call dir_if_exists,$(realpath $(USERPROFILE))/AppData/Local/Arduino15/packages) )
|
||||
$(call show_config_variable,ARDUINO_PACKAGE_DIR,[AUTODETECTED],(from DEFAULT))
|
||||
else
|
||||
$(call show_config_variable,ARDUINO_PACKAGE_DIR,[USER])
|
||||
endif
|
||||
|
||||
ifndef ARDMK_VENDOR
|
||||
ARDMK_VENDOR = OpenCR
|
||||
endif
|
||||
|
||||
ifndef ARCHITECTURE
|
||||
ARCHITECTURE := OpenCR
|
||||
endif
|
||||
|
||||
ifndef CORE_VER
|
||||
CORE_VER := $(wildcard $(ARDUINO_PACKAGE_DIR)/$(ARDMK_VENDOR)/hardware/$(ARCHITECTURE)/1.*)
|
||||
ifneq ($(CORE_VER),)
|
||||
CORE_VER := $(shell basename $(CORE_VER))
|
||||
$(call show_config_variable,CORE_VER,[AUTODETECTED],(from ARDUINO_PACKAGE_DIR))
|
||||
endif
|
||||
else
|
||||
$(call show_config_variable,CORE_VER,[USER])
|
||||
endif
|
||||
|
||||
ARCHITECTURE := sam
|
||||
|
||||
arduino_output =
|
||||
# When output is not suppressed and we're in the top-level makefile,
|
||||
# running for the first time (i.e., not after a restart after
|
||||
# regenerating the dependency file), then output the configuration.
|
||||
ifndef ARDUINO_QUIET
|
||||
ifeq ($(MAKE_RESTARTS),)
|
||||
ifeq ($(MAKELEVEL),0)
|
||||
arduino_output = $(info $(1))
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
# Arduino Settings (will get shown in Arduino.mk as computed)
|
||||
ifndef ALTERNATE_CORE_PATH
|
||||
ifdef CORE_VER
|
||||
ALTERNATE_CORE_PATH = $(ARDUINO_PACKAGE_DIR)/OpenCR/hardware/OpenCR/$(CORE_VER)
|
||||
else
|
||||
echo $(error Cannot find $(CORE_VER). Check directory settings.)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifndef ARDUINO_CORE_PATH
|
||||
ARDUINO_CORE_PATH= $(ALTERNATE_CORE_PATH)/cores/arduino
|
||||
endif
|
||||
|
||||
ifndef BOARDS_TXT
|
||||
BOARDS_TXT= $(ALTERNATE_CORE_PATH)/boards.txt
|
||||
endif
|
||||
|
||||
ifndef VARIANT
|
||||
VARIANT := $(call PARSE_BOARD,$(BOARD_TAG),build.variant)
|
||||
endif
|
||||
|
||||
ARDUINO_VAR_PATH = $(ALTERNATE_CORE_PATH)/variants/$(VARIANT)
|
||||
|
||||
|
||||
# Check boards file exists before continuing as parsing non-existant file can create problems
|
||||
ifneq ($(findstring boards.txt, $(wildcard $(ALTERNATE_CORE_PATH)/*.txt)), boards.txt)
|
||||
echo $(error $(CORE_VER) Cannot find boards file $(BOARDS_TXT). Check ?? and board support installed)
|
||||
endif
|
||||
|
||||
# grab any sources in the variant core path.
|
||||
# directorys were manually checked.
|
||||
# Core sources(used to generate libcore.a archive)
|
||||
OPENCR_CORE_C_SRCS_1 := $(wildcard $(ARDUINO_CORE_PATH)/avr/*.c)
|
||||
OPENCR_CORE_C_SRCS_2 := $(wildcard $(ARDUINO_CORE_PATH)/*.c)
|
||||
OPENCR_CORE_CPP_SRCS := $(wildcard $(ARDUINO_CORE_PATH)/*.cpp)
|
||||
|
||||
# library sources
|
||||
OPENCR_LIB_C_SRCS_1 := $(wildcard $(ARDUINO_VAR_PATH)/bsp/opencr/*.c)
|
||||
OPENCR_LIB_C_SRCS_2 := $(wildcard $(ARDUINO_VAR_PATH)/hw/*.c)
|
||||
OPENCR_LIB_C_SRCS_3 := $(wildcard $(ARDUINO_VAR_PATH)/hw/driver/*.c)
|
||||
OPENCR_LIB_C_SRCS_4 := $(wildcard $(ARDUINO_VAR_PATH)/hw/usb_cdc/*.c)
|
||||
OPENCR_LIB_C_SRCS_5 := $(wildcard $(ARDUINO_VAR_PATH)/lib/STM32F7xx_HAL_Driver/Src/*.c)
|
||||
OPENCR_LIB_CPP_SRCS := $(wildcard $(ARDUINO_VAR_PATH)/*.cpp)
|
||||
OPENCR_LIB_S_SRCS := $(wildcard $(ARDUINO_VAR_PATH)/bsp/opencr/startup/*.S)
|
||||
|
||||
ifndef F_CPU
|
||||
F_CPU := $(call PARSE_BOARD,$(BOARD_TAG),build.f_cpu)
|
||||
endif
|
||||
|
||||
OPENCR_LIB_OBJ_FILES = $(notdir $(OPENCR_LIB_C_SRCS_1:.c=.c.o)) $(notdir $(OPENCR_LIB_C_SRCS_2:.c=.c.o)) $(notdir $(OPENCR_LIB_C_SRCS_3:.c=.c.o)) $(notdir $(OPENCR_LIB_C_SRCS_4:.c=.c.o)) $(notdir $(OPENCR_LIB_C_SRCS_5:.c=.c.o)) $(notdir $(OPENCR_LIB_CPP_SRCS:.cpp=.cpp.o)) $(notdir $(OPENCR_LIB_S_SRCS:.S=.S.o))
|
||||
OTHER_OBJS = $(patsubst %, \
|
||||
$(OBJDIR)/OpenCRlib/%, $(OPENCR_LIB_OBJ_FILES))
|
||||
|
||||
OPENCR_CORE_OBJ_FILES = $(notdir $(OPENCR_CORE_C_SRCS_1:.c=.c.o)) $(notdir $(OPENCR_CORE_C_SRCS_2:.c=.c.o)) $(notdir $(OPENCR_CORE_CPP_SRCS:.cpp=.cpp.o))
|
||||
# override is used since opencr dosen't need other sam core objects
|
||||
override CORE_OBJS = $(patsubst %, \
|
||||
$(OBJDIR)/core/%, $(OPENCR_CORE_OBJ_FILES))
|
||||
|
||||
ifndef AVR_TOOLS_DIR
|
||||
AVR_TOOLS_DIR = $(call dir_if_exists,$(ARDUINO_PACKAGE_DIR)/OpenCR/tools/opencr_gcc/5.4.0-2016q2)
|
||||
endif
|
||||
ifeq ($(strip $(AVR_TOOLS_DIR)),)
|
||||
echo $(error $(AVR_TOOLS_DIR) Cannot find AVR_TOOLS_DIR. Check AVR_TOOLS_DIR)
|
||||
endif
|
||||
|
||||
# Robotis OpenCR platform library directory
|
||||
ifndef ARDUINO_PLATFORM_LIB_PATH
|
||||
ARDUINO_PLATFORM_LIB_PATH = $(ALTERNATE_CORE_PATH)/libraries
|
||||
$(call show_config_variable,ARDUINO_PLATFORM_LIB_PATH,[COMPUTED],(from OPENCR_DIR))
|
||||
endif
|
||||
|
||||
########################################################################
|
||||
# command names
|
||||
|
||||
TOOL_PREFIX = arm-none-eabi
|
||||
|
||||
# processor stuff
|
||||
ifndef MCU
|
||||
MCU := $(call PARSE_BOARD,$(BOARD_TAG),build.mcu)
|
||||
endif
|
||||
|
||||
ifndef MCU_FLAG_NAME
|
||||
MCU_FLAG_NAME=mcpu
|
||||
endif
|
||||
|
||||
########################################################################
|
||||
# FLAGS
|
||||
ifndef USB_TYPE
|
||||
USB_TYPE = USB_SERIAL
|
||||
endif
|
||||
|
||||
# from platform.txt
|
||||
CPPFLAGS += -DARDUINO_OpenCR
|
||||
CPPFLAGS += -DARDUINO_ARCH_OPENCR
|
||||
|
||||
CPPFLAGS += $(call PARSE_BOARD,$(BOARD_TAG),build.common_flags)
|
||||
|
||||
OPENCR_COMPILER_LIBS_C_FLAGS +=-I$(ARDUINO_VAR_PATH)/$(call PARSE_BOARD,$(BOARD_TAG),build.inc1)
|
||||
OPENCR_COMPILER_LIBS_C_FLAGS +=-I$(ARDUINO_VAR_PATH)/$(call PARSE_BOARD,$(BOARD_TAG),build.inc2)
|
||||
OPENCR_COMPILER_LIBS_C_FLAGS +=-I$(ARDUINO_VAR_PATH)/$(call PARSE_BOARD,$(BOARD_TAG),build.inc3)
|
||||
OPENCR_COMPILER_LIBS_C_FLAGS +=-I$(ARDUINO_VAR_PATH)/$(call PARSE_BOARD,$(BOARD_TAG),build.inc4)
|
||||
OPENCR_COMPILER_LIBS_C_FLAGS +=-I$(ARDUINO_VAR_PATH)/$(call PARSE_BOARD,$(BOARD_TAG),build.inc5)
|
||||
OPENCR_COMPILER_LIBS_C_FLAGS +=-I$(ARDUINO_VAR_PATH)/$(call PARSE_BOARD,$(BOARD_TAG),build.inc6)
|
||||
OPENCR_COMPILER_LIBS_C_FLAGS +=-I$(ARDUINO_VAR_PATH)/$(call PARSE_BOARD,$(BOARD_TAG),build.inc7)
|
||||
CPPFLAGS += $(OPENCR_COMPILER_LIBS_C_FLAGS)
|
||||
|
||||
CFLAGS_STD += -c -g -O2 -std=gnu11 -mfloat-abi=softfp -mfpu=fpv5-sp-d16 -Wall -Wextra -DDEBUG_LEVEL=DEBUG_ALL -MMD -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -DBOARD_$(VARIANT)
|
||||
|
||||
CXXFLAGS_STD += -c -g -O2 -std=gnu++11 -mfloat-abi=softfp -mfpu=fpv5-sp-d16 -Wall -Wextra -DDEBUG_LEVEL=DEBUG_ALL -MMD -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -DBOARD_$(VARIANT)
|
||||
|
||||
ASFLAGS += -c -g -x assembler-with-cpp -MMD
|
||||
|
||||
LDFLAGS += -lm -lgcc -mthumb -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-unresolved-symbols -Wl,--start-group -Wl,--whole-archive
|
||||
|
||||
LINKER_SCRIPTS = -T$(ARDUINO_VAR_PATH)/bsp/opencr/ldscript/opencr_flash.ld
|
||||
########################################################################
|
||||
# Reset is handled by upload script. OpenCR don't neet reset command.
|
||||
override RESET_CMD =
|
||||
|
||||
########################################################################
|
||||
# Object conversion & uploading magic, modified from Arduino.mk
|
||||
override TARGET_HEX = $(OBJDIR)/$(TARGET).bin
|
||||
|
||||
override avr_size = $(SIZE) --target=binary $(2)
|
||||
|
||||
# Define UPLOAD_TOOL as avrdude to use avrdude upload recipe in Arduino.mk
|
||||
override UPLOAD_TOOL = avrdude
|
||||
|
||||
ifeq ($(CURRENT_OS), WINDOWS)
|
||||
override AVRDUDE = $(ARDUINO_PACKAGE_DIR)/OpenCR/tools/opencr_tools/1.0.0/win/opencr_ld.exe
|
||||
else
|
||||
override AVRDUDE = $(ARDUINO_PACKAGE_DIR)/OpenCR/tools/opencr_tools/1.0.0/linux/opencr_ld
|
||||
endif
|
||||
override AVRDUDE_COM_OPTS = $(DEVICE_PATH)
|
||||
override AVRDUDE_ISP_OPTS = 115200 $(TARGET_HEX) 1
|
||||
override AVRDUDE_ISPLOAD_OPTS =
|
||||
|
||||
########################################################################
|
||||
# automatically include Arduino.mk
|
||||
|
||||
include $(ARDMK_DIR)/Arduino.mk
|
||||
|
||||
########################################################################
|
||||
|
||||
# OpenCR core files
|
||||
$(OBJDIR)/core/%.c.o: $(ARDUINO_CORE_PATH)/avr/%.c $(COMMON_DEPS) | $(OBJDIR)
|
||||
@$(MKDIR) $(dir $@)
|
||||
$(CC) -MMD -c $(CPPFLAGS) $(CFLAGS) $< -o $@
|
||||
|
||||
$(OBJDIR)/core/%.c.o: $(ARDUINO_CORE_PATH)/%.c $(COMMON_DEPS) | $(OBJDIR)
|
||||
@$(MKDIR) $(dir $@)
|
||||
$(CC) -MMD -c $(CPPFLAGS) $(CFLAGS) $< -o $@
|
||||
|
||||
$(OBJDIR)/core/%.cpp.o: $(ARDUINO_CORE_PATH)/%.cpp $(COMMON_DEPS) | $(OBJDIR)
|
||||
@$(MKDIR) $(dir $@)
|
||||
$(CXX) -MMD -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
|
||||
|
||||
# OpenCR lib files
|
||||
$(OBJDIR)/OpenCRlib/%.c.o: $(ARDUINO_VAR_PATH)/bsp/opencr/%.c $(COMMON_DEPS) | $(OBJDIR)
|
||||
@$(MKDIR) $(dir $@)
|
||||
$(CC) -MMD -c $(CPPFLAGS) $(CFLAGS) $< -o $@
|
||||
$(OBJDIR)/OpenCRlib/%.c.o: $(ARDUINO_VAR_PATH)/hw/%.c $(COMMON_DEPS) | $(OBJDIR)
|
||||
@$(MKDIR) $(dir $@)
|
||||
$(CC) -MMD -c $(CPPFLAGS) $(CFLAGS) $< -o $@
|
||||
|
||||
$(OBJDIR)/OpenCRlib/%.c.o: $(ARDUINO_VAR_PATH)/hw/driver/%.c $(COMMON_DEPS) | $(OBJDIR)
|
||||
@$(MKDIR) $(dir $@)
|
||||
$(CC) -MMD -c $(CPPFLAGS) $(CFLAGS) $< -o $@
|
||||
|
||||
$(OBJDIR)/OpenCRlib/%.c.o: $(ARDUINO_VAR_PATH)/hw/usb_cdc/%.c $(COMMON_DEPS) | $(OBJDIR)
|
||||
@$(MKDIR) $(dir $@)
|
||||
$(CC) -MMD -c $(CPPFLAGS) $(CFLAGS) $< -o $@
|
||||
|
||||
$(OBJDIR)/OpenCRlib/%.c.o: $(ARDUINO_VAR_PATH)/lib/STM32F7xx_HAL_Driver/Src/%.c $(COMMON_DEPS) | $(OBJDIR)
|
||||
@$(MKDIR) $(dir $@)
|
||||
$(CC) -MMD -c $(CPPFLAGS) $(CFLAGS) $< -o $@
|
||||
|
||||
$(OBJDIR)/OpenCRlib/%.cpp.o: $(ARDUINO_VAR_PATH)/%.cpp $(COMMON_DEPS) | $(OBJDIR)
|
||||
@$(MKDIR) $(dir $@)
|
||||
$(CXX) -MMD -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
|
||||
|
||||
$(OBJDIR)/OpenCRlib/%.S.o: $(ARDUINO_VAR_PATH)/bsp/opencr/startup/%.S $(COMMON_DEPS) | $(OBJDIR)
|
||||
@$(MKDIR) $(dir $@)
|
||||
$(CC) -MMD -c $(CPPFLAGS) $(ASFLAGS) $< -o $@
|
||||
|
||||
# Object conversion & uploading magic, modified from Arduino.mk
|
||||
$(OBJDIR)/%.bin: $(OBJDIR)/%.elf $(COMMON_DEPS)
|
||||
@$(MKDIR) $(dir $@)
|
||||
$(OBJCOPY) -v -Obinary $< $@
|
||||
@$(ECHO) '\n'
|
||||
$(call avr_size,$<,$@)
|
||||
ifneq ($(strip $(HEX_MAXIMUM_SIZE)),)
|
||||
@if [ `$(SIZE) --target=binary $@ | awk 'FNR == 2 {print $$2}'` -le $(HEX_MAXIMUM_SIZE) ]; then touch $@.sizeok; fi
|
||||
else
|
||||
@$(ECHO) "Maximum flash memory of $(BOARD_TAG) is not specified. Make sure the size of $@ is less then $(BOARD_TAG)\'s flash memory"
|
||||
@touch $@.sizeok
|
||||
endif
|
||||
|
||||
CORE_LIB += -Wl,--no-whole-archive -lstdc++
|
512
README.md
512
README.md
|
@ -1,532 +1,104 @@
|
|||
# A Makefile for Arduino Sketches [![Build Status](https://travis-ci.org/sudar/Arduino-Makefile.svg)](https://travis-ci.org/sudar/Arduino-Makefile)
|
||||
# A Makefile for Arduino Sketches
|
||||
|
||||
This is a very simple Makefile which knows how to build Arduino sketches. It defines entire workflows for compiling code, flashing it to Arduino and even communicating through Serial monitor. You don't need to change anything in the Arduino sketches.
|
||||
This is a very simple Makefile which knows how to build Arduino sketches. It defines the entire workflows for compiling code, flashing it to Arduino and even communicating through Serial monitor. You don't need to change anything in the Arduino sketches.
|
||||
|
||||
## Features
|
||||
|
||||
- Very robust
|
||||
- Highly customizable
|
||||
- Supports all official AVR-based Arduino boards
|
||||
- Supports official ARM-based Arduino boards using Atmel SAM chip family
|
||||
and includes on-device debugging targets.
|
||||
- Supports chipKIT
|
||||
- Supports Teensy 3.x (via Teensyduino)
|
||||
- Supports Robotis OpenCR 1.0
|
||||
- Works on all three major OS (Mac, Linux, Windows)
|
||||
- Auto detects serial baud rate and libraries used
|
||||
- Support for `*.ino` and `*.pde` sketches as well as raw `*.c` and `*.cpp`
|
||||
- Support for Arduino Software versions 0.x, 1.0.x, 1.5.x and 1.6.x except 1.6.2.
|
||||
We recommend 1.6.3 or above version of Arduino IDE.
|
||||
- Automatic dependency tracking. Referred libraries are automatically included
|
||||
in the build process. Changes in `*.h` files lead to recompilation of sources which include them
|
||||
|
||||
## Installation
|
||||
|
||||
### Through package
|
||||
|
||||
#### Using apt-get (or aptitude)
|
||||
|
||||
If you're using FreeBSD, Debian, Raspbian or Ubuntu, you can find this in the `arduino-mk`
|
||||
package which can be installed using `apt-get` or `aptitude`.
|
||||
|
||||
```sh
|
||||
sudo apt-get install arduino-mk
|
||||
```
|
||||
|
||||
#### homebrew (or linuxbrew)
|
||||
|
||||
If you're using homebrew (or [linuxbrew](https://github.com/Homebrew/linuxbrew)) then you can find this in the
|
||||
`arduino-mk` package which can be installed using the following commands.
|
||||
|
||||
Also make sure you have the necessary dependencies installed. Refer to the [Requirements](#requirements) section below to install the dependencies.
|
||||
|
||||
```sh
|
||||
# add tap
|
||||
$ brew tap sudar/arduino-mk
|
||||
|
||||
# to install the last stable release
|
||||
$ brew install arduino-mk
|
||||
|
||||
# to install the development version
|
||||
$ brew install --HEAD arduino-mk
|
||||
```
|
||||
|
||||
#### Arch Linux
|
||||
|
||||
Arch Linux users can use the unofficial AUR package [arduino-mk](https://aur.archlinux.org/packages/arduino-mk/).
|
||||
It can be installed with [AUR] helper using the following command.
|
||||
|
||||
```sh
|
||||
yay -S arduino-mk
|
||||
```
|
||||
|
||||
#### Fedora
|
||||
|
||||
Fedora Linux users can use our packaging instructions [here](https://github.com/sudar/Arduino-Makefile/tree/master/packaging/fedora)
|
||||
to build an RPM.
|
||||
|
||||
### From source
|
||||
|
||||
- Download the latest release
|
||||
- Or clone it from Github using the command `git clone git@github.com:sudar/Arduino-Makefile.git`
|
||||
- Check the [usage section](https://github.com/sudar/Arduino-Makefile#usage) in this readme about setting usage options
|
||||
|
||||
## Requirements
|
||||
|
||||
### Arduino IDE
|
||||
|
||||
You need to have the Arduino IDE. You can either install it through the
|
||||
installer or download the distribution zip file and extract it.
|
||||
|
||||
### pySerial
|
||||
|
||||
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.
|
||||
|
||||
On most systems you should be able to install it using either `pip3` or `easy_install3`.
|
||||
|
||||
```sh
|
||||
pip3 install pyserial
|
||||
|
||||
# or if you prefer easy_install
|
||||
|
||||
easy_install3 -U pyserial
|
||||
```
|
||||
|
||||
If you prefer to install it as a package, then you can do that as well.
|
||||
|
||||
On Debian or Ubuntu:
|
||||
|
||||
```sh
|
||||
apt-get install python3-serial
|
||||
```
|
||||
|
||||
On Fedora:
|
||||
|
||||
```sh
|
||||
dnf install python3-pyserial
|
||||
```
|
||||
|
||||
On openSUSE:
|
||||
|
||||
```sh
|
||||
zypper install python3-serial
|
||||
```
|
||||
|
||||
On Arch:
|
||||
|
||||
```sh
|
||||
sudo pacman -S python-pyserial
|
||||
```
|
||||
|
||||
On macOS using Homebrew (one can install to System Python but this is not recommend or good practice):
|
||||
|
||||
```sh
|
||||
brew install python
|
||||
pip3 install pyserial
|
||||
```
|
||||
|
||||
On Windows:
|
||||
|
||||
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:
|
||||
|
||||
1. download PySerial source package from [https://pypi.python.org/pypi/pyserial](https://pypi.python.org/pypi/pyserial)
|
||||
2. extract downloaded package running `tar xvzf dowloaded_package_name.tar.gz`
|
||||
3. navigate to extracted package folder
|
||||
4. build and install Python module:
|
||||
|
||||
```
|
||||
python3 setup.py build
|
||||
python3 setup.py install
|
||||
```
|
||||
|
||||
Alternatively, if you have setup Cygwin to use a Windows Python installation,
|
||||
simply install using pip:
|
||||
|
||||
```
|
||||
pip3 install pyserial
|
||||
```
|
||||
|
||||
Arduino-Makefile should automatically detect the Python installation type and
|
||||
use the correct device port binding.
|
||||
If you're using FreeBSD, Debian or Ubuntu, you can find this in the `arduino-mk` package.
|
||||
|
||||
## Usage
|
||||
|
||||
Download a copy of this repo somewhere to your system or install it through a package by following the above installation instruction.
|
||||
You can also find more [detailed instructions in this guide](http://hardwarefun.com/tutorials/compiling-arduino-sketches-using-makefile) or also checkout the sample makefiles inside the examples/ folder
|
||||
|
||||
Sample makefiles are provided in the `examples/` directory. E.g. [Makefile-example](examples/MakefileExample/Makefile-example.mk) demonstrates some of the more advanced options,
|
||||
whilst [Blink](examples/Blink/Makefile) demonstrates the minimal settings required for various boards like the Uno, Nano, Mega, Teensy, ATtiny etc.
|
||||
Download a copy of this repo some where in your system.
|
||||
|
||||
### Mac
|
||||
On the Mac you might want to set:
|
||||
|
||||
On the Mac with IDE 1.0 you might want to set:
|
||||
|
||||
```make
|
||||
ARDUINO_DIR = /Applications/Arduino.app/Contents/Resources/Java
|
||||
ARDMK_DIR = /usr/local
|
||||
|
||||
On Linux, you might prefer:
|
||||
|
||||
ARDUINO_DIR = /usr/share/arduino
|
||||
ARDMK_DIR = /usr/share/arduino
|
||||
ARDMK_PATH = /usr/bin
|
||||
AVR_TOOLS_DIR = /usr
|
||||
MONITOR_PORT = /dev/ttyACM0
|
||||
BOARD_TAG = mega2560
|
||||
```
|
||||
|
||||
On the Mac with IDE 1.5+ it's like above but with
|
||||
- `ARDUINO_DIR` - Path to Arduino installation
|
||||
- `ARDMK_DIR` - Path where the `*.mk` are present. If you installed the package, then it is usually `/usr/share/arduino`
|
||||
- `ARDMK_PATH` - Path where the `ard-reset-arduino` script is present. If you installed the package, then it is usually `/usr/bin`
|
||||
- `AVR_TOOLS_DIR` - Path where the avr tools chain binaries are present. If you are going to use the binaries that came with Arduino installation, then you don't have to set it.
|
||||
|
||||
```make
|
||||
ARDUINO_DIR = /Applications/Arduino.app/Contents/Java
|
||||
```
|
||||
### Linux
|
||||
The Makefile also delegates resetting the board to a short Perl program.
|
||||
You'll need to install `Device::SerialPort` to use it though.
|
||||
|
||||
You can either declare following variables in your project's makefile or set them as environmental variables.
|
||||
On Debian or Ubuntu:
|
||||
|
||||
```make
|
||||
ARDUINO_DIR – Directory where Arduino is installed
|
||||
ARDMK_DIR – Directory where you have copied the makefile
|
||||
AVR_TOOLS_DIR – Directory where avr tools are installed
|
||||
```
|
||||
apt-get install libdevice-serialport-perl
|
||||
|
||||
Keep in mind, that Arduino 1.5.x+ comes with it's own copy of avr tools which you can leverage in your build process here.
|
||||
On Fedora:
|
||||
|
||||
Example of ~/.bashrc file:
|
||||
yum install perl-Device-SerialPort
|
||||
|
||||
```make
|
||||
export ARDUINO_DIR=/home/sudar/apps/arduino-1.0.5
|
||||
export ARDMK_DIR=/home/sudar/Dropbox/code/Arduino-Makefile
|
||||
export AVR_TOOLS_DIR=/usr/include
|
||||
```
|
||||
On openSUSE:
|
||||
|
||||
Example of the project's make file:
|
||||
zypper install perl-Device-SerialPort
|
||||
|
||||
```make
|
||||
BOARD_TAG = mega2560
|
||||
MONITOR_PORT = /dev/ttyACM0
|
||||
```
|
||||
On Mac using MacPorts:
|
||||
|
||||
### Windows
|
||||
sudo port install p5-device-serialport
|
||||
|
||||
On Windows (using Cygwin), you might want to set:
|
||||
|
||||
```make
|
||||
# Symbolic link to Arduino installation directory - see below
|
||||
ARDUINO_DIR = C:/Arduino
|
||||
ARDMK_DIR = path/to/mkfile
|
||||
MONITOR_PORT = com3
|
||||
BOARD_TAG = mega2560
|
||||
```
|
||||
|
||||
**NOTE: Use forward slash not backslash and there should be no spaces or
|
||||
special characters in the Windows paths (due to Win/Unix crossover). The paths
|
||||
should not be *cygdrive* paths.**
|
||||
|
||||
On Windows (using MSYS and PuTTY), you might want to set the following extra parameters:
|
||||
|
||||
```make
|
||||
MONITOR_CMD = putty
|
||||
MONITOR_PARAMS = 8,1,n,N
|
||||
```
|
||||
|
||||
On Arduino 1.5+ installs, you should set the architecture to either `avr` or `sam` and if using a submenu CPU type, then also set that:
|
||||
|
||||
```make
|
||||
ARCHITECTURE = avr
|
||||
BOARD_TAG = atmegang
|
||||
BOARD_SUB = atmega168
|
||||
```
|
||||
|
||||
#### Symbolic Link
|
||||
|
||||
It is recommended in Windows that you create a symbolic link to avoid problems with file naming conventions on Windows; unless one installs to a non-default location. For example, if your your Arduino directory is in:
|
||||
|
||||
C:\Program Files (x86)\Arduino
|
||||
|
||||
You will get problems with the special characters on the directory name. More details about this can be found in [issue #94](https://github.com/sudar/Arduino-Makefile/issues/94)
|
||||
|
||||
To create a symbolic link, you can use the command “mklink” on Windows, e.g.
|
||||
|
||||
```sh
|
||||
mklink /d C:\Arduino C:\Program Files (x86)\Arduino
|
||||
```
|
||||
Alternatively if you've setup Cygwin hard symbolic links ([CYGWIN=winsymlinks:native](https://www.cygwin.com/cygwin-ug-net/using-cygwinenv.html)):
|
||||
|
||||
```sh
|
||||
ln -s /cygdrive/c/Program Files\ \(x86\)/Arduino/ C:/Arduino
|
||||
```
|
||||
|
||||
After which, the variables should be:
|
||||
|
||||
```make
|
||||
ARDUINO_DIR=C:/Arduino
|
||||
```
|
||||
|
||||
Instead of:
|
||||
|
||||
```make
|
||||
ARDUINO_DIR=C:/Program\ Files\ \(x86\)/Arduino
|
||||
```
|
||||
|
||||
### Useful Variables
|
||||
|
||||
The list of all variables that can be overridden is available at [arduino-mk-vars.md](arduino-mk-vars.md) file.
|
||||
|
||||
- `BOARD_TAG` - Type of board, for a list see boards.txt or `make show_boards`
|
||||
- `MONITOR_PORT` - The port where your Arduino is plugged in, usually `/dev/ttyACM0` or `/dev/ttyUSB0` in Linux or Mac OS X and `com3`, `com4`, etc. in Windows.
|
||||
- `ARDUINO_DIR` - Path to Arduino installation. Using Windows with Cygwin,
|
||||
this path must use Unix / and not Windows \\ (eg "C:/Arduino" not
|
||||
"C:\\Arduino).
|
||||
- `ARDMK_DIR` - Path where the `*.mk` are present. If you installed the package, then it is usually `/usr/share/arduino`. On Windows, this should be a path without spaces and no special characters, it can be a *cygdrive* path if necessary and must use / not \\.
|
||||
- `AVR_TOOLS_DIR` - Path where the avr tools chain binaries are present. If you are going to use the binaries that came with Arduino installation, then you don't have to set it. Otherwise set it relative and not absolute.
|
||||
and use /opt/local/bin/perl5 instead of /usr/bin/perl
|
||||
|
||||
On other systems:
|
||||
|
||||
cpan Device::SerialPort
|
||||
|
||||
## Including Libraries
|
||||
|
||||
You can specify space separated list of libraries that are needed for your sketch in the variable `ARDUINO_LIBS`.
|
||||
You can specify space separated list of libraries that are needed for your sketch to the variable `ARDUINO_LIBS`.
|
||||
|
||||
```make
|
||||
ARDUINO_LIBS = Wire SoftwareSerial
|
||||
```
|
||||
`ARDUINO_LIBS = Wire SoftwareSerial`
|
||||
|
||||
The libraries will be searched for in the following places in the following order.
|
||||
The libraries will be searched in the following places in the following order.
|
||||
|
||||
- `/libraries` directory inside your sketchbook directory. Sketchbook directory will be auto detected from your Arduino preference file. You can also manually set it through `ARDUINO_SKETCHBOOK`.
|
||||
- `/libraries` directory inside your Arduino directory, which is read from `ARDUINO_DIR`.
|
||||
- `/libraries` folder inside your sketchbook folder. Sketchbook folder will be auto detected from your Arduino preference file. You can also manually set it through `ARDUINO_SKETCHBOOK`.
|
||||
- `/libraries` folder inside your Arduino folder, which is read from `ARDUINO_DIR`.
|
||||
|
||||
The libraries inside user directories will take precedence over libraries present in Arduino core directory.
|
||||
The libraries inside user folder will take precedence over libraries present in Arduino core folder.
|
||||
|
||||
The makefile can autodetect the libraries that are included from your sketch and can include them automatically. But it can't detect libraries that are included from other libraries. (see [issue #93](https://github.com/sudar/Arduino-Makefile/issues/93))
|
||||
|
||||
## avrdude
|
||||
|
||||
To upload compiled files, `avrdude` is used. This Makefile tries to find `avrdude` and its config (`avrdude.conf`) below `ARDUINO_DIR`. If you like to use the one installed on your system instead of the one which came with Arduino, you can try to set the variables `AVRDUDE` and `AVRDUDE_CONF`. On a typical Linux system these could be set to
|
||||
To upload compiled files, `avrdude` is used. This Makefile tries to find `avrdude` and it's config (`avrdude.conf`) below `ARDUINO_DIR`. If you like to use the one installed on your system instead of the one which came with Arduino, you can try to set the variables `AVRDUDE` and `AVRDUDE_CONF`. On a typical Linux system these could be set to
|
||||
|
||||
```make
|
||||
AVRDUDE = /usr/bin/avrdude
|
||||
AVRDDUDE = /usr/bin/avrdude
|
||||
AVRDUDE_CONF = /etc/avrdude.conf
|
||||
```
|
||||
|
||||
## Teensy 3.x
|
||||
|
||||
For Teensy 3.x support you must first install [Teensyduino](http://www.pjrc.com/teensy/teensyduino.html).
|
||||
|
||||
See examples/BlinkTeensy for example usage.
|
||||
|
||||
## Robotis OpenCM
|
||||
|
||||
For Robotis OpenCM support you must first install [the OpenCM IDE](http://support.robotis.com/en/software/robotis_opencm/robotis_opencm.htm)
|
||||
|
||||
See examples/BlinkOpenCM for example usage.
|
||||
|
||||
For large Robotis projects, [libmaple](https://github.com/Rhoban/Maple) may be more appropriate, as the OpenCM IDE uses a very old compiler release.
|
||||
|
||||
## Arduino ARM Boards
|
||||
|
||||
For Arduino boards using ARM architechure, specifically the Atmel SAM series
|
||||
((SAM3X8E) Due; (SAMD21) Arduino M0 [Pro], Zero, MKR1000, Feather M0, etc.), first
|
||||
install the board support package from the IDE or other distribution channels.
|
||||
|
||||
Define`ARDUINO_PACKAGE_DIR` as the root path containing the ARM support
|
||||
package (the manufacturer folder) and the `BOARD_TAG` (see `make show_boards`
|
||||
for help) within your project Makefile. Include 'Sam.mk' rather than
|
||||
'Arduino.mk' at the end of your file - see examples/ZeroBlink,
|
||||
examples/MZeroBlink and examples/DueBlink for example usage.
|
||||
|
||||
**Note**: The Arduino IDE does not install board support packages to
|
||||
the base Arduino installation directory (the directory that will work with AVR
|
||||
Makefiles). They are generally installed to a '.arduino15/packages' folder in
|
||||
the users home directory. This is the reason for the new `ARDUINO_PACKAGE_DIR`
|
||||
define. On Windows, the package directory is often in the user home directory
|
||||
so advice is to create a symblic link to avoid slash/space in path problems.
|
||||
You can also manually install support packages in your Sketchbook 'hardware'
|
||||
folder, then define ARDUINO_PACKAGE_DIR as this path.
|
||||
|
||||
If using a SAM board from a manufacturer other than Arduino, one must still
|
||||
install the Arduino board support as above (unless using externally defined
|
||||
toolchain) and then define the location of the manufacturer board support core
|
||||
using the ALTERNATIVE_CORE_PATH define. For example: `ALTERNATE_CORE_PATH =
|
||||
$(ARDUINO_SKETCHBOOK)/hardware/sparkfun/samd`
|
||||
|
||||
The programing method will auto-detect based on the `BOARD_TAG` settings read
|
||||
from boards.txt:
|
||||
|
||||
Programming using OpenOCD CMSIS-DAP with the Programming/debug USB is
|
||||
currently supported (the same method used by the IDE), including burning
|
||||
bootloaders. External CMSIS tools such as Atmel Ice will also work with this
|
||||
method. Black Magic Probe (BMP) support is also included using GDB for both
|
||||
uploading and debugging.
|
||||
|
||||
Native USB programing using Bossa (Due, Zero, MKR1000, Feather style bootloaders)
|
||||
and avrdude (M0 bootloaders) is supported. The bootloaders on these devices
|
||||
requires a double press of the reset button or open/closing the serial port at
|
||||
1200 BAUD. The automatic entry of the bootloader is attempted using
|
||||
`ard-reset-arduino` when using the general `make upload` target by polling
|
||||
attached devices until the bootloader port re-attaches (same method as the
|
||||
IDE). On Windows, the USB enumerates as differnt COM ports for the CDC Serial
|
||||
and bootloader and these must be defined. On encountering problems, one can
|
||||
manually enter the bootloader then upload using the `make raw_upload` target.
|
||||
Note that the `make reset` target will enter the bootloader on these devices;
|
||||
there is no way to reset over USB.
|
||||
|
||||
If using system installed tools, be aware that `openocd` and `bossa` were
|
||||
orginally forked for Arduino support and system distributions may not be up
|
||||
to date with merged changes. `bossa` must be version 1.7->. `openocd` should
|
||||
work but there may be problems at run time
|
||||
[ref](https://github.com/pda/arduino-zero-without-ide). Ideally, use the
|
||||
support packaged version or compile and install the Arduino fork.
|
||||
|
||||
With the ARM chipset and using a CMSIS-DAP tool, on-device debugging is made available:
|
||||
|
||||
* `debug_init` and `debug` targets for on-device debugging using GDB. To use
|
||||
this, one must start the GDB server with `make debug_init &`, followed by
|
||||
connecting to the target with `make debug`. If using a Black Magic Probe,
|
||||
one can just use `make debug`. At the moment, a system wide `arm-none-eabi-gdb` must be
|
||||
installed as the one supplied with the Arduino toolchain
|
||||
does not appear to work.
|
||||
* Example usage: https://asciinema.org/a/Jarz7Pr3gD6mqaZvCACQBzqix
|
||||
* See the examples/MZeroBlink Makefile for a commented example.
|
||||
|
||||
## Versioning
|
||||
|
||||
The current version of the makefile is `1.6.0`. You can find the full history in the [HISTORY.md](HISTORY.md) file
|
||||
The current version of the makefile is `0.12.0`. You can find the full history in the [HISTORY.md](HISTORY.md) file
|
||||
|
||||
This project adheres to Semantic [Versioning 2.0](http://semver.org/).
|
||||
|
||||
## License
|
||||
|
||||
This makefile and the related documentation and examples are free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Lesser General Public License as
|
||||
published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
## Contribution
|
||||
|
||||
All contributions (even documentation) are welcome :) Open a pull request and I would be happy to merge them.
|
||||
Also checkout the [contribution guide](CONTRIBUTING.md) for more details.
|
||||
|
||||
If you are looking for ideas to work on, then check out the following TODO items or the [issue tracker](https://github.com/sudar/Arduino-Makefile/issues/).
|
||||
|
||||
## Limitations / Known Issues / TODO's
|
||||
## Limitations / Know Issues / TODO's
|
||||
|
||||
- Doesn't work with Arduino 1.5.x yet. Follow [issue #45](https://github.com/sudar/Arduino-Makefile/issues/45) for progress.
|
||||
- Since it doesn't do any pre processing like Arduino IDE, you have to declare all methods before you use them ([issue #59](https://github.com/sudar/Arduino-Makefile/issues/59))
|
||||
- More than one .ino or .pde file is not supported yet ([issue #49](https://github.com/sudar/Arduino-Makefile/issues/49))
|
||||
- When you compile for the first time, it builds all libs inside Arduino directory even if it is not needed. But while linking only the relevant files are linked. ([issue #29](https://github.com/sudar/Arduino-Makefile/issues/29)). Even Arduino IDE does the same thing though.
|
||||
- This makefile doesn't support boards or IDE from Arduino.org.
|
||||
|
||||
If you find an issue or have an idea for a feature then log them in the [issue tracker](https://github.com/sudar/Arduino-Makefile/issues/)
|
||||
|
||||
## Interfacing with other projects/frameworks/IDE's
|
||||
|
||||
### Colorgcc
|
||||
|
||||
It is possible to use [`colorgcc`](https://github.com/colorgcc/colorgcc) with this makefile. Check out [this comment](http://hardwarefun.com/tutorials/compiling-arduino-sketches-using-makefile#comment-1408) to find usage instructions.
|
||||
|
||||
### Emacs/Flymake support
|
||||
|
||||
On-the-fly syntax checking in Emacs using the [Flymake](http://www.emacswiki.org/emacs/FlyMake) minor mode is now possible.
|
||||
|
||||
First, the flymake mode must be configured to recognize ino files :
|
||||
|
||||
Edit the flymake configuration :
|
||||
|
||||
```
|
||||
M-x customize-option RET
|
||||
flymake-allowed-file-name-masks RET
|
||||
```
|
||||
|
||||
Add the line :
|
||||
|
||||
```
|
||||
("\\.ino\\'" flymake-simple-make-init)
|
||||
```
|
||||
|
||||
Then click on "Apply and Save" button
|
||||
|
||||
Then, the following line must be added to the project Makefile :
|
||||
|
||||
```make
|
||||
check-syntax:
|
||||
$(CXX) -c -include Arduino.h -x c++ $(CXXFLAGS) $(CPPFLAGS) -fsyntax-only $(CHK_SOURCES)
|
||||
```
|
||||
|
||||
### Code:Blocks integration
|
||||
|
||||
In Code:Blocks open Project -> Properties -> Project settings tab -> check "This is custom Makefile".
|
||||
|
||||
Now go to Settings -> Environment -> Environment variables -> Add
|
||||
|
||||
Add three keys with paths as values, using full paths (!):
|
||||
|
||||
```make
|
||||
ARDUINO_DIR=/full/path/to/arduino-1.0.6
|
||||
ARDMK_DIR=/full/path/to/sketchbook
|
||||
AVR_TOOLS_DIR=/usr
|
||||
```
|
||||
|
||||
Now to set DEBUG target (this will compile the project) go to Build options -> Debug -> "Make" commands
|
||||
|
||||
In Build Project/Target remove $target:
|
||||
|
||||
```sh
|
||||
$make -f $makefile
|
||||
```
|
||||
|
||||
In Clean Project/Target remove $target:
|
||||
|
||||
```sh
|
||||
$make -f $makefile clean
|
||||
```
|
||||
|
||||
To set the RELEASE target (which will compile and upload) go to Build options -> Release -> "Make" commands
|
||||
|
||||
In Build Project/Target put:
|
||||
|
||||
```sh
|
||||
$make -f $makefile upload
|
||||
```
|
||||
|
||||
In Clean Project/Target remove $target:
|
||||
|
||||
```sh
|
||||
$make -f $makefile clean
|
||||
```
|
||||
|
||||
## Test Suite
|
||||
|
||||
This project includes a suite of example Makefiles and small Arduino and chipKIT
|
||||
programs to assist the maintainers of the Makefile. Run
|
||||
`tests/script/bootstrap.sh` to attempt to automatically install the dependencies
|
||||
(Arduino IDE, MPIDE, etc.). Run `tests/script/runtests.sh` to attempt to compile
|
||||
all of the examples. The bootstrap script is primarily intended for use by a
|
||||
continuous integration server, specifically Travis CI. It is not intended for
|
||||
normal users.
|
||||
|
||||
## Makefile Generator and Project Initialisation
|
||||
|
||||
`ardmk-init` within the bin/ folder is a utility Python script to create a
|
||||
Arduino-mk Makefile for a project and also has option to create a traditional *tree*
|
||||
organization (src, lib, bin). It can be used as with commanline arguments or
|
||||
prompted - see examples below (append `$ARDMK_DIR/bin/` to command if not on path):
|
||||
|
||||
* Run prompted within current working directory: `ardmk-init`
|
||||
* Create Arduino Uno Makefile (useful within a library example): `ardmk-init -qb uno`
|
||||
* Create boilerplate Arduino Uno project in current working directory of same
|
||||
name: `ardmk-init -b uno --quiet --project`
|
||||
* Create Arduino-mk nano Makefile in current working directory with template .ino: `ardmk-init -b nano -u atmega328 -qtn my-project`
|
||||
* See `ardmk-init --help` for more.
|
||||
|
||||
### Bare-Arduino–Project
|
||||
|
||||
If you are planning on using this makefile in a larger/professional project, you might want to take a look at the [Bare-Arduino–Project](https://github.com/WeAreLeka/Bare-Arduino-Project) framework.
|
||||
|
||||
Similar to HTML frameworks, [Bare-Arduino–Project](https://github.com/WeAreLeka/Bare-Arduino-Project) aims at providing a basic `tree` organization, `Makefile` configurations for both OS X and Linux and a handful of instruction on how to get started with a robust Arduino project architecture.
|
||||
|
||||
Further information are available in the [README.md](https://github.com/WeAreLeka/Bare-Arduino-Project/blob/master/README.md) as well as in the [use/installation procedure](https://github.com/WeAreLeka/Bare-Arduino-Project/blob/master/INSTALL.md).
|
||||
|
||||
Please be sure to report issues to [Bare-Arduino–Project](https://github.com/WeAreLeka/Bare-Arduino-Project/issues) if you use it instead of this project.
|
||||
|
||||
## Credits
|
||||
|
||||
This makefile was originally created by [Martin Oldfield](http://mjo.tc/atelier/2009/02/arduino-cli.html) and he maintained it till v0.10.2.
|
||||
From May 2013, it is maintained by [Sudar Muthu](http://hardwarefun.com/tutorials/compiling-arduino-sketches-using-makefile) and [Simon John](https://github.com/sej7278) with the help of [40+ contributors](https://github.com/sudar/Arduino-Makefile/graphs/contributors).
|
||||
This makefile was originally created by [Martin Oldfield](http://mjo.tc/atelier/2009/02/arduino-cli.html) and he maintained it till v0.10.2.
|
||||
From May 2013, it is maintained by [Sudar](http://hardwarefun.com/tutorials/compiling-arduino-sketches-using-makefile)
|
||||
|
||||
## Similar works
|
||||
- It's not a derivative of this, but Alan Burlison has written a [similar thing](http://bleaklow.com/2010/06/04/a_makefile_for_arduino_sketches.html).
|
||||
|
|
463
Sam.mk
463
Sam.mk
|
@ -1,463 +0,0 @@
|
|||
########################################################################
|
||||
#
|
||||
# Support for Arduino Atmel SAM boards (sam and samd)
|
||||
#
|
||||
# You must install a SAM board hardware support package (such as Arduino Zero)
|
||||
# to use this, then define ARDUINO_PACKAGE_DIR as the path to the root
|
||||
# directory containing the support package.
|
||||
#
|
||||
# 2018 John Whittington @j_whittington
|
||||
#
|
||||
########################################################################
|
||||
|
||||
arduino_output =
|
||||
# When output is not suppressed and we're in the top-level makefile,
|
||||
# running for the first time (i.e., not after a restart after
|
||||
# regenerating the dependency file), then output the configuration.
|
||||
ifndef ARDUINO_QUIET
|
||||
ifeq ($(MAKE_RESTARTS),)
|
||||
ifeq ($(MAKELEVEL),0)
|
||||
arduino_output = $(info $(1))
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
ifndef ARDMK_DIR
|
||||
ARDMK_DIR := $(realpath $(dir $(realpath $(lastword $(MAKEFILE_LIST)))))
|
||||
endif
|
||||
|
||||
# include Common.mk now we know where it is
|
||||
ifndef COMMON_INCLUDED
|
||||
include $(ARDMK_DIR)/Common.mk
|
||||
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
|
||||
# attempt to find based on Linux, macOS and Windows default
|
||||
ARDUINO_PACKAGE_DIR := $(firstword \
|
||||
$(call dir_if_exists,$(HOME)/.arduino15/packages) \
|
||||
$(call dir_if_exists,$(ARDUINO_DIR)/packages) \
|
||||
$(call dir_if_exists,$(HOME)/Library/Arduino15/packages) \
|
||||
$(call dir_if_exists,$(USERPROFILE)/AppData/Local/Arduino15/packages) )
|
||||
$(call show_config_variable,ARDUINO_PACKAGE_DIR,[AUTODETECTED],(from DEFAULT))
|
||||
else
|
||||
$(call show_config_variable,ARDUINO_PACKAGE_DIR,[USER])
|
||||
endif
|
||||
|
||||
ifndef ARDMK_VENDOR
|
||||
ARDMK_VENDOR := arduino
|
||||
endif
|
||||
|
||||
ifndef ARCHITECTURE
|
||||
ARCHITECTURE := samd
|
||||
endif
|
||||
|
||||
ifndef CORE_VER
|
||||
CORE_VER := $(wildcard $(ARDUINO_PACKAGE_DIR)/$(ARDMK_VENDOR)/hardware/$(ARCHITECTURE)/1.*)
|
||||
ifneq ($(CORE_VER),)
|
||||
CORE_VER := $(shell basename $(CORE_VER))
|
||||
$(call show_config_variable,CORE_VER,[AUTODETECTED],(from ARDUINO_PACKAGE_DIR))
|
||||
endif
|
||||
else
|
||||
$(call show_config_variable,CORE_VER,[USER])
|
||||
endif
|
||||
|
||||
ifndef CMSIS_VER
|
||||
CMSIS_VER := $(wildcard $(ARDUINO_PACKAGE_DIR)/$(ARDMK_VENDOR)/tools/CMSIS/4.*)
|
||||
ifneq ($(CMSIS_VER),)
|
||||
CMSIS_VER := $(shell basename $(CMSIS_VER))
|
||||
$(call show_config_variable,CMSIS_VER,[AUTODETECTED],(from ARDUINO_PACKAGE_DIR))
|
||||
endif
|
||||
else
|
||||
$(call show_config_variable,CMSIS_VER,[USER])
|
||||
endif
|
||||
|
||||
ifndef CMSIS_ATMEL_VER
|
||||
CMSIS_ATMEL_VER := $(wildcard $(ARDUINO_PACKAGE_DIR)/$(ARDMK_VENDOR)/tools/CMSIS-Atmel/1.*)
|
||||
ifneq ($(CMSIS_ATMEL_VER),)
|
||||
CMSIS_ATMEL_VER := $(shell basename $(CMSIS_ATMEL_VER))
|
||||
$(call show_config_variable,CMSIS_ATMEL_VER,[AUTODETECTED],(from ARDUINO_PACKAGE_DIR))
|
||||
endif
|
||||
else
|
||||
$(call show_config_variable,CMSIS_ATMEL_VER,[USER])
|
||||
endif
|
||||
|
||||
ifndef CMSIS_DIR
|
||||
ifeq ($(findstring samd, $(strip $(ARCHITECTURE))), samd)
|
||||
CMSIS_DIR := $(ARDUINO_PACKAGE_DIR)/$(ARDMK_VENDOR)/tools/CMSIS/$(CMSIS_VER)/CMSIS
|
||||
else
|
||||
CMSIS_DIR = $(ALTERNATE_CORE_PATH)/system/CMSIS/CMSIS
|
||||
endif
|
||||
$(call show_config_variable,CMSIS_DIR,[AUTODETECTED],(from ARDUINO_PACKAGE_DIR))
|
||||
else
|
||||
$(call show_config_variable,CMSIS_DIR,[USER])
|
||||
endif
|
||||
|
||||
ifndef CMSIS_ATMEL_DIR
|
||||
ifeq ($(findstring samd, $(strip $(ARCHITECTURE))), samd)
|
||||
CMSIS_ATMEL_DIR := $(ARDUINO_PACKAGE_DIR)/$(ARDMK_VENDOR)/tools/CMSIS-Atmel/$(CMSIS_ATMEL_VER)/CMSIS
|
||||
else
|
||||
CMSIS_ATMEL_DIR = $(ALTERNATE_CORE_PATH)/system/CMSIS
|
||||
endif
|
||||
$(call show_config_variable,CMSIS_ATMEL_DIR,[AUTODETECTED],(from ARDUINO_PACKAGE_DIR))
|
||||
else
|
||||
$(call show_config_variable,CMSIS_ATMEL_DIR,[USER])
|
||||
endif
|
||||
|
||||
# Arduino Settings (will get shown in Arduino.mk as computed)
|
||||
ifndef ALTERNATE_CORE_PATH
|
||||
ifdef CORE_VER
|
||||
ALTERNATE_CORE_PATH = $(ARDUINO_PACKAGE_DIR)/$(ARDMK_VENDOR)/hardware/$(ARCHITECTURE)/$(CORE_VER)
|
||||
else
|
||||
ALTERNATE_CORE_PATH = $(ARDUINO_PACKAGE_DIR)/$(ARDMK_VENDOR)/hardware/$(ARCHITECTURE)
|
||||
endif
|
||||
endif
|
||||
ifndef ARDUINO_CORE_PATH
|
||||
ARDUINO_CORE_PATH = $(ALTERNATE_CORE_PATH)/cores/arduino
|
||||
endif
|
||||
ifndef BOARDS_TXT
|
||||
BOARDS_TXT = $(ALTERNATE_CORE_PATH)/boards.txt
|
||||
endif
|
||||
|
||||
# Check boards file exists before continuing as parsing non-existant file can create problems
|
||||
ifneq ($(findstring boards.txt, $(wildcard $(ALTERNATE_CORE_PATH)/*.txt)), boards.txt)
|
||||
echo $(error $(CORE_VER) Cannot find boards file $(BOARDS_TXT). Check ARDUINO_PACKAGE_DIR path: $(ARDUINO_PACKAGE_DIR) and board support installed)
|
||||
endif
|
||||
|
||||
# add CMSIS includes
|
||||
CPPFLAGS += -I$(CMSIS_DIR)/Include/
|
||||
CPPFLAGS += -I$(CMSIS_ATMEL_DIR)/Device/ATMEL
|
||||
# path for Cortex library
|
||||
LIB_PATH = $(CMSIS_DIR)/Lib/GCC
|
||||
BOOTLOADER_PARENT = $(ALTERNATE_CORE_PATH)/bootloaders
|
||||
|
||||
ifndef VARIANT
|
||||
VARIANT := $(call PARSE_BOARD,$(BOARD_TAG),menu.(chip|cpu).$(BOARD_SUB).build.variant)
|
||||
ifndef VARIANT
|
||||
VARIANT := $(call PARSE_BOARD,$(BOARD_TAG),build.variant)
|
||||
endif
|
||||
endif
|
||||
|
||||
# grab any sources in the variant core path (variant.cpp defines pin/port mapping on SAM devices)
|
||||
ifndef SAM_CORE_PATH
|
||||
SAM_CORE_PATH := $(ALTERNATE_CORE_PATH)/variants/$(VARIANT)
|
||||
endif
|
||||
SAM_CORE_C_SRCS := $(wildcard $(SAM_CORE_PATH)/*.c)
|
||||
SAM_CORE_CPP_SRCS := $(wildcard $(SAM_CORE_PATH)/*.cpp)
|
||||
SAM_CORE_S_SRCS := $(wildcard $(SAM_CORE_PATH)/*.S)
|
||||
|
||||
# due/sam specific paths hard define chip type for SystemInit function in system_CHIP.c as not included in core like samd
|
||||
ifeq ($(findstring arduino_due, $(strip $(VARIANT))), arduino_due)
|
||||
ifndef SAM_SYSTEM_PATH
|
||||
SAM_SYSTEM_PATH := $(CMSIS_ATMEL_DIR)/Device/ATMEL/sam3xa
|
||||
endif
|
||||
ifndef SAM_LIBSAM_PATH
|
||||
SAM_LIBSAM_PATH := $(ALTERNATE_CORE_PATH)/system/libsam
|
||||
endif
|
||||
CPPFLAGS += -I$(SAM_SYSTEM_PATH)/include
|
||||
CPPFLAGS += -I$(SAM_LIBSAM_PATH)
|
||||
CPPFLAGS += -I$(SAM_LIBSAM_PATH)/include
|
||||
SAM_CORE_C_SRCS += $(wildcard $(SAM_LIBSAM_PATH)/source/*.c)
|
||||
SAM_CORE_C_SRCS += $(wildcard $(SAM_SYSTEM_PATH)/source/*.c)
|
||||
endif
|
||||
|
||||
# define plaform lib dir from Arduino ARM support
|
||||
ifndef ARDUINO_PLATFORM_LIB_PATH
|
||||
ARDUINO_PLATFORM_LIB_PATH := $(ALTERNATE_CORE_PATH)/libraries
|
||||
$(call show_config_variable,ARDUINO_PLATFORM_LIB_PATH,[COMPUTED],(from ARDUINO_PACKAGE_DIR))
|
||||
endif
|
||||
|
||||
########################################################################
|
||||
# command names
|
||||
|
||||
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
|
||||
GDB_NAME := $(call PARSE_BOARD,$(BOARD_TAG),build.command.gdb)
|
||||
ifndef GDB_NAME
|
||||
GDB_NAME := $(TOOL_PREFIX)-gdb
|
||||
else
|
||||
$(call show_config_variable,GDB_NAME,[COMPUTED])
|
||||
endif
|
||||
endif
|
||||
|
||||
ifndef UPLOAD_TOOL
|
||||
UPLOAD_TOOL := $(call PARSE_BOARD,$(BOARD_TAG),upload.tool)
|
||||
ifndef UPLOAD_TOOL
|
||||
UPLOAD_TOOL := openocd
|
||||
else
|
||||
$(call show_config_variable,UPLOAD_TOOL,[COMPUTED])
|
||||
endif
|
||||
endif
|
||||
|
||||
ifndef BOOTLOADER_UPLOAD_TOOL
|
||||
BOOTLOADER_UPLOAD_TOOL := $(call PARSE_BOARD,$(BOARD_TAG),bootloader.tool)
|
||||
ifndef BOOTLOADER_UPLOAD_TOOL
|
||||
BOOTLOADER_UPLOAD_TOOL := openocd
|
||||
else
|
||||
$(call show_config_variable,BOOTLOADER_UPLOAD_TOOL,[COMPUTED])
|
||||
endif
|
||||
endif
|
||||
|
||||
# processor stuff
|
||||
ifndef MCU
|
||||
MCU := $(call PARSE_BOARD,$(BOARD_TAG),build.mcu)
|
||||
endif
|
||||
|
||||
ifndef MCU_FLAG_NAME
|
||||
MCU_FLAG_NAME=mcpu
|
||||
endif
|
||||
|
||||
# native port emulates an AVR chip to use AVRDUDE
|
||||
ifndef AVRDUDE_MCU
|
||||
AVRDUDE_MCU := $(call PARSE_BOARD,$(BOARD_TAG),build.emu.mcu)
|
||||
endif
|
||||
|
||||
# GDP settings
|
||||
ifndef GDB_PORT
|
||||
# default to localhost default OpenOCD port
|
||||
GDB_PORT = localhost:3333
|
||||
endif
|
||||
|
||||
ifndef GDB_OPTS
|
||||
# if using BMP do a scan and attach
|
||||
ifeq ($(findstring /dev/tty, $(strip $(GDB_PORT))), /dev/tty)
|
||||
GDB_OPTS = -ex "target extended-remote $(GDB_PORT)" -ex "monitor swdp_scan" -ex "attach 1" -ex "load" -d $(OBJDIR) $(TARGET_ELF)
|
||||
else
|
||||
GDB_OPTS = -ex "target extended-remote $(GDB_PORT)" -ex "load" -d $(OBJDIR) $(TARGET_ELF)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifndef GDB_UPLOAD_OPTS
|
||||
GDB_UPLOAD_OPTS = $(GDB_OPTS) -ex "set confirm off" -ex "set target-async off" -ex "set remotetimeout 30" -ex "detach" -ex "kill" -ex "quit"
|
||||
endif
|
||||
|
||||
########################################################################
|
||||
# OpenOCD for SAM devices
|
||||
|
||||
ifndef OPENOCD
|
||||
BUNDLED_OPENOCD_DIR := $(call dir_if_exists,$(ARDUINO_PACKAGE_DIR)/$(ARDMK_VENDOR)/tools/openocd)
|
||||
# Try Arduino support package first
|
||||
ifdef 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/
|
||||
$(call show_config_variable,OPENOCD,[AUTODETECTED],(from ARDUINO_PACKAGE_DIR))
|
||||
else
|
||||
# Otherwise look on user path
|
||||
OPENOCD := $(shell which openocd 2>/dev/null)
|
||||
ifdef OPENOCD
|
||||
$(call show_config_variable,OPENOCD,[AUTODETECTED],(found in $$PATH))
|
||||
endif
|
||||
endif
|
||||
else
|
||||
$(call show_config_variable,OPENOCD,[USER])
|
||||
endif
|
||||
|
||||
ifndef OPENOCD_OPTS
|
||||
OPENOCD_OPTS += -d2 -f $(ALTERNATE_CORE_PATH)/variants/$(VARIANT)/$(OPENOCD_SCRIPT)
|
||||
endif
|
||||
|
||||
########################################################################
|
||||
# Bossa for SAM devices
|
||||
|
||||
ifndef BOSSA
|
||||
BUNDLED_BOSSA_DIR := $(call dir_if_exists,$(ARDUINO_PACKAGE_DIR)/$(ARDMK_VENDOR)/tools/bossac)
|
||||
# Try Arduino support package first
|
||||
ifdef BUNDLED_BOSSA_DIR
|
||||
ifndef BOSSA_VER
|
||||
BOSSA_VER := $(shell basename $(lastword $(wildcard $(BUNDLED_BOSSA_DIR)/*)))
|
||||
endif
|
||||
BOSSA = $(BUNDLED_BOSSA_DIR)/$(BOSSA_VER)/bossac
|
||||
$(call show_config_variable,BOSSA,[AUTODETECTED],(from ARDUINO_PACKAGE_DIR))
|
||||
else
|
||||
# Otherwise look on user path
|
||||
BOSSA := $(shell which bossac 2>/dev/null)
|
||||
ifdef BOSSA
|
||||
$(call show_config_variable,BOSSA,[AUTODETECTED],(found in $$PATH))
|
||||
endif
|
||||
endif
|
||||
else
|
||||
$(call show_config_variable,BOSSA,[USER])
|
||||
endif
|
||||
|
||||
ifndef BOSSA_OPTS
|
||||
BOSSA_OPTS += -d --info --erase --write --verify --reset
|
||||
# Arduino Due forces RS-232 mode and boots from flash
|
||||
ifeq ($(findstring arduino_due, $(strip $(VARIANT))), arduino_due)
|
||||
BOSSA_OPTS += -U false -b
|
||||
endif
|
||||
endif
|
||||
|
||||
get_bootloader = $(shell $(RESET_CMD) | tail -1)
|
||||
|
||||
# if not bootloader port defined (ISP_PORT), automatically grab first port after reset
|
||||
# if not on windows
|
||||
ifndef ISP_PORT
|
||||
ifeq ($(CURRENT_OS), WINDOWS)
|
||||
BOSSA_OPTS += --port=$(COM_STYLE_MONITOR_PORT)
|
||||
else
|
||||
BOSSA_OPTS += --port=$(notdir $(call get_monitor_port))
|
||||
endif
|
||||
else
|
||||
BOSSA_OPTS += --port=$(ISP_PORT)
|
||||
endif
|
||||
|
||||
########################################################################
|
||||
# EXECUTABLES
|
||||
# Define them here to use ARM_TOOLS_PATH and allow auto finding of AVR_TOOLS_PATH
|
||||
|
||||
AVR_TOOLS_DIR := $(ARM_TOOLS_DIR)
|
||||
#GDB = $(ARM_TOOLS_PATH)/$(GDB_NAME)
|
||||
# Use system gdb for now as Arduino supplied has lib error?
|
||||
GDB = $(GDB_NAME)
|
||||
|
||||
########################################################################
|
||||
# FLAGS
|
||||
|
||||
ifndef USB_TYPE
|
||||
USB_TYPE = USBCON
|
||||
endif
|
||||
|
||||
ifndef USB_PRODUCT
|
||||
USB_PRODUCT := $(call PARSE_BOARD,$(BOARD_TAG),build.usb_product)
|
||||
ifdef USB_PRODUCT
|
||||
$(call show_config_variable,USB_PRODUCT,[COMPUTED])
|
||||
endif
|
||||
endif
|
||||
|
||||
ifndef USB_MANUFACTURER
|
||||
USB_MANUFACTURER := $(call PARSE_BOARD,$(BOARD_TAG),build.usb_manufacturer)
|
||||
ifndef USB_MANUFACTURER
|
||||
USB_MANUFACTURER = "Unknown"
|
||||
else
|
||||
$(call show_config_variable,USB_MANUFACTURER,[COMPUTED])
|
||||
endif
|
||||
endif
|
||||
|
||||
ifndef USB_VID
|
||||
USB_VID := $(call PARSE_BOARD,$(BOARD_TAG),build.vid)
|
||||
ifdef USB_VID
|
||||
$(call show_config_variable,USB_VID,[COMPUTED])
|
||||
endif
|
||||
endif
|
||||
|
||||
ifndef USB_PID
|
||||
USB_PID := $(call PARSE_BOARD,$(BOARD_TAG),build.pid)
|
||||
ifdef USB_PID
|
||||
$(call show_config_variable,USB_PID,[COMPUTED])
|
||||
endif
|
||||
endif
|
||||
|
||||
# Bootloader settings
|
||||
ifndef BOOTLOADER_SIZE
|
||||
BOOTLOADER_SIZE := $(call PARSE_BOARD,$(BOARD_TAG),bootloader.size)
|
||||
ifndef BOOTLOADER_SIZE
|
||||
BOOTLOADER_SIZE := 0x2000
|
||||
else
|
||||
$(call show_config_variable,BOOTLOADER_SIZE,[COMPUTED])
|
||||
endif
|
||||
endif
|
||||
|
||||
ifndef BOOTLOADER_UNPROTECT
|
||||
BOOTLOADER_UNPROTECT := $(call PARSE_BOARD,$(BOARD_TAG),bootloader.cmd_unprotect)
|
||||
ifndef BOOTLOADER_UNPROTECT
|
||||
BOOTLOADER_UNPROTECT := at91samd bootloader 0
|
||||
else
|
||||
$(call show_config_variable,BOOTLOADER_UNPROTECT,[COMPUTED])
|
||||
endif
|
||||
endif
|
||||
|
||||
ifndef BOOTLOADER_PROTECT
|
||||
BOOTLOADER_PROTECT := $(call PARSE_BOARD,$(BOARD_TAG),bootloader.cmd_protect)
|
||||
ifndef BOOTLOADER_PROTECT
|
||||
BOOTLOADER_PROTECT := at91samd bootloader 16384
|
||||
else
|
||||
$(call show_config_variable,BOOTLOADER_PROTECT,[COMPUTED])
|
||||
endif
|
||||
endif
|
||||
|
||||
ifndef BOOTLOADER_PROTECT_VERIFY
|
||||
BOOTLOADER_PROTECT_VERIFY := $(call PARSE_BOARD,$(BOARD_TAG),bootloader.cmd_protect_verify)
|
||||
ifndef BOOTLOADER_PROTECT_VERIFY
|
||||
BOOTLOADER_PROTECT_VERIFY := at91samd bootloader
|
||||
else
|
||||
$(call show_config_variable,BOOTLOADER_PROTECT_VERIFY,[COMPUTED])
|
||||
endif
|
||||
endif
|
||||
|
||||
CFLAGS_STD += -std=gnu11
|
||||
CPPFLAGS += -DMD -D$(USB_TYPE) '-DUSB_PRODUCT=$(USB_PRODUCT)' '-DUSB_MANUFACTURER=$(USB_MANUFACTURER)'
|
||||
|
||||
# Get extra define flags from boards.txt
|
||||
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}
|
||||
CPPFLAGS += $(EXFLAGS)
|
||||
CPPFLAGS += -DUSB_VID=$(USB_VID)
|
||||
CPPFLAGS += -DUSB_PID=$(USB_PID)
|
||||
# Cortex compiler flags
|
||||
CPPFLAGS += -mthumb -nostdlib --param max-inline-insns-single=500 -fno-exceptions -Wl,-Map=$(OBJDIR)/$(TARGET).map
|
||||
CXXFLAGS += -fno-rtti -fno-threadsafe-statics -std=gnu++11
|
||||
|
||||
ifndef SIZEFLAGS
|
||||
SIZEFLAGS += -B
|
||||
endif
|
||||
|
||||
AMCU := $(call PARSE_BOARD,$(BOARD_TAG),build.mcu)
|
||||
BOARD_LINKER_SCRIPT := $(call PARSE_BOARD,$(BOARD_TAG),build.ldscript)
|
||||
OPENOCD_SCRIPT := $(call PARSE_BOARD,$(BOARD_TAG),build.openocdscript)
|
||||
LINKER_SCRIPTS := -T$(ALTERNATE_CORE_PATH)/variants/$(VARIANT)/$(BOARD_LINKER_SCRIPT)
|
||||
OTHER_LIBS := $(call PARSE_BOARD,$(BOARD_TAG),build.flags.libs)
|
||||
|
||||
# Due and SAMD boards have different flags/chip specific libs
|
||||
ifeq ($(findstring arduino_due, $(strip $(VARIANT))), arduino_due)
|
||||
CPPFLAGS += -Dprintf=iprintf -DARDUINO_SAM_DUE
|
||||
LDFLAGS += -mthumb -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--entry=Reset_Handler -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align -Wl,--start-group -u _sbrk -u link -u _close -u _fstat -u _isatty -u _lseek -u _read -u _write -u _exit -u kill -u _getpid
|
||||
LDFLAGS += -L$(LIB_PATH) -lm # -larm_cortexM3l_math # IDE doesn't include Cortex-M3 math lib on Due for some reason
|
||||
OTHER_LIBS += $(ALTERNATE_CORE_PATH)/variants/$(VARIANT)/libsam_sam3x8e_gcc_rel.a
|
||||
else
|
||||
LDFLAGS += --specs=nano.specs --specs=nosys.specs -mthumb -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align -Wl,--start-group
|
||||
LDFLAGS += -larm_cortexM0l_math -L$(LIB_PATH) -lm
|
||||
endif
|
||||
|
||||
# OpenOCD reset command only for now
|
||||
ifeq ($(strip $(UPLOAD_TOOL)), openocd)
|
||||
RESET_CMD = $(OPENOCD) $(OPENOCD_OPTS) -c "telnet_port disabled; init; targets; reset run; shutdown"
|
||||
else
|
||||
# Set zero flag for ard-reset for 1200 baud boot to bootloader
|
||||
ARD_RESET_OPTS += --zero
|
||||
endif
|
||||
|
||||
########################################################################
|
||||
# automatially include Arduino.mk for the user
|
||||
|
||||
$(call show_separator)
|
||||
$(call arduino_output,Arduino.mk Configuration:)
|
||||
include $(ARDMK_DIR)/Arduino.mk
|
||||
|
||||
print-% : ; @echo $* = $($*)
|
137
Teensy.mk
137
Teensy.mk
|
@ -1,137 +0,0 @@
|
|||
########################################################################
|
||||
#
|
||||
# Support for Teensy 3.x boards
|
||||
#
|
||||
# https://www.pjrc.com/teensy/
|
||||
#
|
||||
# You must install teensyduino for this Makefile to work:
|
||||
#
|
||||
# http://www.pjrc.com/teensy/teensyduino.html
|
||||
#
|
||||
# Copyright (C) 2014 Jeremy Shaw <jeremy@n-heptane.com> based on
|
||||
# work that is copyright Sudar, Nicholas Zambetti, David A. Mellis
|
||||
# & Hernando Barragan.
|
||||
#
|
||||
# This file is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Lesser General Public License as
|
||||
# published by the Free Software Foundation; either version 2.1 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# Adapted from Arduino 0011 Makefile by M J Oldfield
|
||||
#
|
||||
# Original Arduino adaptation by mellis, eighthave, oli.keller
|
||||
#
|
||||
# Refer to HISTORY.md file for complete history of changes
|
||||
#
|
||||
########################################################################
|
||||
|
||||
|
||||
ifndef ARDMK_DIR
|
||||
ARDMK_DIR := $(realpath $(dir $(realpath $(lastword $(MAKEFILE_LIST)))))
|
||||
endif
|
||||
|
||||
# include Common.mk now we know where it is
|
||||
include $(ARDMK_DIR)/Common.mk
|
||||
|
||||
ARDMK_VENDOR = teensy
|
||||
ARDUINO_CORE_PATH = $(ARDUINO_DIR)/hardware/teensy/avr/cores/teensy3
|
||||
BOARDS_TXT = $(ARDUINO_DIR)/hardware/$(ARDMK_VENDOR)/avr/boards.txt
|
||||
|
||||
|
||||
ifndef F_CPU
|
||||
ifndef BOARD_SUB
|
||||
SPEEDS := $(call PARSE_BOARD,"$(BOARD_TAG),menu.speed.*.build.fcpu") # Obtain sequence of supported frequencies.
|
||||
SPEEDS := $(shell printf "%d\n" $(SPEEDS) | sort -g) # Sort it, just in case. Printf to re-append newlines so that sort works.
|
||||
F_CPU := $(lastword $(SPEEDS)) # List is sorted in ascending order. Take the fastest speed.
|
||||
#$(info "speeds is " $(SPEEDS)) # Good for debugging
|
||||
else
|
||||
F_CPU := $(call PARSE_BOARD,$(BOARD_TAG),menu.speed.$(BOARD_SUB).build.fcpu)
|
||||
endif
|
||||
endif
|
||||
|
||||
# if boards.txt gets modified, look there, else hard code it
|
||||
ARCHITECTURE = $(call PARSE_BOARD,$(BOARD_TAG),build.architecture)
|
||||
ifeq ($(strip $(ARCHITECTURE)),)
|
||||
ARCHITECTURE = arm
|
||||
endif
|
||||
|
||||
AVR_TOOLS_DIR = $(call dir_if_exists,$(ARDUINO_DIR)/hardware/tools/$(ARCHITECTURE))
|
||||
|
||||
# define plaform lib dir ignoring teensy's oversight on putting it all in avr
|
||||
ifndef ARDUINO_PLATFORM_LIB_PATH
|
||||
ARDUINO_PLATFORM_LIB_PATH = $(ARDUINO_DIR)/hardware/$(ARDMK_VENDOR)/avr/libraries
|
||||
$(call show_config_variable,ARDUINO_PLATFORM_LIB_PATH,[COMPUTED],(from ARDUINO_DIR))
|
||||
endif
|
||||
|
||||
########################################################################
|
||||
# command names
|
||||
|
||||
TOOL_PREFIX = arm-none-eabi
|
||||
|
||||
# processor stuff
|
||||
ifndef MCU
|
||||
MCU := $(call PARSE_BOARD,$(BOARD_TAG),build.mcu)
|
||||
endif
|
||||
|
||||
ifndef MCU_FLAG_NAME
|
||||
MCU_FLAG_NAME=mcpu
|
||||
endif
|
||||
|
||||
########################################################################
|
||||
# FLAGS
|
||||
ifndef USB_TYPE
|
||||
USB_TYPE = USB_SERIAL
|
||||
endif
|
||||
|
||||
CPPFLAGS += -DLAYOUT_US_ENGLISH -D$(USB_TYPE)
|
||||
|
||||
CPPFLAGS += $(call PARSE_BOARD,$(BOARD_TAG),build.option)
|
||||
|
||||
CXXFLAGS += $(call PARSE_BOARD,$(BOARD_TAG),build.cppoption)
|
||||
ifeq ("$(call PARSE_BOARD,$(BOARD_TAG),build.gnu0x)","true")
|
||||
CXXFLAGS_STD += -std=gnu++0x
|
||||
endif
|
||||
|
||||
ifeq ("$(call PARSE_BOARD,$(BOARD_TAG),build.elide_constructors)", "true")
|
||||
CXXFLAGS += -felide-constructors
|
||||
endif
|
||||
|
||||
CXXFLAGS += $(call PARSE_BOARD,$(BOARD_TAG),build.flags.common)
|
||||
CXXFLAGS += $(call PARSE_BOARD,$(BOARD_TAG),build.flags.cpu)
|
||||
CXXFLAGS += $(call PARSE_BOARD,$(BOARD_TAG),build.flags.defs)
|
||||
CXXFLAGS += $(call PARSE_BOARD,$(BOARD_TAG),build.flags.cpp)
|
||||
|
||||
CFLAGS += $(call PARSE_BOARD,$(BOARD_TAG),build.flags.common)
|
||||
CFLAGS += $(call PARSE_BOARD,$(BOARD_TAG),build.flags.cpu)
|
||||
CFLAGS += $(call PARSE_BOARD,$(BOARD_TAG),build.flags.defs)
|
||||
|
||||
ASFLAGS += $(call PARSE_BOARD,$(BOARD_TAG),build.flags.common)
|
||||
ASFLAGS += $(call PARSE_BOARD,$(BOARD_TAG),build.flags.cpu)
|
||||
ASFLAGS += $(call PARSE_BOARD,$(BOARD_TAG),build.flags.defs)
|
||||
ASFLAGS += $(call PARSE_BOARD,$(BOARD_TAG),build.flags.S)
|
||||
|
||||
LDFLAGS += $(call PARSE_BOARD,$(BOARD_TAG),build.flags.cpu)
|
||||
|
||||
AMCU := $(call PARSE_BOARD,$(BOARD_TAG),build.mcu)
|
||||
LDFLAGS += -Wl,--gc-sections,--relax
|
||||
LINKER_SCRIPTS ?= -T${ARDUINO_CORE_PATH}/${AMCU}.ld
|
||||
OTHER_LIBS = $(call PARSE_BOARD,$(BOARD_TAG),build.flags.libs)
|
||||
|
||||
CPUFLAGS = $(call PARSE_BOARD,$(BOARD_TAG),build.flags.cpu)
|
||||
# usually defined as per teensy31.build.mcu=mk20dx256 but that isn't valid switch
|
||||
MCU := $(shell echo ${CPUFLAGS} | sed -n -e 's/.*-mcpu=\([a-zA-Z0-9_-]*\).*/\1/p')
|
||||
|
||||
########################################################################
|
||||
# some fairly odd settings so that 'make upload' works
|
||||
#
|
||||
# may require additional patches for Windows support
|
||||
|
||||
do_upload: override get_monitor_port=""
|
||||
AVRDUDE=@true
|
||||
RESET_CMD = nohup $(ARDUINO_DIR)/hardware/tools/teensy_post_compile -board=$(BOARD_TAG) -tools=$(abspath $(ARDUINO_DIR)/hardware/tools) -path=$(abspath $(OBJDIR)) -file=$(TARGET) > /dev/null ; $(ARDUINO_DIR)/hardware/tools/teensy_reboot
|
||||
|
||||
########################################################################
|
||||
# automatially include Arduino.mk for the user
|
||||
|
||||
include $(ARDMK_DIR)/Arduino.mk
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
.TH ARD-RESET-ARDUINO "1" "January 2017" "ard-reset-arduino 1.6.0" "Arduino CLI Reset"
|
||||
|
||||
.SH NAME
|
||||
ard-reset-arduino - Reset Arduino board
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B ard-reset-arduino
|
||||
[OPTION]... [PORT]
|
||||
|
||||
.SH DESCRIPTION
|
||||
To reset Arduinos, we either pulse the DTR line or open the USB port
|
||||
at 1200 baud and close it again.
|
||||
|
||||
.SH OPTIONS
|
||||
.B \-\-verbose
|
||||
Watch what's going on on STDERR.
|
||||
|
||||
.B \-\-period
|
||||
Specify the DTR pulse width in seconds.
|
||||
|
||||
.B \-\-caterina
|
||||
Reset a Leonardo, Micro, Robot, LilyPadUSB or similar 32u4-based device.
|
||||
|
||||
.SH EXAMPLES
|
||||
ard-reset-arduino /dev/ttyACM0
|
||||
.PP
|
||||
ard-reset-arduino \-\-verbose \-\-period=0.1 /dev/cu.usb*
|
||||
.PP
|
||||
ard-reset-arduino \-\-verbose \-\-caterina /dev/ttyUSB0
|
||||
|
||||
.SH BUGS
|
||||
There are no known bugs in this application. Please report problems
|
||||
to the author. Patches are welcome.
|
||||
|
||||
.SH AUTHOR
|
||||
Simon John, git@the-jedi.co.uk
|
||||
|
||||
.SH LICENSE
|
||||
Copyright (c) 2014, Simon John. All rights reserved.
|
||||
.PP
|
||||
This file is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Lesser General Public License as published
|
||||
by the Free Software Foundation; either version 2.1 of the License, or
|
||||
(at your option) any later version.
|
||||
.PP
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
60
ardmk-init.1
60
ardmk-init.1
|
@ -1,60 +0,0 @@
|
|||
.TH ARDMK-INIT "1" "Nov 2017" "ardmk-init" "Arduino Makefile Generator"
|
||||
|
||||
.SH NAME
|
||||
ardmk-init - Generate Arduino Makefile environments
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B ardmk-init
|
||||
[OPTION]...
|
||||
|
||||
.SH OPTIONS
|
||||
.B \-v, \-\-verbose
|
||||
Print file contents during creation.
|
||||
|
||||
.B \-d, \-\-directory
|
||||
Directory to run generator.
|
||||
|
||||
.B \-b, \-\-board
|
||||
Board tag.
|
||||
|
||||
.B \-u, \-\-micro
|
||||
Microcontroller on board.
|
||||
|
||||
.B \-f, \-\-freq
|
||||
Clock frequency.
|
||||
|
||||
.B \-p, \-\-port
|
||||
Monitor port.
|
||||
|
||||
.B \-n, \-\-name
|
||||
Project name.
|
||||
|
||||
.B \-\-cli
|
||||
Run with user prompts rather than arguments.
|
||||
|
||||
.B \-p, \-\-project
|
||||
Create boilerplate project with src, lib and bin folder structure.
|
||||
|
||||
.B \-t, \-\-template
|
||||
Create bare minimum Arduino source file.
|
||||
|
||||
.SH DESCRIPTION
|
||||
Creates a Makefile and project tree structure from templates.
|
||||
|
||||
.SH EXAMPLE
|
||||
ardmk-init -b uno # create Arduino uno Makefile
|
||||
.PP
|
||||
ardmk-init --cli # run with user prompts
|
||||
.PP
|
||||
ardmk-init --board uno --project --template --name my-project # create Arduino uno project and template with name "my-project"
|
||||
|
||||
.SH BUGS
|
||||
Problems may reported on the github project page at:
|
||||
.PP
|
||||
https://github.com/sudar/Arduino-Makefile
|
||||
|
||||
.SH AUTHOR
|
||||
John Whittington, git@jbrengineering.co.uk
|
||||
|
||||
.SH LICENSE
|
||||
This is under MIT license.
|
2002
arduino-mk-vars.md
2002
arduino-mk-vars.md
File diff suppressed because it is too large
Load diff
1127
arduino-mk/Arduino.mk
Normal file
1127
arduino-mk/Arduino.mk
Normal file
File diff suppressed because it is too large
Load diff
38
arduino-mk/Common.mk
Normal file
38
arduino-mk/Common.mk
Normal file
|
@ -0,0 +1,38 @@
|
|||
# Useful functions
|
||||
# Returns the first argument (typically a directory), if the file or directory
|
||||
# named by concatenating the first and optionally second argument
|
||||
# (directory and optional filename) exists
|
||||
dir_if_exists = $(if $(wildcard $(1)$(2)),$(1))
|
||||
|
||||
# For message printing: pad the right side of the first argument with spaces to
|
||||
# the number of bytes indicated by the second argument.
|
||||
space_pad_to = $(shell echo $(1) " " | head -c$(2))
|
||||
|
||||
# Call with some text, and a prefix tag if desired (like [AUTODETECTED]),
|
||||
show_config_info = $(call arduino_output,- $(call space_pad_to,$(2),20) $(1))
|
||||
|
||||
# Call with the name of the variable, a prefix tag if desired (like [AUTODETECTED]),
|
||||
# and an explanation if desired (like (found in $$PATH)
|
||||
show_config_variable = $(call show_config_info,$(1) = $($(1)) $(3),$(2))
|
||||
|
||||
# Just a nice simple visual separator
|
||||
show_separator = $(call arduino_output,-------------------------)
|
||||
|
||||
$(call show_separator)
|
||||
$(call arduino_output,Arduino.mk Configuration:)
|
||||
|
||||
########################################################################
|
||||
#
|
||||
# Detect OS
|
||||
ifeq ($(OS),Windows_NT)
|
||||
CURRENT_OS = WINDOWS
|
||||
else
|
||||
UNAME_S := $(shell uname -s)
|
||||
ifeq ($(UNAME_S),Linux)
|
||||
CURRENT_OS = LINUX
|
||||
endif
|
||||
ifeq ($(UNAME_S),Darwin)
|
||||
CURRENT_OS = MAC
|
||||
endif
|
||||
endif
|
||||
$(call show_config_variable,CURRENT_OS,[AUTODETECTED])
|
|
@ -27,11 +27,23 @@
|
|||
# The show_config_variable is unavailable before we include the common makefile,
|
||||
# so we defer logging the ARDMK_DIR info until it happens in Arduino.mk
|
||||
ifndef ARDMK_DIR
|
||||
# presume it's the same path to our own file
|
||||
ARDMK_DIR := $(realpath $(dir $(realpath $(lastword $(MAKEFILE_LIST)))))
|
||||
# presume it's a level above the path to our own file
|
||||
ARDMK_DIR := $(realpath $(dir $(realpath $(lastword $(MAKEFILE_LIST))))/..)
|
||||
endif
|
||||
|
||||
include $(ARDMK_DIR)/Common.mk
|
||||
ifndef ARDMK_PATH
|
||||
ARDMK_PATH = $(ARDMK_DIR)/bin
|
||||
endif
|
||||
|
||||
ifneq ($(wildcard $(ARDMK_DIR)/arduino-mk/Common.mk),)
|
||||
# git checkout
|
||||
include $(ARDMK_DIR)/arduino-mk/Common.mk
|
||||
else
|
||||
ifneq ($(wildcard $(ARDMK_DIR)/Common.mk),)
|
||||
# package install
|
||||
include $(ARDMK_DIR)/Common.mk
|
||||
endif
|
||||
endif
|
||||
|
||||
ifndef MPIDE_DIR
|
||||
AUTO_MPIDE_DIR := $(firstword \
|
||||
|
@ -47,12 +59,6 @@ else
|
|||
$(call show_config_variable,MPIDE_DIR,[USER])
|
||||
endif
|
||||
|
||||
ifeq ($(CURRENT_OS),WINDOWS)
|
||||
ifneq ($(shell echo $(ARDUINO_DIR) | egrep '^(/|[a-zA-Z]:\\)'),)
|
||||
echo $(error On Windows, MPIDE_DIR must be a relative path)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifndef MPIDE_PREFERENCES_PATH
|
||||
AUTO_MPIDE_PREFERENCES_PATH := $(firstword \
|
||||
$(call dir_if_exists,$(HOME)/.mpide/preferences.txt) \
|
||||
|
@ -63,42 +69,34 @@ ifndef MPIDE_PREFERENCES_PATH
|
|||
endif
|
||||
endif
|
||||
|
||||
# The same as in Arduino, the Linux distribution contains avrdude and #
|
||||
# avrdude.conf in a different location, but for chipKIT it's even slightly
|
||||
# different than the Linux paths for Arduino, so we have to "double override".
|
||||
ifeq ($(CURRENT_OS),LINUX)
|
||||
AVRDUDE_DIR = $(ARDUINO_DIR)/hardware/tools
|
||||
AVRDUDE = $(AVRDUDE_DIR)/avrdude
|
||||
AVRDUDE_CONF = $(AVRDUDE_DIR)/avrdude.conf
|
||||
endif
|
||||
|
||||
AVR_TOOLS_DIR = $(ARDUINO_DIR)/hardware/pic32/compiler/pic32-tools
|
||||
|
||||
AVRDUDE_DIR = $(ARDUINO_DIR)/hardware/tools
|
||||
AVRDUDE = $(AVRDUDE_DIR)/avrdude
|
||||
AVRDUDE_CONF = $(AVRDUDE_DIR)/avrdude.conf
|
||||
|
||||
ALTERNATE_CORE = pic32
|
||||
ALTERNATE_CORE_PATH = $(MPIDE_DIR)/hardware/pic32
|
||||
ARDUINO_CORE_PATH = $(ALTERNATE_CORE_PATH)/cores/$(ALTERNATE_CORE)
|
||||
ARDUINO_PREFERENCES_PATH = $(MPIDE_PREFERENCES_PATH)
|
||||
ARDUINO_DIR = $(MPIDE_DIR)
|
||||
|
||||
CORE_AS_SRCS = $(ARDUINO_CORE_PATH)/vector_table.S \
|
||||
$(ARDUINO_CORE_PATH)/cpp-startup.S \
|
||||
$(ARDUINO_CORE_PATH)/crti.S \
|
||||
$(ARDUINO_CORE_PATH)/crtn.S \
|
||||
$(ARDUINO_CORE_PATH)/pic32_software_reset.S
|
||||
|
||||
ARDUINO_VERSION = 23
|
||||
|
||||
TOOL_PREFIX = pic32
|
||||
CC_NAME = pic32-gcc
|
||||
CXX_NAME = pic32-g++
|
||||
AR_NAME = pic32-ar
|
||||
OBJDUMP_NAME = pic32-objdump
|
||||
OBJCOPY_NAME = pic32-objcopy
|
||||
SIZE_NAME = pic32-size
|
||||
|
||||
LDSCRIPT = $(call PARSE_BOARD,$(BOARD_TAG),ldscript)
|
||||
LDSCRIPT_FILE = $(ARDUINO_CORE_PATH)/$(LDSCRIPT)
|
||||
|
||||
MCU_FLAG_NAME=mprocessor
|
||||
LDFLAGS += -mdebugger -mno-peripheral-libs -nostartfiles -Wl,--gc-sections
|
||||
LINKER_SCRIPTS += -T $(ARDUINO_CORE_PATH)/$(LDSCRIPT)
|
||||
LINKER_SCRIPTS += -T $(ARDUINO_CORE_PATH)/chipKIT-application-COMMON.ld
|
||||
CPPFLAGS += -mno-smart-io -fno-short-double -fframe-base-loclist \
|
||||
-g3 -Wcast-align -D_BOARD_MEGA_
|
||||
LDFLAGS += -T$(ARDUINO_CORE_PATH)/$(LDSCRIPT)
|
||||
CPPFLAGS += -mno-smart-io -fno-short-double
|
||||
CFLAGS_STD =
|
||||
|
||||
include $(ARDMK_DIR)/Arduino.mk
|
||||
include $(ARDMK_DIR)/arduino-mk/Arduino.mk
|
|
@ -1,126 +1,147 @@
|
|||
#!/usr/bin/python3
|
||||
#!/usr/bin/env perl
|
||||
|
||||
import serial
|
||||
import serial.tools.list_ports
|
||||
import os.path
|
||||
import argparse
|
||||
from time import sleep
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
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('--caterina', action='store_true', help='Reset a Leonardo, Micro, Robot or LilyPadUSB.')
|
||||
parser.add_argument('--verbose', action='store_true', help="Watch what's going on on STDERR.")
|
||||
parser.add_argument('--period', default=0.1, help='Specify the DTR pulse width in seconds.')
|
||||
parser.add_argument('port', nargs=1, help='Serial device e.g. /dev/ttyACM0')
|
||||
args = parser.parse_args()
|
||||
use Device::SerialPort;
|
||||
use Getopt::Long;
|
||||
use Pod::Usage;
|
||||
|
||||
my %Opt =
|
||||
(
|
||||
period => 0.1,
|
||||
);
|
||||
|
||||
GetOptions(\%Opt,
|
||||
"period=f", # width of reset pulse in seconds
|
||||
"verbose!",
|
||||
"help!",
|
||||
"info!",
|
||||
"caterina!",
|
||||
);
|
||||
|
||||
if ($Opt{help} || $Opt{info})
|
||||
{
|
||||
usage();
|
||||
}
|
||||
|
||||
die "No Arduinos found!\n"
|
||||
unless @ARGV;
|
||||
|
||||
foreach my $dev (@ARGV)
|
||||
{
|
||||
my $p = Device::SerialPort->new($dev)
|
||||
or die "Unable to open $dev: $!\n";
|
||||
|
||||
if ($Opt{caterina})
|
||||
{
|
||||
$p->baudrate(1200);
|
||||
$p->write_settings;
|
||||
$p->close;
|
||||
|
||||
print STDERR "Forcing reset using 1200bps open/close on port $dev\n"
|
||||
if $Opt{verbose};
|
||||
|
||||
# wait for it to come back
|
||||
sleep 1;
|
||||
while( ! -e $dev ) {
|
||||
print STDERR "Waiting for $dev to come back\n"
|
||||
if $Opt{verbose};
|
||||
sleep 1;
|
||||
}
|
||||
|
||||
print STDERR "$dev has come back after reset\n"
|
||||
if $Opt{verbose};
|
||||
}
|
||||
else
|
||||
{
|
||||
my $dt = $Opt{period};
|
||||
|
||||
print STDERR "Setting DTR high for ${dt}s on $dev\n"
|
||||
if $Opt{verbose};
|
||||
|
||||
die "Invalid pulse width ($dt), "
|
||||
unless $dt > 0.0;
|
||||
|
||||
$p->pulse_dtr_on($dt * 1000.0);
|
||||
}
|
||||
}
|
||||
|
||||
## here endeth the main
|
||||
|
||||
sub usage
|
||||
{
|
||||
pod2usage(-verbose => 2);
|
||||
}
|
||||
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
ard-reset-arduino - Reset an Arduino
|
||||
|
||||
=head1 USAGE
|
||||
|
||||
$ ard-reset-arduino /dev/cu.usb*
|
||||
|
||||
$ ard-reset-arduino --verbose --period=0.1 /dev/cu.usb*
|
||||
|
||||
$ ard-reset-arduino --verbose --caterina /dev/ttyUSB0
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
To reset (most) Arduinos, it's enough to just pulse the DTR line.
|
||||
|
||||
You can do that from the shell with stty, but there's an interesting
|
||||
diversity of command flags. This little program gives a uniform interface
|
||||
at the cost of requiring C<Device::SerialPort>.
|
||||
|
||||
=head1 OPTIONS
|
||||
|
||||
=over
|
||||
|
||||
=item --verbose
|
||||
|
||||
Watch what's going on on STDERR.
|
||||
|
||||
=item --period=0.25
|
||||
|
||||
Specify the DTR pulse width in seconds.
|
||||
|
||||
=item --caterina
|
||||
|
||||
Reset a Leonardo, Micro, Robot or LilyPadUSB.
|
||||
|
||||
=back
|
||||
|
||||
=head1 BUGS AND LIMITATIONS
|
||||
|
||||
There are no known bugs in this application.
|
||||
|
||||
Please report problems to the author.
|
||||
|
||||
Patches are welcome.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Martin Oldfield, ex-atelier@mjo.tc
|
||||
|
||||
Support for Leonardo/Micro added by sej7278, https://github.com/sej7278
|
||||
|
||||
Thanks to Daniele Vergini who suggested this to me, and supplied
|
||||
a command line version.
|
||||
|
||||
=head1 LICENCE AND COPYRIGHT
|
||||
|
||||
Copyright (c) 2012, Martin Oldfield. All rights reserved.
|
||||
|
||||
This file is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Lesser General Public License as published
|
||||
by the Free Software Foundation; either version 2.1 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
def list_ports(output=False):
|
||||
""" Lists serial ports attached
|
||||
|
||||
:returns
|
||||
A list of paths to serial ports on system
|
||||
"""
|
||||
ports = serial.tools.list_ports.comports()
|
||||
connected = [port[0] for port in ports]
|
||||
if output:
|
||||
print(connected)
|
||||
|
||||
return connected
|
||||
|
||||
|
||||
def new_port(old, new):
|
||||
""" Checks if a new port has attached
|
||||
|
||||
Args:
|
||||
old: previous list of ports to check
|
||||
new: current list of ports to check
|
||||
Returns:
|
||||
index of port in 'new' if new port found, otherwise -1
|
||||
"""
|
||||
new_port = -1
|
||||
|
||||
for port in new:
|
||||
if port not in old:
|
||||
new_port = new.index(port)
|
||||
break
|
||||
|
||||
return new_port
|
||||
|
||||
|
||||
if args.zero:
|
||||
# number of trys to attempt
|
||||
zero_attempts = 20 # ~2 seconds
|
||||
initial_ports = list_ports(args.verbose)
|
||||
|
||||
if args.verbose:
|
||||
print('Attempting to enter bootloader using 1200 bps open/close on port %s' % args.port[0])
|
||||
|
||||
ser = serial.Serial(args.port[0], 57600)
|
||||
ser.close()
|
||||
ser.baudrate = 1200
|
||||
|
||||
# do the open/close at 1200 BAUD
|
||||
ser.open()
|
||||
ser.close()
|
||||
|
||||
if args.verbose:
|
||||
print('Done. Waiting for bootloader port to attach...')
|
||||
|
||||
# get new list of ports
|
||||
reset_ports = list_ports(args.verbose)
|
||||
|
||||
# wait for new port or port to return
|
||||
port_index = new_port(initial_ports, reset_ports)
|
||||
|
||||
# keep checking until new port appears or timeout
|
||||
while port_index < 0:
|
||||
# count down attempts and leave if expired
|
||||
zero_attempts -= 1
|
||||
if zero_attempts < 0:
|
||||
break
|
||||
sleep(0.1)
|
||||
# get list of ports after bootloader toggle performed
|
||||
reset_ports = list_ports(args.verbose)
|
||||
# if a port drops, set initial ports to reset ports so that
|
||||
# next attached device will be new port
|
||||
if (len(reset_ports) < len(initial_ports)):
|
||||
initial_ports = reset_ports
|
||||
# check if a new port has attached and return the index if it has
|
||||
port_index = new_port(initial_ports, reset_ports)
|
||||
# return the new port if detected, otherwise return passed port
|
||||
if port_index == -1:
|
||||
bootloader_port = args.port[0]
|
||||
else:
|
||||
bootloader_port = reset_ports[port_index]
|
||||
|
||||
# print so that `tail -1` can be piped for bootloader port
|
||||
print(bootloader_port)
|
||||
elif args.caterina:
|
||||
if args.verbose: print('Forcing reset using 1200bps open/close on port %s' % args.port[0])
|
||||
ser = serial.Serial(args.port[0], 57600)
|
||||
ser.close()
|
||||
|
||||
if pyserial_version < 3:
|
||||
ser.setBaudrate (1200)
|
||||
else:
|
||||
ser.baudrate = 1200
|
||||
|
||||
ser.open()
|
||||
ser.setRTS(True) # RTS line needs to be held high and DTR low
|
||||
ser.setDTR(False) # (see Arduino IDE source code)
|
||||
ser.close()
|
||||
sleep(1)
|
||||
|
||||
while not os.path.exists(args.port[0]):
|
||||
if args.verbose: print('Waiting for %s to come back' % args.port[0])
|
||||
sleep(1)
|
||||
|
||||
if args.verbose: print('%s has come back after reset' % args.port[0])
|
||||
else:
|
||||
if args.verbose: print('Setting DTR high on %s for %ss' % (args.port[0],args.period))
|
||||
ser = serial.Serial(args.port[0], 115200)
|
||||
ser.setDTR(False)
|
||||
sleep(args.period)
|
||||
ser.setDTR(True)
|
||||
ser.close()
|
||||
|
|
278
bin/ardmk-init
278
bin/ardmk-init
|
@ -1,278 +0,0 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
"""
|
||||
Arduino-mk Makefile and project initialiser
|
||||
|
||||
This script can be used in its basic form create a project specific Makefile
|
||||
for use with Arduino-mk. Addionally, it can be used to create a template
|
||||
Arduino source file and a traditional boilerplate project file structure.
|
||||
|
||||
Example:
|
||||
* Run prompted within current working directory (requires Clint): `ardmk-init --cli`
|
||||
* Create Arduino Uno Makefile (useful within a library example): `ardmk-init -b uno`
|
||||
* Create boilerplate Arduino Uno project in current working directory of same
|
||||
name: `ardmk-init -b uno --project`
|
||||
* Create Arduino-mk nano Makefile in current working directory with template .ino:
|
||||
`ardmk-init -b nano -u atmega328 -tn my-project`
|
||||
|
||||
See `armk-init --help` for CLI arguments
|
||||
"""
|
||||
|
||||
import os
|
||||
import argparse
|
||||
|
||||
## Global Vars
|
||||
VERSION = "1.2"
|
||||
ARD_TEMPLATE = "\n\
|
||||
#include <Arduino.h>\n\
|
||||
#include <Wire.h>\n\
|
||||
\n\
|
||||
\n\
|
||||
void setup() {\n\
|
||||
}\n\
|
||||
\n\
|
||||
void loop() {\n\
|
||||
}\n\
|
||||
"
|
||||
|
||||
## Command Parser
|
||||
PARSER = argparse.ArgumentParser(prog='ardmk-init',
|
||||
description='Arduino Makefile and boilerplate project generator.\
|
||||
For use with Ard-Makefile: https://github.com/sudar/Arduino-Makefile.\
|
||||
Script created by John Whittington https://github.com/tuna-f1sh 2017\
|
||||
\n\nVersion: ' + VERSION)
|
||||
PARSER.add_argument('-v', '--verbose', action='store_true',
|
||||
help="print file contents during creation")
|
||||
PARSER.add_argument('-d', '--directory', default=os.getcwd(), help='directory to run generator, default cwd')
|
||||
PARSER.add_argument('-b', '--board', default='uno', help='board tag')
|
||||
PARSER.add_argument('-u', '--micro', default='AUTO', help='microcontroller on board')
|
||||
PARSER.add_argument('-f', '--freq', default='AUTO', help='clock frequency')
|
||||
PARSER.add_argument('-p', '--port', default='AUTO', help='monitor port')
|
||||
PARSER.add_argument('-n', '--name', default=os.path.basename(os.getcwd()), help='project name')
|
||||
PARSER.add_argument('-s', '--sam', action='store_true', help='sam device, will include Sam.mk rather than Arduino.mk')
|
||||
PARSER.add_argument('--cli', action='store_true', help='run with user prompts (requires "Clint" module), rather than args')
|
||||
PARSER.add_argument('-P', '--project', action='store_true',
|
||||
help='create boilerplate project with src, lib and bin folder structure')
|
||||
PARSER.add_argument('-t', '--template', action='store_true',
|
||||
help='create bare minimum Arduino source file')
|
||||
PARSER.add_argument('-V', '--version', action='version', version='%(prog)s '+ VERSION)
|
||||
ARGS = PARSER.parse_args()
|
||||
|
||||
try:
|
||||
from clint.textui import prompt, validators
|
||||
except ImportError:
|
||||
if ARGS.cli:
|
||||
print("Python module 'clint' is required for running prompted. Install the module or run with arguments only")
|
||||
quit()
|
||||
|
||||
|
||||
def generate_makefile():
|
||||
"""
|
||||
Generate the Makefile content using prompts or parsed arguments
|
||||
"""
|
||||
# Header
|
||||
file_content = "# Generated by ard-make version " + VERSION + "\n\n"
|
||||
|
||||
# Basic
|
||||
if ARGS.cli:
|
||||
print("Generating Arduino Ard-Makefile project in "
|
||||
+ os.path.abspath(ARGS.directory))
|
||||
btag = prompt.query('Board tag?', default='uno')
|
||||
if btag != 'uno':
|
||||
bsub = prompt.query('Board sub micro?', default='atmega328')
|
||||
f_cpu = prompt.query('Board frequency', default='16000000L')
|
||||
else:
|
||||
bsub = 'AUTO'
|
||||
f_cpu = 'AUTO'
|
||||
monitor_port = prompt.query('Arduino port?', default='AUTO')
|
||||
else:
|
||||
btag = ARGS.board
|
||||
bsub = ARGS.micro
|
||||
f_cpu = ARGS.freq
|
||||
monitor_port = ARGS.port
|
||||
|
||||
file_content += check_define('BOARD_TAG', btag)
|
||||
file_content += check_define('BOARD_SUB', bsub)
|
||||
file_content += check_define('F_CPU', f_cpu)
|
||||
file_content += check_define('MONITOR_PORT', monitor_port)
|
||||
|
||||
# Extended
|
||||
if ARGS.cli:
|
||||
if not prompt.yn('Extended options?', default='n'):
|
||||
if not prompt.yn('Define local folders?', default='n'):
|
||||
src_dir = prompt.query('Sources folder (Makefile will be created here)?',
|
||||
default='', validators=[])
|
||||
userlibs = prompt.query('Library folder (will create if does not exist) - AUTO is Sketchbook directory?',
|
||||
default='AUTO', validators=[])
|
||||
obj_dir = prompt.query('Output directory?', default='AUTO', validators=[])
|
||||
else:
|
||||
src_dir = ''
|
||||
userlibs = 'AUTO'
|
||||
obj_dir = 'AUTO'
|
||||
boards_txt = prompt.query('Boards file?', default='AUTO')
|
||||
isp_prog = prompt.query('ISP programmer?', default='atmelice_isp')
|
||||
isp_port = prompt.query('ISP port?', default='AUTO')
|
||||
if not prompt.yn('Quiet make?', default='n'):
|
||||
file_content += "ARDUINO_QUIET = 1\n"
|
||||
|
||||
file_content += check_define('ISP_PROG', isp_prog)
|
||||
file_content += check_define('ISP_PORT', isp_port)
|
||||
file_content += check_define('BOARDS_TXT', boards_txt)
|
||||
|
||||
# Check andd create folders
|
||||
check_create_folder(src_dir)
|
||||
check_create_folder(userlibs)
|
||||
check_create_folder(obj_dir)
|
||||
|
||||
# Makefile will be in src_dir so lib and bin must be relative
|
||||
if src_dir:
|
||||
userlibs = "../" + userlibs
|
||||
obj_dir = "../" + obj_dir
|
||||
|
||||
file_content += check_define('USER_LIB_PATH', userlibs)
|
||||
file_content += check_define('OBJDIR', obj_dir)
|
||||
else:
|
||||
src_dir = ''
|
||||
|
||||
if ARGS.template or not prompt.yn('Create template Arduino source?', default='n'):
|
||||
source_filename = prompt.query('Name of project?',
|
||||
default=os.path.basename(os.getcwd()))
|
||||
if src_dir:
|
||||
write_template(src_dir + "/" + source_filename)
|
||||
else:
|
||||
write_template(source_filename)
|
||||
file_content += check_define('TARGET', source_filename)
|
||||
|
||||
else:
|
||||
if ARGS.project:
|
||||
src_dir = 'src'
|
||||
userlibs = 'lib'
|
||||
obj_dir = 'bin'
|
||||
else:
|
||||
src_dir = ''
|
||||
userlibs = 'AUTO'
|
||||
obj_dir = 'AUTO'
|
||||
|
||||
# Check andd create folders
|
||||
check_create_folder(src_dir)
|
||||
check_create_folder(userlibs)
|
||||
check_create_folder(obj_dir)
|
||||
|
||||
# Makefile will be in src_dir so lib and bin must be relative
|
||||
if src_dir:
|
||||
userlibs = "../" + userlibs
|
||||
obj_dir = "../" + obj_dir
|
||||
|
||||
file_content += check_define('USER_LIB_PATH', userlibs)
|
||||
file_content += check_define('OBJDIR', obj_dir)
|
||||
|
||||
if ARGS.project or ARGS.template:
|
||||
if src_dir:
|
||||
write_template(src_dir + "/" + ARGS.name)
|
||||
else:
|
||||
write_template(ARGS.name)
|
||||
file_content += check_define('TARGET', ARGS.name)
|
||||
|
||||
if not "ARDMK_DIR" in os.environ:
|
||||
if not ARGS.cli:
|
||||
print("Warning: ARDMK_DIR environment variable not defined. \
|
||||
Must be defined for Makefile to work")
|
||||
else:
|
||||
ardmk = prompt.query('Arduino Makefile path?',
|
||||
default='/usr/share/arduino',
|
||||
validators=[validators.PathValidator()])
|
||||
ardmk = "ARDMK_DIR := " + ardmk + "\n"
|
||||
|
||||
if ARGS.sam:
|
||||
file_content += "\ninclude $(ARDMK_DIR)/Sam.mk"
|
||||
else:
|
||||
file_content += "\ninclude $(ARDMK_DIR)/Arduino.mk"
|
||||
|
||||
# Add forward slash if source directory exists
|
||||
if src_dir:
|
||||
write_to_makefile(file_content, (src_dir + "/"))
|
||||
else:
|
||||
write_to_makefile(file_content, "")
|
||||
|
||||
return file_content
|
||||
|
||||
def write_to_makefile(file_content, path):
|
||||
"""
|
||||
Write the Makefile file
|
||||
"""
|
||||
makefile = open(path + "Makefile", 'w')
|
||||
print("Writing Makefile...")
|
||||
if ARGS.verbose:
|
||||
print(file_content)
|
||||
makefile.write(file_content)
|
||||
makefile.close()
|
||||
|
||||
def write_template(filename):
|
||||
"""
|
||||
Write template Arduino .ino source
|
||||
"""
|
||||
print("Writing " + os.path.abspath(filename) + ".ino...")
|
||||
if os.path.isfile(filename + '.ino'):
|
||||
if not ARGS.cli:
|
||||
print(filename + '.ino' + ' already exists! Stopping.')
|
||||
return
|
||||
print(filename + '.ino' + ' already exists! Overwrite?')
|
||||
if prompt.yn('Continue?', default='n'):
|
||||
return
|
||||
src = open((filename + ".ino"), 'w')
|
||||
if ARGS.verbose:
|
||||
print(ARD_TEMPLATE)
|
||||
src.write("/* Project: " + filename + " */\n" + ARD_TEMPLATE)
|
||||
src.close()
|
||||
|
||||
def check_create_folder(folder):
|
||||
"""
|
||||
Check if folder exists and make it if it doesn't and hasn't been set to AUTO
|
||||
"""
|
||||
if folder and not folder == 'AUTO':
|
||||
if not os.path.exists(folder):
|
||||
print("Creating " + os.path.abspath(folder) + " folder")
|
||||
os.makedirs(folder)
|
||||
|
||||
def check_define(define, user):
|
||||
"""
|
||||
Check whether user has set define and return Makefile formatted string if they have
|
||||
"""
|
||||
# Return is empty unless user has passed value
|
||||
string = ""
|
||||
|
||||
# Set define only if not empty or set to AUTO
|
||||
if user and not user == 'AUTO':
|
||||
string = define + " = " + user + "\n"
|
||||
|
||||
return string
|
||||
|
||||
def check_args():
|
||||
"""
|
||||
Check input args will work with Makefile
|
||||
"""
|
||||
# Micro should be defined for non uno boards
|
||||
if ARGS.board != 'uno' and ARGS.micro == 'AUTO':
|
||||
print('\n!!! Warning: --micro should be defined and not left AUTO for non-Uno boards\n')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
# Create directory if not exist
|
||||
check_create_folder(ARGS.directory)
|
||||
# Check input args
|
||||
check_args()
|
||||
# Change to dir so all commands are run relative
|
||||
os.chdir(ARGS.directory)
|
||||
if os.path.isfile('Makefile'):
|
||||
if not ARGS.cli:
|
||||
print('Makefile in ' + os.path.abspath(ARGS.directory)
|
||||
+ ' already exists! Please remove before generating. Stopping.')
|
||||
quit()
|
||||
|
||||
# Confirm with user if not quiet mode
|
||||
print('Makefile in ' + os.path.abspath(ARGS.directory)
|
||||
+ ' already exists! Overwrite?')
|
||||
if prompt.yn('Continue?', default='n'):
|
||||
quit()
|
||||
# Run it
|
||||
generate_makefile()
|
|
@ -1,94 +0,0 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
# This script sends a program on a robotis board (OpenCM9.04 or CM900)
|
||||
# using the robotis bootloader (used in OpenCM IDE)
|
||||
#
|
||||
# Usage:
|
||||
# python robotis-loader.py <serial port> <binary>
|
||||
#
|
||||
# Example:
|
||||
# python robotis-loader.py /dev/ttyACM0 firmware.bin
|
||||
#
|
||||
# https://github.com/Gregwar/robotis-loader
|
||||
|
||||
import serial, sys, os, time
|
||||
|
||||
print('~~ Robotis loader ~~')
|
||||
print('')
|
||||
|
||||
# Reading command line
|
||||
if len(sys.argv) != 3:
|
||||
exit('! Usage: robotis-loader.py <serial-port> <binary>')
|
||||
pgm, port, binary = sys.argv
|
||||
|
||||
# Helper to prints a progress bar
|
||||
def progressBar(percent, precision=65):
|
||||
threshold=precision*percent/100.0
|
||||
sys.stdout.write('[ ')
|
||||
for x in xrange(0, precision):
|
||||
if x < threshold: sys.stdout.write('#')
|
||||
else: sys.stdout.write(' ')
|
||||
sys.stdout.write(' ] ')
|
||||
sys.stdout.flush()
|
||||
|
||||
# Opening the firmware file
|
||||
try:
|
||||
stat = os.stat(binary)
|
||||
size = stat.st_size
|
||||
firmware = file(binary, 'rb')
|
||||
print('* Opening %s, size=%d' % (binary, size))
|
||||
except:
|
||||
exit('! Unable to open file %s' % binary)
|
||||
|
||||
# Opening serial port
|
||||
try:
|
||||
s = serial.Serial(port, baudrate=115200)
|
||||
except:
|
||||
exit('! Unable to open serial port %s' % port)
|
||||
|
||||
print('* Resetting the board')
|
||||
s.setRTS(True)
|
||||
s.setDTR(False)
|
||||
time.sleep(0.1)
|
||||
s.setRTS(False)
|
||||
s.write('CM9X')
|
||||
s.close()
|
||||
time.sleep(1.0);
|
||||
|
||||
print('* Connecting...')
|
||||
s = serial.Serial(port, baudrate=115200)
|
||||
s.write('AT&LD')
|
||||
print('* Download signal transmitted, waiting...')
|
||||
|
||||
# Entering bootloader sequence
|
||||
while True:
|
||||
line = s.readline().strip()
|
||||
if line.endswith('Ready..'):
|
||||
print('* Board ready, sending data')
|
||||
cs = 0
|
||||
pos = 0
|
||||
while True:
|
||||
c = firmware.read(2048)
|
||||
if len(c):
|
||||
pos += len(c)
|
||||
sys.stdout.write("\r")
|
||||
progressBar(100*float(pos)/float(size))
|
||||
s.write(c)
|
||||
for k in range(0,len(c)):
|
||||
cs = (cs+ord(c[k]))%256
|
||||
else:
|
||||
break
|
||||
print('')
|
||||
s.setDTR(True)
|
||||
print('* Checksum: %d' % (cs))
|
||||
s.write(chr(cs))
|
||||
print('* Firmware was sent')
|
||||
else:
|
||||
if line == 'Success..':
|
||||
print('* Success, running the code')
|
||||
print('')
|
||||
s.write('AT&RST')
|
||||
s.close()
|
||||
exit()
|
||||
else:
|
||||
print('Board -> '+line)
|
|
@ -1,59 +1,13 @@
|
|||
# Arduino Make file. Refer to https://github.com/sudar/Arduino-Makefile
|
||||
|
||||
# Set this if the IDE is not in your $PATH or you want to use a specific version:
|
||||
ARDUINO_DIR = $(HOME)/arduino-1.8.5
|
||||
# if you have placed the alternate core in your sketchbook directory, then you can just mention the core name alone.
|
||||
ALTERNATE_CORE = attiny
|
||||
# If not, you might have to include the full path.
|
||||
#ALTERNATE_CORE_PATH = /home/sudar/Dropbox/code/arduino-sketches/hardware/attiny/
|
||||
|
||||
# Programmer type:
|
||||
ISP_PROG = usbasp
|
||||
BOARD_TAG = attiny85-8
|
||||
ISP_PORT = /dev/ttyACM*
|
||||
|
||||
# Examples - obviously pick only one and comment/delete the rest:
|
||||
include $(ARDMK_DIR)/arduino-mk/Arduino.mk
|
||||
|
||||
# ------------------------------------------------------------------ #
|
||||
|
||||
# https://github.com/SpenceKonde/ATTinyCore (1.5+)
|
||||
ALTERNATE_CORE = ATTinyCore
|
||||
BOARD_TAG = attinyx4
|
||||
BOARD_SUB = 84
|
||||
VARIANT = tinyX4
|
||||
F_CPU = 8000000L
|
||||
#BOARD_TAG = attinyx313
|
||||
#BOARD_SUB = 4313
|
||||
#BOARD_TAG = attinyx61
|
||||
#BOARD_SUB = 861
|
||||
#F_CPU = 8000000L
|
||||
|
||||
# ------------------------------------------------------------------ #
|
||||
|
||||
# https://github.com/Coding-Badly/TinyCore1 (1.5+)
|
||||
ALTERNATE_CORE = tiny
|
||||
BOARD_TAG = attiny85at8
|
||||
#BOARD_TAG = attiny2313at1
|
||||
|
||||
# https://github.com/Coding-Badly/arduino-tiny (1.0)
|
||||
ALTERNATE_CORE = tiny
|
||||
BOARD_TAG = attiny85at8
|
||||
#BOARD_TAG = attiny44at8
|
||||
#BOARD_TAG = attiny84at8
|
||||
ARDUINO_VAR_PATH = $(HOME)/arduino/hardware/tiny/cores/tiny
|
||||
ARDUINO_CORE_PATH = $(HOME)/arduino/hardware/tiny/cores/tiny
|
||||
|
||||
# ------------------------------------------------------------------ #
|
||||
|
||||
# https://github.com/damellis/attiny (1.5+)
|
||||
ALTERNATE_CORE = attiny-master
|
||||
BOARD_TAG = attiny
|
||||
BOARD_SUB = attiny85
|
||||
F_CPU = 16000000L
|
||||
|
||||
# https://github.com/damellis/attiny (1.0)
|
||||
ALTERNATE_CORE = attiny-master
|
||||
BOARD_TAG = attiny85
|
||||
#BOARD_TAG = attiny44-8
|
||||
#BOARD_TAG = attiny84-20
|
||||
|
||||
# ------------------------------------------------------------------ #
|
||||
|
||||
# Path to the Arduino Makefile
|
||||
include $(ARDMK_DIR)/Arduino.mk
|
||||
|
||||
# !!! Important. You have to use 'make ispload' when using an ISP.
|
||||
# !!! Important. You have to use make ispload to upload when using ISP programmer
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
BOARD_TAG = uno
|
||||
ARDUINO_LIBS =
|
||||
MONITOR_PORT = /dev/cu.usb*
|
||||
ARDUINO_LIBS =
|
||||
|
||||
include $(ARDMK_DIR)/Arduino.mk
|
||||
include ../../arduino-mk/Arduino.mk
|
|
@ -1,18 +1,19 @@
|
|||
/*
|
||||
Blink
|
||||
Turns on an LED on for one second, then off for one second, repeatedly.
|
||||
|
||||
This example code is in the public domain.
|
||||
*/
|
||||
|
||||
void setup() {
|
||||
// initialize the digital pin as an output.
|
||||
// Pin 13 has an LED connected on most Arduino boards:
|
||||
pinMode(13, OUTPUT);
|
||||
// initialize the digital pin as an output.
|
||||
// Pin 13 has an LED connected on most Arduino boards:
|
||||
pinMode(13, OUTPUT);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
digitalWrite(13, HIGH); // set the LED on
|
||||
delay(1000); // wait for a second
|
||||
digitalWrite(13, LOW); // set the LED off
|
||||
delay(1000); // wait for a second
|
||||
digitalWrite(13, HIGH); // set the LED on
|
||||
delay(1000); // wait for a second
|
||||
digitalWrite(13, LOW); // set the LED off
|
||||
delay(1000); // wait for a second
|
||||
}
|
||||
|
|
|
@ -1,121 +1,6 @@
|
|||
# Arduino Make file. Refer to https://github.com/sudar/Arduino-Makefile
|
||||
|
||||
BOARD_TAG = uno
|
||||
include $(ARDMK_DIR)/Arduino.mk
|
||||
MONITOR_PORT = /dev/cu.usb*
|
||||
ARDUINO_LIBS =
|
||||
|
||||
include ../../arduino-mk/Arduino.mk
|
||||
|
||||
|
||||
# --- leonardo (or pro micro w/leo bootloader)
|
||||
#BOARD_TAG = leonardo
|
||||
#MONITOR_PORT = /dev/ttyACM0
|
||||
#include /usr/share/arduino/Arduino.mk
|
||||
|
||||
# --- mega2560 ide 1.0
|
||||
#BOARD_TAG = mega2560
|
||||
#ARDUINO_PORT = /dev/ttyACM0
|
||||
#include /usr/share/arduino/Arduino.mk
|
||||
|
||||
# --- mega2560 ide 1.6
|
||||
#BOARD_TAG = mega
|
||||
#BOARD_SUB = atmega2560
|
||||
#MONITOR_PORT = /dev/ttyACM0
|
||||
#ARDUINO_DIR = /where/you/installed/arduino-1.6.5
|
||||
#include /usr/share/arduino/Arduino.mk
|
||||
|
||||
# --- nano ide 1.0
|
||||
#BOARD_TAG = nano328
|
||||
#MONITOR_PORT = /dev/ttyUSB0
|
||||
#include /usr/share/arduino/Arduino.mk
|
||||
|
||||
# --- nano ide 1.6
|
||||
#BOARD_TAG = nano
|
||||
#BOARD_SUB = atmega328
|
||||
#ARDUINO_DIR = /where/you/installed/arduino-1.6.5
|
||||
#include /usr/share/arduino/Arduino.mk
|
||||
|
||||
# --- pro mini
|
||||
#BOARD_TAG = pro5v328
|
||||
#MONITOR_PORT = /dev/ttyUSB0
|
||||
#include /usr/share/arduino/Arduino.mk
|
||||
|
||||
# --- sparkfun pro micro
|
||||
#BOARD_TAG = promicro16
|
||||
#ALTERNATE_CORE = promicro
|
||||
#BOARDS_TXT = $(HOME)/arduino/hardware/promicro/boards.txt
|
||||
#BOOTLOADER_PARENT = $(HOME)/arduino/hardware/promicro/bootloaders
|
||||
#BOOTLOADER_PATH = caterina
|
||||
#BOOTLOADER_FILE = Caterina-promicro16.hex
|
||||
#ISP_PROG = usbasp
|
||||
#AVRDUDE_OPTS = -v
|
||||
#include /usr/share/arduino/Arduino.mk
|
||||
|
||||
# --- chipkit
|
||||
#BOARD_TAG = mega_pic32
|
||||
#MPIDE_DIR = /where/you/installed/mpide-0023-linux64-20130817-test
|
||||
#include /usr/share/arduino/chipKIT.mk
|
||||
|
||||
# --- pinoccio
|
||||
#BOARD_TAG = pinoccio256
|
||||
#ALTERNATE_CORE = pinoccio
|
||||
#BOOTLOADER_PARENT = $(HOME)/arduino/hardware/pinoccio/bootloaders
|
||||
#BOOTLOADER_PATH = STK500RFR2/release_0.51
|
||||
#BOOTLOADER_FILE = boot_pinoccio.hex
|
||||
#CFLAGS_STD = -std=gnu99
|
||||
#CXXFLAGS_STD = -std=gnu++11
|
||||
#include /usr/share/arduino/Arduino.mk
|
||||
|
||||
# --- fio
|
||||
#BOARD_TAG = fio
|
||||
#include /usr/share/arduino/Arduino.mk
|
||||
|
||||
# --- atmega-ng ide 1.6
|
||||
#BOARD_TAG = atmegang
|
||||
#BOARD_SUB = atmega168
|
||||
#MONITOR_PORT = /dev/ttyACM0
|
||||
#ARDUINO_DIR = /where/you/installed/arduino-1.6.5
|
||||
#include /usr/share/arduino/Arduino.mk
|
||||
|
||||
# --- teensy3
|
||||
#BOARD_TAG = teensy31
|
||||
#ARDUINO_DIR = /where/you/installed/the/patched/teensy/arduino-1.0.6
|
||||
#include /usr/share/arduino/Teensy.mk
|
||||
|
||||
# --- mighty 1284p
|
||||
#BOARD_TAG = mighty_opt
|
||||
#BOARDS_TXT = $(HOME)/arduino/hardware/mighty-1284p/boards.txt
|
||||
#BOOTLOADER_PARENT = $(HOME)/arduino/hardware/mighty-1284p/bootloaders
|
||||
#BOOTLOADER_PATH = optiboot
|
||||
#BOOTLOADER_FILE = optiboot_atmega1284p.hex
|
||||
#ISP_PROG = usbasp
|
||||
#AVRDUDE_OPTS = -v
|
||||
#include /usr/share/arduino/Arduino.mk
|
||||
|
||||
# --- mightycore
|
||||
#ALTERNATE_CORE = MightyCore
|
||||
#BOARD_TAG = 1284
|
||||
#MCU = atmega1284p
|
||||
#BOARD_TAG = 644
|
||||
#MCU = atmega644p
|
||||
#VARIANT = standard
|
||||
#F_CPU = 16000000L
|
||||
#include /usr/share/arduino/Arduino.mk
|
||||
|
||||
# --- megacore
|
||||
#BOARD_TAG = 128
|
||||
#ALTERNATE_CORE = megacore
|
||||
#F_CPU = 16000000L
|
||||
#include /usr/share/arduino/Arduino.mk
|
||||
|
||||
# --- sanguino 644p
|
||||
#BOARD_TAG = atmega644p
|
||||
#ALTERNATE_CORE = sanguino
|
||||
#ISP_PROG = usbasp
|
||||
#AVRDUDE_OPTS = -v
|
||||
#include /usr/share/arduino/Arduino.mk
|
||||
|
||||
# --- atmega328p on breadboard
|
||||
#BOARD_TAG = atmega328bb
|
||||
#ISP_PROG = usbasp
|
||||
#AVRDUDE_OPTS = -v
|
||||
#BOARDS_TXT = $(HOME)/arduino/hardware/breadboard/boards.txt
|
||||
#include /usr/share/arduino/Arduino.mk
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
// A derived Blink, that uses an example 3rd party library.
|
||||
// Turns on an LED on for one second, then off for one second, repeatedly.
|
||||
// This example code is in the public domain.
|
||||
|
||||
#include <TogglePin.h>
|
||||
|
||||
#ifdef ARDUINO
|
||||
#if ARDUINO >= 100
|
||||
#include "Arduino.h"
|
||||
#else
|
||||
#include "WProgram.h"
|
||||
#endif
|
||||
#endif // ARDUINO
|
||||
|
||||
int main()
|
||||
{
|
||||
init();
|
||||
TogglePin led(13, false);
|
||||
while (true) {
|
||||
delay(1000);
|
||||
led.toggle();
|
||||
}
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
# This program is free software and is licensed under the same conditions as
|
||||
# describe in https://github.com/sudar/Arduino-Makefile/blob/master/licence.txt
|
||||
|
||||
# This is an example Makefile, that demonstrates the linking of a third party
|
||||
# library. In this case the third party library resides in the ./Toggle
|
||||
# sub-directory. Note that the archive TOGGLE_ARCHIVE _only_ contains the
|
||||
# compiled Toggle.c.o object. The TOGGLE_ARCHIVE is thus very lean, but it
|
||||
# requires the Arduino libraries, which are being build in this directory,
|
||||
# together with Blink, the 'main' program.
|
||||
|
||||
include board.mk
|
||||
|
||||
TOGGLE_ARCHIVE = build-$(BOARD_TAG)/libtoggle.a
|
||||
|
||||
CXXFLAGS += -IToggle
|
||||
OTHER_OBJS = Toggle/$(TOGGLE_ARCHIVE)
|
||||
|
||||
include $(ARDMK_DIR)/Arduino.mk
|
||||
|
||||
Toggle/$(TOGGLE_ARCHIVE):
|
||||
$(MAKE) -C Toggle $(TOGGLE_ARCHIVE)
|
||||
|
||||
clean::
|
||||
$(MAKE) -C Toggle clean
|
|
@ -1,14 +0,0 @@
|
|||
# This program is free software and is licensed under the same conditions as
|
||||
# describe in https://github.com/sudar/Arduino-Makefile/blob/master/licence.txt
|
||||
|
||||
# This is an example Makefile, that is being used to build an archive
|
||||
# from locally compiled objects.
|
||||
#
|
||||
# All source files in this directory will automatically get compiled
|
||||
# and archived into the build-$(BOARD_TAG)/libtoggle.a target.
|
||||
|
||||
include ../board.mk
|
||||
include $(ARDMK_DIR)/Arduino.mk
|
||||
|
||||
build-$(BOARD_TAG)/libtoggle.a: $(LOCAL_OBJS)
|
||||
$(AR) rcs $@ $(LOCAL_OBJS)
|
|
@ -1,27 +0,0 @@
|
|||
// This program is free software and is licensed under the same conditions as
|
||||
// describe in https://github.com/sudar/Arduino-Makefile/blob/master/licence.txt
|
||||
|
||||
#include "TogglePin.h"
|
||||
|
||||
#ifdef ARDUINO
|
||||
#if ARDUINO >= 100
|
||||
#include "Arduino.h"
|
||||
#else
|
||||
#include "WProgram.h"
|
||||
#endif
|
||||
#endif // ARDUINO
|
||||
|
||||
TogglePin::TogglePin(int pinNumber, bool state)
|
||||
: _pinNumber(pinNumber), _state(state)
|
||||
{
|
||||
pinMode(_pinNumber, OUTPUT);
|
||||
digitalWrite(_pinNumber, _state ? HIGH : LOW);
|
||||
}
|
||||
|
||||
bool
|
||||
TogglePin::toggle()
|
||||
{
|
||||
_state = !_state;
|
||||
digitalWrite(_pinNumber, _state ? HIGH : LOW);
|
||||
return _state;
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
// This program is free software and is licensed under the same conditions as
|
||||
// describe in https://github.com/sudar/Arduino-Makefile/blob/master/licence.txt
|
||||
|
||||
#ifndef TOGGLEPIN_H_
|
||||
#define TOGGLEPIN_H_
|
||||
|
||||
class TogglePin
|
||||
{
|
||||
public:
|
||||
TogglePin(int pinNumber, bool state);
|
||||
|
||||
bool toggle();
|
||||
|
||||
private:
|
||||
const int _pinNumber;
|
||||
bool _state;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,7 +0,0 @@
|
|||
# This program is free software and is licensed under the same conditions as
|
||||
# describe in https://github.com/sudar/Arduino-Makefile/blob/master/licence.txt
|
||||
|
||||
# The following can be overridden at make-time, by setting an environment
|
||||
# variable with the same name. eg. BOARD_TAG=pro5v328 make
|
||||
|
||||
BOARD_TAG ?= uno
|
|
@ -1,5 +1,6 @@
|
|||
BOARD_TAG = mega_pic32
|
||||
MONITOR_PORT = /dev/cu.usb*
|
||||
ARDUINO_LIBS =
|
||||
|
||||
include $(ARDMK_DIR)/chipKIT.mk
|
||||
include ../../arduino-mk/chipKIT.mk
|
||||
|
||||
|
|
|
@ -10,7 +10,8 @@ F_CPU = 8000000L
|
|||
|
||||
ISP_PROG = stk500v1
|
||||
AVRDUDE_ISP_BAUDRATE = 19200
|
||||
ISP_PORT = /dev/ttyACM*
|
||||
|
||||
include $(ARDMK_DIR)/Arduino.mk
|
||||
include $(ARDMK_DIR)/arduino-mk/Arduino.mk
|
||||
|
||||
# !!! Important. You have to use make ispload to upload when using ISP programmer
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* (c) Anil Kumar Pugalia, 2010. Email: email@sarika-pugs.com
|
||||
* © Anil Kumar Pugalia, 2010. Email: email@sarika-pugs.com
|
||||
*
|
||||
* ATmega48/88/168, ATmega16/32
|
||||
*
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
/*
|
||||
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
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
# 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=true
|
||||
MONITOR_PORT=/dev/spidev0.0
|
||||
|
||||
include $(ARDMK_DIR)/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
|
||||
|
||||
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
|
|
@ -1,18 +0,0 @@
|
|||
/*
|
||||
Blink
|
||||
Turns an LED on for one second, then off for one second, repeatedly.
|
||||
|
||||
This example code is in the public domain.
|
||||
*/
|
||||
|
||||
void setup() {
|
||||
// initialize the led pin as an output.
|
||||
pinMode(BOARD_LED_PIN, OUTPUT);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
digitalWrite(BOARD_LED_PIN, HIGH); // set the LED on
|
||||
delay(1000); // wait for a second
|
||||
digitalWrite(BOARD_LED_PIN, LOW); // set the LED off
|
||||
delay(1000); // wait for a second
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
BOARD_TAG = cm904
|
||||
ARDUINO_LIBS =
|
||||
|
||||
#MONITOR_PORT = /dev/ttyACM0
|
||||
#OPENCMIDE_DIR = /where/you/installed/robotis_opencm
|
||||
|
||||
include ../../OpenCM.mk
|
|
@ -1,48 +0,0 @@
|
|||
/*
|
||||
* Blink(LED)
|
||||
*/
|
||||
|
||||
|
||||
#define BDPIN_LED_USER_1 22
|
||||
#define BDPIN_LED_USER_2 23
|
||||
#define BDPIN_LED_USER_3 24
|
||||
#define BDPIN_LED_USER_4 25
|
||||
|
||||
|
||||
int led_pin = 13;
|
||||
int led_pin_user[4] = { BDPIN_LED_USER_1, BDPIN_LED_USER_2, BDPIN_LED_USER_3, BDPIN_LED_USER_4 };
|
||||
|
||||
void setup() {
|
||||
// Set up the built-in LED pin as an output:
|
||||
pinMode(led_pin, OUTPUT);
|
||||
pinMode(led_pin_user[0], OUTPUT);
|
||||
pinMode(led_pin_user[1], OUTPUT);
|
||||
pinMode(led_pin_user[2], OUTPUT);
|
||||
pinMode(led_pin_user[3], OUTPUT);
|
||||
|
||||
Serial.begin(115200);
|
||||
|
||||
}
|
||||
|
||||
void loop() {
|
||||
int i;
|
||||
|
||||
digitalWrite(led_pin, HIGH); // set to as HIGH LED is turn-off
|
||||
delay(100); // Wait for 0.1 second
|
||||
digitalWrite(led_pin, LOW); // set to as LOW LED is turn-on
|
||||
delay(100); // Wait for 0.1 second
|
||||
|
||||
|
||||
for( i=0; i<4; i++ )
|
||||
{
|
||||
digitalWrite(led_pin_user[i], HIGH);
|
||||
delay(100);
|
||||
}
|
||||
for( i=0; i<4; i++ )
|
||||
{
|
||||
digitalWrite(led_pin_user[i], LOW);
|
||||
delay(100);
|
||||
}
|
||||
|
||||
Serial.println( String(10) );
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
BOARD_TAG = OpenCR
|
||||
|
||||
|
||||
ARDUINO_LIBS =
|
||||
|
||||
#MONITOR_PORT = /dev/ttyACM0
|
||||
|
||||
include ../../OpenCR.mk
|
|
@ -1,19 +0,0 @@
|
|||
/*
|
||||
Blink
|
||||
Turns on an LED on for one second, then off for one second, repeatedly.
|
||||
|
||||
This example code is in the public domain.
|
||||
*/
|
||||
|
||||
void setup() {
|
||||
// initialize the digital pin as an output.
|
||||
// Pin 13 has an LED connected on most Arduino boards:
|
||||
pinMode(13, OUTPUT);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
digitalWrite(13, HIGH); // set the LED on
|
||||
delay(1000); // wait for a second
|
||||
digitalWrite(13, LOW); // set the LED off
|
||||
delay(1000); // wait for a second
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
BOARD_TAG = teensy31
|
||||
ARDUINO_LIBS =
|
||||
|
||||
include $(ARDMK_DIR)/Teensy.mk
|
|
@ -1,4 +1,5 @@
|
|||
BOARD_TAG = uno
|
||||
ARDUINO_LIBS =
|
||||
MONITOR_PORT = /dev/cu.usb*
|
||||
ARDUINO_LIBS =
|
||||
|
||||
include $(ARDMK_DIR)/Arduino.mk
|
||||
include ../../arduino-mk/Arduino.mk
|
|
@ -1,19 +0,0 @@
|
|||
/*
|
||||
Blink
|
||||
Turns on an LED on for one second, then off for one second, repeatedly.
|
||||
|
||||
This example code is in the public domain.
|
||||
*/
|
||||
|
||||
void setup() {
|
||||
// initialize the digital pin as an output.
|
||||
// Pin 13 has an LED connected on most Arduino boards:
|
||||
pinMode(13, OUTPUT);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
digitalWrite(13, HIGH); // set the LED on
|
||||
delay(1000); // wait for a second
|
||||
digitalWrite(13, LOW); // set the LED off
|
||||
delay(1000); // wait for a second
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
# Arduino Due uses SAM3X8E SAM chip
|
||||
BOARD_TAG = arduino_due_x
|
||||
ARCHITECTURE = sam
|
||||
|
||||
# Define ARM toolchain dir if not using Arduino supplied
|
||||
#ARM_TOOLS_DIR = /usr
|
||||
|
||||
# Define AVR toolchain dir if not using Arduino supplied and using native port
|
||||
#AVR_TOOLS_DIR = /usr
|
||||
|
||||
# Define Arduino support package installation path where SAM device support has been installed
|
||||
# Linux
|
||||
#ARDUINO_PACKAGE_DIR := $(HOME)/.arduino15/packages
|
||||
# macOS
|
||||
#ARDUINO_PACKAGE_DIR := $(HOME)/Library/Arduino15/packages
|
||||
# Windows
|
||||
#ARDUINO_PACKAGE_DIR := "C:/Users/$(USER)/AppData/Local/Arduino15/packages"
|
||||
|
||||
include ../../Sam.mk
|
|
@ -1,4 +1,5 @@
|
|||
BOARD_TAG = uno
|
||||
ARDUINO_LIBS =
|
||||
MONITOR_PORT = /dev/cu.usb*
|
||||
ARDUINO_LIBS =
|
||||
|
||||
include $(ARDMK_DIR)/Arduino.mk
|
||||
include ../../arduino-mk/Arduino.mk
|
|
@ -1,4 +1,5 @@
|
|||
BOARD_TAG = uno
|
||||
MONITOR_PORT = /dev/cu.usb*
|
||||
ARDUINO_LIBS = LiquidCrystal
|
||||
|
||||
include $(ARDMK_DIR)/Arduino.mk
|
||||
include ../../arduino-mk/Arduino.mk
|
|
@ -1,19 +0,0 @@
|
|||
/*
|
||||
Blink
|
||||
Turns on an LED on for one second, then off for one second, repeatedly.
|
||||
|
||||
This example code is in the public domain.
|
||||
*/
|
||||
|
||||
void setup() {
|
||||
// initialize the digital pin as an output.
|
||||
// Pin 13 has an LED connected on most Arduino boards:
|
||||
pinMode(13, OUTPUT);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
digitalWrite(13, HIGH); // set the LED on
|
||||
delay(1000); // wait for a second
|
||||
digitalWrite(13, LOW); // set the LED off
|
||||
delay(1000); // wait for a second
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
# Arduino M0 Pro Programming Port
|
||||
BOARD_TAG = mzero_pro_bl_dbg
|
||||
|
||||
# Define debug if you want to use gdb
|
||||
#DEBUG = 1
|
||||
|
||||
# Define port if using Black Magic Probe rather than default localhost:3333
|
||||
#GDB_PORT = /dev/ttyACM0
|
||||
|
||||
# Define ARM toolchain dir if not using Arduino supplied
|
||||
#ARM_TOOLS_DIR = /usr
|
||||
|
||||
# Define AVR toolchain dir if not using Arduino supplied and using native port
|
||||
#AVR_TOOLS_DIR = /usr
|
||||
|
||||
# Define Arduino support package installation path where SAM device support has been installed
|
||||
# Linux
|
||||
# ARDUINO_PACKAGE_DIR := $(HOME)/.arduino15/packages
|
||||
# macOS
|
||||
# ARDUINO_PACKAGE_DIR := $(HOME)/Library/Arduino15/packages
|
||||
# Windows
|
||||
# ARDUINO_PACKAGE_DIR := "C:/Users/$(USER)/AppData/Local/Arduino15/packages"
|
||||
|
||||
include ../../Sam.mk
|
|
@ -1,56 +0,0 @@
|
|||
### DISCLAIMER
|
||||
### This is an example Makefile and it MUST be configured to suit your needs.
|
||||
### For detailed explanations about all of the available options, please refer
|
||||
### to https://github.com/sudar/Arduino-Makefile/blob/master/arduino-mk-vars.md
|
||||
|
||||
### How to setup a project using a board definition provided by the 3rd party
|
||||
### =========================================================================
|
||||
|
||||
### Some vendors provide definitions/configuration of their boards separately,
|
||||
### as so-called addon packages. Originally, they are supposed to be used in
|
||||
### the Arduino IDE but they can be used with Arduino-Makefile as well:
|
||||
|
||||
### 1. get the package from the vendor
|
||||
### if they provide .json file, look into it and take the URL of the package
|
||||
### archive from there
|
||||
###
|
||||
### 2. extract the package into your ARDUINO_SKETCHBOOK directory
|
||||
### you have to end with the directory structure like this, in your
|
||||
### ARDUINO_SKETCHBOOK directory (sparkfun is the vendor name):
|
||||
|
||||
### hardware/
|
||||
### ├── sparkfun/
|
||||
### │ └── avr/
|
||||
### │ ├── boards.txt
|
||||
### │ ├── bootloaders/
|
||||
### │ ├── driver/
|
||||
### │ ├── platform.txt
|
||||
### │ ├── signed_driver/
|
||||
### │ └── variants/
|
||||
|
||||
### 3. Create this Makefile (use your vendor/package name)
|
||||
|
||||
### ALTERNATE_CORE = sparkfun
|
||||
### include $(HOME)/Arduino-Makefile/Arduino.mk
|
||||
|
||||
### 4. run 'make show_boards'
|
||||
### check that you can see (only) boards provided by this vendor
|
||||
|
||||
### 5. select the name of your board
|
||||
### and add a line "BOARD_TAG = ...." to your Makefile
|
||||
|
||||
### 6. if your board has more cpu variants, run 'make show_submenu'
|
||||
### to see them; select your one and add a line "BOARD_SUB = ...."
|
||||
### to your Makefile
|
||||
|
||||
#####
|
||||
|
||||
### The basic configuration should be done now.
|
||||
### The example follows:
|
||||
|
||||
ARDUINO_SKETCHBOOK = $(HOME)/sketchbook
|
||||
ALTERNATE_CORE = sparkfun
|
||||
BOARD_TAG = promicro
|
||||
BOARD_SUB = 8MHzatmega32U4
|
||||
include $(ARDMK_DIR)/Arduino.mk
|
||||
|
|
@ -1,74 +0,0 @@
|
|||
### DISCLAIMER
|
||||
### This is an example Makefile and it MUST be configured to suit your needs.
|
||||
### For detailed explanations about all of the available options, please refer
|
||||
### to https://github.com/sudar/Arduino-Makefile/blob/master/arduino-mk-vars.md
|
||||
### Original project where this Makefile comes from: https://github.com/WeAreLeka/Bare-Arduino-Project
|
||||
|
||||
### PROJECT_DIR
|
||||
### This is the path to where you have created/cloned your project
|
||||
PROJECT_DIR = /Users/MyUserName/path/to/my/Project
|
||||
|
||||
### ARDMK_DIR
|
||||
### Path to the Arduino-Makefile directory.
|
||||
ARDMK_DIR = $(PROJECT_DIR)/Arduino-Makefile
|
||||
|
||||
### ARDUINO_DIR
|
||||
### Path to the Arduino application and resources directory.
|
||||
### On OS X:
|
||||
ARDUINO_DIR = /Applications/Arduino.app/Contents/Java
|
||||
### or on Linux: (remove the one you don't want)
|
||||
ARDUINO_DIR = /usr/share/arduino
|
||||
|
||||
### USER_LIB_PATH
|
||||
### Path to where the your project's libraries are stored.
|
||||
USER_LIB_PATH := $(PROJECT_DIR)/lib
|
||||
|
||||
### BOARD_TAG
|
||||
### It must be set to the board you are currently using. (i.e uno, mega2560, etc.)
|
||||
BOARD_TAG = uno
|
||||
|
||||
### MONITOR_BAUDRATE
|
||||
### It must be set to Serial baudrate value you are using.
|
||||
MONITOR_BAUDRATE = 115200
|
||||
|
||||
### AVR_TOOLS_DIR
|
||||
### Path to the AVR tools directory such as avr-gcc, avr-g++, etc.
|
||||
### On OS X with `homebrew`:
|
||||
AVR_TOOLS_DIR = /usr/local
|
||||
### or on Linux: (remove the one you don't want)
|
||||
AVR_TOOLS_DIR = /usr
|
||||
|
||||
### AVRDUDE
|
||||
### Path to avrdude directory.
|
||||
### On OS X with `homebrew`:
|
||||
AVRDUDE = /usr/local/bin/avrdude
|
||||
### or on Linux: (remove the one you don't want)
|
||||
AVRDUDE = /usr/bin/avrdude
|
||||
|
||||
### CFLAGS_STD
|
||||
### Set the C standard to be used during compilation. Documentation (https://github.com/WeAreLeka/Arduino-Makefile/blob/std-flags/arduino-mk-vars.md#cflags_std)
|
||||
CFLAGS_STD = -std=gnu11
|
||||
|
||||
### CXXFLAGS_STD
|
||||
### Set the C++ standard to be used during compilation. Documentation (https://github.com/WeAreLeka/Arduino-Makefile/blob/std-flags/arduino-mk-vars.md#cxxflags_std)
|
||||
CXXFLAGS_STD = -std=gnu++11
|
||||
|
||||
### CXXFLAGS
|
||||
### Flags you might want to set for debugging purpose. Comment to stop.
|
||||
CXXFLAGS += -pedantic -Wall -Wextra
|
||||
|
||||
### MONITOR_PORT
|
||||
### The port your board is connected to. Using an '*' tries all the ports and finds the right one.
|
||||
MONITOR_PORT = /dev/tty.usbmodem*
|
||||
|
||||
### CURRENT_DIR
|
||||
### Do not touch - used for binaries path
|
||||
CURRENT_DIR = $(shell basename $(CURDIR))
|
||||
|
||||
### OBJDIR
|
||||
### This is where you put the binaries you just compile using 'make'
|
||||
OBJDIR = $(PROJECT_DIR)/bin/$(BOARD_TAG)/$(CURRENT_DIR)
|
||||
|
||||
### Do not touch - the path to Arduino.mk, inside the ARDMK_DIR
|
||||
include $(ARDMK_DIR)/Arduino.mk
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
This folder contains the list of example Arduino sketches and makefile showing
|
||||
the different usage patterns
|
||||
|
||||
- BlinkInAVRC - Shows how to use plain AVR C code
|
||||
- ATtinyBlink - Shows how to use different cores like ATtiny
|
||||
- Blink - Shows normal usage
|
||||
- HelloWorld - Shows how to include Arduino libraries
|
||||
- SerialPrint - Shows how serial monitor can be used
|
||||
- BlinkChipKIT - Shows how to use ChipKIT
|
|
@ -1,5 +0,0 @@
|
|||
# Arduino Make file. Refer to https://github.com/sudar/Arduino-Makefile
|
||||
|
||||
BOARD_TAG = uno
|
||||
|
||||
include $(ARDMK_DIR)/Arduino.mk
|
|
@ -1,10 +0,0 @@
|
|||
void setup() {
|
||||
Serial.begin(9600);
|
||||
Serial.print("Press any key: ");
|
||||
}
|
||||
|
||||
void loop() {
|
||||
if (Serial.available()) {
|
||||
Serial.println(Serial.read());
|
||||
}
|
||||
}
|
|
@ -1,20 +1,15 @@
|
|||
# Arduino Make file. Refer to https://github.com/sudar/Arduino-Makefile
|
||||
|
||||
# if you have placed the alternate core in your sketchbook directory, then you can just mention the core name alone.
|
||||
# if you have placed the alternate core in your sketchbook directory, then you can just mention the core name alone.
|
||||
ALTERNATE_CORE = attiny
|
||||
# If not, you might have to include the full path.
|
||||
#ALTERNATE_CORE_PATH = /home/sudar/Dropbox/code/arduino-sketches/hardware/attiny/
|
||||
|
||||
# !!! Important. You have to use "make ispload" to upload when using ISP programmer
|
||||
ISP_PROG = usbasp
|
||||
|
||||
# 1.5+ example of submenu cpu
|
||||
BOARD_TAG = attiny
|
||||
BOARD_SUB = attiny85
|
||||
|
||||
# clock is a submenu too
|
||||
F_CPU = 16000000L
|
||||
BOARD_TAG = attiny85-8
|
||||
ISP_PORT = /dev/ttyACM*
|
||||
|
||||
ARDUINO_LIBS = SoftwareSerial
|
||||
|
||||
include $(ARDMK_DIR)/Arduino.mk
|
||||
include $(ARDMK_DIR)/arduino-mk/Arduino.mk
|
||||
|
||||
# !!! Important. You have to use make ispload to upload when using ISP programmer
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# Arduino Make file. Refer to https://github.com/sudar/Arduino-Makefile
|
||||
|
||||
BOARD_TAG = uno
|
||||
MONITOR_PORT = /dev/cu.usb*
|
||||
ARDUINO_LIBS = Ethernet SPI
|
||||
|
||||
include $(ARDMK_DIR)/Arduino.mk
|
||||
include ../../arduino-mk/Arduino.mk
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
# Arduino Zero Native Port (should work with Feather, MKR1000 etc.)
|
||||
# BOOTLOADER: The bootloader on these devices loaded when reset is pressed twice
|
||||
# or the port is opened/closed at 1200 BAUD. If there is no program on the device,
|
||||
# you may have to manually enter bootloader by toggling reset twice.
|
||||
# see http://www.avdweb.nl/arduino/samd21/virus.html
|
||||
BOARD_TAG = arduino_zero_native
|
||||
|
||||
# Define alternative core path if using another board supplier
|
||||
#ALTERNATE_CORE_PATH = $(HOME)/Arduino/hardware/sparkfun/samd
|
||||
|
||||
# Define monitor port and isp port (bootloader port).
|
||||
# Will automatically detect if Linux/macOS but MUST be defined on Windows
|
||||
#MONITOR_PORT = com40 # CDC serial
|
||||
#ISP_PORT = com39 # bootloader
|
||||
|
||||
# Define ARM toolchain dir if not using Arduino supplied
|
||||
#ARM_TOOLS_DIR = /usr
|
||||
|
||||
# Define AVR toolchain dir if not using Arduino supplied and using native port
|
||||
#AVR_TOOLS_DIR = /usr
|
||||
|
||||
# Define Arduino support package installation path where SAM device support has been installed
|
||||
# Linux
|
||||
#ARDUINO_PACKAGE_DIR := $(HOME)/.arduino15/packages
|
||||
# macOS
|
||||
#ARDUINO_PACKAGE_DIR := $(HOME)/Library/Arduino15/packages
|
||||
# Windows
|
||||
#ARDUINO_PACKAGE_DIR := "C:/Users/$(USER)/AppData/Local/Arduino15/packages"
|
||||
|
||||
include ../../Sam.mk
|
|
@ -1,19 +0,0 @@
|
|||
/*
|
||||
Blink
|
||||
Turns on an LED on for one second, then off for one second, repeatedly.
|
||||
|
||||
This example code is in the public domain.
|
||||
*/
|
||||
|
||||
void setup() {
|
||||
// initialize the digital pin as an output.
|
||||
// Pin 13 has an LED connected on most Arduino boards:
|
||||
pinMode(13, OUTPUT);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
digitalWrite(13, HIGH); // set the LED on
|
||||
delay(1000); // wait for a second
|
||||
digitalWrite(13, LOW); // set the LED off
|
||||
delay(1000); // wait for a second
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
# Arduino Make file. Refer to https://github.com/sudar/Arduino-Makefile
|
||||
|
||||
BOARD_TAG = uno
|
||||
MONITOR_PORT = /dev/cu.usb*
|
||||
ARDUINO_LIBS = Wire
|
||||
|
||||
include $(ARDMK_DIR)/Arduino.mk
|
||||
include ../../arduino-mk/Arduino.mk
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
BOARD_TAG = uno
|
||||
ARDUINO_LIBS =
|
||||
MONITOR_PORT = /dev/cu.usb*
|
||||
ARDUINO_LIBS =
|
||||
|
||||
include $(ARDMK_DIR)/Arduino.mk
|
||||
include ../../arduino-mk/Arduino.mk
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
# How to compile a Deb package
|
||||
|
||||
Use these instructions to build your own Deb package from your local sources.
|
||||
For the latest official packages go to [Debian](http://packages.debian.org/arduino-mk)
|
||||
or [Ubuntu](https://launchpad.net/ubuntu/+source/arduino-mk) or use apt.
|
||||
|
||||
First install the dependencies as root:
|
||||
|
||||
apt-get build-dep arduino-mk
|
||||
apt-get install arduino-core build-essential dpkg-dev fakeroot devscripts
|
||||
|
||||
Fetch the Debian source:
|
||||
|
||||
apt-get source arduino-mk
|
||||
|
||||
Make any local changes to want within the arduino-mk-* directory and update the package version:
|
||||
|
||||
cd arduino-mk-*
|
||||
dch -i
|
||||
|
||||
Then compile. This will create a binary Deb:
|
||||
|
||||
dpkg-buildpackage -b
|
|
@ -1,45 +0,0 @@
|
|||
# How to compile an RPM
|
||||
|
||||
First install the dependencies as root:
|
||||
|
||||
```sh
|
||||
yum install arduino-core rpm-build
|
||||
|
||||
# or on Fedora 22+
|
||||
|
||||
dnf install arduino-core rpmdevtools
|
||||
```
|
||||
|
||||
From the top-level Arduino-Makefile directory you've checked out of github, run the following (as unprivileged user) to create a compressed tarball using the naming conventions required by rpmbuild:
|
||||
|
||||
git archive HEAD --prefix=arduino-mk-1.5/ -o ../arduino-mk-1.5.tar.gz
|
||||
|
||||
If you don't already have a rpmbuild setup (e.g. you've not installed the SRPM) you will need to create the directories:
|
||||
|
||||
mkdir -p ~/rpmbuild/{SOURCES,SPECS}
|
||||
|
||||
Then copy the tarball and specfile into those directories:
|
||||
|
||||
cp ../arduino-mk-1.5.tar.gz ~/rpmbuild/SOURCES/
|
||||
cp packaging/fedora/arduino-mk.spec ~/rpmbuild/SPECS/
|
||||
|
||||
Then compile. This will create a binary and source RPM:
|
||||
|
||||
cd ~/rpmbuild/SPECS/
|
||||
rpmbuild -ba arduino-mk.spec
|
||||
|
||||
Fedora's AVR compilers use ccache, so you may have to override some of the paths to the AVR tools in your sketch's Makefile, for example:
|
||||
|
||||
```Makefile
|
||||
OVERRIDE_EXECUTABLES = 1
|
||||
CC = /usr/lib64/ccache/$(CC_NAME)
|
||||
CXX = /usr/lib64/ccache/$(CXX_NAME)
|
||||
AS = /usr/bin/$(AS_NAME)
|
||||
OBJCOPY = /usr/bin/$(OBJCOPY_NAME)
|
||||
OBJDUMP = /usr/bin/$(OBJDUMP_NAME)
|
||||
AR = /usr/bin/$(AR_NAME)
|
||||
SIZE = /usr/bin/$(SIZE_NAME)
|
||||
NM = /usr/bin/$(NM_NAME)
|
||||
```
|
||||
|
||||
Or if you don't want to use ccache, then just set ```AVR_TOOLS_PATH=/usr``` and none of the above will be necessary.
|
|
@ -1,83 +0,0 @@
|
|||
Name: arduino-mk
|
||||
Version: 1.6.0
|
||||
Release: 2%{dist}
|
||||
Summary: Program your Arduino from the command line
|
||||
Packager: Simon John <git@the-jedi.co.uk>
|
||||
URL: https://github.com/sudar/Arduino-Makefile
|
||||
Source: %{name}-%{version}.tar.gz
|
||||
Group: Development/Tools
|
||||
License: LGPLv2+
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
BuildArch: noarch
|
||||
Requires: arduino-core python3-pyserial
|
||||
|
||||
%description
|
||||
Arduino is an open-source electronics prototyping platform based on
|
||||
flexible, easy-to-use hardware and software. It's intended for artists,
|
||||
designers, hobbyists, and anyone interested in creating interactive
|
||||
objects or environments.
|
||||
|
||||
This package will install a Makefile to allow for CLI programming of the
|
||||
Arduino platform.
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
|
||||
%install
|
||||
mkdir -p %{buildroot}/%{_datadir}/arduino
|
||||
mkdir -p %{buildroot}/%{_bindir}
|
||||
mkdir -p %{buildroot}/%{_mandir}/man1
|
||||
mkdir -p %{buildroot}/%{_docdir}/%{name}/examples
|
||||
install -m 755 -d %{buildroot}/%{_docdir}/%{name}
|
||||
install -m 755 -d %{buildroot}/%{_docdir}/%{name}/examples
|
||||
for dir in `find examples -type d` ; do install -m 755 -d %{buildroot}/%{_docdir}/%{name}/$dir ; done
|
||||
for file in `find examples -type f ! -name .gitignore` ; do install -m 644 $file %{buildroot}/%{_docdir}/%{name}/$file ; done
|
||||
install -m 644 *.mk arduino-mk-vars.md %{buildroot}/%{_datadir}/arduino
|
||||
install -m 644 licence.txt %{buildroot}/%{_docdir}/%{name}
|
||||
install -m 755 bin/ard-reset-arduino %{buildroot}/%{_bindir}/ard-reset-arduino
|
||||
install -m 644 ard-reset-arduino.1 %{buildroot}/%{_mandir}/man1
|
||||
install -m 755 bin/robotis-loader %{buildroot}/%{_bindir}/robotis-loader
|
||||
install -m 644 robotis-loader.1 %{buildroot}/%{_mandir}/man1
|
||||
install -m 755 bin/ardmk-init %{buildroot}/%{_bindir}/ardmk-init
|
||||
install -m 644 ardmk-init.1 %{buildroot}/%{_mandir}/man1
|
||||
|
||||
%clean
|
||||
rm -rf %{buildroot}
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,-)
|
||||
%{_bindir}/ard-reset-arduino
|
||||
%{_mandir}/man1/ard-reset-arduino.1*
|
||||
%{_bindir}/robotis-loader
|
||||
%{_mandir}/man1/robotis-loader.1*
|
||||
%{_bindir}/ardmk-init
|
||||
%{_mandir}/man1/ardmk-init.1*
|
||||
%{_datadir}/arduino/*.mk
|
||||
%{_datadir}/arduino/arduino-mk-vars.md
|
||||
%doc %{_docdir}/%{name}/licence.txt
|
||||
%docdir %{_docdir}/%{name}/examples
|
||||
%{_docdir}/%{name}/examples
|
||||
|
||||
%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>
|
||||
- Added ardmk-init binary and manpage
|
||||
* Tue Jul 11 2017 Karl Semich <fuzzyTew@gmail.com>
|
||||
- Added robotis-loader binary and manpage
|
||||
* Sat Apr 12 2014 Simon John <git@the-jedi.co.uk>
|
||||
- Put manpage back.
|
||||
* Fri Apr 04 2014 Simon John <git@the-jedi.co.uk>
|
||||
- Removed BuildRequires of python3/pyserial.
|
||||
* Wed Apr 02 2014 Simon John <git@the-jedi.co.uk>
|
||||
- Added BuildRequires of python3-pyserial. Need to look into Requires.
|
||||
* Mon Mar 24 2014 Simon John <git@the-jedi.co.uk>
|
||||
- Replaced perl/help2man with pyserial for reset script.
|
||||
* Tue Feb 04 2014 Simon John <git@the-jedi.co.uk>
|
||||
- Added arduino-mk-vars.md to the files to be installed/packaged.
|
||||
* Sat Feb 01 2014 Simon John <git@the-jedi.co.uk>
|
||||
- Updated version.
|
||||
* Mon Jan 13 2014 Simon John <git@the-jedi.co.uk>
|
||||
- Removed arduino-mk subdirectory
|
||||
* Mon Dec 30 2013 Simon John <git@the-jedi.co.uk>
|
||||
- Initial release.
|
|
@ -1,27 +0,0 @@
|
|||
.TH ROBOTIS-LOADER "1" "July 2017" "robotis-loader" "Robotis CLI Uploader"
|
||||
|
||||
.SH NAME
|
||||
robotis-loader - Flash Robotis boards
|
||||
|
||||
.SH SYNOPSIS
|
||||
.B robotis-loader
|
||||
PORT BINARY
|
||||
|
||||
.SH DESCRIPTION
|
||||
Sends a program on a Robotis board (OpenCM9.04 or CM900) using the
|
||||
Robotis bootloader (used in OpenCM IDE).
|
||||
|
||||
.SH EXAMPLE
|
||||
robotis-loader /dev/ttyACM0 firmware.bin
|
||||
|
||||
.SH BUGS
|
||||
Problems may reported on the github project page at:
|
||||
.PP
|
||||
https://github.com/Gregwar/robotis-loader
|
||||
|
||||
.SH AUTHOR
|
||||
Grégoire Passault, g.passault@gmail.com
|
||||
|
||||
.SH LICENSE
|
||||
This is under MIT license.
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
SCRIPTS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
pushd $SCRIPTS_DIR/..
|
||||
|
||||
source $SCRIPTS_DIR/bootstrap/chipkit.sh
|
||||
source $SCRIPTS_DIR/bootstrap/arduino.sh
|
||||
source $SCRIPTS_DIR/bootstrap/samd.sh
|
|
@ -1,46 +0,0 @@
|
|||
set -e
|
||||
BOOTSTRAP_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
source $BOOTSTRAP_DIR/common.sh
|
||||
|
||||
echo "Installing dependencies for building for the Arduino"
|
||||
|
||||
if [ -z "$ARDUINO_DIR" ] || ! test -e $ARDUINO_DIR || [ $OS == "cygwin" ]; then
|
||||
|
||||
echo "Installing Arduino..."
|
||||
|
||||
ARDUINO_BASENAME="arduino-1.8.11"
|
||||
|
||||
if [ $OS == "cygwin" ]; then
|
||||
ARDUINO_FILE="$ARDUINO_BASENAME-windows".zip
|
||||
EXTRACT_COMMAND="unzip -q"
|
||||
elif [ $OS == "mac" ]; then
|
||||
ARDUINO_FILE="$ARDUINO_BASENAME-macosx".zip
|
||||
EXTRACT_COMMAND="unzip -q"
|
||||
else
|
||||
ARDUINO_FILE="$ARDUINO_BASENAME-linux64".tar.xz
|
||||
EXTRACT_COMMAND="tar -xf"
|
||||
fi
|
||||
|
||||
ARDUINO_URL=http://arduino.cc/download.php?f=/$ARDUINO_FILE
|
||||
|
||||
_pushd $DEPENDENCIES_FOLDER
|
||||
if ! test -e $ARDUINO_FILE
|
||||
then
|
||||
echo "Downloading Arduino IDE..."
|
||||
download $ARDUINO_URL $ARDUINO_FILE
|
||||
fi
|
||||
|
||||
if ! test -d $ARDUINO_BASENAME
|
||||
then
|
||||
echo "Installing Arduino to local folder..."
|
||||
$EXTRACT_COMMAND $ARDUINO_FILE
|
||||
mv $ARDUINO_BASENAME arduino
|
||||
echo "Arduino installed"
|
||||
fi
|
||||
|
||||
_popd
|
||||
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "${bldgreen}Arduino dependencies installed.$txtrst"
|
|
@ -1,61 +0,0 @@
|
|||
set -e
|
||||
BOOTSTRAP_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
source $BOOTSTRAP_DIR/common.sh
|
||||
|
||||
echo "Installing dependencies for building for the chipKIT"
|
||||
|
||||
|
||||
if [ -z "$MPIDE_DIR" ] || ! test -e $MPIDE_DIR || [ $OS == "cygwin" ]; then
|
||||
|
||||
echo "Installing MPIDE..."
|
||||
|
||||
if [ $OS == "cygwin" ]; then
|
||||
MPIDE_BASENAME="mpide-0023-windows-20130715"
|
||||
MPIDE_FILE="$MPIDE_BASENAME".zip
|
||||
EXTRACT_COMMAND="unzip -q"
|
||||
if ! command -v unzip >/dev/null 2>&1; then
|
||||
_cygwin_error "unzip"
|
||||
fi
|
||||
elif [ $OS == "mac" ]; then
|
||||
MPIDE_BASENAME=mpide-0023-macosx-20130715
|
||||
MPIDE_FILE="$MPIDE_BASENAME".dmg
|
||||
else
|
||||
MPIDE_BASENAME=mpide-0023-linux64-20130817-test
|
||||
MPIDE_FILE="$MPIDE_BASENAME".tgz
|
||||
EXTRACT_COMMAND="tar -xzf"
|
||||
fi
|
||||
|
||||
MPIDE_URL=http://chipkit.s3.amazonaws.com/builds/$MPIDE_FILE
|
||||
|
||||
_pushd $DEPENDENCIES_FOLDER
|
||||
if ! test -e $MPIDE_FILE
|
||||
then
|
||||
echo "Downloading MPIDE..."
|
||||
download $MPIDE_URL $MPIDE_FILE
|
||||
fi
|
||||
|
||||
if ! test -d $MPIDE_BASENAME
|
||||
then
|
||||
echo "Installing MPIDE to local folder..."
|
||||
if [ $OS == "mac" ]; then
|
||||
hdiutil attach $MPIDE_FILE
|
||||
cp -R /Volumes/Mpide/Mpide.app/Contents/Resources/Java $MPIDE_BASENAME
|
||||
hdiutil detach /Volumes/Mpide
|
||||
else
|
||||
$EXTRACT_COMMAND $MPIDE_FILE
|
||||
fi
|
||||
echo "MPIDE installed"
|
||||
fi
|
||||
|
||||
if [ $OS == "cygwin" ]; then
|
||||
chmod a+x mpide/hardware/pic32/compiler/pic32-tools/bin/*
|
||||
chmod a+x -R mpide/hardware/pic32/compiler/pic32-tools/pic32mx/
|
||||
chmod a+x mpide/*.dll
|
||||
chmod a+x mpide/hardware/tools/avr/bin/*
|
||||
fi
|
||||
_popd
|
||||
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "${bldgreen}chipKIT dependencies installed.$txtrst"
|
|
@ -1,182 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
BOOTSTRAP_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
if [ -z $COMMON_SOURCED ]; then
|
||||
|
||||
# TODO this is kind of a hacky way of determining if root is required -
|
||||
# ideally we wouuld set up a little virtualenv in the dependencies folder
|
||||
SUDO_CMD=
|
||||
if command -v sudo >/dev/null 2>&1; then
|
||||
SUDO_CMD="sudo -E"
|
||||
|
||||
if [ -z $CI ] && [ -z $VAGRANT ]; then
|
||||
echo "The bootstrap script needs to install a few packages to your system as an admin, and we will use the 'sudo' command - enter your password to continue"
|
||||
$SUDO_CMD ls > /dev/null
|
||||
fi
|
||||
fi
|
||||
|
||||
KERNEL=`uname`
|
||||
ARCH=`uname -m`
|
||||
if [ ${KERNEL:0:7} == "MINGW32" ]; then
|
||||
OS="windows"
|
||||
elif [ ${KERNEL:0:6} == "CYGWIN" ]; then
|
||||
OS="cygwin"
|
||||
elif [ $KERNEL == "Darwin" ]; then
|
||||
OS="mac"
|
||||
else
|
||||
OS="linux"
|
||||
if ! command -v lsb_release >/dev/null 2>&1; then
|
||||
# Arch Linux
|
||||
if command -v pacman>/dev/null 2>&1; then
|
||||
$SUDO_CMD pacman -S lsb-release
|
||||
fi
|
||||
fi
|
||||
|
||||
DISTRO=`lsb_release -si`
|
||||
fi
|
||||
|
||||
|
||||
die() {
|
||||
echo >&2 "${bldred}$@${txtrst}"
|
||||
exit 1
|
||||
}
|
||||
|
||||
_cygwin_error() {
|
||||
echo
|
||||
echo "${bldred}Missing \"$1\"${txtrst} - run the Cygwin installer again and select the base package set:"
|
||||
echo " $CYGWIN_PACKAGES"
|
||||
echo "After installing the packages, re-run this bootstrap script."
|
||||
die
|
||||
}
|
||||
|
||||
if ! command -v tput >/dev/null 2>&1; then
|
||||
if [ $OS == "cygwin" ]; then
|
||||
echo "OPTIONAL: Install the \"ncurses\" package in Cygwin to get colored shell output"
|
||||
fi
|
||||
else
|
||||
set +e
|
||||
# These exit with 1 when provisioning in a Vagrant box...?
|
||||
txtrst=$(tput sgr0) # reset
|
||||
bldred=${txtbld}$(tput setaf 1)
|
||||
bldgreen=${txtbld}$(tput setaf 2)
|
||||
set -e
|
||||
fi
|
||||
|
||||
|
||||
_pushd() {
|
||||
pushd $1 > /dev/null
|
||||
}
|
||||
|
||||
_popd() {
|
||||
popd > /dev/null
|
||||
}
|
||||
|
||||
_wait() {
|
||||
if [ -z $CI ] && [ -z $VAGRANT ]; then
|
||||
echo "Press Enter when done"
|
||||
read
|
||||
fi
|
||||
}
|
||||
|
||||
_install() {
|
||||
if [ $OS == "cygwin" ]; then
|
||||
_cygwin_error $1
|
||||
elif [ $OS == "mac" ]; then
|
||||
# brew exists with 1 if it's already installed
|
||||
set +e
|
||||
brew install $1
|
||||
set -e
|
||||
else
|
||||
if [ -z $DISTRO ]; then
|
||||
echo
|
||||
echo "Missing $1 - install it using your distro's package manager or build from source"
|
||||
_wait
|
||||
else
|
||||
if [ $DISTRO == "arch" ]; then
|
||||
$SUDO_CMD pacman -S $1
|
||||
elif [ $DISTRO == "Ubuntu" ]; then
|
||||
$SUDO_CMD apt-get update -qq
|
||||
$SUDO_CMD apt-get install $1 -y
|
||||
else
|
||||
echo
|
||||
echo "Missing $1 - install it using your distro's package manager or build from source"
|
||||
_wait
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
download() {
|
||||
url=$1
|
||||
filename=$2
|
||||
curl $url -L -o $filename
|
||||
}
|
||||
|
||||
if [ `id -u` == 0 ]; then
|
||||
die "Error: running as root - don't use 'sudo' with this script"
|
||||
fi
|
||||
|
||||
if ! command -v unzip >/dev/null 2>&1; then
|
||||
_install "unzip"
|
||||
fi
|
||||
|
||||
if ! command -v curl >/dev/null 2>&1; then
|
||||
if [ $OS == "cygwin" ]; then
|
||||
_cygwin_error "curl"
|
||||
else
|
||||
_install curl
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Storing all downloaded dependencies in the \"dependencies\" folder"
|
||||
|
||||
DEPENDENCIES_FOLDER="/var/tmp/Arduino-Makefile-testing-dependencies"
|
||||
mkdir -p $DEPENDENCIES_FOLDER
|
||||
|
||||
if ! command -v make >/dev/null 2>&1; then
|
||||
if [ $OS == "cygwin" ]; then
|
||||
_cygwin_error "make"
|
||||
elif [ $OS == "mac" ]; then
|
||||
die "Missing 'make' - install the Xcode CLI tools"
|
||||
else
|
||||
if [ $DISTRO == "arch" ]; then
|
||||
_install "base-devel"
|
||||
elif [ $DISTRO == "Ubuntu" ]; then
|
||||
_install "build-essential"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $DISTRO == "Ubuntu" ] && [ $ARCH == "x86_64" ]; then
|
||||
_install "libc6-i386"
|
||||
_install "lib32gcc1"
|
||||
fi
|
||||
|
||||
if ! command -v g++ >/dev/null 2>&1; then
|
||||
if [ $DISTRO == "Ubuntu" ]; then
|
||||
_install "g++"
|
||||
fi
|
||||
fi
|
||||
|
||||
if ! command -v python3 >/dev/null 2>&1; then
|
||||
echo "Installing Python..."
|
||||
_install "python3"
|
||||
fi
|
||||
|
||||
if ! command -v pip3 >/dev/null 2>&1; then
|
||||
echo "Installing Pip..."
|
||||
_install "python3-pip"
|
||||
fi
|
||||
|
||||
PIP_SUDO_CMD=
|
||||
if [ -z $VIRTUAL_ENV ]; then
|
||||
# Only use sudo if the user doesn't have an active virtualenv
|
||||
PIP_SUDO_CMD=$SUDO_CMD
|
||||
fi
|
||||
|
||||
$PIP_SUDO_CMD pip3 install --src dependencies --pre -Ur $BOOTSTRAP_DIR/pip-requirements.txt
|
||||
|
||||
COMMON_SOURCED=1
|
||||
fi
|
|
@ -1 +0,0 @@
|
|||
pyserial==3.4
|
|
@ -1,46 +0,0 @@
|
|||
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"
|
|
@ -1,100 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
SCRIPTS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
TESTS_DIR=examples
|
||||
export ARDMK_DIR="${ARDMK_DIR:-$SCRIPTS_DIR/../..}"
|
||||
|
||||
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
|
||||
# alternate cores. The MakefileExample doesn't actually contain any source code
|
||||
# to compile.
|
||||
NON_TESTABLE_EXAMPLES=(ATtinyBlink MakefileExample TinySoftWareSerial BlinkOpenCM BlinkOpenCR BlinkTeensy BlinkNetworkRPi BlinkInAVRC DueBlink)
|
||||
|
||||
for dir in $TESTS_DIR/*/
|
||||
do
|
||||
dir=${dir%*/}
|
||||
example=${dir##*/}
|
||||
example_is_testable=true
|
||||
for non_testable_example in "${NON_TESTABLE_EXAMPLES[@]}"; do
|
||||
if [[ $example == $non_testable_example ]]; then
|
||||
example_is_testable=false
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if ! $example_is_testable; then
|
||||
info "Skipping non-testable example $example..."
|
||||
continue
|
||||
fi
|
||||
|
||||
run pushd $dir
|
||||
info "Compiling $example..."
|
||||
runtest clean
|
||||
runtest
|
||||
|
||||
if [[ $? -ne 0 ]]; then
|
||||
failures+=("$example")
|
||||
info "Example $example failed"
|
||||
fi
|
||||
|
||||
runtest disasm
|
||||
if [[ $? -ne 0 ]]; then
|
||||
failures+=("$example disasm")
|
||||
info "Example $example disasm failed"
|
||||
fi
|
||||
|
||||
runtest generate_assembly
|
||||
if [[ $? -ne 0 ]]; then
|
||||
failures+=("$example generate_assembly")
|
||||
info "Example $example generate_assembly failed"
|
||||
fi
|
||||
|
||||
runtest symbol_sizes
|
||||
if [[ $? -ne 0 ]]; then
|
||||
failures+=("$example symbol_sizes")
|
||||
info "Example $example symbol_sizes failed"
|
||||
fi
|
||||
|
||||
run popd
|
||||
done
|
||||
|
||||
if [[ ${#failures[@]} -eq 0 ]]; then
|
||||
echo "All tests passed."
|
||||
else
|
||||
for failure in "${failures[@]}"; do
|
||||
echo "Example $failure failed"
|
||||
done
|
||||
|
||||
exit 1
|
||||
fi
|
Loading…
Reference in a new issue