Compare commits

...

191 commits

Author SHA1 Message Date
Sudar Muthu
a1fbda0c53
Merge pull request from tuna-f1sh/grep_Fix
no echo required for `info`
2021-08-02 13:08:09 +05:30
John Whittington
4d7a10c774 no echo required 2021-07-19 11:15:37 +02:00
Sudar Muthu
32736a9353
Merge pull request from xrstf/patch-1
fixed typo in readme
2021-06-05 09:27:30 +05:30
Christoph Mewes
5a328f2673
fixed typo in readme 2021-05-27 16:27:50 +02:00
Simon John
7ac13de7f9
Merge pull request from kpfleming/improve-detection-ard-reset-arduino
Improve detection of ard-reset-arduino location
2020-10-20 12:20:30 +01:00
Kevin P. Fleming
55e003ff6c Improve detection of ard-reset-arduino location
Find location of ard-reset-arduino before prefixing it with
PYTHON_CMD (so that 'which' failure can be detected). Also
display the resulting RESET_CMD, or user-provided RESET_CMD.
2020-10-20 06:47:20 -04:00
Simon John
d664c9b6b2
Merge pull request from kpfleming/use-cxx-for-linking-on-samd
Use C++ compiler when linking for SAMD-based boards
2020-10-20 09:15:05 +01:00
Simon John
e39a026014
Merge pull request from soburi/define_board_macro
Add -DARDUINO_{build.board} and -DARDUINO_VARIANT for compile options
2020-10-20 09:13:50 +01:00
Tokita, Hiroshi
01493f4e23 Add -DARDUINO_VARIANT definition 2020-10-20 09:57:36 +09:00
Kevin P. Fleming
37e757599a Use C++ compiler when linking for SAMD-based boards
The Arduino IDE supports full usage of C++ (including the standard
library) on SAMD-based boards, so the final linking of the executable
must be done using the C++ compiler.

Closes .
2020-10-19 06:21:45 -04:00
Tokita Hiroshi
d21e7ebe99 Add -DARDUINO_BOARD definition 2020-09-16 08:00:59 +09:00
Tokita Hiroshi
e482e6fbc7 Add -DARDUINO_{build.board} for compile options 2020-09-15 12:57:05 +09:00
Sudar Muthu
c7eb909b84
Merge pull request from co-dan/ctags_docs_fix
Rename `CTAGS_CMD` to `CTAGS_EXEC` (in the documentation).
2020-09-03 07:30:28 +05:30
Sudar Muthu
587beb9d7c
Merge pull request from osamuaoki/ARDMK_DIR
Let's make examples platform neutral
2020-09-03 07:25:14 +05:30
Sudar Muthu
e6881e2a43
Merge pull request from tuna-f1sh/travis
Fix Travis CI, add SAMD test support, support GNU grep on macOS
2020-09-03 07:22:54 +05:30
John Whittington
2329d19b97 remove 2020-08-10 16:37:32 +02:00
John Whittington
bf319c49b7 platform neutral examples and manual cherry-pick merge of https://github.com/alissa-huskey/Arduino-Makefile/tree/test_fixes 2020-08-06 20:01:05 +02:00
John Whittington
185a1e9e35 document GREP_CMD 2020-08-06 12:42:47 +02:00
John Whittington
264f8f604a Arduino IDE upto support version and SAMD builds
process uses direct downloads. Might be better to move to distribution
Arduino install + arduino-cli to install board support in future.
2020-08-06 12:32:17 +02:00
John Whittington
bcce50471e add python3 and pip3 to travis yml 2020-08-06 09:29:32 +02:00
John Whittington
517fe4a632 Merge remote-tracking branch 'sej7278/python3' 2020-08-05 18:22:29 +02:00
Simon John
88dc641c8d removed shebang sed from specfile 2020-08-05 00:04:42 +01:00
Simon John
5f5a68aa31 Replaced env with python3 shebang 2020-08-04 23:49:32 +01:00
Simon John
dff6492a4b Fixed SyntaxWarning: "is" vs "==" 2020-08-04 23:28:36 +01:00
Simon John
207253abc6 Rebased python3 branch with some changes from tuna-f1sh@87d5241 2020-08-04 23:19:49 +01:00
John Whittington
26e34cd6f2 detect and use GNU grep on macOS 2020-08-04 11:51:35 +02:00
John Whittington
0c36c3489e Merge branch 'master' of https://github.com/sudar/Arduino-Makefile 2020-06-04 17:50:33 +02:00
Osamu Aoki
ce088e097d Use $(ARDMK_DIR) for 1.6 files
Signed-off-by: Osamu Aoki <osamu@debian.org>
2020-04-13 00:47:06 +09:00
Osamu Aoki
9357f7d3ab Use $(ARDMK_DIR)
Signed-off-by: Osamu Aoki <osamu@debian.org>
2020-04-13 00:28:41 +09:00
Sudar Muthu
6f786a96b0
Merge pull request from ladislas/fix-monitor_baudrate-typo
Fix monitor baudrate typo for user config
2020-03-21 19:48:11 +05:30
Ladislas de Toldi
95d99dd3cc
fix monitor baudrate typo for user config 2020-03-21 13:47:48 +01:00
John Whittington
e6574e3c72 switch compliler flags to prevent AR fail on ARM 2020-02-24 09:58:20 +01:00
John Whittington
93b251a4e1 Merge branch 'master' of https://github.com/sudar/Arduino-Makefile into HEAD 2020-02-24 09:57:13 +01:00
Simon John
e870443f48
Merge pull request from TaylorZowtuk/master
Fixed syntax error of make monitor on windows/cygwin
2019-08-25 15:18:09 +01:00
Dan Frumin
d0f192e983 Rename CTAGS_CMD to CTAGS_EXEC.
The former is not actually tweakable.
2019-07-31 19:42:56 +02:00
Taylor Zowtuk
fa2146080c Updated changelog 2019-07-19 11:11:58 -06:00
Taylor Zowtuk
54c941fa88 Syntax fix and documentation of MONITOR_PARAMS 2019-07-19 11:00:25 -06:00
John Whittington
62caf00a15 Add new *_VER variables to documentation 2019-07-18 11:10:42 +02:00
John Whittington
e3b46003d3 Merge branch 'upstream' into HEAD 2019-07-17 10:25:21 +02:00
John Whittington
bdeaf1576b ARM_TOOL_PATH detection, use latest version of tool if multiple found 2019-07-17 10:19:03 +02:00
Simon John
0e462fcff1
Merge pull request from szeder/build-api
Build the ArduinoCore API (fixes issue )
2019-07-05 07:03:50 +01:00
SZEDER Gábor
d4ae799795 Build the ArduinoCore API
As part of the big modularizing efforts of the Arduino project they
split out the hardware-independent layer of the Arduino "language"
from the hardware-specific cores into the dedicated 'ArduinoCore-API'
repository.  As described in 'ArduinoCore-API's README, the API source
files won't reside directly in the directory of the standard Arduino
core, i.e. in 'ARDUINO_CORE_PATH', but in its 'ARDUINO_CORE_PATH/api'
subdirectory.  Consequently, Arduino-Makefile won't be able to build
any projects when using an Arduino core following the new directory
structure.

Prepare for the upcoming new Arduino core directory structure by
building all 'ARDUINO_CORE_PATH/api/*.cpp' source files as well.  Out
of caution, look out for and build any .c source files in that
directory, too: though there are no .c source files in the
'ArduinoCore-API' repository at the moment, in the future there might
be.  Furthermore, add this directory to the list of directories to be
searched for header files: though it's not necessary to explicitly and
directly include any header file from this directory ('Arduino.h'
includes all there is), some projects might nonetheless do so, and
their build would then break.

Note that a 'make clean' will be most likely necessary when
re-building a project after switching to the new directory structure.
2019-07-04 22:19:18 +02:00
Sudar Muthu
95cae69d7c
Merge pull request from mumme74/master
Allow custom link script (Teensy)
2019-07-03 09:06:19 +05:30
Fredrik Johansson
19d5aafd10 Allow custom link script 2019-07-02 19:02:57 +02:00
Sudar Muthu
3f1ef10d40
Merge pull request from SearchAThing-forks/master
allow to enable AVRDUDE_AUTOERASE_FLASH
2019-06-19 09:05:02 +05:30
Simon John
cf5d016746
Merge pull request from szeder/quiet-0
Show the configuration when ARDUINO_QUIET=0
2019-06-12 20:28:02 +01:00
SZEDER Gábor
dafdaafabd Show the configuration when ARDUINO_QUIET=0
There is a bit of inconsistency between documentation and code
regarding the ARDUINO_QUIET variable: 'arduino-mk-vars.md' states
that ARDUINO_QUIET "Defaults to `0` (unset/disabled)", but the code
only checks whether it's defined or not, and doesn't check whether
it's set to '0' or something else.

Consequently, having 'ARDUINO_QUIET=0' in the Makefile or running
'make ARDUINO_QUIET=0' contadicts the documentation and doesn't print
the configuration.  It also means that if someone in general prefers
not to see a screenful of configuration on each build and therefore
has 'ARDUINO_QUIET = 1' in the project's Makefile or 'config.mak',
then there is no way to override it from the command line in the odd
case when showing the configuration is desired.

Modify the corresponding condition in Arduino.mk to check whether
ARDUINO_QUIET is set to 0 and treat an undefined ARDUINO_QUIET
variable as "set to 0" as well.
2019-06-12 17:15:27 +02:00
Sudar Muthu
3817dbeb28
Merge pull request from stv0g/fix-issue-601
Fix regression: PARSE_BOARD chops off flags which contain '=' signs
2019-06-03 11:52:05 +05:30
Steffen Vogel
6cf275f0e7 fix regression: PARSE_BOARD chops off flags which contain '=' signs (closes ) 2019-05-03 20:07:13 +02:00
Sudar Muthu
8c85ca7001
Merge pull request from Dukejung/master
Add OpenCR.mk for OpenCR 1.0 board example sketch
2019-04-20 14:37:12 +05:30
Simon John
4e465c693c
Update HISTORY.md 2019-04-01 10:30:33 +01:00
Simon John
f5893dc7a1
Merge pull request from tuna-f1sh/master
add swtich for ARM 'avr-size' so that .elf is passed as arg
2019-04-01 10:26:33 +01:00
John Whittington
9783e68bc8 add swtich for ARM 'avr-size' so that .elf is passed as arg
`avr-size` was defaulting to AVR non-aware when using ARM builds, which
meant passing .hex rather than .elf to size and limiting size readout.
Adding a switch for defining `avr-size` and SIZEFLAGS to Sam.mk seems
like the best way to include proper ARM support (despite conflicting
naming).
2019-03-25 13:36:03 +00:00
Simon John
591855b890
Merge pull request from HorkusBoy/samd-typo-pr
Fixed typo in variable name BOARDS_TXT in Sam.mk
2019-03-02 23:38:21 +00:00
Ben B
d2d7d4ec16 Fixed typo in var name BOARDS_TXT in Sam.mk 2019-03-02 10:01:25 -06:00
Dukejung
12c62dd200
Update runtests.sh 2019-02-11 18:04:09 +09:00
Dukejung
c9d9c9f34d
Update HISTORY.md 2019-02-11 17:50:05 +09:00
Dukejung
17a69524ee Add OpenCR.mk for OpenCR 1.0 board and add example code(example/BlinkOpenCR) 2019-02-11 16:54:35 +09:00
Simon John
4452f7790a
Merge pull request from tuna-f1sh/master
Fix  and sam flag for ardmk-init
2019-01-11 19:55:14 +00:00
John Whittington
e3a99fdf4e Only add USB_PRODUCT and USB_MANUFACTURER to flags if defined 2019-01-11 13:49:40 +00:00
John Whittington
8a313c5d94 Populate USB_PRODUCT and USB_MANUFACTURER if in boards file using Caterina 2019-01-11 11:17:16 +00:00
John Whittington
e88f7e1a9f Add 'sam' flag to ardmk-init to include Sam.mk rather than Arduino.mk 2018-12-24 09:24:14 +00:00
Simon John
fd24677719
Updated history
Added ArchLinux documentation uplift
2018-11-27 15:45:59 +00:00
Simon John
2938a0f5b4
Merge pull request from Akram-Chehaima/master
Change & add repo to install package on Arch linux
2018-11-27 14:18:37 +00:00
Akram Chehaima
ccd3a5289c
Change & add repo to install package onArch linux
yaourt is "Discontinued" it's not save must use alternatives like yay On Arch Linux
add commands to install python-pyserial on Arch Linux
2018-11-27 13:59:12 +01:00
Simon John
d3be28b500
Merge pull request from dewhisna/cpu_speed_select
Add support for BOARD_CLOCK setting
2018-11-17 18:59:48 +00:00
Donna Whisnant
35fece8b9c Change BOARD_SPEED to BOARD_CLOCK setting and extend to menu.clock and menu.speed.
This is needed to specify CPU speed and fuses for boards.txt files that use this format:
"{board_tag}.menu.clock.{board_clock}.build.f_cpu"
"{board_tag}.menu.clock.{board_clock}.bootloader.low_fuses"
"{board_tag}.menu.clock.{board_clock}.bootloader.high_fuses"
"{board_tag}.menu.clock.{board_clock}.bootloader.extended_fuses"
For example ATtiny processors.

It also works for speed-only settings like the Watterott ATmega328PB library: https://github.com/watterott/ATmega328PB-Testing
"{board_tag}.menu.speed.{board_clock}.build.f_cpu"
2018-11-11 17:14:11 -06:00
Donna Whisnant
66e0211878 Update documentation for BOARD_SPEED. 2018-11-11 13:27:11 -06:00
Donna Whisnant
0f02622467 Add support for BOARD_SPEED setting.
This is needed to specify CPU speed for boards.txt files that use this format:
"{board_tag}.menu.speed.{board_speed}.build.f_cpu"
For example, the Watterott ATmega328PB library: https://github.com/watterott/ATmega328PB-Testing
2018-11-11 13:01:52 -06:00
Lorenzo Delana
ec1947a7cd allow to enable AVRDUDE_AUTOERASE_FLASH 2018-10-13 02:28:32 +02:00
Lorenzo Delana
b351ab375d
Update arduino-mk-vars.md 2018-10-13 02:21:47 +02:00
Sudar Muthu
5a0c80bf0c
Merge pull request from wingunder/move_core_link_last
Moved CORE_LIB to the last position of the defined linked objects.
2018-10-07 11:19:56 +05:30
Pieter du Preez
ed608ce658 Merge remote-tracking branch 'origin/fix-travis-sudo-required' into move_core_link_last 2018-10-03 21:19:16 +02:00
Pieter du Preez
50e883b640
Fix "does not allow use of 'sudo'" error in travis
Pull requests seem to fail with the following error:
> This job is running on container-based infrastructure, which does not allow use of 'sudo', setuid, and setgid executables.
> If you require sudo, add 'sudo: required' to your .travis.yml

This commit fixes it, by adding 'sudo: required' to .travis.yml, as suggested by the error message.
2018-10-03 14:36:49 +02:00
Pieter du Preez
a285810cb5 Added a test case for moving CORE_LIB in PR .
This patch is meant to test the link order, if the OTHER_OBJS
variable gets used to add 3rd party archives, that depend on the
Arduino core lib (the archive pointed to by the CORE_LIB variable).

The examples/Blink3rdPartyLib directory contains a stripped down Blink
and includes a library in the examples/Blink3rdPartyLib/Toggle
sub-directory. The archive, built inside the Toggle directory mimics a
3rd party library. The archive gets built and linked in by using the
OTHER_OBS variable in examples/Blink3rdPartyLib/Makefile.
2018-10-02 23:00:14 +02:00
Pieter du Preez
d4d3d3d6c3 Merge remote-tracking branch 'org/master' into move_core_link_last 2018-10-02 22:53:12 +02:00
Sudar Muthu
fe84c59194
Merge pull request from wingunder/master
Moved the PARSE_BOARD macro and added the TOOL_PREFIX variable for setting up tool chains.
2018-09-30 20:13:29 +05:30
Sudar Muthu
089b535601
Merge pull request from tuna-f1sh/master
Pass OpenOCD options to debug_init target
2018-09-30 20:12:49 +05:30
Pieter du Preez
ddf7210407 Moved CORE_LIB to the last position of the defined linked objects.
The linking order was changed from:
   $(LOCAL_OBJS) $(CORE_LIB) $(OTHER_OBJS) $(OTHER_LIBS)
to:
   $(LOCAL_OBJS) $(OTHER_OBJS) $(OTHER_LIBS) $(CORE_LIB)

This makes more sense, as OTHER_OBJS would rather depend on CORE_LIB,
than the other way around.

Apart from libc and libm, CORE_LIB should conceptually _always_ be
the last lib in the link list, as it is the core (base of everything).
BTW, this was implemented correctly for the 'sam' architecture.
2018-09-30 00:27:18 +02:00
John Whittington
0692c13e98 Pass OpenOCD options to debug_init target 2018-09-28 18:25:56 +01:00
Pieter du Preez
62d23d66a2 Moved the BOARDS_TXT section and stop if BOARDS_TXT is not a file.
The section of Arduino.mk that calculates BOARDS_TXT was moved to just
before the point where it gets used for the first time (a call to
PARSE_BOARD). An error gets generated if BOARDS_TXT is not pointing to a
valid file, directly after the BOARDS_TXT calculation.

In addition, the PARSE_BOARD macro will now be bypassed if the
BOARDS_TXT variable points to a non-existing file. If a user makefile
uses PARSE_BOARD before including Arduino.mk, and the BOARDS_TXT is
wrong, the error will only be caught in the Arduino.mk file, which is
probably acceptable.
2018-09-15 14:31:39 +02:00
Pieter du Preez
e44540043e Added the TOOL_PREFIX variable for setting up the executable tools.
Currently three different tool chains seem to be used:
   * avr-*
   * pic32-*
   * arm-none-eabi-*

These all get set up independently. This patch centralizes the
definitions of the executable tools and does it generically, by means
of the newly introduced TOOL_PREFIX variable. Setting up a
tool chain is now simply a matter of defining the TOOL_PREFIX
variable. For the currently supported tool chains it gets set to avr,
pic32 or arm-none-eabi. Arbitrary tool chains can now easily be set up,
by the TOOL_PREFIX variable.

Although the use of the OVERRIDE_EXECUTABLES variable is now almost
not justifiable, it was left as-is, in order to assure backwards
compatibility.
2018-09-14 16:14:14 +02:00
Pieter du Preez
2442dafb4f Moved the PARSE_BOARD macro from Arduino.mk to Common.mk.
There seems to be 3 different macros to parse the boards.txt file.
This patch moves the PARSE_BOARD macro from Arduino.mk to Common.mk.
The PARSE_OPENCM and PARSE_TEENSY macros in Teensy.mk and OpenCM.mk
were removed and the common PARSE_BOARD is now being called from
everywhere.

Advantages of this fix are:
  1. Less code, i.e. no redundant parse macros.
  2. A single standardized algorithm to parse the boards.txt file.
2018-09-13 23:44:12 +02:00
Simon John
22ca63614d
Merge pull request from TE-HiroakiYamazoe/fix_typo_of_avrdude_isp_opt
Fix typo of AVRDUDE_ISP_OPT
2018-08-10 19:41:18 +01:00
Hiroaki Yamazoe
300ec05328 Fix typo of AVRDUDE_ISP_OPT 2018-08-09 18:48:50 +09:00
Sudar Muthu
b2d1ff23a2
Merge pull request from tuna-f1sh/due
Support for Arduino Due added
2018-06-22 09:45:03 +05:30
John Whittington
3f32563683 Support for Arduino Due added
Update HISTORY.md

Add avr core emulation to C sources
2018-06-14 07:29:06 +01:00
Sudar Muthu
0809b54606
Merge pull request from wingunder/master
Added the DIAGNOSTICS_COLOR_WHEN var for controlling diagnostics-color.
2018-03-18 22:36:23 +05:30
Pieter du Preez
36b6b233eb Added the DIAGNOSTICS_COLOR_WHEN var for controlling diagnostics-color.
Some IDEs do not work nicely with the recently added diagnostics-color
compiler switch. This patch adds the DIAGNOSTICS_COLOR_WHEN variable,
for controlling diagnostics-color switch. The default was chosen to be
'always', which makes the Arduino.mk file backwards compatible with
everything up to commit fa82c3a9db (Sat Sep 2 15:32:52 2017 +0100).

The supported values for DIAGNOSTICS_COLOR_WHEN are: `always`, `never`
and `auto`, and as with all Arduino.mk variables, it can easily be
overridden. For more details on the diagnostics-color compiler switch,
see: https://gcc.gnu.org/onlinedocs/gcc-4.9.2/gcc/Language-Independent-Options.html#Language-Independent-Options
2018-03-18 16:54:39 +01:00
Simon John
a7b8084ac6
Merge pull request from kierdavis/disable-prog-types-compat
Allow compatibility with old pgmspace API to be disabled by the user
2018-02-24 16:06:09 +00:00
Simon John
139b5dbc49
Merge branch 'master' into disable-prog-types-compat 2018-02-24 16:03:37 +00:00
Simon John
c10eaa4f48
Merge pull request from doronbehar/detect-archlinux
Set `ARDMK_VENDOR` differently if OS is Arch Linux.
2018-02-24 16:02:18 +00:00
Simon John
80b8167206
Merge pull request from tuna-f1sh/sam
Arduino Atmel SAM family Support (ARM architecture)

Thanks @tuna-f1sh !
2018-02-24 16:01:00 +00:00
John Whittington
f804866095 SAMD Cortex M0 device support (Zero, MKR1000, etc)
Compilation improvements by adding variant as other obj but not working on device

Arduino Zero devices with OpenOCD working

Created ARM_TOOLS_DIR and define arm toolchain executables in Sam.mk

Check avr-gcc on last AVR_TOOLS_DIR detect and indenting formatting

GDB debugging and programming added

Documentation updates and define ARDMK_VENDOR rather than include Sam.mk

Expand all parse_boards when defined rather than when used

Trim extra defines regex working on both macOS and Linux but need better fix

Print USB ids and added debug usage to readme

Add note on Arduino package dir and made board.txt work

Do ARM ARDUINO_ARCH define in Arduino.mk]

Add MZeroBlink to non-testable examples for now

Remove \B from extra defines grep

Add ARDUINO_PACKAGE_DIR for board support files

Fix a typo in the README

Fix typo in arduino-mk-vars.md

Prevent re-including Arduino.mk from Sam.mk when make restarts for upload

Add catrina to ARD_REST_OPTS if/else

Remove realpath in Sam.mk for cygwin compatability

SAMD bootloader support in ard-reset using --zero

Enters bootloader using open/close of port at 1200 BAUD, then polls the
attached devices for new port enumerating (bootloader). This is how the
Arduino IDE operates

Bossa support for Zero, MKR1000 etc

Re-word Arm README section after Native USB development

Reset for zero refactored like IDE

Zero bootloader reset tested on macOS and comments added

Re-word ARM bootloader and remove imports from testing

Patch changes ARDMK_VENDOR->ARCHITECHTURE, show_config_vars, ignore CORE_VER if emtpy

Common.mk header guard, openocd/bossac avoid separator, typos

Documentation update for patch changes

Move ARM tools to Sam.mk and auto-detect include

Correct accidental commit of Blink Makefile change

Lib fix with alternative core and documentation

Append zero to ARD_RESET_OPTS rather than set

Prioritise package ARM upload tools over path installed

Add note in README on ARM tools versions

Move openocd variant config script flag to OPTS
2018-02-24 11:15:53 +00:00
Sudar Muthu
8480373477
Merge pull request from kierdavis/fix-typo
Fix typo in arduino-mk-vars.md
2018-01-25 09:38:47 +05:30
Kier Davis
b4c381c4b7
Fix typo in arduino-mk-vars.md 2018-01-24 22:12:01 +00:00
Kier Davis
b3c5127be2
Allow compatibility with old pgmspace API to be disabled by the user
When this compatibility mode is enabled, code that is entirely
compliant with the new pgmspace API can still raise deprecation
warnings when symbols present in both the old and new APIs (for
example, PGM_P) are used. Clearly, these warnings are false
positives. They can be avoided by disabling the compatibility mode.

This functionality is achieved by prepending the flag that enables
the compatibility mode to CPPFLAGS instead of appending it, thus
allowing the user to override the default behaviour and disable the
compatibility mode by putting the negation of the flag in the
CPPFLAGS variable in their top-level Makefile.
2018-01-24 21:52:22 +00:00
Sudar Muthu
5869c98344
Merge pull request from kierdavis/fix-readme-typo
Fix a typo in the README
2018-01-22 15:00:28 +05:30
Kier Davis
5229b075cb
Fix a typo in the README 2018-01-21 23:06:05 +00:00
Simon John
74e1ef00fd
Merge pull request from tuna-f1sh/master
ardmk-init - Makefile initialisation and template project utility
2018-01-12 19:27:14 +00:00
John Whittington
a6d979ef90 Merge remote-tracking branch 'upstream/master' 2018-01-03 08:14:39 +00:00
Simon John
c3fe5dcc2f
Merge pull request from sej7278/master
Moved ATtiny examples from Blink to ATtinyBlink

Probably the last merge of 2017? ;-)
2017-12-28 18:05:18 +00:00
Simon John
6d3d973cd4 Moved ATtiny examples from Blink to ATtinyBlink and updated the instructions (issue ).
Updated the alternate core instructions for e.g. ATmega644p for IDE 1.8
2017-12-28 17:55:01 +00:00
Simon John
7a26a86c78
Merge pull request from sej7278/master
Moved -e flag for avrdude from set_fuses to ispload
2017-12-22 14:13:23 +00:00
Simon John
246e568011 Moved -e flag for avrdude from set_fuses to ispload as you wouldn't want a chip erase operation when only setting the fuses.
ispload probably should erase the flash+eeprom+lockbits as that's when you upload the sketch.

setting fuses should be just that, not deleting anything.
2017-12-22 10:14:06 +00:00
John Whittington
d874c59103 ardmk-init runs without prompt by default, cli arg added to avoid clint dependency 2017-11-07 16:54:34 +00:00
John Whittington
78d11c6678 Update Fedora spec file 2017-10-13 15:41:56 +01:00
John Whittington
625861009a Merge remote-tracking branch 'upstream/master' 2017-10-12 10:41:56 +01:00
John Whittington
2a4c2660be Run ardmk-init without dependancy if running quiet 2017-10-12 09:25:56 +01:00
John Whittington
55c149fb03 Add ardmk-init manpage and correct typos 2017-10-06 10:32:17 +01:00
Doron Behar
c18ad9fba5 Set ARDMK_VENDOR differently if OS is Arch Linux. 2017-10-06 11:35:47 +03:00
SZEDER Gábor
b8f5eaa816 Recognize serial monitors with full path in MONITOR_CMD
When assembling the command line for the various supported serial
monitors, MONITOR_CMD must match the name of one of the supported
commands to be recognized.  Serial monitors given with leading path
components are not recognized, and a command like

  make MONITOR_CMD=~/src/picocom/picocom monitor

errors out as the fallback monitor command is executed instead of the
picocom-specific one.  However, sometimes it's necessary to specify a
supported serial monitor with its full path, because e.g. the user
wants to tests a freshly compiled version before installing it.  Sure,
the user could just run the serial monitor directly, but that's
cumbersome because he has to pay attention to use the right baud rate
and USB port.

So strip all leading path components, if present, from MONITOR_CMD
using the 'nondir' make function before checking whether it's one of
the supported serial monitors.  This way commands like the above would
just work.

While at it, remove the single quotes around 'putty': they are both
unnecessary and inconsistent with similar constructs throughout
Arduino.mk.
2017-10-03 12:54:13 +01:00
John Whittington
c2d17c825a ardmk-init linted using pylint 2017-10-02 15:26:02 +01:00
Sudar Muthu
bc5092f25b Merge pull request from szeder/monitor-cmd-with-path
Recognize serial monitors with full path in MONITOR_CMD
2017-09-29 09:59:16 +05:30
John Whittington
a165a3bf26 ardmk-init usage added to README and HISTORY update 2017-09-28 13:51:08 +01:00
John Whittington
f3bb8249c1 ardmk-init arg parse options and made V1.0 2017-09-28 13:51:04 +01:00
John Whittington
8819e761fb WIP: ardmk-init more verbose about directory operating in 2017-09-28 13:50:51 +01:00
John Whittington
91604be7cc WIP: CLI project makefile generator 2017-09-28 13:45:27 +01:00
John Whittington
5245606f64 Add support for ISP_PROG Atmel Ice 2017-09-28 13:42:49 +01:00
John Whittington
1882a8024e Fix:Add to langmap not set ino,pde using ctags 2017-09-28 13:42:49 +01:00
SZEDER Gábor
c49af21700 Recognize serial monitors with full path in MONITOR_CMD
When assembling the command line for the various supported serial
monitors, MONITOR_CMD must match the name of one of the supported
commands to be recognized.  Serial monitors given with leading path
components are not recognized, and a command like

  make MONITOR_CMD=~/src/picocom/picocom monitor

errors out as the fallback monitor command is executed instead of the
picocom-specific one.  However, sometimes it's necessary to specify a
supported serial monitor with its full path, because e.g. the user
wants to tests a freshly compiled version before installing it.  Sure,
the user could just run the serial monitor directly, but that's
cumbersome because he has to pay attention to use the right baud rate
and USB port.

So strip all leading path components, if present, from MONITOR_CMD
using the 'nondir' make function before checking whether it's one of
the supported serial monitors.  This way commands like the above would
just work.

While at it, remove the single quotes around 'putty': they are both
unnecessary and inconsistent with similar constructs throughout
Arduino.mk.
2017-09-27 00:14:57 +02:00
Sudar Muthu
9708e8265d Merge pull request from tuna-f1sh/master
Update Windows documentation to allow non-relative paths
2017-09-10 18:48:55 -04:00
John Whittington
770d3a7080 Fix indenting 2017-09-06 09:48:04 +00:00
John Whittington
42b5d2dbd8 Auto detect Windows sketchbook path using USERPROFILE not HOME and spelling 2017-09-06 10:34:07 +01:00
John Whittington
e413feedbb Update HISTORY.md 2017-09-05 17:39:42 +01:00
John Whittington
11e2059009 Documentation changes for Windows usage 2017-09-05 17:12:22 +01:00
John Whittington
4519be5bac Detect Cygwin Python or user installed Windows Python and use according device port 2017-09-05 14:18:03 +01:00
Sudar Muthu
360db6f27c Merge pull request from tuna-f1sh/master
Support for generation of project tags file
2017-09-04 22:21:56 -04:00
John Whittington
73426bc233 Merge branch 'master' of https://github.com/sudar/Arduino-Makefile 2017-09-03 21:37:03 +01:00
Simon John
983db51764 Merge pull request from sej7278/master
Moved the LTO etc. flags from CXXFLAGS_STD to CXXFLAGS
2017-09-03 16:02:21 +01:00
John Whittington
04f0ee0728 rm old tags file made safer and only if it exists 2017-09-03 13:19:36 +01:00
John Whittington
85db740a1c Ido/ino typo in echo when building tags 2017-09-03 08:52:44 +01:00
Simon John
fa82c3a9db Moved the LTO etc. flags from CXXFLAGS_STD to CXXFLAGS 2017-09-02 15:32:52 +01:00
John Whittington
4c4c9ac2f0 Merge with upstream 2017-09-01 12:42:45 +00:00
John Whittington
62f2d70815 Use LOCAL_SRC variable due to proir assert and only scan libs if there are libs 2017-09-01 12:33:48 +00:00
Simon John
5fcd04cdef Merge pull request from szeder/quote-prefix-tag
Quote the prefix tag in the space_pad_to function
2017-08-11 09:27:10 +01:00
SZEDER Gábor
a80518e308 Quote the prefix tag in the space_pad_to function
POSIX shells treat an unquoted [abcd] as a pattern bracket expression
and apply it for filename expansion.  This kicks in and causes
troubles in the space_pad_to function when it's called to pad prefix
tags like '[AUTODETECT]', because the argument holding such a tag is
passed to a shell unquoted.  The result is funny output when the
directory containing the Makefile also contains any files or
directories, whose name is a single upper-case character that can be
found in any prefix tags:

  $ touch A B C D
  $ make
  -------------------------
  Arduino.mk Configuration:
  - A C D                CURRENT_OS = LINUX
  - [USER]               ARDUINO_DIR = /home/szeder/src/arduino/arduino-1.8.1
  - [USER]               ARDMK_DIR = /home/szeder/src/arduino/Arduino-Makefile
  - A C D                ARDUINO_VERSION = 181
  - A D                  ARCHITECTURE = avr
  - A D                  ARDMK_VENDOR = arduino
  - A D                  ARDUINO_SKETCHBOOK =
  <snip>

Prevent this by quoting space_pad_to's parameter when passing it to a
shell.
2017-08-08 23:41:28 +02:00
Simon John
c116e48418 Merge pull request from sej7278/master
Add -fno-devirtualize to CXXFLAGS_STD
2017-07-25 06:13:48 +01:00
Simon John
d1156e8fdf Add -fno-devirtualize to CXXFLAGS_STD to workaround a g++ bug. As this could impact performance we should track when the issue is fixed upstream to remove the flag again (see links from Issue )
Enabled colourised diagnostics from avr-gcc

We forgot to increase ARDMK_VERSION for the 1.6.0 release
2017-07-21 21:26:11 +01:00
Sudar Muthu
d738cac966 Merge pull request from fuzzyTew/robotis-opencm
Add makefile for Robotis OpenCM
2017-07-16 17:48:42 +05:30
Karl Semich
5bcb64ade9 Add makefile for Robotis OpenCM & update version to 1.6.0 2017-07-12 23:55:05 +00:00
John Whittington
81673d4666 Support for generation of project tags file
Considering the number of project files spread in different locations
when developing an Arduino project, proper use of tags can be difficult;
resolving beyond local functions.

I've added automatic generation of a tags file, which includes:

* Standard ctags source in project dir (.c, .cpp, .h)
* Arduino source in project dir (.ide, .pde)
* Arduino core based on detected project core from Arduino install.
* Included Arduino libraries from user library folder.

As a Vim user I find this hugely useful and think it would be a useful
addtion for others. Target has been added as `make tags`.
2017-06-04 10:47:04 +01:00
Simon John
ba96840399 Merge pull request from MilanV/master
Document how to setup Makefile for 3rd party boards
2017-06-02 10:38:16 +01:00
Milan Vancura
1b5494f262 Fix paths in the example Makefile 2017-06-02 09:54:35 +02:00
Milan Vancura
60d7e9401e Document how to setup Makefile for 3rd party boards 2017-06-02 00:37:03 +02:00
Simon John
c41763851b Merge pull request from sej7278/master
Fix autodetection of USB_PID on SparkFun's new ProMicro core

Remove use of tilde from documentation
2017-06-01 21:33:52 +01:00
Simon John
d1363592f2 Fix autodetection of USB_PID on SparkFun's new ProMicro core
Remove use of tilde in documentation as ~ doesn't work, use $(HOME) instead
2017-06-01 19:22:28 +01:00
Simon John
807cf65f71 Merge pull request from sej7278/master
Add support for cu as MONITOR_CMD
2017-04-01 23:16:06 +01:00
Simon John
18c6474d50 Add support for cu as MONITOR_CMD, use ~. to exit, be mindful when using over ssh 2017-04-01 23:06:28 +01:00
Simon John
6bffcd3383 Update HISTORY.md 2017-03-13 15:38:26 +00:00
Simon John
a4e77e4692 Merge pull request from cbosdo/show_submenu-fix
show_submenu: fix sed expression
2017-03-13 15:34:51 +00:00
Cédric Bosdonnat
928a642265 show_submenu: fix sed expression
The matching parentheses and | in sed expresssions need to be escaped
or sed will consider like normal characters.

Without this fix, make show_submenu was showing lines like this one:

  pro.menu.cpu.8MHzatmega328    ATmega328 (3.3V, 8 MHz)

It now properly outputs lines like this:

  pro        8MHzatmega328   ATmega328 (3.3V, 8 MHz)

This output is much less misleading to users especially newcomers.
2017-03-13 14:38:52 +01:00
Simon John
9f2cec3204 Update HISTORY.md 2017-03-12 22:05:23 +00:00
Simon John
ed58b61983 Merge pull request from ericdand/patch-1
Correct spelling mistake in PuTTY section

Thanks @ericdand
2017-03-12 22:02:57 +00:00
Eric Dand
2674885bf0 Correct spelling mistake in PuTTY section
MONITOR_PARMS should be MONITOR_PARAMS.
2017-03-12 14:30:29 -07:00
Simon John
08b4f441ff Update HISTORY.md 2017-02-12 18:13:50 +00:00
Simon John
24cbf1b2a3 Merge pull request from DaWelter/master
Auto-detect F_CPU for Teensy boards

Thanks for the PR @DaWelter 

i'll update HISTORY.md @sudar
2017-02-12 18:11:42 +00:00
Michael Welter
c6012a4be5 Autodetect the fastest speed with which various Teensy boards can run. Alternatively, set the speed in MHz via BOARD_SUB. 2017-02-12 11:22:36 +01:00
Sudar Muthu
12522f3726 Merge pull request from Batchyx/master
Fix generate_assembly for cpp files.
2017-01-24 09:50:25 +05:30
batchy
697c95e26f Arduino.mk: Fix generating assembly for cpp files.
Do not include the Arduino header when generating assembly for .cpp
files with generate_assembly.  This was likely a copy-paste error.
2017-01-21 12:32:25 +01:00
batchy
e126d37f9b History.md: Re-add "In Development" section. 2017-01-21 12:32:25 +01:00
Sudar Muthu
7a14d670eb Bump up version to 1.5.2 for release 2017-01-11 16:48:33 +05:30
Sudar Muthu
03e62130f3 Merge pull request from wilywampa/master
Fix parsing of Teensy options with multiple "="s
2016-11-13 08:49:42 +05:30
Jacob Niehus
9533e7a392 Fix parsing of Teensy options with multiple "="s 2016-11-12 14:56:48 -07:00
Sudar Muthu
2c1155e156 Merge pull request from georgeharker/master
Update to work with Arduino 1.6.12 and Teensyduino 1.30
2016-11-09 07:27:07 +05:30
George Harker
7d564b6a26 fix incorrect variable ref 2016-11-05 12:19:15 -07:00
George Harker
0b1aa8d26a hard code ARCHITECTURE if not found in boards.txt, update history 2016-11-05 12:10:15 -07:00
George Harker
3830299491 add comment on additional vars 2016-11-04 15:32:57 -07:00
George Harker
bcf664079c fix mcu 2016-11-04 11:37:10 -07:00
George Harker
0c55418057 fix platform dir 2016-11-04 11:28:18 -07:00
George Harker
1d7773938c make it work with modern arduino and teensyduino scripts 2016-11-04 11:21:02 -07:00
Simon John
23556d759c Merge pull request from sej7278/master
Changed the PARSE_BOARD function to handle colons
2016-10-12 00:11:49 +01:00
Simon John
a6a9928859 Changed the PARSE_BOARD function to handle colons found in things like build.core and
build.variant

Fixes Issue 
2016-10-11 19:59:35 +01:00
Simon John
299c1831cc Merge pull request from sej7278/master
Changed LTO support check to avr-gcc > 4.9.0
2016-10-11 15:35:35 +01:00
Simon John
fe020380b6 Changed LTO support check to avr-gcc > 4.9.0 as the 4.8.1 bundled with the IDE prior to 1.6.10
doesn't support LTO or plugins. Fixes Issue 

So essentially LTO support will only be enabled with avr-gcc 4.9.2 which comes with 1.6.10 or later
and Debian, Ubuntu etc; not 4.8.1 which comes with IDE 1.6.9 and a few earlier versions.

Tested with:

 * 1.6.8 (avr-gcc 4.8.1 which doesn't support LTO so uses avr-ar and doesn't set LTO flags)
 * 1.6.12 (avr-gcc 4.9.2 which supports LTO so uses avr-gcc-ar and sets LTO flags)
 * 1.0.5 with Debian avr-gcc 4.9.2 (supports LTO so uses avr-gcc-ar and sets LTO flags)
2016-10-11 15:23:36 +01:00
Simon John
f3f7684463 Merge pull request from sej7278/master
Updated changelog
2016-09-08 18:34:34 +01:00
Simon John
c426e07fe2 Updated changelog 2016-09-08 18:31:52 +01:00
Sudar Muthu
fd76029b9a Merge pull request from sej7278/master
Added LTO flags etc. to provide smaller/faster AVR code.
2016-09-08 21:39:53 +05:30
Simon John
0b9ba23520 Updated docs regarding CXXFLAGS etc. for LTO support 2016-09-08 15:48:04 +01:00
Simon John
ab261ddd6e Added LTO flags etc. to provide smaller/faster AVR code.
Works with 1.6.10 or later; or 1.0.x with avr-gcc toolchain 4.8+
2016-09-08 14:49:36 +01:00
Sudar Muthu
7c28446e5e Merge pull request from sovcik/master
PySerial installation for Windows updated
2016-08-25 22:32:16 +05:30
Jozef Sovcik
2dd7c567c0 PySerial installation for Windows updated () 2016-08-25 18:36:01 +02:00
Sudar Muthu
0ec1489414 Merge pull request from sej7278/master
Fix for 1.6.10 version detection
2016-07-29 20:48:27 +05:30
Simon John
737a3f14cd Fix for 1.6.10 version detection
Updated HISTORY.md with latest commits
2016-07-29 16:13:36 +01:00
Sudar Muthu
5a83288e6a Merge pull request from straccio/master
Search in submenu chip or cpu for vars
2016-07-25 19:45:11 +05:30
Sudar Muthu
b971b05929 Merge pull request from sej7278/master
Change CXXFLAGS_STD to match upstream
2016-07-25 19:42:23 +05:30
Simon John
e4b30603d8 Added -std=gnu++11 -fno-threadsafe-statics to CXXFLAGS_STD if we're using Arduino 1.6 to match
upstream (without it compilation seems to fail on OSX). Updated docs.

Also made ARDUINO_LIB_PATH overloadable (as implied by arduino-mk-vars.md) although this is a
pretty niche use-case.
2016-07-25 13:13:02 +01:00
Sudar Muthu
77431bf250 Merge branch 'az-z-master' 2016-07-02 08:08:32 +05:30
az-z
77d1d9c4ea Update README
Updated to reflect the Linux changes for Arduino 1.6.5
Updated to reflect the information (Linux portion) from the guide. Removed the URL to the blog.
2016-07-02 08:08:11 +05:30
straccio
8addd6c469 Search in BOARDS_TXT for chip or cpu submenu
Using new Arduino IDE and ATTinyCore board module he need to search var
various vars not in cpu submenu but in chip. Changed the makefile in
order to search chip or cpu using regular expression.
2016-06-22 10:55:43 +02:00
straccio
6c5589bd3c Merge remote-tracking branch 'sudar/master' 2016-06-22 10:52:07 +02:00
56 changed files with 3573 additions and 474 deletions

View file

@ -1,5 +1,15 @@
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

File diff suppressed because it is too large Load diff

View file

@ -1,9 +1,19 @@
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)), \
@ -14,7 +24,7 @@ runscript_if_exists = \
# 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))
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))
@ -26,21 +36,33 @@ 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,Arduino.mk Configuration:)
$(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])
@ -51,12 +73,20 @@ $(call show_config_variable,CURRENT_OS,[AUTODETECTED])
ifneq ($(TEST),)
DEPENDENCIES_DIR = /var/tmp/Arduino-Makefile-testing-dependencies
DEPENDENCIES_MPIDE_DIR = $(DEPENDENCIES_DIR)/mpide-0023-linux64-20130817-test
DEPENDENCIES_MPIDE_DIR := $(shell find $(DEPENDENCIES_DIR) -name 'mpide-0023-*' -type d -exec ls -dt {} + | head -n 1)
ifeq ($(MPIDE_DIR),)
MPIDE_DIR = $(DEPENDENCIES_MPIDE_DIR)
endif
DEPENDENCIES_ARDUINO_DIR = $(DEPENDENCIES_DIR)/arduino-1.0.6
ifndef ARDUINO_IDE_DIR
ifeq ($(CURRENT_OS),MAC)
ARDUINO_IDE_DIR = Arduino.app/Contents/Resources/Java
else
ARDUINO_IDE_DIR := $(shell basename $(basename $(basename $(lastword $(wildcard $(DEPENDENCIES_DIR)/arduino*)))))
endif
endif
DEPENDENCIES_ARDUINO_DIR = $(DEPENDENCIES_DIR)/$(ARDUINO_IDE_DIR)
ifeq ($(ARDUINO_DIR),)
ARDUINO_DIR = $(DEPENDENCIES_ARDUINO_DIR)
endif
@ -81,7 +111,28 @@ else
endif
ifeq ($(CURRENT_OS),WINDOWS)
ifneq ($(shell echo $(ARDUINO_DIR) | egrep '^(/|[a-zA-Z]:\\)'),)
echo $(error On Windows, ARDUINO_DIR must be a relative path)
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

View file

@ -4,6 +4,63 @@ 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.
### 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)

161
OpenCM.mk Normal file
View file

@ -0,0 +1,161 @@
########################################################################
#
# 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 Normal file
View file

@ -0,0 +1,273 @@
########################################################################
#
# 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++

236
README.md
View file

@ -7,8 +7,11 @@ This is a very simple Makefile which knows how to build Arduino sketches. It def
- 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`
@ -51,10 +54,10 @@ $ 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 using the following command.
It can be installed with [AUR] helper using the following command.
```sh
yaourt -S arduino-mk
yay -S arduino-mk
```
#### Fedora
@ -80,14 +83,14 @@ installer or download the distribution zip file and extract it.
The Makefile also delegates resetting the board to a short Python program.
You'll need to install [`pySerial`](https://pypi.python.org/pypi/pyserial) to use it though.
On most systems you should be able to install it using either `pip` or `easy_install`.
On most systems you should be able to install it using either `pip3` or `easy_install3`.
```sh
pip install pyserial
pip3 install pyserial
# or if you prefer easy_install
easy_install -U pyserial
easy_install3 -U pyserial
```
If you prefer to install it as a package, then you can do that as well.
@ -95,44 +98,68 @@ If you prefer to install it as a package, then you can do that as well.
On Debian or Ubuntu:
```sh
apt-get install python-serial
apt-get install python3-serial
```
On Fedora:
```sh
yum install pyserial
# or on Fedora 22+
dnf install pyserial
dnf install python3-pyserial
```
On openSUSE:
```sh
zypper install python-serial
zypper install python3-serial
```
On Mac using MacPorts:
On Arch:
```sh
sudo port install py27-serial
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 and the following Serial library
or you can install it using the [pre-built package installer](https://pypi.python.org/pypi/pyserial)
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.
## Usage
You can also find more [detailed instructions in this guide](http://hardwarefun.com/tutorials/compiling-arduino-sketches-using-makefile).
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 checkout the sample makefiles inside the `examples/` directory, e.g. [Makefile-example](examples/MakefileExample/Makefile-example.mk) demonstrates some of the more advanced options,
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 or install it through a package.
### Mac
On the Mac with IDE 1.0 you might want to set:
@ -146,83 +173,121 @@ On the Mac with IDE 1.0 you might want to set:
On the Mac with IDE 1.5+ it's like above but with
```
```make
ARDUINO_DIR = /Applications/Arduino.app/Contents/Java
```
### Linux
On Linux (if you have installed through package), you shouldn't need to set anything other than your board type and port:
You can either declare following variables in your project's makefile or set them as environmental variables.
```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
```
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.
Example of ~/.bashrc file:
```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
```
Example of the project's make file:
```make
BOARD_TAG = mega2560
MONITOR_PORT = /dev/ttyACM0
```
On Windows (using cygwin), you might want to set:
### Windows
On Windows (using Cygwin), you might want to set:
```make
ARDUINO_DIR = ../../arduino
# 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_PARMS = 8,1,n,N
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
ARCHITECTURE = avr
BOARD_TAG = atmegang
BOARD_SUB = atmega168
```
It is recommended in Windows that you create a symbolic link to avoid problems with file naming conventions on Windows. For example, if your your Arduino directory is in:
#### Symbolic Link
c:\Program Files (x86)\Arduino
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
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=../../../../../Arduino
ARDUINO_DIR=C:/Arduino
```
Instead of:
```make
ARDUINO_DIR=../../../../../Program\ Files\ \(x86\)/Arduino
ARDUINO_DIR=C:/Program\ Files\ \(x86\)/Arduino
```
- `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. In Cygwin in Windows this path must be
relative, not absolute (e.g. "../../arduino" and not "/c/cygwin/Arduino").
- `ARDMK_DIR` - Path where the `*.mk` are present. If you installed the package, then it is usually `/usr/share/arduino`
- `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 realtive and not absolute.
### 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.
## Including Libraries
You can specify space separated list of libraries that are needed for your sketch to the variable `ARDUINO_LIBS`.
You can specify space separated list of libraries that are needed for your sketch in the variable `ARDUINO_LIBS`.
```make
ARDUINO_LIBS = Wire SoftwareSerial
```
The libraries will be searched in the following places in the following order.
The libraries will be searched for 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`.
@ -233,7 +298,7 @@ The makefile can autodetect the libraries that are included from your sketch and
## avrdude
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
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
```make
AVRDUDE = /usr/bin/avrdude
@ -246,9 +311,83 @@ For Teensy 3.x support you must first install [Teensyduino](http://www.pjrc.com/
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.5.1`. You can find the full history in the [HISTORY.md](HISTORY.md) file
The current version of the makefile is `1.6.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/).
@ -265,9 +404,8 @@ 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 / Know Issues / TODO's
## Limitations / Known Issues / TODO's
- Doesn't support SAM boards yet.
- 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.
@ -361,6 +499,20 @@ 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-ArduinoProject
If you are planning on using this makefile in a larger/professional project, you might want to take a look at the [Bare-ArduinoProject](https://github.com/WeAreLeka/Bare-Arduino-Project) framework.

463
Sam.mk Normal file
View file

@ -0,0 +1,463 @@
########################################################################
#
# 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 $* = $($*)

138
Teensy.mk
View file

@ -34,99 +34,43 @@ endif
include $(ARDMK_DIR)/Common.mk
ARDMK_VENDOR = teensy
ARDUINO_CORE_PATH = $(ARDUINO_DIR)/hardware/teensy/cores/teensy3
BOARDS_TXT = $(ARDUINO_DIR)/hardware/$(ARDMK_VENDOR)/boards.txt
ARDUINO_CORE_PATH = $(ARDUINO_DIR)/hardware/teensy/avr/cores/teensy3
BOARDS_TXT = $(ARDUINO_DIR)/hardware/$(ARDMK_VENDOR)/avr/boards.txt
ifndef F_CPU
F_CPU=96000000
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
ifndef PARSE_TEENSY
# result = $(call READ_BOARD_TXT, 'boardname', 'parameter')
PARSE_TEENSY = $(shell grep -v "^\#" "$(BOARDS_TXT)" | grep $(1).$(2) | cut -d = -f 2,3 )
# 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
ARCHITECTURE = $(call PARSE_TEENSY,$(BOARD_TAG),build.architecture)
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
ifndef CC_NAME
CC_NAME := $(call PARSE_TEENSY,$(BOARD_TAG),build.command.gcc)
ifndef CC_NAME
CC_NAME := arm-none-eabi-gcc
else
$(call show_config_variable,CC_NAME,[COMPUTED])
endif
endif
ifndef CXX_NAME
CXX_NAME := $(call PARSE_TEENSY,$(BOARD_TAG),build.command.g++)
ifndef CXX_NAME
CXX_NAME := arm-none-eabi-g++
else
$(call show_config_variable,CXX_NAME,[COMPUTED])
endif
endif
ifndef AS_NAME
AS_NAME := $(call PARSE_TEENSY,$(BOARD_TAG),build.command.as)
ifndef AS_NAME
AS_NAME := arm-none-eabi-gcc-as
else
$(call show_config_variable,AS_NAME,[COMPUTED])
endif
endif
ifndef OBJCOPY_NAME
OBJCOPY_NAME := $(call PARSE_TEENSY,$(BOARD_TAG),build.command.objcopy)
ifndef OBJCOPY_NAME
OBJCOPY_NAME := arm-none-eabi-objcopy
else
$(call show_config_variable,OBJCOPY_NAME,[COMPUTED])
endif
endif
ifndef OBJDUMP_NAME
OBJDUMP_NAME := $(call PARSE_TEENSY,$(BOARD_TAG),build.command.objdump)
ifndef OBJDUMP_NAME
OBJDUMP_NAME := arm-none-eabi-objdump
else
$(call show_config_variable,OBJDUMP_NAME,[COMPUTED])
endif
endif
ifndef AR_NAME
AR_NAME := $(call PARSE_TEENSY,$(BOARD_TAG),build.command.ar)
ifndef AR_NAME
AR_NAME := arm-none-eabi-ar
else
$(call show_config_variable,AR_NAME,[COMPUTED])
endif
endif
ifndef SIZE_NAME
SIZE_NAME := $(call PARSE_TEENSY,$(BOARD_TAG),build.command.size)
ifndef SIZE_NAME
SIZE_NAME := arm-none-eabi-size
else
$(call show_config_variable,SIZE_NAME,[COMPUTED])
endif
endif
ifndef NM_NAME
NM_NAME := $(call PARSE_TEENSY,$(BOARD_TAG),build.command.nm)
ifndef NM_NAME
NM_NAME := arm-none-eabi-gcc-nm
else
$(call show_config_variable,NM_NAME,[COMPUTED])
endif
endif
TOOL_PREFIX = arm-none-eabi
# processor stuff
ifndef MCU
MCU := $(call PARSE_TEENSY,$(BOARD_TAG),build.cpu)
MCU := $(call PARSE_BOARD,$(BOARD_TAG),build.mcu)
endif
ifndef MCU_FLAG_NAME
@ -141,22 +85,41 @@ endif
CPPFLAGS += -DLAYOUT_US_ENGLISH -D$(USB_TYPE)
CPPFLAGS += $(call PARSE_TEENSY,$(BOARD_TAG),build.option)
CPPFLAGS += $(call PARSE_BOARD,$(BOARD_TAG),build.option)
CXXFLAGS += $(call PARSE_TEENSY,$(BOARD_TAG),build.cppoption)
ifeq ("$(call PARSE_TEENSY,$(BOARD_TAG),build.gnu0x)","true")
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_TEENSY,$(BOARD_TAG),build.elide_constructors)", "true")
ifeq ("$(call PARSE_BOARD,$(BOARD_TAG),build.elide_constructors)", "true")
CXXFLAGS += -felide-constructors
endif
LDFLAGS += $(call PARSE_TEENSY,$(BOARD_TAG),build.linkoption) $(call PARSE_TEENSY,$(BOARD_TAG),build.additionalobject)
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)
ifneq ("$(call PARSE_TEENSY,$(BOARD_TAG),build.linkscript)",)
LDFLAGS += -T$(ARDUINO_CORE_PATH)/$(call PARSE_TEENSY,$(BOARD_TAG),build.linkscript)
endif
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
@ -171,3 +134,4 @@ RESET_CMD = nohup $(ARDUINO_DIR)/hardware/tools/teensy_post_compile -board=$(BOA
# automatially include Arduino.mk for the user
include $(ARDMK_DIR)/Arduino.mk

View file

@ -1,4 +1,4 @@
.TH ARD-RESET-ARDUINO "1" "February 2016" "ard-reset-arduino 1.5.1" "Arduino CLI Reset"
.TH ARD-RESET-ARDUINO "1" "January 2017" "ard-reset-arduino 1.6.0" "Arduino CLI Reset"
.SH NAME
ard-reset-arduino - Reset Arduino board

60
ardmk-init.1 Normal file
View file

@ -0,0 +1,60 @@
.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.

View file

@ -11,6 +11,8 @@ The following are the different variables that can be overwritten in the user ma
* [Avrdude setting variables](#avrdude-setting-variables)
* [Bootloader variables](#bootloader-variables)
* [ChipKIT variables](#chipkit-variables)
* [ARM variables](#arm-variables)
* [Ctags variables](#ctags-variables)
## Global variables
@ -72,6 +74,48 @@ AVR_TOOLS_DIR = /usr/share/arduino/hardware/tools/avr
----
### ARM_TOOLS_DIR
**Description:**
Directory where the arm toolchain is installed. `arm-none-eabi-*` should be
within a /bin subdirectory.
Can usually be detected from `$ARDUINO_PACKAGE_DIR` /tools subdirectory when ARM
device support is installed.
**Example:**
```Makefile
ARM_TOOLS_DIR = /usr
# or
ARM_TOOLS_DIR =
/usr/share/arduino/hardware/tools/arm-none-eabi-gcc/VERSION
```
**Requirement:** *Optional*
----
### ARM_TOOLS_VER
**Description:**
Sub-directory where the arm toolchain is installed - usually the tool version.
Can usually be detected from `$ARDUINO_PACKAGE_DIR` /tools subdirectory when ARM
device support is installed. Will resolve latest version if multiple found.
**Example:**
```Makefile
ARM_TOOLS_VER = 7-2017q4
```
**Requirement:** *Optional*
----
### RESET_CMD
**Description:**
@ -83,7 +127,39 @@ Defaults to `ard-reset-arduino` with the extra `--caterina` flag for atmega32u4
**Example:**
```Makefile
RESET_CMD = ~/gertduino/reset
RESET_CMD = $(HOME)/gertduino/reset
```
**Requirement:** *Optional*
----
### PYTHON_CMD
**Description:**
Path to Python binary. Requires pyserial module installed. Makefile will error if unable to auto-find as utility scripts will not work. To override this, give it an empty define.
**Example:**
```Makefile
PYTHON_CMD = /usr/bin/python3
```
**Requirement:** *Optional*
----
### GREP_CMD
**Description:**
Path to GNU grep binary. Only added for macOS, which has BSD grep by default but results in some parsing warnings. macOS users should install GNU grep using Homebrew.
**Example:**
```Makefile
GREP_CMD = /bin/grep
```
**Requirement:** *Optional*
@ -113,6 +189,27 @@ ARDUINO_DIR = /Applications/Arduino.app/Contents/Java
----
### ARDUINO_PACKAGE_DIR
**Description:**
Directory where the Arduino package support files are stored. Can auto-detect based on default OS IDE locations.
**Example:**
```Makefile
# Linux
ARDUINO_PACKAGE_DIR = $(HOME)/.arduino15/packages
# Mac OS X
ARDUINO_PACKAGE_DIR = $(HOME)/Library/Arduino15/packages
# Windows
ARDUINO_PACKAGE_DIR = $(USERPROFILE)/AppData/Local/Arduino15/packages
```
**Requirement:** *Optional*
----
### ARDUINO_PLATFORM_LIB_PATH
**Description:**
@ -154,12 +251,13 @@ ARDUINO_VERSION = 105
Architecture for Arduino 1.5+
Defaults to unset for 1.0 or `avr` for 1.5+
Defaults to unset for 1.0 or `avr` for 1.5+. This value is not literally the chip architecture but will often be
the chip series within a vendor's 'hardware' folder. For example, will default to `samd` if using Sam.mk.
**Example:**
```Makefile
ARCHITECTURE = sam
ARCHITECTURE = arm
```
**Requirement:** *Optional*
@ -170,9 +268,9 @@ ARCHITECTURE = sam
**Description:**
Board vendor/maintainer.
Board vendor/maintainer/series.
Defaults to `arduino`
Defaults to `arduino`.
**Example:**
@ -190,12 +288,12 @@ ARDMK_VENDOR = sparkfun
Path to `sketchbook` directory.
Usually can be auto-detected from the Arduino `preferences.txt` file or the default `~/sketchbook`
Usually can be auto-detected from the Arduino `preferences.txt` file or the default `$(HOME)/sketchbook`
**Example:**
```Makefile
ARDUINO_SKETCHBOOK = ~/sketches
ARDUINO_SKETCHBOOK = $(HOME)/sketches
```
**Requirement:** *Optional*
@ -210,15 +308,15 @@ Path to Arduino `preferences.txt` file.
Usually can be auto-detected as `AUTO_ARDUINO_PREFERENCES` from the defaults:
* on Linux (1.0): `~/.arduino/preferences.txt`
* on Linux (1.5+): `~/.arduino15/preferences.txt`
* on Mac OS X (1.0): `~/Library/Arduino/preferences.txt`
* on Mac OS X (1.5+): `~/Library/Arduino15/preferences.txt`
* on Linux (1.0): `$(HOME)/.arduino/preferences.txt`
* on Linux (1.5+): `$(HOME)/.arduino15/preferences.txt`
* on Mac OS X (1.0): `$(HOME)/Library/Arduino/preferences.txt`
* on Mac OS X (1.5+): `$(HOME)/Library/Arduino15/preferences.txt`
**Example:**
```Makefile
ARDUINO_PREFERENCES_PATH = ~/sketches/preferences.txt
ARDUINO_PREFERENCES_PATH = $(HOME)/sketches/preferences.txt
```
**Requirement:** *Optional*
@ -297,6 +395,33 @@ BOARD_SUB=atmega168
----
### BOARD_CLOCK
**Description:**
Allow selection of f_cpu and fuses specified in `boards.txt` as `{BOARD_TAG}.menu.clock.{BOARD_CLOCK}`.
This works for microprocessor board definitions like ATtiny that specify not only the clock speed but fuse settings as clock overrides.
It also works for f_cpu values specified in `boards.txt` as `{BOARD_TAG}.menu.speed.{BOARD_CLOCK}`.
For example, the Watterott ATmega328PB library [https://github.com/watterott/ATmega328PB-Testing](https://github.com/watterott/ATmega328PB-Testing).
**Example:**
```Makefile
# Select external 16 MHz clock
BOARD_CLOCK=external16
```
**Example:**
```Makefile
# Select 20MHz speed
BOARD_CLOCK=20mhz
```
**Requirement:** *Optional to override main board f_cpu and/or fuse settings.*
----
### MONITOR_PORT
**Description:**
@ -351,7 +476,7 @@ Defaults to `libraries` directory within user's sketchbook.
```Makefile
# Linux
USER_LIB_PATH = ~/sketchbook/libraries
USER_LIB_PATH = $(HOME)/sketchbook/libraries
# For a random project on *nix
USER_LIB_PATH = /path/to/my/project
```
@ -428,7 +553,7 @@ Path to non-standard core's variant files.
**Example:**
```Makefile
ARDUINO_VAR_PATH = ~/sketchbook/hardware/arduino-tiny/cores/tiny
ARDUINO_VAR_PATH = $(HOME)/sketchbook/hardware/arduino-tiny/cores/tiny
```
**Requirement:** *Optional*
@ -458,6 +583,26 @@ CORE = tiny
----
### BOARD
**Description:**
Board identifier that passes to a compile option as -DARDUINO_$(BOARD).
Usually can be auto-detected as `build.board` from `boards.txt`.
If not found build.board entry, use upper-case converted "$(ARCHITECTURE)_$(BOARD_TAG)".
**Example:**
```Makefile
BOARD = AVR_LEONARD
```
**Requirement:** *Optional*
----
### VARIANT
**Description:**
@ -657,7 +802,8 @@ ISP_PROG = stk500v1
**Description:**
Device path to ArduinoISP. Not needed for hardware ISP's.
Device path to ArduinoISP. Not needed for hardware ISP's. Also used to define
bootloader port on SAMD devices.
**Example:**
@ -762,6 +908,37 @@ CC_NAME = pic32-gcc
----
## Compiler/Executable variables
### TOOL_PREFIX
**Description:**
The tool prefix, which gets prepended to the tools like $(TOOL_PREFIX)-gcc, $(TOOL_PREFIX)-g++, etc.
The following tools will be prefixed with '$(TOOL_PREFIX)-':
* gcc
* g++
* as
* objcopy
* objdump
* ar
* size
* nm
Defaults to `avr`
**Example:**
```Makefile
TOOL_PREFIX = arm-none-eabi
TOOL_PREFIX = pic32
```
**Requirement:** *Optional*
----
### CXX_NAME
**Description:**
@ -822,7 +999,7 @@ OBJDUMP_NAME = pic32-objdump
Archive utility.
Defaults to `avr-ar`
Defaults to `avr-ar` unless you're using toolchain > 4.9.0 in which case we use avr-gcc-ar.
**Example:**
@ -870,6 +1047,18 @@ NM_NAME = pic32-nm
----
### GDB_NAME
**Description:**
GDB utility.
Defaults to `arm-none-eabi-gdb`
**Requirement:** *Optional*
----
### OPTIMIZATION_LEVEL
**Description:**
@ -888,35 +1077,53 @@ OPTIMIZATION_LEVEL = 3
----
### OTHER_LIBS
**Description:**
Additional Linker lib flags, for platform support
Defaults to ""
**Example:**
```Makefile
OTHER_LIBS = -lsomeplatformlib
```
**Requirement:** *Optional*
----
### CFLAGS_STD
**Description:**
Controls, *exclusively*, which C standard is to be used for compilation.
Defaults to `undefined`
Defaults to `undefined` on 1.0.x or `-std=gnu11` on 1.5+ or if you install AVR toolchain > 4.9.0
Possible values:
* With `avr-gcc 4.3`, shipped with the Arduino IDE:
* With `avr-gcc 4.3`, shipped with the 1.0 Arduino IDE:
* `undefined`
* `-std=c99`
* `-std=gnu89` - This is the default for C code
* `-std=gnu99`
* With `avr-gcc 4.7, 4.8 or 4.9`, installed by you
* With `avr-gcc 4.7, 4.8 or 4.9`, installed by you or 1.5+ IDE:
* `undefined`
* `-std=c99`
* `-std=c11`
* `-std=gnu89` - This is the default for C code
* `-std=gnu89`
* `-std=gnu99`
* `-std=gnu11`
* `-std=gnu11` - This is the default for C code
For more information, please refer to the [Options Controlling C Dialect](https://gcc.gnu.org/onlinedocs/gcc/C-Dialect-Options.html)
**Example:**
```Makefile
CFLAGS_STD = = -std=gnu89
CFLAGS_STD = -std=gnu89
```
**Requirement:** *Optional*
@ -929,24 +1136,24 @@ CFLAGS_STD = = -std=gnu89
Controls, *exclusively*, which C++ standard is to be used for compilation.
Defaults to `undefined`
Defaults to `undefined` on 1.0 or `-std=gnu++11` on AVR toolchain > 4.9.0 (e.g. IDE 1.6.10+)
Possible values:
* With `avr-gcc 4.3`, shipped with the Arduino IDE:
* With `avr-gcc 4.3`, shipped with the 1.0 Arduino IDE:
* `undefined`
* `-std=c++98`
* `-std=c++0x`
* `-std=gnu++98` - This is the default for C code
* `-std=gnu++0x`
* With `avr-gcc 4.7, 4.8 or 4.9`, installed by you
* With `avr-gcc 4.7, 4.8 or 4.9`, installed by you or 1.5+ IDE:
* `undefined`
* `-std=c++98`
* `-std=c++11`
* `-std=c++1y`
* `-std=c++14`
* `-std=gnu++98` - This is the default for C++ code
* `-std=gnu++11`
* `-std=gnu++98`
* `-std=gnu++11` - This is the default for C++ code
* `-std=gnu++1y`
* `-std=gnu++14`
@ -955,7 +1162,7 @@ For more information, please refer to the [Options Controlling C Dialect](https:
**Example:**
```Makefile
CXXFLAGS_STD = = -std=gnu++98
CXXFLAGS_STD = -std=gnu++98
```
**Requirement:** *Optional*
@ -969,7 +1176,7 @@ CXXFLAGS_STD = = -std=gnu++98
Flags passed to compiler for files compiled as C. Add more flags to this
variable using `+=`.
Defaults to all flags required for a typical build.
Defaults to `undefined` on 1.0 or `-flto -fno-fat-lto-objects -fdiagnostics-color=$(DIAGNOSTICS_COLOR_WHEN)` on AVR toolchain > 4.9.0 (e.g. IDE 1.6.10+)
**Example:**
@ -988,7 +1195,9 @@ CFLAGS += -my-c-only-flag
Flags passed to the compiler for files compiled as C++. Add more flags to this
variable using `+=`.
Defaults to all flags required for a typical build.
Defaults to `-fpermissive -fno-exceptions` on 1.0
or `-fpermissive -fno-exceptions -fno-threadsafe-statics -flto -fno-devirtualize -fdiagnostics-color`
on AVR toolchain > 4.9.0 (e.g. IDE 1.6.10+)
**Example:**
@ -1000,6 +1209,30 @@ CXXFLAGS += -my-c++-onlyflag
----
### DIAGNOSTICS_COLOR_WHEN
**Description:**
This variable controls the compiler's diagnostics-color setting, as defined
in CFLAGS or CXXFLAGS, on AVR toolchain > 4.9.0.
Supported values are: `always`, `never` and `auto`.
For more details, see: [Options to Control Diagnostic Messages Formatting]
(https://gcc.gnu.org/onlinedocs/gcc-4.9.2/gcc/Language-Independent-Options.html#Language-Independent-Options)
Defaults to `always`.
**Example:**
```Makefile
DIAGNOSTICS_COLOR_WHEN = never
# or
DIAGNOSTICS_COLOR_WHEN = auto
```
**Requirement:** *Optional*
----
### ASFLAGS
**Description:**
@ -1023,7 +1256,7 @@ ASFLAGS += -my-as-only-flag
**Description:**
Flags passed to the C pre-processor (for C, C++ and assembly source flies). Add
Flags passed to the C pre-processor (for C, C++ and assembly source files). Add
more flags to this variable using `+=`.
Defaults to all flags required for a typical build.
@ -1042,14 +1275,27 @@ CPPFLAGS += -DMY_DEFINE_FOR_ALL_SOURCE_TYPES
**Description:**
Override the default build tools.
Override the default build tool paths and names.
If set to `1`, each tool (`CC`, `CXX`, `AS`, `OBJCOPY`, `OBJDUMP`, `AR`, `SIZE`, `NM`) must have its path explicitly defined. See `chipKIT.mk`.
If OVERRIDE_EXECUTABLES is defined, all tools (`CC`, `CXX`, `AS`,
`OBJCOPY`, `OBJDUMP`, `AR`, `SIZE`, `NM`) must have their paths
explicitly defined. This may be used in the rare case where
overriding a path and/or executable name is required.
The "?=" assignment cannot be used because the executable tags
are already implicitly defined by Make (e.g. $(CC) == cc).
**Example:**
```Makefile
OVERRIDE_EXECUTABLES = 1
CC = /usr/bin/avr-gcc
CXX = /usr/bin/avr-g++
AS = /usr/bin/avr-as
OBJCOPY = /usr/bin/avr-objcopy
OBJDUMP = /usr/bin/avr-objdump
AR = /usr/bin/avr-ar
SIZE = /some_path/alternative_avr-size
NM = /some_path/alternative_avr-nm
```
**Requirement:** *Optional*
@ -1074,6 +1320,24 @@ MONITOR_CMD = minicom
----
### MONITOR_PARAMS
**Description:**
Additional parameters for the putty -sercfg command line argument.
Interpreted as a comma-separated list of configuration options.
**Example:**
```Makefile
MONITOR_PARAMS = 8,1,n,N
```
**Requirement:** *Optional*
----
### PRE_BUILD_HOOK
**Description:**
@ -1086,7 +1350,7 @@ Defaults to `pre-build-hook.sh`
**Example:**
```Makefile
PRE_BUILD_HOOK = ~/bin/bump-revision.sh
PRE_BUILD_HOOK = $(HOME)/bin/bump-revision.sh
```
**Requirement:** *Optional*
@ -1133,6 +1397,24 @@ AVRDUDE_CONF = /usr/share/arduino/hardware/tools/avrdude.conf
----
### AVRDUDE_AUTOERASE_FLASH
**Description:**
Enable autoerase flash.
By default disabled.
**Example:**
```Makefile
AVRDUDE_AUTOERASE_FLASH = yes
```
**Requirement:** *Optional*
----
### AVR_TOOLS_PATH
**Description:**
@ -1201,13 +1483,61 @@ Defaults to `ARDUINO_SKETCHBOOK/hardware/ALTERNATE_CORE`
**Example:**
```Makefile
ALTERNATE_CORE_PATH = ~/sketchbook/hardware/arduino-tiny/cores/tiny
ALTERNATE_CORE_PATH = $(HOME)/sketchbook/hardware/arduino-tiny/cores/tiny
```
**Requirement:** *Optional*
----
### CORE_VER
**Description:**
Alternate core release version. The Arduino board support packages are within
a sub-directory indicated by this define.
Defaults to package current release.
**Example:**
```Makefile
CORE_VER = 1.6.17
```
**Requirement:** *Optional*
----
### CMSIS_DIR
**Description:**
Path to ARM CMSIS. Normally installed as part of ARM board support.
Defaults to `ARDUINO_PACKAGE_DIR/tools/CMSIS/4.5.0/CMSIS`
**Example:**
```Makefile
CMSIS_DIR = /usr/share/CMSIS
```
**Requirement:** *Optional*
----
### CMSIS_ATMEL_DIR
**Description:**
Path to CMSIS-Atmel directory. Installed with ARM support package.
Defaults to `ARDUINO_PACKAGE_DIR/tools/CMSIS-Atmel/1.1.0/CMSIS`
**Requirement:** *Optional*
----
### BOARDS_TXT
**Description:**
@ -1219,7 +1549,7 @@ Defaults to `ARDUINO_DIR/hardware/arduino/boards.txt`
**Example:**
```Makefile
BOARD_TXT = ~/sketchbook/hardware/boards.txt
BOARD_TXT = $(HOME)/sketchbook/hardware/boards.txt
# or
BOARD_TXT = /usr/share/arduino/hardware/arduino/boards.txt
```
@ -1353,17 +1683,78 @@ Defaults to `/usr/share/arduino/hardware/arduino/bootloaders` (Linux)
**Example:**
```Makefile
BOOTLOADER_PARENT = ~/sketchbook/hardware/promicro/bootloaders
BOOTLOADER_PARENT = $(HOME)/sketchbook/hardware/promicro/bootloaders
BOOTLOADER_PATH = caterina
BOOTLOADER_FILE = Caterina-promicro16.hex
```
Would result in an absolute path to the bootloader hex file of `~/sketchbook/hardware/promicro/bootloaders/caterina/Caterina-promicro16.hex`
Would result in an absolute path to the bootloader hex file of `$(HOME)/sketchbook/hardware/promicro/bootloaders/caterina/Caterina-promicro16.hex`
**Requirement:** *Optional, unless BOOTLOADER_FILE and/or BOOTLOADER_PATH are user-defined*
----
### BOOTLOADER_SIZE
**Description:**
Size of bootloader on ARM devices, ensures correct start address when flashing
application area. Normally parsed from boards.txt
Defaults to `0x2000`
**Requirement:** *Optional*
----
### BOOTLOADER_UNPROTECT
**Description:**
Bootloader unprotect sequence for upload tool. Normally parsed from boards.txt
Defaults to `at91samd bootloader 0`
**Requirement:** *Optional*
----
### BOOTLOADER_PROTECT
**Description:**
Bootloader protect sequence for upload tool. Normally parsed from boards.txt
Defaults to `at91samd bootloader 16384`
**Requirement:** *Optional*
----
### BOOTLOADER_PROTECT_VERIFY
**Description:**
Bootloader protect and verify sequence for upload tool. Normally parsed from boards.txt
Defaults to `at91samd bootloader`
**Requirement:** *Optional*
----
### BOOTLOADER_UPLOAD_TOOL
**Description:**
Bootloader upload binary to use. Normally parsed from boards.txt.
Defaults to `openocd`
**Requirement:** *Optional*
----
## ChipKIT variables
### MPIDE_DIR
@ -1377,7 +1768,7 @@ Usually can be auto-detected as `AUTO_MPIDE_DIR` from the defaults `/usr/share/m
**Example:**
```Makefile
MPIDE_DIR = ~/mpide
MPIDE_DIR = $(HOME)/mpide
```
**Requirement:** *Optional*
@ -1390,12 +1781,222 @@ MPIDE_DIR = ~/mpide
Path to chipKIT `preferences.txt` file.
Usually can be auto-detected as `AUTO_MPIDE_PREFERENCES_PATH` from the defaults `~/.mpide/preferences.txt` (Linux) or `~/Library/Mpide/preferences.txt` (OSX)
Usually can be auto-detected as `AUTO_MPIDE_PREFERENCES_PATH` from the defaults `$(HOME)/.mpide/preferences.txt` (Linux) or `$(HOME)/Library/Mpide/preferences.txt` (OSX)
**Example:**
```Makefile
MPIDE_PREFERENCES_PATH = ~/chipkit/preferences.txt
MPIDE_PREFERENCES_PATH = $(HOME)/chipkit/preferences.txt
```
**Requirement:** *Optional*
----
## ARM variables
### UPLOAD_TOOL
**Description:**
Tool to upload binary to device. Normally parsed from boards.txt.
Defaults to `openocd`
**Example:**
```Makefile
UPLOAD_TOOL = gdb
```
**Requirement:** *Optional*
----
### DEBUG
**Description:**
Define to set `DEBUG_FLAGS` and allow stepping of code using GDB.
Defaults to undefined.
**Example:**
```Makefile
DEBUG = 1
```
**Requirement:** *Optional*
----
### GDB_PORT
**Description:**
Server port to use for GDB debugging or upload. Default assumes server running
on localhost but can re-define to use Black Magic Probe serial port.
Defaults to `localhost:3333`
**Example:**
```Makefile
GDB_PORT = /dev/ttyACM0
```
**Requirement:** *Optional*
----
### GDB_OPTS
**Description:**
Optional arguments to parse to GDB command.
Defaults to `-ex "target extended-remote $(GDB_PORT)" -ex "monitor swdp_scan" -ex "attach 1" -ex "load" -d $(OBJDIR) $(TARGET_ELF)`
**Requirement:** *Optional*
----
### GDB_UPLOAD_OPTS
**Description:**
Optional arguments to parse to GDB command when uploading binary only.
Defaults to `GDB_UPLOAD_OPTS = $(GDB_OPTS) -ex "set confirm off" -ex "set target-async off" -ex "set remotetimeout 30" -ex "detach" -ex "kill" -ex "quit"`
**Requirement:** *Optional*
----
### BOSSA
**Description:**
Path to bossac binary.
Can usually be detected from `$ARDUINO_PACKAGE_DIR` /tools subdirectory when ARM
device support is installed.
**Requirement:** *Optional*
----
### BOSSA_VER
**Description:**
`bossa` sub-directory - usually the tool version. Will auto-detect to highest version found.
**Requirement:** *Optional*
----
### BOSSA_OPTS
**Description:**
Flags to pass to bossac command.
Defaults to `-d --info --erase --write --verify --reset`
**Requirement:** *Optional*
----
### OPENOCD
**Description:**
Path to openocd binary.
Can usually be detected from `$ARDUINO_PACKAGE_DIR` /tools subdirectory when ARM
device support is installed.
**Requirement:** *Optional*
----
### OPENOCD_VER
**Description:**
`openocd` sub-directory - usually the tool version. Will auto-detect to highest version found.
**Requirement:** *Optional*
----
### OPENOCD_OPTS
**Description:**
Flags to pass to openocd command. If using openocd from non-Arduino
distributions, one should define this with the path to the Arduino openocd script.
Defaults to `-d2`
Example:
```Makefile
OPENOCD_OPTS = $(ARDUINO_PACKAGE_DIR)/$(ARDMK_VENDOR)/tools/openocd/0.9.0-arduino6-static/share/openocd/scripts/ -f $(ARDUINO_PACKAGE_DIR)/$(ARDMK_VENDOR)/hardware/samd/1.6.17/variants/$(VARIANT)/$(OPENOCD_SCRIPT)
```
**Requirement:** *Optional*
----
## Ctags variables
### TAGS_FILE
**Description:**
Output file name for tags. Defaults to 'tags'.
**Example:**
```Makefile
TAGS_FILE = .tags
```
**Requirement:** *Optional*
----
### CTAGS_OPTS
**Description:**
Additional options to pass to `ctags` command.
**Example:**
```Makefile
# Run ctags in verbose mode
CTAGS_OPTS = -V
```
**Requirement:** *Optional*
----
### CTAGS_EXEC
**Description:**
Path to the `ctags` binary. Defaults to user path.
**Example:**
```Makefile
CTAGS_EXEC = /usr/local/bin/ctags
```
**Requirement:** *Optional*

View file

@ -1,25 +1,102 @@
#!/usr/bin/env python
#!/usr/bin/python3
from __future__ import print_function
import serial
import serial.tools.list_ports
import os.path
import argparse
from time import sleep
pyserial_version = None
try:
pyserial_version = int(serial.VERSION[0])
except:
pyserial_version = 2 # less than 2.3
parser = argparse.ArgumentParser(description='Reset an Arduino')
parser.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()
if args.caterina:
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()

278
bin/ardmk-init Executable file
View file

@ -0,0 +1,278 @@
#!/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()

94
bin/robotis-loader Executable file
View file

@ -0,0 +1,94 @@
#!/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)

View file

@ -72,8 +72,7 @@ ifeq ($(CURRENT_OS),LINUX)
AVRDUDE_CONF = $(AVRDUDE_DIR)/avrdude.conf
endif
PIC32_TOOLS_DIR = $(ARDUINO_DIR)/hardware/pic32/compiler/pic32-tools
PIC32_TOOLS_PATH = $(PIC32_TOOLS_DIR)/bin
AVR_TOOLS_DIR = $(ARDUINO_DIR)/hardware/pic32/compiler/pic32-tools
ALTERNATE_CORE = pic32
ALTERNATE_CORE_PATH = $(MPIDE_DIR)/hardware/pic32
@ -89,23 +88,7 @@ CORE_AS_SRCS = $(ARDUINO_CORE_PATH)/vector_table.S \
ARDUINO_VERSION = 23
CC_NAME = pic32-gcc
CXX_NAME = pic32-g++
AR_NAME = pic32-ar
OBJDUMP_NAME = pic32-objdump
OBJCOPY_NAME = pic32-objcopy
SIZE_NAME = pic32-size
NM_NAME = pic32-nm
OVERRIDE_EXECUTABLES = 1
CC = $(PIC32_TOOLS_PATH)/$(CC_NAME)
CXX = $(PIC32_TOOLS_PATH)/$(CXX_NAME)
AS = $(PIC32_TOOLS_PATH)/$(AS_NAME)
OBJCOPY = $(PIC32_TOOLS_PATH)/$(OBJCOPY_NAME)
OBJDUMP = $(PIC32_TOOLS_PATH)/$(OBJDUMP_NAME)
AR = $(PIC32_TOOLS_PATH)/$(AR_NAME)
SIZE = $(PIC32_TOOLS_PATH)/$(SIZE_NAME)
NM = $(PIC32_TOOLS_PATH)/$(NM_NAME)
TOOL_PREFIX = pic32
LDSCRIPT = $(call PARSE_BOARD,$(BOARD_TAG),ldscript)
LDSCRIPT_FILE = $(ARDUINO_CORE_PATH)/$(LDSCRIPT)

View file

@ -1,13 +1,59 @@
# 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.
ALTERNATE_CORE = attiny
# If not, you might have to include the full path.
#ALTERNATE_CORE_PATH = /home/sudar/Dropbox/code/arduino-sketches/hardware/attiny/
# 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
BOARD_TAG = attiny85-8
ISP_PORT = /dev/ttyACM*
# Programmer type:
ISP_PROG = usbasp
# Examples - obviously pick only one and comment/delete the rest:
# ------------------------------------------------------------------ #
# 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 to upload when using ISP programmer
# !!! Important. You have to use 'make ispload' when using an ISP.

View file

@ -1,4 +1,4 @@
BOARD_TAG = uno
ARDUINO_LIBS =
include ../../Arduino.mk
include $(ARDMK_DIR)/Arduino.mk

View file

@ -1,7 +1,7 @@
# Arduino Make file. Refer to https://github.com/sudar/Arduino-Makefile
BOARD_TAG = uno
include ../../Arduino.mk
include $(ARDMK_DIR)/Arduino.mk
@ -45,8 +45,8 @@ include ../../Arduino.mk
#BOOTLOADER_PARENT = $(HOME)/arduino/hardware/promicro/bootloaders
#BOOTLOADER_PATH = caterina
#BOOTLOADER_FILE = Caterina-promicro16.hex
#ISP_PROG = usbasp
#AVRDUDE_OPTS = -v
#ISP_PROG = usbasp
#AVRDUDE_OPTS = -v
#include /usr/share/arduino/Arduino.mk
# --- chipkit
@ -75,40 +75,8 @@ include ../../Arduino.mk
#ARDUINO_DIR = /where/you/installed/arduino-1.6.5
#include /usr/share/arduino/Arduino.mk
# --- arduino-tiny ide 1.0
#ISP_PROG = usbasp
#BOARD_TAG = attiny85at8
#ALTERNATE_CORE = tiny
#ARDUINO_VAR_PATH = $(HOME)/arduino/hardware/tiny/cores/tiny
#ARDUINO_CORE_PATH = $(HOME)/arduino/hardware/tiny/cores/tiny
#AVRDUDE_OPTS = -v
#include /usr/share/arduino/Arduino.mk
# --- arduino-tiny ide 1.6
#ISP_PROG = usbasp
#BOARD_TAG = attiny85at8
#ALTERNATE_CORE = tiny
#ARDUINO_DIR = /where/you/installed/arduino-1.6.5
#include /usr/share/arduino/Arduino.mk
# --- damellis attiny ide 1.0
#ISP_PROG = usbasp
#BOARD_TAG = attiny85
#ALTERNATE_CORE = attiny-master
#AVRDUDE_OPTS = -v
#include /usr/share/arduino/Arduino.mk
# --- damellis attiny ide 1.6
#ISP_PROG = usbasp
#BOARD_TAG = attiny
#BOARD_SUB = attiny85
#ALTERNATE_CORE = attiny
#F_CPU = 16000000L
#ARDUINO_DIR = /where/you/installed/arduino-1.6.5
#include /usr/share/arduino/Arduino.mk
# --- teensy3
#BOARD_TAG = teensy31
#BOARD_TAG = teensy31
#ARDUINO_DIR = /where/you/installed/the/patched/teensy/arduino-1.0.6
#include /usr/share/arduino/Teensy.mk
@ -118,8 +86,31 @@ include ../../Arduino.mk
#BOOTLOADER_PARENT = $(HOME)/arduino/hardware/mighty-1284p/bootloaders
#BOOTLOADER_PATH = optiboot
#BOOTLOADER_FILE = optiboot_atmega1284p.hex
#ISP_PROG = usbasp
#AVRDUDE_OPTS = -v
#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

View file

@ -0,0 +1,23 @@
// 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();
}
}

View file

@ -0,0 +1,24 @@
# 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

View file

@ -0,0 +1,14 @@
# 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)

View file

@ -0,0 +1,27 @@
// 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;
}

View file

@ -0,0 +1,19 @@
// 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

View file

@ -0,0 +1,7 @@
# 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

View file

@ -1,5 +1,5 @@
BOARD_TAG = mega_pic32
ARDUINO_LIBS =
include ../../chipKIT.mk
include $(ARDMK_DIR)/chipKIT.mk

View file

@ -11,6 +11,6 @@ F_CPU = 8000000L
ISP_PROG = stk500v1
AVRDUDE_ISP_BAUDRATE = 19200
include ../../Arduino.mk
include $(ARDMK_DIR)/Arduino.mk
# !!! Important. You have to use make ispload to upload when using ISP programmer

View file

@ -16,7 +16,7 @@ AVRDUDE_CONF=/usr/local/etc/avrdude.conf
FORCE_MONITOR_PORT=true
MONITOR_PORT=/dev/spidev0.0
include ../../Arduino.mk
include $(ARDMK_DIR)/Arduino.mk
# Additional rules to use a remote Raspberry Pi programmer

View file

@ -0,0 +1,18 @@
/*
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
}

View file

@ -0,0 +1,7 @@
BOARD_TAG = cm904
ARDUINO_LIBS =
#MONITOR_PORT = /dev/ttyACM0
#OPENCMIDE_DIR = /where/you/installed/robotis_opencm
include ../../OpenCM.mk

View file

@ -0,0 +1,48 @@
/*
* 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) );
}

View file

@ -0,0 +1,8 @@
BOARD_TAG = OpenCR
ARDUINO_LIBS =
#MONITOR_PORT = /dev/ttyACM0
include ../../OpenCR.mk

View file

@ -1,4 +1,4 @@
BOARD_TAG = teensy31
ARDUINO_LIBS =
include ../../Teensy.mk
include $(ARDMK_DIR)/Teensy.mk

View file

@ -1,4 +1,4 @@
BOARD_TAG = uno
ARDUINO_LIBS =
include ../../Arduino.mk
include $(ARDMK_DIR)/Arduino.mk

View file

@ -0,0 +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);
}
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
}

View file

@ -0,0 +1,19 @@
# 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

View file

@ -1,4 +1,4 @@
BOARD_TAG = uno
ARDUINO_LIBS =
include ../../Arduino.mk
include $(ARDMK_DIR)/Arduino.mk

View file

@ -1,4 +1,4 @@
BOARD_TAG = uno
ARDUINO_LIBS = LiquidCrystal
include ../../Arduino.mk
include $(ARDMK_DIR)/Arduino.mk

View file

@ -0,0 +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);
}
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
}

View file

@ -0,0 +1,24 @@
# 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

View file

@ -0,0 +1,56 @@
### 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

View file

@ -2,4 +2,4 @@
BOARD_TAG = uno
include ../../Arduino.mk
include $(ARDMK_DIR)/Arduino.mk

View file

@ -17,4 +17,4 @@ F_CPU = 16000000L
ARDUINO_LIBS = SoftwareSerial
include /usr/share/arduino/Arduino.mk
include $(ARDMK_DIR)/Arduino.mk

View file

@ -3,4 +3,4 @@
BOARD_TAG = uno
ARDUINO_LIBS = Ethernet SPI
include ../../Arduino.mk
include $(ARDMK_DIR)/Arduino.mk

View file

@ -0,0 +1,30 @@
# 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

View file

@ -0,0 +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);
}
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
}

View file

@ -3,4 +3,4 @@
BOARD_TAG = uno
ARDUINO_LIBS = Wire
include ../../Arduino.mk
include $(ARDMK_DIR)/Arduino.mk

View file

@ -1,4 +1,4 @@
BOARD_TAG = uno
ARDUINO_LIBS =
include ../../Arduino.mk
include $(ARDMK_DIR)/Arduino.mk

View file

@ -1,6 +1,6 @@
Name: arduino-mk
Version: 1.5.1
Release: 1%{dist}
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
@ -9,8 +9,7 @@ Group: Development/Tools
License: LGPLv2+
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
Requires: arduino-core pyserial
BuildRequires: arduino-core
Requires: arduino-core python3-pyserial
%description
Arduino is an open-source electronics prototyping platform based on
@ -37,6 +36,10 @@ 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}
@ -45,6 +48,10 @@ rm -rf %{buildroot}
%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
@ -52,6 +59,12 @@ rm -rf %{buildroot}
%{_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>

27
robotis-loader.1 Normal file
View file

@ -0,0 +1,27 @@
.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.

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,13 +1,45 @@
#!/usr/bin/env bash
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 BlinkTeensy BlinkNetworkRPi BlinkInAVRC)
NON_TESTABLE_EXAMPLES=(ATtinyBlink MakefileExample TinySoftWareSerial BlinkOpenCM BlinkOpenCR BlinkTeensy BlinkNetworkRPi BlinkInAVRC DueBlink)
for dir in $TESTS_DIR/*/
do
@ -22,46 +54,47 @@ do
done
if ! $example_is_testable; then
echo "Skipping non-testable example $example..."
info "Skipping non-testable example $example..."
continue
fi
pushd $dir
echo "Compiling $example..."
make_output=`make clean TEST=1`
make_output=`make TEST=1`
run pushd $dir
info "Compiling $example..."
runtest clean
runtest
if [[ $? -ne 0 ]]; then
failures+=("$example")
echo "Example $example failed"
info "Example $example failed"
fi
make_output=`make disasm TEST=1`
runtest disasm
if [[ $? -ne 0 ]]; then
failures+=("$example disasm")
echo "Example $example disasm failed"
info "Example $example disasm failed"
fi
make_output=`make generate_assembly TEST=1`
runtest generate_assembly
if [[ $? -ne 0 ]]; then
failures+=("$example generate_assembly")
echo "Example $example generate_assembly failed"
info "Example $example generate_assembly failed"
fi
make_output=`make symbol_sizes TEST=1`
runtest symbol_sizes
if [[ $? -ne 0 ]]; then
failures+=("$example symbol_sizes")
echo "Example $example symbol_sizes failed"
info "Example $example symbol_sizes failed"
fi
popd
done
for failure in "${failures[@]}"; do
echo "Example $failure failed"
run popd
done
if [[ ${#failures[@]} -eq 0 ]]; then
echo "All tests passed."
else
exit 1
for failure in "${failures[@]}"; do
echo "Example $failure failed"
done
exit 1
fi