Compare commits

...

514 commits

Author SHA1 Message Date
Sudar Muthu
a1fbda0c53
Merge pull request #667 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 #665 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 #646 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 #645 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 #643 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 #644.
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 #614 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 #630 from osamuaoki/ARDMK_DIR
Let's make examples platform neutral
2020-09-03 07:25:14 +05:30
Sudar Muthu
e6881e2a43
Merge pull request #640 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 #630 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 #628 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 #613 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 #599 from szeder/build-api
Build the ArduinoCore API (fixes issue #607)
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 #608 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 #586 from SearchAThing-forks/master
allow to enable AVRDUDE_AUTOERASE_FLASH
2019-06-19 09:05:02 +05:30
Simon John
cf5d016746
Merge pull request #605 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 #604 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 #601) 2019-05-03 20:07:13 +02:00
Sudar Muthu
8c85ca7001
Merge pull request #598 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 #603 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 #600 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 #597 from tuna-f1sh/master
Fix #594 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 #593 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 #592 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 #583 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 #583.
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 #580 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 #582 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 #578 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 #567 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 #556 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 #546 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 #533 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 #543 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 #548 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 #545 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 #530 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 #541 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 #537).
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 #540 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 #529 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 #525 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 #502 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 #524 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 #516 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 #510 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 #486)
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 #508 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 #501 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 #500 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 #493 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 #488 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 #487 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 #477 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 #475 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 #469 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 #468 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 #465 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 #461
2016-10-11 19:59:35 +01:00
Simon John
299c1831cc Merge pull request #464 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 #456

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 #453 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 #452 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 #449 from sovcik/master
PySerial installation for Windows updated
2016-08-25 22:32:16 +05:30
Jozef Sovcik
2dd7c567c0 PySerial installation for Windows updated (#1) 2016-08-25 18:36:01 +02:00
Sudar Muthu
0ec1489414 Merge pull request #445 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 #437 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 #442 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
Sudar Muthu
c0fea5ccd9 Bump up version to v1.5.1 for release 2016-02-22 17:21:46 +05:30
Sudar Muthu
e2f63c0854 Merge pull request #412 from drewhutchison/master
Add target to display submenu options parsed out of boards.txt
2016-02-20 16:04:19 +05:30
andrew hutchison
a1832e2759 update changelog to reflect show_submenu target 2016-02-19 15:08:51 -07:00
andrew hutchison
4219444417 updated BOARD_TAG to indicate show_submenu target 2016-02-19 15:05:26 -07:00
andrew hutchison
37debe9d70 added show_submenu target 2016-02-19 15:01:15 -07:00
Sudar Muthu
c0fe818d85 Merge pull request #411 from gauteh/pyserial_3_fix
should be setBaudrate not setBaudRate
2016-02-12 16:27:38 +05:30
Gaute Hope
03f5852f2d should be setBaudrate not setBaudRate 2016-02-11 20:07:34 +01:00
Sudar Muthu
967c27d4b0 Merge pull request #409 from sudar/fix/travis
Fix Travis build
2016-02-09 16:07:39 +05:30
Sudar Muthu
6ac297ded9 Don't upgrade setuptools while bootstrap travis environment
For some reason the command `pip install --upgrade setuptools` fails in
the new travis build infrastructure.

You can see the full error log in #404

Fix #404
2016-02-09 15:53:26 +05:30
Sudar Muthu
5e4c578d75 Merge pull request #408 from gauteh/pyserial_3
ard-reset-arduino: support pyserial 3.0
2016-02-09 15:28:28 +05:30
Gaute Hope
745b520dd6 ard-reset-arduino: support pyserial 3.0 2016-02-09 09:05:11 +01:00
Simon John
2326da3a50 Merge pull request #403 from sej7278/master
Removed the check for BOOTLOADER_PATH being empty

Tested on 1.0.5 and 1.6.7, last commit  of 2015?
2015-12-30 01:02:16 +00:00
Simon John
c67f505a71 Removed the check for BOOTLOADER_PATH being empty as its merged into
BOOTLOADER_FILE in 1.5+

Now we just check for BOOTLOADER_FILE being non-empty on both versions.

Fixes issue #402
2015-12-28 10:05:53 +00:00
Simon John
7e6a3e252b Merge pull request #399 from sej7278/master
Fixed "make show_boards" regex to allow for hyphens in BOARD_TAG
2015-12-16 18:39:52 +00:00
Simon John
9115d9e030 Fixed "make show_boards" regex to allow for hyphens in BOARD_TAG
e.g. attiny44-20, thanks to Atmel for the sample chip!
2015-12-16 18:27:31 +00:00
Simon John
9afa0e787c Merge pull request #393 from zabereer/master
Better parsing of boards.txt file, thanks for the PR and good spotting!
2015-10-27 21:41:49 +00:00
Albert Pretorius
fb2567e7fb correct HISTORY.md order 2015-10-27 21:30:00 +00:00
Albert Pretorius
edcaa8557b Better parsing of boards.txt file which allows Adafruit Trinket to be used 2015-10-26 19:22:33 +00:00
Simon John
02a1811d45 Merge pull request #390 from thomaskilian/master
Correct path ARDUINO_DIR for Macs

Merged and thanks for the PR @thomaskilian
2015-09-21 22:56:44 +01:00
Thomas Kilian
cba515531c added missing quote in RAEDME.md and fix-note in HISTORY.md 2015-09-21 23:39:21 +02:00
Thomas Kilian
ba24a6ff4d Add path examples for both Mac IDE versions 2015-09-21 20:41:44 +02:00
Thomas Kilian
ededb0ebbc Correct path ARDUINO_DIR for Macs 2015-09-21 17:34:47 +02:00
Sudar Muthu
0ce685b1a1 Merge pull request #388 from sej7278/master
Replace $VENDOR with $ARDMK_VENDOR
2015-09-15 18:48:22 +05:30
Simon John
af17878bc4 Replace $VENDOR with $ARDMK_VENDOR as $VENDOR is a tcsh environment variable.
$ARCHITECTURE is probably safe as that's usually called $ARCH.

Fixes issue #386.

Need to decide if this is going to upset too many user's who have already
started using $VENDOR - and who uses tcsh? ;-)
2015-09-15 00:00:30 +01:00
Simon John
3198aeab40 Merge pull request #385 from sej7278/master
Ensure AVRDUDE_CONF is set when AVR_TOOLS_DIR is manually set
2015-09-14 23:50:41 +01:00
Simon John
44fe2270a2 Ensure AVRDUDE_CONF is set when AVR_TOOLS_DIR is manually set by user,
not just on Windows - fixes issue #381

Code around this area probably needs a tidy up at some point.
2015-09-13 09:49:53 +01:00
Simon John
7efd0ccd2c Added contributor details to history 2015-09-07 11:21:43 +01:00
Simon John
40f17b8482 Merge pull request #380 from svendahlstrand/target-documentation
Add documentation for the TARGET variable.

thanks @svendahlstrand
2015-09-07 11:19:00 +01:00
Simon John
8f85c543d8 Merge pull request #379 from svendahlstrand/target-spaces
Make sure TARGET is set correctly when CURDIR contains spaces.
2015-09-07 11:18:43 +01:00
Sven Dahlstrand
81d0669869 Add documentation for the TARGET variable. 2015-09-07 11:23:18 +02:00
Sven Dahlstrand
8e787ca161 Make sure TARGET is set correctly when CURDIR contains spaces.
With this fix the `TARGET` variable is set correctly when the project directory
(or its path) contains spaces. So in this case:

    /Users/Joe/Dropbox (Personal)/example project

`TARGET` will be set to `example_project` instead of `Dropbox example project`
(like it was before this fix).
2015-09-07 11:22:00 +02:00
Sudar Muthu
69f3db0bff Merge pull request #371 from optik-aper/master
Fix typo
2015-08-05 10:32:20 +05:30
michael
f7efd1ba97 Fix typo 2015-08-04 21:44:15 -04:00
Simon John
1fb7cddf0e Add AVR Dragon commit info to HISTORY.md 2015-07-14 14:45:51 +02:00
Simon John
2cde585210 Merge pull request #369 from mtnocean/AVRDragonISP
Added support for AVR Dragon in both ISP and DebugWire mode

Thanks @mtnocean
2015-07-14 14:43:23 +02:00
Paul Russo
98f91e65cf Added support for AVR Dragon in both ISP and DebugWire mode 2015-07-14 00:19:52 -06:00
Sudar Muthu
3dd06a6e90 Merge pull request #365 from sej7278/master
Preserve source extension for object files.

Fix #256 
Fix #266 
Fix #364
2015-07-12 15:43:26 +05:30
Simon John
28210c85a9 Took another couple of changes from @peplin's PR #256 for chipKIT 2015-07-09 22:26:02 +02:00
Simon John
da5f42be21 Added space between -T and linker script to allow mpide-0023-linux64-20140821
to build (blink at least!)
2015-07-09 21:18:40 +02:00
Simon John
62fb4668c5 fix typo, add more info about asm core sources 2015-07-09 20:13:16 +02:00
Simon John
abbd020bf4 Preserve source extension for object files.
Needed to fix the new wiring_pulse.S in IDE 1.6.5 which
also has a wiring_pulse.c source file.

Mostly rebased @peplin's PR #266, so should allow us
to support newer chipKIT builds too.
2015-07-09 18:05:28 +02:00
Sudar Muthu
e3d97f76f5 Merge pull request #362 from sej7278/master
Added examples for various boards and IDE versions to the Blink example.
2015-07-02 22:15:26 +05:30
Simon John
1ccbc03114 Added examples for various boards and IDE versions to the Blink example. 2015-07-02 14:37:28 +01:00
Sudar Muthu
1a1a7396ea Merge pull request #361 from sej7278/master
Updated instructions for Fedora 22
2015-06-24 08:05:29 +05:30
Simon John
6a9796b63f Updated instructions for Fedora 22 2015-06-24 01:55:33 +01:00
Sudar Muthu
ed6fb91bf0 Merge pull request #360 from biesiad/master
Add support for picocom terminal emulator and  /dev/tty.wchusbserial
2015-06-12 10:32:17 +05:30
Grzegorz Biesiadecki
6d56ac2037 Updated changelog 2015-06-11 11:13:48 -07:00
Grzegorz Biesiadecki
decdf73f7c Add /dev/tty.wchusbserial* to the list of serial ports (CH341, CH34O chip comes with cheap arduino clones - DCCduino) 2015-06-11 10:58:49 -07:00
Grzegorz Biesiadecki
92f82e3329 Add support for picocom as a monitor 2015-06-11 10:56:06 -07:00
Sudar
9629867ced Merge branch 'hhgarnes-patch-2' 2015-06-02 12:19:07 +05:30
hhgarnes
1dce271b53 Add option to split avrdude MCU from avr-gcc MCU
Fix #359
2015-06-02 12:18:12 +05:30
Simon John
7b11860ba8 Merge pull request #355 from sej7278/master
Added some extra checks to Travis-CI
2015-05-21 21:16:44 +01:00
Simon John
412e1c442e Added some extra checks to Travis-CI 2015-05-21 13:31:09 +01:00
Sudar Muthu
977e43f90a Merge pull request #353 from sej7278/master
Updated some documentation to clarify 1.5+ settings.
2015-05-16 10:39:40 +05:30
Simon John
eaa8f1fe44 Updated some documentation to clarify 1.5+ settings.
Fixes #352
2015-05-15 18:09:00 +01:00
Simon John
cd74017a06 Update HISTORY.md 2015-05-09 16:02:00 +01:00
Simon John
7e02600850 Merge pull request #351 from dcousens/patch-1
example: further spelling error fixes

thanks @dcousens
2015-05-09 16:00:08 +01:00
Daniel Cousens
0da1cb4b1f example: "all of the"
thanks @sej7278
2015-05-09 22:25:10 +10:00
Daniel Cousens
ae80ce16a9 example: further spelling error fixes 2015-05-09 22:04:36 +10:00
Sudar Muthu
63f2d0b7cd Merge pull request #350 from dcousens/patch-1
Fix s/detailled/detailed typo
2015-05-09 10:22:56 +05:30
Daniel Cousens
bc4d8791e8 Fix s/detailled/detailed typo 2015-05-09 14:10:31 +10:00
Sudar
6866b79423 Prepare HISTORY.md for develpment of next version 2015-04-13 09:21:22 +05:30
Sudar Muthu
d7ed2f4cbb Merge pull request #347 from sej7278/master
Looks for submenu items first when parsing BOARDS_TXT. Fix #346
2015-04-13 09:18:22 +05:30
Simon John
a066e86019 Looks for submenu items first when parsing BOARDS_TXT
as suggested by @michaelbaisch in issue #346

Might want to update HISTORY.md with an "in development" version number.
2015-04-12 19:46:58 +01:00
Sudar
0cc6faf16d Update README about the version of Arduino that are supported
Fix #328
2015-04-08 16:13:01 +05:30
Sudar
66ff5ce94e Bump version to v1.5 for release 2015-04-07 21:37:12 +05:30
Sudar Muthu
de21423c9c Merge pull request #342 from sej7278/master
Replace comment about not supporting 1.5 with not supporting SAM
2015-04-06 09:05:55 +05:30
Simon John
1e1f2f6b95 Replace comment about not supporting 1.5 with not supporting SAM
We can probably close issue #45 and maybe open a new one for ARM
SAM support, as 1.6.3 is supported now (and 1.5 is dead).
2015-04-06 01:50:24 +01:00
Sudar
eba20c78c4 Add a note about Arduino.org 2015-04-05 17:14:32 +05:30
Sudar
c4089c02b0 Merge branch 'calvinli-patch-1'
Fix #340
2015-04-04 16:09:10 +05:30
Calvin Li
bc2a9a9798 Fix reset for leonardo
I found that the previous reset code did not work for Leonardo or Micro, nor did any reset code anywhere on the internet.

An examination of the Arduino IDE source code (and the JNI code behind its serial implementation) shows that it holds RTS high and DTR low when doing the 1200 baud open/close. And it turns out that's exactly what's needed!
2015-04-04 16:08:23 +05:30
Sudar
3dce457c6d Make sure pyserial is properly linked 2015-04-04 06:29:44 +05:30
Sudar
467b677d8b Link to Requirements section 2015-04-04 06:27:31 +05:30
Sudar
87a9e7f0cb Tweak pyserial installation instructions 2015-04-04 06:24:39 +05:30
Sudar
10ac2d9c12 Better highlighting for code in README 2015-04-04 06:15:40 +05:30
Sudar Muthu
509a63a721 Merge pull request #339 from sej7278/master
Better autodetection of ARDUINO_SKETCHBOOK and ARDUINO_DIR on OSX
2015-04-04 05:40:51 +05:30
Simon John
c67f07fab8 Better autodetection of ARDUINO_SKETCHBOOK and ARDUINO_DIR on OSX 2015-04-04 00:58:30 +01:00
Simon John
cfe83bca20 Merge pull request #336 from sej7278/master
Added support for VARIANT in submenu's

Also fixed sed issue on OSX (copyright symbol)
2015-03-28 16:34:58 +00:00
Simon John
47395782c3 Replaced UTF-8 copyright symbol causing sed errors on OSX
Fixes issue #335
2015-03-28 16:26:45 +00:00
Simon John
f42a7e6508 Added support for VARIANT in submenu's
Also added a note that in certain 1.6 cores (attiny) F_CPU is
a submenu item e.g. attiny.menu.clock.internal1.build.f_cpu=1000000L
2015-03-28 16:10:06 +00:00
Sudar
861d2ff72f Add a new example to show how serial monitor can be used 2015-03-28 19:40:50 +05:30
Sudar
6f326e6e26 Whitespace fixes in examples 2015-03-28 19:37:49 +05:30
Simon John
d9176a0a64 Merge pull request #334 from sej7278/master
Fixed typo - bracket should be backslash to continue the call to firstword
2015-03-28 12:19:57 +00:00
Simon John
c5e0f5c1ab Fixed typo - bracket should be backslash to continue the call to firstword() 2015-03-28 12:18:38 +00:00
Sudar
16924fe60e Locate 1.5+ preferences.txt file on Mac 2015-03-28 17:26:30 +05:30
Sudar Muthu
1dfcb941b3 Merge pull request #333 from sej7278/master
Add = to PARSE_BOARD regex to make it less greedy.
2015-03-28 17:10:22 +05:30
Simon John
8d52840eb8 Now we know that arduino 1.6.1 uses the ~/.arduino15 directory
we can find preferences.txt

Still need to find out where it looks on OSX/Cygwin
2015-03-27 16:57:45 +00:00
Simon John
ce235b6bb3 Add = to PARSE_BOARD regex to make it less greedy.
For instance in the Sparkfun 1.6 core, we have:

  promicro16.build.vid.0=0x1B4F
  promicro16.build.vid.1=0x1B4F
  promicro16.build.vid=0x1B4F

So we end up matching all 3 instead of just the last one.

Adding the = means we're looking for promicro16.build.vid= so
not catching the .0 or .1 version.
2015-03-27 16:11:27 +00:00
Sudar Muthu
ab06829172 Merge pull request #331 from sej7278/master
Added BOARD_SUB to OBJDIR
2015-03-27 08:54:43 +05:30
Simon John
8606592063 Added BOARD_SUB to OBJDIR so that when changing sub boards we don't accidentally overwrite
existing builds.

E.g. mega1280 and mega2560 previously *both* created a "build-mega" directory,
now they'll create build-mega-mega2560 and build-mega-mega1280

Only applies to 1.5+ of course, and only when BOARD_SUB is used. 1.0 will still
create build-mega2560 and build-mega1280 directories (just BOARD_TAG)
2015-03-26 23:17:05 +00:00
Simon John
ade0589a16 Merge pull request #330 from sej7278/master
Added ARCHITECTURE to ALTERNATE_CORE_PATH to support 1.5+ cores
2015-03-25 22:41:12 +00:00
Simon John
356f5b3e04 Added ARCHITECTURE to ALTERNATE_CORE_PATH to support 1.5+ cores like arduino-tiny.
arduino-tiny and damellis' attiny85 cores don't use a vendor, but they
do use the avr architecture (subdirectory) in their 1.5/1.6 branches.

arduino-tiny builds and is auto-detected now, still needs some
work to support sub-cpu's and clocks.

damellis doesn't compile, but that's not our makefile it seems.
2015-03-25 19:29:21 +00:00
Sudar Muthu
43e5f03746 Merge pull request #329 from sej7278/master
Added search of PLATFORM_LIB_NAMES to ARDUINO_LIBS
2015-03-25 17:42:19 +05:30
Simon John
495a0b8f91 Always forgetting the history! 2015-03-25 12:10:13 +00:00
Simon John
f6c69c9155 Added search of PLATFORM_LIB_NAMES to ARDUINO_LIBS so that Wire.h is found on 1.6.1 and its output separately to SYS_LIB_NAMES
Added "sort" to the USER/SYS/PLATFORM _LIBS so we don't get duplicates
2015-03-25 11:58:19 +00:00
Sudar
ea67b57949 Add credit to the contributors 2015-03-14 15:41:30 +05:30
Sudar Muthu
fb94c84bff Merge pull request #322 from onandoffables/linuxgpio
Add "linuxgpio" to the list of ISP's that don't have a port
2015-02-27 14:32:03 +05:30
onandoffables
79ea7e222f Add "linuxgpio" to the list of ISP's that don't have a port 2015-02-26 21:17:53 +01:00
Sudar
64145418f3 Give credit to @fbielejec for #321 2015-02-25 14:58:27 +05:30
Sudar Muthu
dddce32ef8 Merge pull request #321 from fbielejec/master
instructions on setting CodeBlocks IDE to use the makefiles
2015-02-25 14:56:02 +05:30
filip
1ec5e6c253 instructions on setting CodeBlocks IDE to use the makefiles 2015-02-25 09:34:21 +01:00
poofjunior
d535bf5fde Ability to modify USB_TYPE in Teensy.md
See #313
2015-01-23 15:42:13 +05:30
Sudar
27ed197acc Merge pull request #315 from sej7278/master
Get all the commits before #313
2015-01-23 15:23:55 +05:30
Simon John
a6505e6da8 Change CXX_NAME to CXX as per the EmacsWiki for Flymake instructions.
Makes it a bit more standard too.
2015-01-01 01:25:23 +00:00
Sudar
cfd6af90fb Merge pull request #307 from Gaboose/pr
Ease flashing through ssh. Tweak alternate core support. #306 rebased
2014-12-31 11:16:59 +05:30
Gabrielius Mickevicius
e639f81b6c Fix build.core parsing
Disregard anything before first colon.
E.g. build.core = arduino:arduino results in CORE = arduino
Print CORE.
2014-12-30 17:45:36 +02:00
Gabrielius Mickevicius
de602e8b61 Typo 2014-12-30 17:45:36 +02:00
Gabrielius Mickevicius
6d549c89aa Tidy new arduino mk vars
Add CORE and FORCE_MONITOR_PORT to arduino-mk-vars.md and FORCE_MONITOR_PORT
to config print.
2014-12-30 17:45:36 +02:00
Gabrielius Mickevicius
4b4592ac3e Note on using root in BlinkNetworkRPi 2014-12-30 17:45:36 +02:00
Gabrielius Mickevicius
ecb05452f7 Update changelog 2014-12-30 17:45:36 +02:00
Gabrielius Mickevicius
a930c9983f Example: set fuses and upload hex on remote programmer
Implements two new make rules: 'net_set_fuses' executes a single
ssh command, 'net_upload' pipes hex through ssh connection.

The example also showcases the FORCE_MONITOR_PORT feature.
2014-12-30 17:45:36 +02:00
Gabrielius Mickevicius
3442ef8e6d Let 'build.core' from boards.txt change ARDUINO_CORE_PATH
This is support for https://code.google.com/p/arduino-tiny
The arduino-tiny project provides a boards.txt file and a whole
separate Arduino core modified to work with attinies.
Arduino.mk will now switch to that core if it finds a
'build.core' parameter in boards.txt and a folder in
$(ALTERNATE_CORE_PATH)/cores by that name.
2014-12-30 17:45:36 +02:00
Gabrielius Mickevicius
3754e5c012 Let user skip MONITOR_PORT existance check
Define FORCE_MONITOR_PORT to enable.
Useful if one uses 'ssh root@remotemachine avrdude' instead of the
usual AVRDUDE command.
2014-12-28 23:26:35 +02:00
Sudar
dcc7512284 Merge pull request #304 from phord/master
Do not add '.' to gcc includes search path
2014-12-08 19:33:16 +05:30
Phil Hord
d998de8d84 Do not add '.' to gcc includes search path
Include files are searched for in the include search path made up
from, among other places, the -I switches given to the gcc compiler.
The . (dot) used for the current directory is not in the search
path when the IDE builds the project and does not seem to be needed
in any reasonable case.  Maybe it was included because someone thought
it meant to "search in the same directory as the file being compiled",
but I cannot tell because the switch was already included in the first
commit in this repo.  In any case, the current file directory is already
searched by gcc before the search path is consulted, in any case, so
this switch is not needed to cause this behavior.

Including the "-I."  switch causes compiles to fail when libraries
include a header which is coincidentally named the same as one of the
user headers.  For example, if the user has a Udp.h file in his sketch
folder, the compile will fail if it includes the EthernetUdp.h file.

A simple example is the examples/WebServer code. It fails if you do
this:

   touch examples/WebServer/Udp.h
   make -C examples/WebServer

But it builds ok from the IDE which does not include "." in the
search path.

Similarly, HelloWorld fails for the same reason if you do this:

   touch examples/HelloWorld/Print.h
   make -C examples/HelloWorld

Remove the -I. switch from the CPPFLAGS directive altogether to
prevent this include filename confusion and to more closely model
the behavior of the IDE.  Fixes #303.

It may also work to move the -I. to the end of the search path,
but this still would compile differently from the IDE and so it
is considered not to be a useful feature to retain in any case.

--

I did not add a test case here because it's not clear to me how it
should be added.  Should I modify HelloWorld as described above,
or should I add examples/TestSearchPath/ with the same files
explicitly for this test?  It would be clearer for me if there
was an explicit "tests" directory independent from "examples".
2014-12-07 18:53:03 -05:00
Sudar
e18132e269 Merge pull request #302 from sej7278/master
Moved location of avrdude and avrdude.conf for 1.5.8 on Linux (only!)
2014-12-04 10:31:15 +05:30
Simon John
9c9491d1cc Moved location of avrdude and avrdude.conf for 1.5.8 on Linux (only!)
Subject to change during the beta phase, as its already different
than 1.5.6, also may change when packaged for Debian (usually symlinked)

Fixes issue #301
2014-12-03 22:38:50 +00:00
Sudar
f946670f3d Merge pull request #300 from sej7278/master
Removed all double-quoting except for comments/echo's
2014-11-30 09:54:12 +05:30
Simon John
b45a163b9d Removed all double-quoting except for comments/echo's
Double-quoting was added in 7618da7 to allow for spaces in paths,
that was a bad idea as:

 1. most GNU Make functions can't handle spaces
 2. it breaks variable expansion on Linux/OSX e.g. ~/sketchbook
 3. Windows doesn't like double-quotes - see d5c7ed1

So basically, don't put spaces in your paths, as most Make functions
can't handle them, even if escaped, and its a bit dangerous when
shelling out to grep etc.

Single-quoting is no better either.
2014-11-29 22:31:49 +00:00
Sudar
131809e508 Add information about installing dependencies when installing using
homebrew

Refer to https://github.com/sudar/homebrew-arduino-mk/issues/2#issuecomment-64432785
2014-11-27 19:48:25 +05:30
Sudar
32a12e46d1 Add information about homebrew in ReadME 2014-11-23 20:11:16 +05:30
Sudar
e99deb2079 Merge pull request #298 from PeterMosmans/puttywindows
Added support for PuTTY on Windows
2014-11-23 18:56:08 +05:30
Peter Mosmans
78452da702 Added support for PuTTY on Windows
Use MONITOR_CMD=putty
The optional parameter MONITOR_PARMS can be used as well
2014-11-23 20:38:38 +10:00
Sudar
4b7d999073 Merge pull request #297 from PeterMosmans/cygwincom
Improved Windows (Cygwin/MSYS) support
2014-11-23 15:46:53 +05:30
Peter Mosmans
5f1a5a2ac0 Improved Windows (Cygwin/MSYS) support
Changed RESET_CMD structure under Cygwin
Changed behaviour of get_monitor_port under Windows

DEVICE_PATH always becomes/dev/ttyS[0-9] on Windows
MONITOR_PORT always becomes com[0-9] on Windows
2014-11-23 19:56:49 +10:00
Sudar
6053817833 Merge pull request #292 from sej7278/master
Fix speed regression

Fix #280
2014-11-11 19:26:31 +05:30
Simon John
0df314249a Fix speed regression since 8d443f62c, faster than 1.3.4 now
Audited *some* use of := vs. =, when calling shell/foreach/wildcard,
could probably do with more looking into.
2014-11-10 23:19:00 +00:00
Sudar
5d7bc158d3 Merge pull request #288 from tchebb/fix-ispload-erase
Allow avrdude to erase the chip before programming during ispload
2014-11-08 12:50:12 +05:30
Thomas Hebb
05b57c3cc3 Allow avrdude to erase the chip before programming during ispload
We currently pass the -D (do not erase) option to avrdude
unconditionally in order to work around an Arduino Mega bootloader bug.
However, this has the side-effect of breaking the ispload target for all
non-XMEGA chips, since a write operation on these chips essentially ANDs
the new program with the existing memory contents. If the memory is not
first erased to contain only 0xff, the resulting image is garbage. This
patch makes it so we pass -D when we're using the Arduino bootloader but
don't pass it when we're using ISP directly.
2014-11-07 22:47:08 -05:00
Sudar
fe5c2b6ce1 Merge pull request #289 from sej7278/master
Arduino changed the download link again
2014-11-08 09:03:06 +05:30
Simon John
893adf7f98 Arduino changed the download link again, this time it uses a script,
curl handles it ok luckily.
2014-11-08 02:51:39 +00:00
Sudar
36213ceb06 Merge pull request #287 from sej7278/master
Made CXX compile *.cpp files instead of CC.

Fix #285
2014-11-05 21:21:05 +05:30
Simon John
713997d602 Made CXX compile *.cpp files instead of CC.
Fixes issue #285
2014-11-05 15:09:43 +00:00
Sudar
73f08aad76 Merge pull request #282 from sej7278/master
Add "avrispmkii" to the list of ISP's that don't have a port.

Fix #279
2014-10-24 09:03:17 +05:30
Sudar
3eee9851bb Merge pull request #281 from stepcut/teensy.mk
Add support for Teensyduino 3.x
2014-10-24 09:02:51 +05:30
Simon John
a2c8fe5196 Add's "avrispmkii" to the list of ISP's that don't have a port,
defaults to reading communication_type from avrdude.conf, which
is "usb" usually, rather than setting the -P flag which is the
user override.
2014-10-23 23:44:14 +01:00
stepcut
daacad1d77 added info about Teensy to README.md 2014-10-22 16:44:53 -05:00
stepcut
f162d8fee3 put ARDUINO_DIR block after Travis-CI block else travis will fail. 2014-10-22 15:43:01 -05:00
stepcut
1cddbfb2f4 Teensy.mk: simplify setting of MCU and MCU_FLAG_NAME 2014-10-22 15:29:43 -05:00
stepcut
6534cf8f15 move ARDUINO_DIR auto-detection into Common.mk. This allows Teensy.mk to use auto-detected location. 2014-10-22 15:27:59 -05:00
stepcut
1f5e0b3367 Make BlinkTeensy a NON_TESTABLE_EXAMPLES 2014-10-22 12:29:36 -05:00
stepcut
edf90842c5 Added BlinkTeensy example which uses the Teensy.mk file. 2014-10-22 12:23:52 -05:00
stepcut
b6eb4a8686 Added Teensy to HISTORY.md 2014-10-15 18:33:11 -05:00
stepcut
d029fab8f0 Teensy.mk: default to arm-none-eabi-xxx for executable names. Tweak the upload/reset stuff a little more. Add COPYRIGHT block. 2014-10-15 18:29:26 -05:00
Sudar
8d443f62c8 Merge pull request #277 from lukasz-e/arduino-1.5.x-libs
Arduino 1.5.x libs - handle new library layout (issue #275) and hardware/vendor specific libs (issue #276)
2014-10-14 08:44:24 +05:30
stepcut
969a468bed minor tweaks to Teensy.mk 2014-10-13 19:57:24 -05:00
stepcut
e42d91ed4f support for Teensy 3.x via Teensy.mk 2014-10-13 19:48:07 -05:00
Lukasz Engel
922a8d59bd do not print default (empty) ARDUINO_PLATFORM_LIB_PATH value for arduino 1.0.x 2014-10-13 21:36:29 +02:00
Lukasz Engel
c7219a12b9 remove unwanted TABs 2014-10-12 19:32:55 +02:00
Lukasz Engel
58c94f3d11 Add changelog entry for #275 and #276 2014-10-12 16:48:54 +02:00
Sudar
38f8ba8068 Merge pull request #274 from sej7278/master
Replaced double quotes with singles.

Fix #272
2014-10-12 14:12:41 +05:30
Simon John
d5c7ed15f7 Replaced double quotes with singles when passing arguments to
avr-objcopy. Windows doesn't seem to like double quotes.

Fixes issue #272, thanks @vogt31337
2014-10-12 09:04:57 +01:00
Lukasz Engel
7b74e100ce Arduino 1.5.x - support new library layout and plaform specific system libs
- Add support for 1.5.x library layout.
  (https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5:-Library-specification)

- Allow using Arduino 1.5.x platform specific system libraries.
  Arduino 1.5.x has additional directories for platform (vendor/architecture)
  specific libraries - look there when searching for libraries.
2014-10-11 23:56:02 +02:00
Sudar
2c5a66a973 Merge pull request #270 from sej7278/travis106
Update Travis-CI scripts to test against Arduino v1.0.6
2014-09-29 15:55:20 +05:30
Simon John
88c81b6d95 Added ArchLinux package info, thanks Niels.
Linked Fedora packaging instructions to homepage.

Added Raspbian to distro's with arduino-mk apt packages.
2014-09-23 18:22:03 +01:00
Simon John
5c50797471 Update Travis-CI scripts to test against Arduino v1.0.6 2014-09-22 22:50:27 +01:00
Sudar
623b55c55c Merge pull request #269 from sej7278/fix-travis
Remove Travis-CI references from all examples

Fix #250
Fix #208
2014-09-22 11:55:24 +05:30
Simon John
6be2614c30 Removed Travis-CI references from all examples. Regular users
are not affected by test scripts/makefiles.

Added makefile and gcc version info to config output.

Tested on Arduino 1.0.6
2014-09-21 19:36:50 +01:00
Sudar
ee1855c6b1 Merge pull request #268 from peplin/259-move-examples
Move tests back to 'examples', skip non-testable examples when testing.

Fix #259
Fix #260
2014-09-21 12:05:12 +05:30
Christopher Peplin
d092c14d7e Remove old dependencies dir from .gitignore, now stored in /var/tmp. 2014-09-20 16:29:12 -04:00
Christopher Peplin
663626f06d Move scripts inside tests directory.
Fixed https://github.com/sudar/Arduino-Makefile/issues/260
2014-09-20 16:26:39 -04:00
Christopher Peplin
086c6e96ca Move tests back to 'examples', skip non-testable examples when testing.
This fixes https://github.com/sudar/Arduino-Makefile/issues/259.
2014-09-20 16:14:32 -04:00
Sudar
6f46722abb Merge pull request #263 from peplin/document-flags-vars
Document CFLAGS, CXXFLAGS, ASFLAGS and CPPFLAGS.
2014-09-10 22:08:45 +05:30
Christopher Peplin
9a297758e1 Document CFLAGS, CXXFLAGS, ASFLAGS and CPPFLAGS.
After understanding the difference between CXXFLAGS and CPPFLAGS, this
is a revised commit for https://github.com/sudar/Arduino-Makefile/pull/257
2014-09-10 11:13:44 -04:00
Sudar
640519d7be Add a note about unit test cases in contributing notes 2014-09-10 15:10:39 +05:30
Sudar
4348fd5660 Add the built status button 2014-09-10 11:18:29 +05:30
Sudar
35ed0dd3af Rearrange items in changelog 2014-09-10 11:07:34 +05:30
Sudar
80fd656fce Add note about test suite in changelog 2014-09-10 11:05:35 +05:30
Sudar
fe00b04a0e Merge pull request #254 from peplin/test-suite-and-ci
Add an automated test runner for example programs and Travis CI integration
2014-09-10 11:00:34 +05:30
Christopher Peplin
48356f96ce Add config for Travis CI to run the tests automatically. 2014-09-09 23:17:17 -04:00
Christopher Peplin
c86ce093ce Add a script to compile examples as an automated test suite.
* Added script/boostrap.sh to download the Arduino IDE and MPIDE (for
    chipKIT). Tested in Linux, should work in Cygwin and OS X too.
* Added script/runtests.sh to run "make" in each example project and
    collect the results. The script returns -1 if any fails.
* Moved currently testable examples to a "tests" directory, separate
    from examples that require alternative cores.
2014-09-09 23:17:15 -04:00
Sudar
e30bb5c28a Merge pull request #245 from sej7278/master
Allow libraries/sketches to have the same name as system libs. Fix #229 Fix #244
2014-09-02 18:14:44 +05:30
Simon John
9a6b0ef75f Added *.cpp to extensions supported by "make generate_assembly" 2014-08-29 09:56:52 +02:00
Simon John
aa879d8db8 Allow libraries/sketches to have the same name as system libs,
e.g. main or Wire

Doesn't seem to work with main.cpp but main.ino works.

Fixes issue #229 and #244
2014-08-29 09:56:52 +02:00
Sudar
846636b139 Merge pull request #247 from jrbenito/master
Fix a typo in README
2014-08-29 08:19:51 +05:30
Joseivaldo Benito Junior
5420e920fb Small typo, can lead to copy and paste fails
Signed-off-by: Joseivaldo Benito Junior <jrbenito@benito.qsl.br>
2014-08-28 23:42:47 -03:00
Sudar
47c9ec8f68 Merge pull request #241 from sej7278/master
Fix regex for "make show_boards" on 1.5
2014-08-21 07:35:20 +05:30
Simon John
1239263896 Fix regex for "make show_boards" on 1.5
In 1.5.6 the Due board has an underscore, this regex tweak allows for:

arduino_due_x_dbg  Arduino Due (Programming Port)
arduino_due_x      Arduino Due (Native USB Port)
2014-08-17 19:29:43 +02:00
Sudar
08c3ff6809 Merge pull request #240 from sej7278/master
allows "make clean" to be extended

Fix #239
Fix #240
2014-08-17 10:27:32 +05:30
Simon John
421a40e261 allows "make clean" to be extended in the user's local makefile to clean
other files out, e.g. backup/git files
2014-08-16 19:31:07 +02:00
Sudar
e9c0a1e92e Merge pull request #237 from bgamari/patch-1
MakefileExample: Fix AVR_TOOLS_DIR default
2014-08-14 22:52:58 +05:30
Ben Gamari
a58062611e MakefileExample: Fix AVR_TOOLS_DIR default
Judging by the default for OS X directly above it and the fact that the current default doesn't work, it seems this should not include the `/bin`.
2014-08-14 12:14:40 -04:00
Sudar
e17b2a4781 Merge pull request #234 from WeAreLeka/std-flags
CFLAGS_STD and CXXFLAGS_STD
2014-08-14 14:59:44 +05:30
ladislas
51e65b0a08 add CFLAGS_STD and CXXFLAGS_STD defaults 2014-08-13 17:52:32 +02:00
Sudar
9bef267f62 Merge pull request #235 from sudar/revert-233-std-flags
Revert "Using CFLAGS_STD and CPPFLAGS_STD"
2014-08-13 10:14:12 +05:30
Sudar
209446c944 Revert "Using CFLAGS_STD and CPPFLAGS_STD" 2014-08-13 10:13:16 +05:30
Sudar
b4f80a1b65 Merge pull request #233 from WeAreLeka/std-flags
Using CFLAGS_STD and CPPFLAGS_STD
2014-08-12 23:00:42 +05:30
ladislas
a5b84b1722 create CPPFLAGS_STD and make both CFLAGS_STD and CPPFLAGS_STD avalaible for CFLAGS and CXXFLAGS 2014-08-12 18:11:24 +02:00
Sudar
bb7fc9ad3b Merge pull request #232 from sej7278/master
Add some documentation regarding overloading system libs
2014-08-08 17:47:08 +05:30
Simon John
331aea254e Add some documentation regarding overloading system libs and reporting bugs 2014-08-08 10:15:08 +02:00
Sudar
b24a2a7394 Merge pull request #230 from sej7278/master
Fix CFLAGS vs CXXFLAGS typo

Fix #229
2014-08-01 16:02:32 +05:30
Simon John
2f4d6c11f0 Fix CFLAGS vs CXXFLAGS typo 2014-08-01 12:17:06 +02:00
Sudar
92b775d794 Add information about Bare-Arduino-Project in README
Fix #220
Fix #221
Fix #225
2014-07-16 12:13:18 +05:30
Sudar
cc5268cceb Add "Interfacing with other projects" section in README 2014-07-16 12:08:32 +05:30
Sudar
d3a2f1743f Merge pull request #224 from WeAreLeka/update_objdir_clean
Allow "make clean" of any OBJDIR
2014-07-15 14:25:05 +05:30
ladislas
dfc7382368 Remove "./" in "make clean" to clean any OBJDIR & change "tinyladi" to "ladislas" in HISTORY.md 2014-07-15 10:25:38 +02:00
Sudar
93db89cb56 Merge pull request #222 from sej7278/1.5
Start of 1.5 development
2014-07-13 11:04:39 +05:30
Simon John
8cdae73deb Made all the changes into one commit that could be a patch for master 2014-07-12 19:05:35 +02:00
Sudar
542529ae4f Bump up version to v1.3.4 for release 2014-07-12 21:00:51 +05:30
Sudar
1f950db032 Merge pull request #218 from sej7278/master
Build core objects in subdirectory, fix issue #82 and fix #218
2014-07-01 11:03:45 +05:30
Simon John
437a0f54b5 Build core objects in subdirectory, fixes issue #82 2014-06-30 09:03:15 +02:00
Sudar
20ccdf1414 Merge pull request #217 from sej7278/master
Quote/regex/wildcard audit (fixes issue #192)
2014-06-29 10:18:39 +05:30
Simon John
7618da7f5f Added quotes around greps/cats to help alleviate possible problems
with spaces in directory/file-names.

Removed $TARGETS as it was an unsafe wildcard and was only used
in "make clean" which itself has been simplified to just delete
the $OBJDIR rather than waste time deleting individual files.
2014-06-29 00:14:18 +02:00
Sudar
87895de366 Merge pull request #216 from sej7278/master
Really fix $MONITOR_PORT detection. Fix #215
2014-06-22 10:57:03 +05:30
Simon John
e5b8125469 Really fix $MONITOR_PORT detection
Fixes issue #215
2014-06-21 12:32:34 +02:00
Sudar
1b33e8d741 Merge pull request #214 from sej7278/master
Fix $MONITOR_PORT detection, thanks choffmann

Fix #213
2014-06-15 21:51:28 +05:30
Simon John
583a9e4950 Fixed $MONITOR_PORT detection, thanks choffmann 2014-06-15 17:56:52 +02:00
Ronan Barzic
05a0c7d377 Make Arduino.mk compatible with Flymake
If Flymake is configured to parse .ino files the same way as for c/c++
files, it creates a temporary file (_flymake.ino) in the same directory
as the original file. It fails with the current Arduino.mk because of
the check for multiple .ino files. This fix removes the check
only when flymake is calling the Makefile (Flymake will call make with
the variable CHK_SOURCES set to the temporary file name)

To make Flymake working with .ino file :

Add :
check-syntax:
	$(CXX_NAME) -c -include Arduino.h   -x c++ $(CXXFLAGS)   $(CPPFLAGS)  -fsyntax-only $(CHK_SOURCES)

in the project Makefile after the inclusion of the Arduino.mk file

Edit the flymake configuration :
M-x customize-option RET
flymake-allowed-file-name-masks RET (using auto completion !)

Add the line :

("\\.ino\\'" flymake-simple-make-init)

Then click on "Apply and Save" button

Fix #211
2014-06-10 16:05:08 +05:30
Sudar
a4dc43b58f Merge pull request #210 from sej7278/master
Add missing newlines at end of some echo's. Fix #207
2014-05-27 16:53:33 +05:30
Simon John
cc93d7b0b2 Add missing newlines at end of some echo's (issue #207)
Whilst doing that, i noticed that there were some missing
targets to "make help" so added those in and re-ordered
and re-worded some of the targets to make more sense
e.g. all of the upload's are together, all of the
assemblers are together etc.
2014-05-27 11:25:23 +01:00
Sudar
29198023d9 Merge pull request #206 from sej7278/master
Fix alpha sort on those crazy Macs ;-)
2014-05-23 15:06:47 +05:30
Simon John
f5efbe5533 Fixed alpha sort on those crazy Macs ;-) 2014-05-23 09:29:41 +01:00
Sudar
ae54002365 Merge pull request #205 from sej7278/master
"make show_boards" now lists the board name as well as board tag.
2014-05-23 11:18:07 +05:30
Simon John
82afb2769f "make show_boards" now lists the board name as well as board tag.
also is alphabetically sorted by tag now.

Fixes #204
2014-05-22 23:35:43 +01:00
Sudar
423b0a7b8b Merge pull request #203 from sej7278/master
Some language clean up
2014-05-21 10:50:25 +05:30
Simon John
634bd9bc9c Some language clean up 2014-05-21 00:14:46 +01:00
Simon John
9a45b80017 Check that on windows ARDUINO_DIR (and MPIDE_DIR) is a relative path.
Checks for paths starting with / e.g. /cydrive/arduino or a
drive letter e.g. C:\Program Files\Arduino

Fix #201
Fix #202
2014-05-20 12:12:14 +05:30
Chris Patuzzo
70dfdcc7eb If no port is specified, try to guess it from wildcards
Fix #197
2014-05-03 09:01:24 +05:30
Sudar
22e876e88b Merge pull request #196 from sej7278/master
Fix lintian "hyphen-used-as-minus-sign" warning in manpage
2014-04-26 09:33:17 +05:30
Simon John
dbf252e9c5 Fixed lintian "hyphen-used-as-minus-sign" warning in manpage 2014-04-26 00:26:15 +02:00
hrobeers
041d54d9ab Add support for assembler code in libraries
Fix #195
2014-04-25 14:31:32 +05:30
Sudar
6c37b19b38 Merge pull request #194 from sej7278/master
fix typo - should be ARDUINO_SKETCHBOOK not ARDUINO_VERSION
2014-04-22 08:16:33 +05:30
Simon John
fc6ff0f041 fixed typo - should be ARDUINO_SKETCHBOOK not ARDUINO_VERSION 2014-04-21 19:42:23 +02:00
Sudar
70af7d49ec Merge pull request #193 from sej7278/master
Add easier ccache workaround for Fedora
2014-04-21 10:52:04 +05:30
Simon John
cbe3011711 Added easier instructions to workaround ccache on Fedora. Prettified. 2014-04-21 00:56:11 +02:00
Pierre DAVID
aa4c96ce50 Allow spaces in "Serial.begin (....)"
Fix #190
Fix #191
2014-04-14 12:24:13 +05:30
Simon John
b42d05d8b1 Bump up version to v1.3.3 for release
Fix #189
2014-04-13 09:56:32 +05:30
Simon John
fc54954d0f Add manpage back to specfile
Includes following changes
- change author info
- add examples section

Fix #188
2014-04-13 09:56:20 +05:30
Sudar
ba2b27db28 Bump up version to v1.3.2 for release 2014-04-11 20:26:11 +05:30
EAGMnor
32d35da2a0 Tweak AVRdude conf file detection in windows
On windows the AVRdude configuration file is now detected properly. The
comments and `README` are updated as well.

Fix #187
2014-04-11 20:24:17 +05:30
Sudar
87129f1d2b Merge pull request #185 from sej7278/master
simplify packaging by removing dependencies on python3/pyserial
2014-04-05 18:12:12 +05:30
Simon John
7b5a163e9a simplified packaging by removing dependencies on python3/pyserial 2014-04-04 21:54:26 +01:00
Sudar
10ea6fbc33 Merge pull request #183 from sej7278/master
python3 compatibility
2014-04-03 09:12:32 +05:30
Simon John
c080fb29b7 python3 compatibility 2014-04-02 17:57:58 +01:00
Simon John
392a6b9db1 replace perl reset script with python one
Fix #180
Fix #127
2014-04-02 18:57:00 +05:30
Simon John
5599d2ab1e Add BOOTLOADER_PARENT which has to be set if the user sets either of the other two BOOTLOADER variables
Fix #178
2014-03-23 18:30:37 -07:00
Julien Ridoux
ffde764ada Add phony target to run pre-build hook script
Fix #176
2014-03-20 11:17:14 -07:00
Sudar
64e9074042 Merge pull request #177 from geoffholden/master
Consider usb... to be a valid ISP_PORT
2014-03-16 06:30:51 -07:00
Geoff Holden
ce89531226 Fix: Consider usb... to be a valid ISP_PORT
AVRDUDE requires -P usb to be passed as an argument for some ISP
devices, and it is also required in the case where you have multiple
usbtiny or usbasp devices connected at once to select a specific one.

Fix #167
2014-03-14 16:10:18 -02:30
Christopher Peplin
f1a79dbb3f Fix AVR tools paths for chipKIT in Linux.
Fix #175
Fix #174
2014-03-11 09:51:01 +05:30
tinyladi
a06136aafc Beautify arduino-mk-vars.md
Clean up markdown and add code blocks where needed

Fix #171
2014-03-06 22:50:05 +05:30
tinyladi
5c4328dd29 Add OBJDIR reference to arduino-mk-vars.md
Signed-off-by: tinyladi <ladislas@weareleka.com>
2014-03-06 22:50:01 +05:30
tinyladi
668a447054 Add a reference makefile, with real-world example 2014-03-06 22:48:25 +05:30
Simon John
f62b5838df Add -D__PROG_TYPES_COMPAT__ to the avr-g++ compiler flags
This results in just a deprecated warning rather than an error
when using libraries (e.g. jeelib) that still use prog_XXX types

This is how the IDE does it, and means that libraries don't have to
add the #define __PROG_TYPES_COMPAT__ line

Reference: http://www.nongnu.org/avr-libc/user-manual/group__avr__pgmspace.html

Fix #169
2014-02-15 16:57:16 +05:30
Simon John
ff103b244c Add "gpio" to the list of isp's that don't have a port
The gpio programmer type is used on the raspberry pi to upload using
the gpio spi pins via a sysfs interface, with a modified avrdude

Fix #165
Fix #166
2014-02-08 09:59:50 +05:30
Sudar
0b954ab5a5 Merge pull request #164 from sej7278/master
Include avr-libc/*.c files malloc.c and realloc.c
2014-02-06 10:21:35 +05:30
Simon John
920c74024e now includes avr-libc/*.c files malloc.c and realloc.c
if bug-reporter confirms this fixes issue #163 then should be ok to merge.
2014-02-05 23:31:12 +00:00
Sudar
5d5704ff97 Merge pull request #162 from sej7278/master
Add arduino-mk-vars.md to the RPM SPECfile.
2014-02-04 18:59:53 -08:00
Simon John
5a521361a0 Added the arduino-mk-vars.md file to the Fedora SPECfile.
Added some notes to the SPECfile regarding overriding the paths
to the avr tools - most are in /usr/bin, but gcc/g++ are in an
architecture-dependant ccache directory

Upped version to 1.3.2 devel
2014-02-04 17:41:51 +00:00
Sudar
e48ae82fbd Bump up version to 1.3.1 for release 2014-02-04 18:29:18 +05:30
Sudar
cff1dec365 Add a new target help_vars
This target can display all variables that can be overridden
2014-02-04 18:27:46 +05:30
Sudar
e8634fb642 Document all the variables that can be overridden in child makefile
Huge thanks to @sej7278 for doing this

Fix #75
2014-02-04 18:26:43 +05:30
Sudar
9a49615e07 Merge pull request #161 from sej7278/master
BUNDLED_AVR_TOOLS_DIR is now set correctly
2014-02-02 06:06:32 -08:00
Simon John
1893199dad BUNDLED_AVR_TOOLS_DIR is now set correctly using := instead of ?=,
so that installations using only the arduino-core packages that
don't have the $(ARDUINO_DIR)/hardware/tools/avr directory can
still use the avr-g++ tools found in the $PATH (/usr/bin)

Previously BUNDLED_AVR_TOOLS_DIR was set to an empty string as
the directory doesn't exist, which meant that "ifdef BUNDLED_AVR_TOOLS_DIR..."
was set rather than skipping to "else SYSTEMPATH_AVR_TOOLS_DIR...."

No user would set BUNDLED_AVR_TOOLS_DIR so the assignment operator
:= should be used not ?=

Updated the version info/changes in various locations.
2014-02-01 00:41:00 +00:00
Sudar
20b9774645 Bump up version to v1.3.0 for release 2014-01-29 11:53:26 +05:30
Sudar
f549f9c401 Fix some typos and errors in changelog 2014-01-29 11:38:05 +05:30
Sudar
0526855340 Update README.md about compatibility with Windows
Fix #94
2014-01-29 11:32:16 +05:30
Sudar
967d47c7bd Update changelog about the recent changes 2014-01-29 10:58:25 +05:30
Sudar
33813e09d8 Merge pull request #159 from peplin/simpler-crossplatform-paths
Override complete compiler tool paths for chipKIT.
2014-01-28 21:21:57 -08:00
Sudar
afdb27656b Merge pull request #158 from peplin/silent-which
Silence the stderr output from call to `which`.
2014-01-28 21:21:15 -08:00
Sudar
993cb0b8d4 Merge pull request #157 from peplin/no-hardcoded-port-in-examples
Don't hard code MONITOR_PORT in examples, for more flexible testing.
2014-01-28 21:20:36 -08:00
Sudar
418109c11b Document that ARDUINO_DIR must be a relative path in Windows
Fix #156
2014-01-29 10:44:12 +05:30
Sudar
9463195834 Merge pull request #155 from peplin/monitor-port-check
Use more reliable serial device naming in Windows.
2014-01-28 20:58:45 -08:00
Christopher Peplin
427c4573cd Document that ARDUINO_DIR must be a relative path in Windows. 2014-01-28 10:31:40 -05:00
Christopher Peplin
5445142acf Use more reliable serial device naming in Windows.
* Strip leading "/dev/" from MONITOR_PORT before handing to avrdude in Windows.
* Use the more widely available awk tool instead of bc to subtract 1
    from COM ID (as opposed to `bc`).
* Allow Windows user to specify "com1" or just "1".
* Document MONITOR_PORT format for Windows users.
2014-01-28 10:00:37 -05:00
Christopher Peplin
e50caad1e9 Don't hard code MONITOR_PORT in examples, for more flexible testing. 2014-01-28 09:44:33 -05:00
Christopher Peplin
d3a8fcac00 Silence the stderr output from call to which. 2014-01-28 09:44:08 -05:00
Christopher Peplin
067afbb8e4 Override complete compiler tool paths for chipKIT.
Previously we were setting the AVR tools path to the PIC32 tools path because it
made grabbing the compiling tools easier. Consequently, it made finding the
avrdude path much harder, especially since the avrdude files are in different
locations in the Linux distributions of MPIDE and Arduino.

Instead, we set the AVR tools path to the *correct* path (where *AVR* dude
lives), and totally override the CC, CXX, etc. paths to point to their PIC32
equivalents.
2014-01-28 09:43:33 -05:00
Sudar
ac0b7d46c3 Freezing up code for v1.2.0 release 2014-01-14 14:38:44 +05:30
Sudar
ce9c54848f Remove arduino-mk folder from all examples
Fix #154
2014-01-14 14:36:24 +05:30
Simon John
d4e0a383ae Simplify package vs git checkout detection
Fix #147
Fix #151
Fix #153

The following are the detailed changes

- Remove ARDMK_PATH, ARDMK_FILE and arduino-mk subdirectory
- Looks for ard-reset-arduino in $PATH or ARDMK_DIR/bin
- Fix git-archive command in RPM SPEC file
- Remove some whitespace
- Remove arduino-mk dir from debian package's arduino-mk.install
- Update docs to reflect the above changes
- Bump Up version to 1.2.0
2014-01-14 14:23:25 +05:30
Simon John
fa6b9215c8 Move files out of arduino-mk subdirectory
fix #152
2014-01-14 14:23:25 +05:30
Sudar
320fec7981 Add information about package folder to changelog 2014-01-14 14:23:00 +05:30
Sudar
c2aacb9487 Merge pull request #146 from sej7278/master
Debian package rebuild instructions.
2014-01-04 20:58:17 -08:00
Simon John
cec6553cf9 Added some more build dependencies to ensure everything needed to build is
installed.
2014-01-05 01:19:23 +00:00
Simon John
277a98b2c8 Debian package rebuild instructions.
Shows a user how to make their own Debian packages from Git. Also has
instructions for getting official upstream builds for their distro.
2014-01-05 00:45:02 +00:00
Sudar
d3af7ca19d Merge pull request #145 from sej7278/master
Added package directory with RPM SPECfile (and instructions!)
2014-01-01 05:19:27 -08:00
Simon John
4e2b945dd1 Changed documentation to use new path, also added dependency info.
Tested on Fedora 20 - help2man still a bit iffy
2013-12-30 20:07:22 +00:00
Simon John
371377e0ac moved to better directory layout 2013-12-30 19:36:42 +00:00
Simon John
9ad2c858ce Added package directory with RPM SPECfile (and instructions!)
Linked to issue #144

Tested on Fedora 18, works fine except the ard-reset-arduino manpage displays
[1m and [0m around some headings, might be a bug in help2man 1.41.2 as it
works fine on Debian with 1.43.3, will try CentOS/OEL 6.5 next.

I didn't update the changelog as I didn't know what the new development
version is going to be.
2013-12-30 16:07:36 +00:00
Sudar
6e2708a446 Bump up version number to v1.1.0 for release 2013-12-26 16:07:58 +05:30
Sudar
cf6ffb5d6e Add information about license in README.md
Fix #128
2013-12-26 16:05:46 +05:30
Sudar
7af27ae494 Use ARDUINO_HEADER variable instead of hardcoded file names
Fix #131
2013-12-26 16:00:08 +05:30
Sudar
a51754c2b2 Merge pull request #143 from mahoy/master
Allow target specific optimization levels/debug flags
2013-12-20 08:40:58 -08:00
mahoy
d3e7eedd5f Allow target specific optimization levels/debug flags
Changing the optimization level from -Os to something else breaks the
SoftwareSerial library. This patch allow optimization flags to be set on a
per target basis.
2013-12-20 17:25:18 +01:00
Sudar
e721a249cd Add CONTRIBUTING.md explaining how to contribute to this project 2013-12-17 17:28:59 +05:30
Sudar
672d6f40cf Update changelog about the last pull request #142 2013-12-17 15:38:26 +05:30
Sudar
67b5d06cc8 Merge pull request #142 from sej7278/master
User-defined or calculated bootloader parent directory
2013-12-17 01:50:40 -08:00
Simon John
fc92c24cc0 User-defined or calculated bootloader parent directory, allows for
relative paths as defined in boards.txt  e.g. "atmega"

Also added [USER] to ARDUINO_SKETCHBOOK detection

Fixes #126
2013-12-17 09:15:33 +00:00
Sudar
38255ed0f0 Update changelog about usbtiny fix 2013-12-16 23:36:50 +05:30
Sudar
1ad771fea9 Merge pull request #140 from PPvG/master
Don't append port details to avrdude for usbtiny
2013-12-16 10:03:29 -08:00
Simon John
7ea19ce322 Add option to set fuses without burning a bootloader
When using ICSP programmers e.g. usbasp, you can burn sketches directly
to the chip without having to burn a bootloader, however you do need to
set fuses e.g. if you're changing speed/BOD.

Updated help text to include "make set_fuses" and also changed
"make burn_bootloader" help text which wasn't entirely accurate.

Fix #141
2013-12-16 23:14:32 +05:30
Peter-Paul van Gemerden
5dc5cf2257 Don't append port details to avrdude for usbtiny
Fix 138
2013-12-13 10:19:29 +01:00
Sudar
25a00d73b7 Merge pull request #137 from peplin/chipkit-avrdude-mac
Adjust path to avrdude/avrdude.conf for MPIDE in Linux.
2013-12-09 05:47:19 -08:00
Christopher Peplin
bc03025596 Adjust path to avrdude/avrdude.conf for MPIDE in Linux. 2013-12-08 15:07:36 -05:00
anthony cantor
24128a1819 Use MAKEFILE_LIST to get the name of the make file
This way we don't assume the make file is 'Makefile' and it will
work even if it is named as 'makefile' or 'makefile-uno'

Fix #130
2013-12-05 12:25:53 +05:30
Ladislas
e04bb4d7d4 Auto detect and include libraries specified in USER_LIB_PATH
Fix #135
2013-12-05 12:12:15 +05:30
Sudar
7bacc727a8 Update HISTORY.md about ChipKIT 2013 support 2013-12-05 11:51:03 +05:30
Christopher Peplin
ef521d284a Include assembly vector table in chipKIT build.
* Added build step for assembly files in CORE
* Removed duplicate flags from AS build step
2013-12-03 11:24:19 -05:00
Christopher Peplin
58f1cb249c Add common linker script for MPIDE version 0023-*-20130817-test. 2013-12-03 10:27:44 -05:00
Thomas Sigurdsen
d32d612a4b Change echo for printf
rationale:
http://unix.stackexchange.com/questions/65803/why-is-printf-better-than-echo

fix #129
2013-11-27 17:07:47 +05:30
Sudar
51f1271b32 Show correct path to arduino.mk file in help message
Fix #120
2013-10-06 19:20:52 +05:30
Sudar
4fb3e089bb Add burn_bootloader target
Code to burn fuses is moved from ispload target to this new target, so
that fuses are burned only once when needed.

Fix #85
2013-10-06 19:14:50 +05:30
Sudar
7961a86286 In ISP mode, read baudrate and programmer from boards.txt
Arduino IDE also reads this from boards.txt file

Fix #125
2013-10-06 18:14:58 +05:30
Sudar
a17cf2af96 Ignore commented lines while parsing boards.txt file
Fix #124
2013-10-06 18:13:32 +05:30
Sudar
9ff2b2e4d6 Don't append port details to avrdude for usbasp
When usbasp is used as programmer, there is no need to specify the port
to avrdude.

Fix #123
2013-10-06 17:43:03 +05:30
Sudar
9c22972b98 Bump up version to v1.0.1 for release
This is just a minor bug fix release
2013-09-25 15:22:05 +05:30
Sudar
85d2d2ec6e Fix whitespace and line spacing
No change in functionality
2013-09-25 15:21:21 +05:30
Sudar
0f68487501 Unconditionally add -D in avrdude options.
This is needed in Mega boards, because of a bug in Mega bootloader. See
https://github.com/sudar/Arduino-Makefile/issues/114#issuecomment-25011005
for detailed explanation.

Fix #114
2013-09-25 15:18:14 +05:30
Sudar
7ad24ef8d2 Fix link to colorgcc in readme 2013-09-22 18:36:10 +05:30
Sudar
8cf353d551 Bump up version to v1.0.0 for release 2013-09-22 18:31:44 +05:30
Sudar
5b80b540bb Add note about using colorgcc with this makefile
Fix #119
2013-09-22 18:26:59 +05:30
Sudar
c93304cf94 Add a README file for /examples folder
Fix #74
2013-09-22 18:23:10 +05:30
Sudar
6300679343 Revert "Make all executables overridable"
If these executables are not overridden in the child makefile, then the
default values are not set properly in the master makefile.

This complicates the solution for #119 :(

This reverts commit 66eec82a3a.
2013-09-19 16:22:28 +05:30
Sudar
9004efd944 Change the next version to 1.0.0, instead of 0.13.0
Lot of changes went it for this release and the code is stable enough
for 1.0.0
2013-09-18 16:46:12 +05:30
Sudar
66eec82a3a Make all executables overridable
This is helpful for #119 which will add support for colorgcc
2013-09-18 16:44:24 +05:30
Sudar
50e407f8a7 Remove redundant list of targets
After #118, we have a separate target (help) to list all available
targets. Having this list in a single place is better, since we don't
have to make changes in multiple places when things change.
2013-09-18 16:38:58 +05:30
Sudar
f9027d4d13 Whitespace and formatting fix
No code or functionality change
2013-09-18 16:30:16 +05:30
Sudar
099510ef5b Merge branch 'help' of github.com:dapicester/Arduino-Makefile into dapicester-help 2013-09-15 12:55:56 +05:30
Sudar
3f4e2bf2ff Added detailed instructions for using alternative cores
Should close Issue #60
2013-09-15 12:53:19 +05:30
Paolo D'Apice
b2eaca9b2e Added help target showing a summary of all the available targetsx 2013-09-15 15:01:07 +08:00
Sudar
91ea12a630 Merge pull request #116 from sej7278/master
Add detailed instructions for using alternative cores

Fix #60
2013-08-18 23:03:42 -07:00
Simon John
c7f4400822 Added detailed instructions for using alternative cores
Should close Issue #60
2013-08-18 19:55:37 +02:00
71 changed files with 7852 additions and 1431 deletions

1
.gitignore vendored
View file

@ -1,3 +1,4 @@
*.o
build-cli
/.project
build-*

15
.travis.yml Normal file
View file

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

1917
Arduino.mk Normal file

File diff suppressed because it is too large Load diff

36
CONTRIBUTING.md Normal file
View file

@ -0,0 +1,36 @@
# Contributing To Arduino Makefile
Community made patches, localizations, bug reports, documentation and contributions are always welcome and are crucial to the success of this project.
When contributing please ensure you follow the guidelines below so that we can keep on top of things.
## Getting Started
Submit a ticket for your issue, assuming one does not already exist.
- Raise it on our [Issue Tracker](https://github.com/sudar/Arduino-Makefile/issues)
- Clearly describe the issue including steps to reproduce the bug.
- Make sure you fill in the earliest version that you know has the issue as well as the following
- Your operating system (Mac, Linux/Unix, Windows)
- Your Arduino IDE version
- Snippet of your makefile
## Making Changes
- Fork the repository on GitHub
- Make the changes to your forked repository
- Update the [changelog file](HISTORY.md) and add a note about your change. If possible prefix it with either Fix, Tweak or New
- If you are adding or changing the behavior of any variable, then update the corresponding documentation in the [arduino-mk-vars.md](arduino-mk-vars.md) file as well
- When committing, reference your issue (if present) and include a note about the fix
- If possible (and if makes sense) do atomic commits
- Try to follow [this guideline](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) while choosing the git commit message
- If it makes sense then add a unit test case for the changes that you are making
- Push the changes to your fork and submit a pull request to the 'master' branch of the this repository
At this point you're waiting on us to merge your pull request. We'll review all pull requests, and make suggestions and changes if necessary.
# Additional Resources
- [General GitHub Documentation](http://help.github.com/)
- [GitHub Pull Request documentation](http://help.github.com/send-pull-requests/)
- [Guide about contributing code in GitHub](http://sudarmuthu.com/blog/contributing-to-project-hosted-in-github)

138
Common.mk Normal file
View file

@ -0,0 +1,138 @@
COMMON_INCLUDED = TRUE
# Useful functions
# Returns the first argument (typically a directory), if the file or directory
# named by concatenating the first and optionally second argument
# (directory and optional filename) exists
dir_if_exists = $(if $(wildcard $(1)$(2)),$(1))
# result = $(call READ_BOARD_TXT, 'boardname', 'parameter')
PARSE_BOARD = $(shell if [ -f $(BOARDS_TXT) ]; \
then \
$(GREP_CMD) -Ev '^\#' $(BOARDS_TXT) | \
$(GREP_CMD) -E "^[ \t]*$(1).$(2)=" | \
cut -d = -f 2- | \
cut -d : -f 2; \
fi)
# Run a shell script if it exists. Stops make on error.
runscript_if_exists = \
$(if $(wildcard $(1)), \
$(if $(findstring 0, \
$(lastword $(shell $(abspath $(wildcard $(1))); echo $$?))), \
$(info Info: $(1) success), \
$(error ERROR: $(1) failed)))
# For message printing: pad the right side of the first argument with spaces to
# the number of bytes indicated by the second argument.
space_pad_to = $(shell echo "$(1) " | head -c$(2))
# Call with some text, and a prefix tag if desired (like [AUTODETECTED]),
show_config_info = $(call arduino_output,- $(call space_pad_to,$(2),20) $(1))
# Call with the name of the variable, a prefix tag if desired (like [AUTODETECTED]),
# and an explanation if desired (like (found in $$PATH)
show_config_variable = $(call show_config_info,$(1) = $($(1)) $(3),$(2))
# Just a nice simple visual separator
show_separator = $(call arduino_output,-------------------------)
# Master Arduino Makefile include (after user Makefile)
ardmk_include = $(shell basename $(word 2,$(MAKEFILE_LIST)))
$(call show_separator)
$(call arduino_output,$(call ardmk_include) Configuration:)
########################################################################
#
# Detect OS
ifeq ($(OS),Windows_NT)
CURRENT_OS = WINDOWS
GREP_CMD = grep
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
CURRENT_OS = LINUX
GREP_CMD = grep
endif
ifeq ($(UNAME_S),Darwin)
CURRENT_OS = MAC
ifeq (, $(shell which gggrep))
$(info Using macOS BSD grep, please install GNU grep to avoid warnings)
GREP_CMD = grep
else
GREP_CMD = ggrep
endif
endif
endif
$(call show_config_variable,CURRENT_OS,[AUTODETECTED])
########################################################################
#
# Travis-CI
ifneq ($(TEST),)
DEPENDENCIES_DIR = /var/tmp/Arduino-Makefile-testing-dependencies
DEPENDENCIES_MPIDE_DIR := $(shell find $(DEPENDENCIES_DIR) -name 'mpide-0023-*' -type d -exec ls -dt {} + | head -n 1)
ifeq ($(MPIDE_DIR),)
MPIDE_DIR = $(DEPENDENCIES_MPIDE_DIR)
endif
ifndef ARDUINO_IDE_DIR
ifeq ($(CURRENT_OS),MAC)
ARDUINO_IDE_DIR = Arduino.app/Contents/Resources/Java
else
ARDUINO_IDE_DIR := $(shell basename $(basename $(basename $(lastword $(wildcard $(DEPENDENCIES_DIR)/arduino*)))))
endif
endif
DEPENDENCIES_ARDUINO_DIR = $(DEPENDENCIES_DIR)/$(ARDUINO_IDE_DIR)
ifeq ($(ARDUINO_DIR),)
ARDUINO_DIR = $(DEPENDENCIES_ARDUINO_DIR)
endif
endif
########################################################################
# Arduino Directory
ifndef ARDUINO_DIR
AUTO_ARDUINO_DIR := $(firstword \
$(call dir_if_exists,/usr/share/arduino) \
$(call dir_if_exists,/Applications/Arduino.app/Contents/Resources/Java) \
$(call dir_if_exists,/Applications/Arduino.app/Contents/Java) )
ifdef AUTO_ARDUINO_DIR
ARDUINO_DIR = $(AUTO_ARDUINO_DIR)
$(call show_config_variable,ARDUINO_DIR,[AUTODETECTED])
else
echo $(error "ARDUINO_DIR is not defined")
endif
else
$(call show_config_variable,ARDUINO_DIR,[USER])
endif
ifeq ($(CURRENT_OS),WINDOWS)
ifneq ($(shell echo $(ARDUINO_DIR) | egrep '\\|[[:space:]]|cygdrive'),)
echo $(error On Windows, ARDUINO_DIR and other defines must use forward slash and not contain spaces, special characters or be cygdrive relative)
endif
endif
########################################################################
# System Python
ifndef PYTHON_CMD
# try for Python 3 first
PYTHON_CMD := $(shell which python3 2> /dev/null)
ifdef PYTHON_CMD
$(call show_config_variable,PYTHON_CMD,[AUTODETECTED])
else
# fall-back to any Python
PYTHON_CMD := $(shell which python 2> /dev/null)
ifdef PYTHON_CMD
$(call show_config_variable,PYTHON_CMD,[AUTODETECTED])
else
echo $(error "Unable to find system Python! Utility scipts won't work. Override this error by defining PYTHON_CMD")
endif
endif
else
$(call show_config_variable,PYTHON_CMD,[USER])
endif

View file

@ -1,9 +1,211 @@
A Makefile for Arduino Sketches
===============================
The following is the rough list of changes that went into different versions. I tried to give credit whenever possible. If I have missed anyone, kindly add it to the list.
The following is the rough list of changes that went into different versions.
I tried to give credit whenever possible. If I have missed anyone, kindly add it to the list.
### 0.13.0 (in development)
### In Development
- Fix: Moved CORE_LIB to the last position of the defined linked objects. (https://github.com/wingunder)
- Fix: Moved ATtiny examples to ATtinyBlink, updated alternate core instructions (issue #537) (https://github.com/sej7278)
- Fix: Add -fno-devirtualize flag to workaround g++ segfault bug (issue #486). (https://github.com/sej7278)
- Fix: Quote the prefix tag in the space_pad_to function
- Fix: recognize serial monitors with full path in MONITOR_CMD
- Fix: Grab USB_PRODUCT and USB_MANUFACTURER from boards.txt for 32u4 boards (issue #594).
- Fix: Show the configuration when ARDUINO_QUIET=0
- Fix: Travis build and bring Arduino IDE upto date
- Fix: Builds for SAMD-based boards use the C++ compiler for linking (issue #644). (https://github.com/kpfleming)
- Tweak: Move chip erase flag from set_fuses to ispload to prevent sketch being nuked when setting fuses
- Tweak: Set ARDMK_VERSION to 1.6 (https://github.com/sej7278)
- Tweak: Move non-standard-related items from CxxFLAGS_STD to CxxFLAGS (issue #523) (https://github.com/sej7278)
- Tweak: Update Windows usage documentation and allow non-relative paths (issue #519) (https://github.com/tuna-f1sh)
- Tweak: Support Cygwin Unix Python and Windows installation on Windows to pass correct port binding. (https://github.com/tuna-f1sh)
- Tweak: Update how avr-size is called on Sam, also moved to gnu11 std (issue #602) (https://github.com/tuna-f1sh)
- Tweak: Detect most recent toolchain if multiple found, add `*_VER` variable to override (issue #611) (https://github.com/tuna-f1sh)
- New: Added -fdiagnostics-color to \*STD flags (https://github.com/sej7278)
- New: Made -fdiagnostics-color take a variiable DIAGNOSTICS_COLOR_WHEN: never, always, auto. (https://github.com/wingunder)
- New: Add generation of tags file using ctags, which automatically includes project libs and Arduino core. (https://github.com/tuna-f1sh)
- New: Add template Makefile and project boilerplate initialise script, `ardmk-init`. (https://github.com/tuna-f1sh)
- New: Support atmelice_isp JTAG tool as ISP programmer. (https://github.com/tuna-f1sh)
- New: Compatibility with deprecated pgmspace.h API can now be disabled since it sometimes causes bogus compiler warnings (issue #546)
- New: Support Arduino ARM SAMD devices (Zero, M0 Pro, Feather M0). (https://github.com/tuna-f1sh)
- New: Support Arduino ARM SAM devices (Due). (https://github.com/tuna-f1sh)
- New: Moved the PARSE_BOARD macro to Common.mk and use only this to parse the boards.txt file. (https://github.com/wingunder)
- New: Added the TOOL_PREFIX variable for setting up the executable tools centrally and generically. (https://github.com/wingunder)
- New: Add support for BOARD_CLOCK for board.menu.speed and board.menu.clock entries in boards.txt files. (https://github.com/dewhisna)
- New: Updated Arch instructions. (https://github.com/Akram-Chehaima)
- New: Add support for Robotis OpenCR 1.0 boards.
- New: Build the ArduinoCore API
- New: Support for Python 3 and multi-os Python installation using new PYTHON_CMD variable.
- New: Add "ARDUINO_{build.board}" to be able to detect board type.
### 1.6.0 (2017-07-11)
- Fix: Allowed for SparkFun's weird usb pid/vid submenu shenanigans (issue #499). (https://github.com/sej7278)
- Fix: Do not include the Arduino header when calling generate_assembly on .cpp files. (https://github.com/Batchyx)
- Fix: Auto-detect F_CPU on Teensy from boards.txt (https://github.com/DaWelter)
- Fix: params typo in PuTTY section (issue #487) (https://github.com/ericdand)
- Fix: Fixed sed expression to properly format show_submenu (issue #488) (https://github.com/cbosdo)
- Tweak: Removed tilde from documentation (issue #497). (https://github.com/sej7278)
- New: Add support for good old cu as monitor command (issue #492) (https://github.com/mwm)
- New: Add a documentation how to setup Makefile for 3rd party boards (issue #499). (https://github.com/MilanV)
- New: Add support for Robotis OpenCM boards
- Fix: Syntax of inner conditional statements of monitor command evaluated when MONITOR_CMD = putty
### 1.5.2 (2017-01-11)
- New: Add LTO support for users with avr-gcc > 4.9 (issue #446 & #456) (https://github.com/sej7278)
- Tweak: Updated Linux instructions and sync documentation from the old blog(), README.md and Arduino.mk (https://github.com/az-z)
- Tweak: Documentation for Windows updated to include installation of PySerial (https://github.com/sovcik)
- Fix: Updated CXXFLAGS_STD to match upstream 1.6 (issue #424) (https://github.com/calvinli)
- Fix: Added support for attiny core's use of chip instead of cpu in submenus (https://github.com/straccio)
- Fix: ARDUINO_VERSION can cope with the longer 1.6.10 version string (issue #444) (https://github.com/sej7278)
- Fix: Changed PARSE_BOARD to handle colons in e.g. CORE or VARIANT (issue #461) (https://github.com/sej7278)
- Fix: Changed Teensy.mk to support Arduino 1.6.12 and Teensyduino 1.30 (issues #383 , #431) (https://github.com/georgeharker)
### 1.5.1 (Debian version: 1.5-3) (2016-02-22)
- New: Add show_submenu target (https://github.com/drewhutchison)
- New: Add AVR Dragon to list of ISP's without a port (https://github.com/mtnocean)
- New: Add more board examples to Blink demo (https://github.com/sej7278)
- New: Add option to split avrdude MCU from avr-gcc MCU (Issue #357) (https://github.com/hhgarnes)
- New: Add support for /dev/tty.wchusbserial* (comes with cheap clones - DCCduino) (https://github.com/biesiad)
- New: Add support for picocom as serial monitor (https://github.com/biesiad)
- Tweak: Add support for Adafruit trinket3/trinket5/protrinket3/protrinket5 by improved BOARDS_TXT parsing (Issue #393) (https://github/com/zabereer)
- Tweak: Looks for submenu items first when parsing BOARDS_TXT (Issue #347) (https://github.com/sej7278)
- Tweak: Various spelling/grammar/typo fixes (https://github.com/dcousens)
- Tweak: Clarified some 1.5+ issues in docs (Issue #352) (https://github.com/sej7278)
- Tweak: Added some more Continuous Integration tests (https://github.com/sej7278)
- Tweak: Updated Fedora instructions (https://github.com/sej7278)
- Fix: Preserve original extension for object files, support asm sources in core, fixes pulseInASM (Issue #255, #364) (https://github.com/sej7278)
- Fix: Make sure TARGET is set correctly when CURDIR contains spaces (https://github.com/svendahlstrand)
- Fix: Ensure AVRDUDE_CONF is set when AVR_TOOLS_DIR is, not just on Windows (Issue #381) (https://github.com/sej7278)
- Fix: Rename VENDOR to ARDMK_VENDOR to workaround tcsh issue (Issue #386) (https://github.com/sej7278)
- Fix: Document OSX 1.0/1.6 ARDUINO_DIR differences (https://github.com/thomaskilian)
- Fix: Fix regex to support BOARD_TAGs with hyphens e.g. attiny44-20 (https://github.com/sej7278)
- Fix: Remove check for BOOTLOADER_PATH, just check for BOOTLOADER_FILE (Issue #402) (https://github.com/sej7278)
- Fix: Port ard-reset-arduino to pyserial 3.0 (#407, #408) (https://github.com/gauteh)
### 1.5 (2015-04-07)
- New: Add support for new 1.5.x library layout (Issue #275) (https://github.com/lukasz-e)
- New: Add support for 1.5.x vendor/hardware architecture library location (Issue #276) (https://github.com/lukasz-e)
- New: Added test suite and integration with travis CI. (https://github.com/peplin)
- New: Add information about `Bare-ArduinoProject` in README. (https://github.com/ladislas)
- New: Add information about reporting bugs to the correct project (Issue #231). (https://github.com/sej7278)
- New: Add documentation about CFLAGS_STD and CXXFLAGS_STD (Issue #234) (https://github.com/ladislas)
- New: Allow "make clean" target to be extended (Issue #239). (https://github.com/sej7278)
- New: Add makefile and gcc version info to config output. (https://github.com/sej7278)
- New: Support for Teensy 3.x (https://github.com/stepcut)
- New: Support for PuTTY under Windows (https://github.com/PeterMosmans)
- New: Add support for installation using homebrew(https://github.com/ladislas)
- New: Add support and example for flashing on a remote RPi. (https://github.com/Gaboose)
- Tweak: Update Makefile-example.mk with STD flags (https://github.com/ladislas)
- Tweak: Allow remove of any OBJDIR with `$(REMOVE) $(OBJDIR)`. (https://github.com/ladislas)
- Tweak: Add cpp to extensions supported by "make generate_assembly". (https://github.com/sej7278)
- Tweak: Update travis-ci to test against Arduino 1.0.6. (https://github.com/sej7278)
- Tweak: Updated package instructions for Arch/Fedora/Raspbian. (https://github.com/sej7278)
- Tweak: Remove $(EXTRA_XXX) variables (Issue #234) (https://github.com/ladislas)
- Tweak: Moved location of avrdude for 1.5.8 on Linux (Issue #301) (https://github.com/sej7278)
- Tweak: Allow 'build.core' param as found in [arduino-tiny](https://code.google.com/p/arduino-tiny/) Prospective Boards.txt. (https://github.com/Gaboose)
- Tweak: Replace CXX_NAME with CXX as per the Emacs Flymake Wiki (Issue #309) (https://github.com/sej7278)
- Tweak: Ability to override `USB_TYPE` in Teensy.md (Issue #313) (https://github.com/Poofjunior)
- Tweak: Integration instructions for CodeBlocks IDE (Issue #321) (https://github.com/fbielejec)
- Tweak: Add BOARD_SUB to OBJDIR if defined in 1.5+ (https://github.com/sej7278)
- Tweak: Add = to PARSE_BOARD regex to make it less greedy and not match vid.0, vid.1 and vid (https://github.com/sej7278)
- Tweak: Added note about clock submenu's being used as F_CPU (https://github.com/sej7278)
- Tweak: Better autodetection of ARDUINO_SKETCHBOOK and ARDUINO_DIR on OSX (https://github.com/sej7278)
- Fix: Improved Windows (Cygwin/MSYS) support (https://github.com/PeterMosmans)
- Fix: Change "tinyladi" username to "ladislas" in HISTORY.md. (https://github.com/ladislas)
- Fix: Make avr-g++ use CXXFLAGS instead of CFLAGS. (https://github.com/sej7278)
- Fix: Allow the use of CFLAGS_STD and CXXFLAGS_STD and set defaults (Issue #234) (https://github.com/ladislas)
- Fix: Update "make show_boards" regex to work with the Due in 1.5. (https://github.com/sej7278)
- Fix: Allow user libaries/sketches to have the same name as system libs. (Issue #244, #229). (https://github.com/sej7278)
- Fix: Remove impact of travis-ci from regular users. (Issue #258). (https://github.com/sej7278)
- Fix: objcopy quoting issue on Windows. (Issue #272). (https://github.com/sej7278)
- Fix: Add "avrispmkii" to the list of isp that don't have a port. (Issue #279). (https://github.com/sej7278)
- Fix: Make CXX compile .cpp files instead of CC. (Issue #285). (https://github.com/sej7278)
- Fix: Changed IDE download URL *again* for Travis-CI. (https://github.com/sej7278)
- Fix: Allow avrdude to erase the chip before programming during ispload (https://github.com/tchebb)
- Fix: Fix speed regression. Thanks ladislas (Issue #280) (https://github.com/sej7278)
- Fix: Removed some double quotes that were breaking variable expansion. (https://github.com/sej7278)
- Fix: Fixed PLATFORM_LIB support for 1.5+ and removed duplicate libs (https://github.com/sej7278)
- Fix: Added ARCHITECTURE to ALTERNATE_CORE_PATH to support 1.5+ cores like arduino-tiny (https://github.com/sej7278)
- Fix: Can now find IDE 1.5+ preferences.txt on Linux and Mac (https://github.com/sej7278)
- Fix: Added support for VARIANT being a submenu item in 1.6 cores like attiny (https://github.com/sej7278)
- Fix: Replaced copyright symbol causing sed problems on OSX (Issue #335). (https://github.com/sej7278)
- Fix: Fix issues with resetting Leonardo and Micro boards(Issue #340) (https://github.com/calvinli)
### 1.3.4 (2014-07-12)
- Tweak: Allow spaces in "Serial.begin (....)". (Issue #190) (https://github.com/pdav)
- Add: Add support for compiling assembler code. (Issue #195) (https://github.com/hrobeers)
- Add: Try to guess port from wildcards if not specified. (Issue #197) (https://github.com/tuzz)
- Fix: Check that on windows ARDUINO_DIR (and MPIDE_DIR) is a relative path. (Issue #201 and #202) (https://github.com/sej7278)
- Add: List board name as well as tag in `make show_boards`. (Issue #204) (https://github.com/sej7278)
- Fix: Add missing newlines at end of some echo's (Issue #207) (https://github.com/sej7278)
- Fix: Add missing/reorder/reword targets in `make help` (https://github.com/sej7278)
- New: Arduino.mk is now compatible with Flymake mode (https://github.com/rbarzic)
- Fix: MONITOR_PORT detection (Issue #213, #215) (https://github.com/sej7278)
- Tweak: Audited regexes/quoting/wildcards (Issue #192) (https://github.com/sej7278)
- New: Build core objects in subdirectory (Issue #82) (https://github.com/sej7278)
### 1.3.3 (2014-04-12)
- Fix: Make a new manpage for ard-reset-arduino. Fixes issue #188 (https://github.com/sej7278)
### 1.3.2 (2014-04-11)
- Fix: Add arduino-mk-vars.md file to RPM SPECfile. (https://github.com/sej7278)
- Fix: Add avr-libc/malloc.c and realloc.c to included core files. Fixes issue #163 (https://github.com/sej7278)
- Fix: Add "gpio" to the list of isp that don't have a port. (Issue #165, #166) (https://github.com/sej7278)
- Fix: Add "-D__PROG_TYPES_COMPAT__" to the avr-g++ compiler flags to match IDE. (https://github.com/sej7278)
- New: Create `Makefile-example-mk`, a *real life* `Makefile` example, to be used as a reference. (https://github.com/ladislas)
- Tweak: Add `OBJDIR` to `arduino-mk-vars.md` (https://github.com/ladislas)
- Tweak: *Beautify* `arduino-mk-vars.md` with code blocks. (https://github.com/ladislas)
- Fix: AVR tools paths for chipKIT in Linux. (https://github.com/peplin)
- Fix: Consider usb or usb:... to be a valid ISP_PORT (https://github.com/geoffholden)
- Add: Add phony target to run pre-build hook script (https://github.com/jrid)
- Fix: Add BOOTLOADER_PARENT to `arduino-mk-vars.md` and fixed BOOTLOADER_PATH example. (https://github.com/sej7278)
- Tweak: Replace perl reset script with Python script. (https://github.com/sej7278)
- Tweak: Made choice of Python2/3 interpreter up to the OS. (https://github.com/peplin)
- Tweak: Simplified packaging dependencies. (https://github.com/sej7278)
- Tweak: Tweak AVRDUDE conf detection in windows. (https://github.com/EAGMnor)
### 1.3.1 (2014-02-04)
- Fix: BUNDLED_AVR_TOOLS_DIR is now set properly when using only arduino-core and not the whole arduino package. (https://github.com/sej7278)
- New: Document all variables that can be overridden. (https://github.com/sej7278)
- New: Add a new `help_vars` target to display information about variables that can be overridden.
### 1.3.0 (2014-01-29)
- Fix: Use more reliable serial device naming in Windows. Fix issue #139 and #155 (https://github.com/peplin)
- Fix: Document that ARDUINO_DIR must be a relative path in Windows. Fix issue #156 (https://github.com/peplin)
- Tweak: Don't hard code MONITOR_PORT in examples, for more flexible testing. (Issue #157) (https://github.com/peplin)
- Tweak: Silence the stderr output from call to `which`. (Issue #158) (https://github.com/peplin)
- Fix: Override complete compiler tool paths for chipKIT. (Issue #159) (https://github.com/peplin)
- New: The makefile is compatible with Windows
- New: Update `README.md` file about usage and Windows compatibility
### 1.2.0 (2014-01-14)
- Add: Add RPM SPECfile and new `package` directory to store package instructions and files (https://github.com/sej7278)
- Fix: Remove use of arduino-mk subdirectory in git. Fix issue #151, #152 and #147 (https://github.com/sej7278)
- Fix: Remove `arduino-mk` directory from all examples. Fix #154
### 1.1.0 (2013-12-26)
- Don't append port details to avrdude for usbasp. See #123
- Ignore commented lines while parsing boards.txt file. See #124
- In ISP mode, read baudrate and programmer from boards.txt. See #125
- Add `burn_bootloader` target. See #85
- Show correct path to `arduino.mk` file in help message. Fix #120
- Change echo for printf. Fix #129 (https://github.com/thomassigurdsen)
- Add support for ChipKiT 2013. Fix #136 (https://github.com/peplin)
- Auto detect and include libraries specified in `USER_LIB_PATH`. Fix #135 (https://github.com/ladislas)
- Use `MAKEFILE_LIST` to get the name of the make file. Fix #130 (https://github.com/cantora)
- New: Add option to set fuses without burning a bootloader. Fix #141 (https://github.com/sej7278)
- Tweak: Don't append port details to avrdude for usbtiny. Fix #140 and #138 (https://github.com/PPvG)
- Fix: Handle relative paths of bootloader file while burning bootloaders. Fix #126 and #142 (https://github.com/sej7278)
- New: Add `CONTRIBUTING.md` explaining how to contribute to the project.
- New: Force -Os optimization for SoftwareSerial. Add `OPTIMIZATION_FLAGS` and `DEBUG_FLAGS`. (https://github.com/mahoy)
- Fix: Use `ARDUINO_HEADER` variable instead of hardcoded file names. Fix #131
### 1.0.1 (2013-09-25)
- Unconditionally add -D in avrdude options. See #114
### 1.0.0 (2013-09-22)
- Add $OBJDIR to the list of configuration that gets printed. Fix issue #77
- Add support for specifying optimization level. Fix issue #81
- Add support for reseting "Micro" Arduino. Fix issue #80 (https://github.com/sej7278)
@ -19,6 +221,7 @@ The following is the rough list of changes that went into different versions. I
- Replace Leonardo detection with Caterina detection (https://github.com/sej7278)
- Autodetect baudrate only if either a .ino/.pde is present
- Allow building with Arduino core, without a .ino/.pde file
- Ability to support different Arduino cores (https://github.com/sej7278)
### 0.12.0 (2013-06-20)
- Fix "generated_assembly" target, which got broken earlier. Fix issue #76 (https://github.com/matthijskooijman)
@ -157,4 +360,3 @@ Tweaked rules for the reset target on Philip Hands advice.
- Tidied up the licensing, making it clear that its released under LGPL 2.1.
- [Philip Hands](http://hands.com/~phil/) sent me some code to reset the Arduino by dropping DTR for 100ms, and I added it.
- Tweaked the Makefile to handle version 0018 of the Arduino software which now includes main.cpp. Accordingly we dont need to—and indeed must not—add main.cxx to the .pde sketch file. The paths seem to have changed a bit too.

161
OpenCM.mk 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++

508
README.md
View file

@ -1,104 +1,532 @@
# A Makefile for Arduino Sketches
# A Makefile for Arduino Sketches [![Build Status](https://travis-ci.org/sudar/Arduino-Makefile.svg)](https://travis-ci.org/sudar/Arduino-Makefile)
This is a very simple Makefile which knows how to build Arduino sketches. It defines the entire workflows for compiling code, flashing it to Arduino and even communicating through Serial monitor. You don't need to change anything in the Arduino sketches.
This is a very simple Makefile which knows how to build Arduino sketches. It defines entire workflows for compiling code, flashing it to Arduino and even communicating through Serial monitor. You don't need to change anything in the Arduino sketches.
If you're using FreeBSD, Debian or Ubuntu, you can find this in the `arduino-mk` package.
## Features
## Usage
- Very robust
- Highly customizable
- Supports all official AVR-based Arduino boards
- Supports official ARM-based Arduino boards using Atmel SAM chip family
and includes on-device debugging targets.
- Supports chipKIT
- Supports Teensy 3.x (via Teensyduino)
- Supports Robotis OpenCR 1.0
- Works on all three major OS (Mac, Linux, Windows)
- Auto detects serial baud rate and libraries used
- Support for `*.ino` and `*.pde` sketches as well as raw `*.c` and `*.cpp`
- Support for Arduino Software versions 0.x, 1.0.x, 1.5.x and 1.6.x except 1.6.2.
We recommend 1.6.3 or above version of Arduino IDE.
- Automatic dependency tracking. Referred libraries are automatically included
in the build process. Changes in `*.h` files lead to recompilation of sources which include them
You can also find more [detailed instructions in this guide](http://hardwarefun.com/tutorials/compiling-arduino-sketches-using-makefile) or also checkout the sample makefiles inside the examples/ folder
## Installation
Download a copy of this repo some where in your system.
### Through package
On the Mac you might want to set:
#### Using apt-get (or aptitude)
ARDUINO_DIR = /Applications/Arduino.app/Contents/Resources/Java
ARDMK_DIR = /usr/local
If you're using FreeBSD, Debian, Raspbian or Ubuntu, you can find this in the `arduino-mk`
package which can be installed using `apt-get` or `aptitude`.
On Linux, you might prefer:
```sh
sudo apt-get install arduino-mk
```
ARDUINO_DIR = /usr/share/arduino
ARDMK_DIR = /usr/share/arduino
ARDMK_PATH = /usr/bin
AVR_TOOLS_DIR = /usr
#### homebrew (or linuxbrew)
- `ARDUINO_DIR` - Path to Arduino installation
- `ARDMK_DIR` - Path where the `*.mk` are present. If you installed the package, then it is usually `/usr/share/arduino`
- `ARDMK_PATH` - Path where the `ard-reset-arduino` script is present. If you installed the package, then it is usually `/usr/bin`
- `AVR_TOOLS_DIR` - Path where the avr tools chain binaries are present. If you are going to use the binaries that came with Arduino installation, then you don't have to set it.
If you're using homebrew (or [linuxbrew](https://github.com/Homebrew/linuxbrew)) then you can find this in the
`arduino-mk` package which can be installed using the following commands.
The Makefile also delegates resetting the board to a short Perl program.
You'll need to install `Device::SerialPort` to use it though.
Also make sure you have the necessary dependencies installed. Refer to the [Requirements](#requirements) section below to install the dependencies.
```sh
# add tap
$ brew tap sudar/arduino-mk
# to install the last stable release
$ brew install arduino-mk
# to install the development version
$ brew install --HEAD arduino-mk
```
#### Arch Linux
Arch Linux users can use the unofficial AUR package [arduino-mk](https://aur.archlinux.org/packages/arduino-mk/).
It can be installed with [AUR] helper using the following command.
```sh
yay -S arduino-mk
```
#### Fedora
Fedora Linux users can use our packaging instructions [here](https://github.com/sudar/Arduino-Makefile/tree/master/packaging/fedora)
to build an RPM.
### From source
- Download the latest release
- Or clone it from Github using the command `git clone git@github.com:sudar/Arduino-Makefile.git`
- Check the [usage section](https://github.com/sudar/Arduino-Makefile#usage) in this readme about setting usage options
## Requirements
### Arduino IDE
You need to have the Arduino IDE. You can either install it through the
installer or download the distribution zip file and extract it.
### pySerial
The Makefile also delegates resetting the board to a short Python program.
You'll need to install [`pySerial`](https://pypi.python.org/pypi/pyserial) to use it though.
On most systems you should be able to install it using either `pip3` or `easy_install3`.
```sh
pip3 install pyserial
# or if you prefer easy_install
easy_install3 -U pyserial
```
If you prefer to install it as a package, then you can do that as well.
On Debian or Ubuntu:
apt-get install libdevice-serialport-perl
```sh
apt-get install python3-serial
```
On Fedora:
yum install perl-Device-SerialPort
```sh
dnf install python3-pyserial
```
On openSUSE:
zypper install perl-Device-SerialPort
```sh
zypper install python3-serial
```
On Mac using MacPorts:
On Arch:
sudo port install p5-device-serialport
```sh
sudo pacman -S python-pyserial
```
and use /opt/local/bin/perl5 instead of /usr/bin/perl
On macOS using Homebrew (one can install to System Python but this is not recommend or good practice):
```sh
brew install python
pip3 install pyserial
```
On Windows:
You need to install Cygwin and its packages for Make, Perl, Python3 and the following Serial library.
Assuming you included Python in your Cygwin installation:
1. download PySerial source package from [https://pypi.python.org/pypi/pyserial](https://pypi.python.org/pypi/pyserial)
2. extract downloaded package running `tar xvzf dowloaded_package_name.tar.gz`
3. navigate to extracted package folder
4. build and install Python module:
```
python3 setup.py build
python3 setup.py install
```
Alternatively, if you have setup Cygwin to use a Windows Python installation,
simply install using pip:
```
pip3 install pyserial
```
Arduino-Makefile should automatically detect the Python installation type and
use the correct device port binding.
## Usage
Download a copy of this repo somewhere to your system or install it through a package by following the above installation instruction.
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.
### Mac
On the Mac with IDE 1.0 you might want to set:
```make
ARDUINO_DIR = /Applications/Arduino.app/Contents/Resources/Java
ARDMK_DIR = /usr/local
AVR_TOOLS_DIR = /usr
MONITOR_PORT = /dev/ttyACM0
BOARD_TAG = mega2560
```
On the Mac with IDE 1.5+ it's like above but with
```make
ARDUINO_DIR = /Applications/Arduino.app/Contents/Java
```
### Linux
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
```
### Windows
On Windows (using Cygwin), you might want to set:
```make
# Symbolic link to Arduino installation directory - see below
ARDUINO_DIR = C:/Arduino
ARDMK_DIR = path/to/mkfile
MONITOR_PORT = com3
BOARD_TAG = mega2560
```
**NOTE: Use forward slash not backslash and there should be no spaces or
special characters in the Windows paths (due to Win/Unix crossover). The paths
should not be *cygdrive* paths.**
On Windows (using MSYS and PuTTY), you might want to set the following extra parameters:
```make
MONITOR_CMD = putty
MONITOR_PARAMS = 8,1,n,N
```
On Arduino 1.5+ installs, you should set the architecture to either `avr` or `sam` and if using a submenu CPU type, then also set that:
```make
ARCHITECTURE = avr
BOARD_TAG = atmegang
BOARD_SUB = atmega168
```
#### Symbolic Link
It is recommended in Windows that you create a symbolic link to avoid problems with file naming conventions on Windows; unless one installs to a non-default location. For example, if your your Arduino directory is in:
C:\Program Files (x86)\Arduino
You will get problems with the special characters on the directory name. More details about this can be found in [issue #94](https://github.com/sudar/Arduino-Makefile/issues/94)
To create a symbolic link, you can use the command “mklink” on Windows, e.g.
```sh
mklink /d C:\Arduino C:\Program Files (x86)\Arduino
```
Alternatively if you've setup Cygwin hard symbolic links ([CYGWIN=winsymlinks:native](https://www.cygwin.com/cygwin-ug-net/using-cygwinenv.html)):
```sh
ln -s /cygdrive/c/Program Files\ \(x86\)/Arduino/ C:/Arduino
```
After which, the variables should be:
```make
ARDUINO_DIR=C:/Arduino
```
Instead of:
```make
ARDUINO_DIR=C:/Program\ Files\ \(x86\)/Arduino
```
### Useful Variables
The list of all variables that can be overridden is available at [arduino-mk-vars.md](arduino-mk-vars.md) file.
- `BOARD_TAG` - Type of board, for a list see boards.txt or `make show_boards`
- `MONITOR_PORT` - The port where your Arduino is plugged in, usually `/dev/ttyACM0` or `/dev/ttyUSB0` in Linux or Mac OS X and `com3`, `com4`, etc. in Windows.
- `ARDUINO_DIR` - Path to Arduino installation. Using Windows with Cygwin,
this path must use Unix / and not Windows \\ (eg "C:/Arduino" not
"C:\\Arduino).
- `ARDMK_DIR` - Path where the `*.mk` are present. If you installed the package, then it is usually `/usr/share/arduino`. On Windows, this should be a path without spaces and no special characters, it can be a *cygdrive* path if necessary and must use / not \\.
- `AVR_TOOLS_DIR` - Path where the avr tools chain binaries are present. If you are going to use the binaries that came with Arduino installation, then you don't have to set it. Otherwise set it relative and not absolute.
On other systems:
cpan Device::SerialPort
## 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`.
`ARDUINO_LIBS = Wire SoftwareSerial`
```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` folder inside your sketchbook folder. Sketchbook folder will be auto detected from your Arduino preference file. You can also manually set it through `ARDUINO_SKETCHBOOK`.
- `/libraries` folder inside your Arduino folder, which is read from `ARDUINO_DIR`.
- `/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`.
The libraries inside user folder will take precedence over libraries present in Arduino core folder.
The libraries inside user directories will take precedence over libraries present in Arduino core directory.
The makefile can autodetect the libraries that are included from your sketch and can include them automatically. But it can't detect libraries that are included from other libraries. (see [issue #93](https://github.com/sudar/Arduino-Makefile/issues/93))
## avrdude
To upload compiled files, `avrdude` is used. This Makefile tries to find `avrdude` and 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
AVRDDUDE = /usr/bin/avrdude
```make
AVRDUDE = /usr/bin/avrdude
AVRDUDE_CONF = /etc/avrdude.conf
```
## Teensy 3.x
For Teensy 3.x support you must first install [Teensyduino](http://www.pjrc.com/teensy/teensyduino.html).
See examples/BlinkTeensy for example usage.
## Robotis OpenCM
For Robotis OpenCM support you must first install [the OpenCM IDE](http://support.robotis.com/en/software/robotis_opencm/robotis_opencm.htm)
See examples/BlinkOpenCM for example usage.
For large Robotis projects, [libmaple](https://github.com/Rhoban/Maple) may be more appropriate, as the OpenCM IDE uses a very old compiler release.
## Arduino ARM Boards
For Arduino boards using ARM architechure, specifically the Atmel SAM series
((SAM3X8E) Due; (SAMD21) Arduino M0 [Pro], Zero, MKR1000, Feather M0, etc.), first
install the board support package from the IDE or other distribution channels.
Define`ARDUINO_PACKAGE_DIR` as the root path containing the ARM support
package (the manufacturer folder) and the `BOARD_TAG` (see `make show_boards`
for help) within your project Makefile. Include 'Sam.mk' rather than
'Arduino.mk' at the end of your file - see examples/ZeroBlink,
examples/MZeroBlink and examples/DueBlink for example usage.
**Note**: The Arduino IDE does not install board support packages to
the base Arduino installation directory (the directory that will work with AVR
Makefiles). They are generally installed to a '.arduino15/packages' folder in
the users home directory. This is the reason for the new `ARDUINO_PACKAGE_DIR`
define. On Windows, the package directory is often in the user home directory
so advice is to create a symblic link to avoid slash/space in path problems.
You can also manually install support packages in your Sketchbook 'hardware'
folder, then define ARDUINO_PACKAGE_DIR as this path.
If using a SAM board from a manufacturer other than Arduino, one must still
install the Arduino board support as above (unless using externally defined
toolchain) and then define the location of the manufacturer board support core
using the ALTERNATIVE_CORE_PATH define. For example: `ALTERNATE_CORE_PATH =
$(ARDUINO_SKETCHBOOK)/hardware/sparkfun/samd`
The programing method will auto-detect based on the `BOARD_TAG` settings read
from boards.txt:
Programming using OpenOCD CMSIS-DAP with the Programming/debug USB is
currently supported (the same method used by the IDE), including burning
bootloaders. External CMSIS tools such as Atmel Ice will also work with this
method. Black Magic Probe (BMP) support is also included using GDB for both
uploading and debugging.
Native USB programing using Bossa (Due, Zero, MKR1000, Feather style bootloaders)
and avrdude (M0 bootloaders) is supported. The bootloaders on these devices
requires a double press of the reset button or open/closing the serial port at
1200 BAUD. The automatic entry of the bootloader is attempted using
`ard-reset-arduino` when using the general `make upload` target by polling
attached devices until the bootloader port re-attaches (same method as the
IDE). On Windows, the USB enumerates as differnt COM ports for the CDC Serial
and bootloader and these must be defined. On encountering problems, one can
manually enter the bootloader then upload using the `make raw_upload` target.
Note that the `make reset` target will enter the bootloader on these devices;
there is no way to reset over USB.
If using system installed tools, be aware that `openocd` and `bossa` were
orginally forked for Arduino support and system distributions may not be up
to date with merged changes. `bossa` must be version 1.7->. `openocd` should
work but there may be problems at run time
[ref](https://github.com/pda/arduino-zero-without-ide). Ideally, use the
support packaged version or compile and install the Arduino fork.
With the ARM chipset and using a CMSIS-DAP tool, on-device debugging is made available:
* `debug_init` and `debug` targets for on-device debugging using GDB. To use
this, one must start the GDB server with `make debug_init &`, followed by
connecting to the target with `make debug`. If using a Black Magic Probe,
one can just use `make debug`. At the moment, a system wide `arm-none-eabi-gdb` must be
installed as the one supplied with the Arduino toolchain
does not appear to work.
* Example usage: https://asciinema.org/a/Jarz7Pr3gD6mqaZvCACQBzqix
* See the examples/MZeroBlink Makefile for a commented example.
## Versioning
The current version of the makefile is `0.12.0`. 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/).
## License
This makefile and the related documentation and examples are free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
## Contribution
All contributions (even documentation) are welcome :) Open a pull request and I would be happy to merge them.
Also checkout the [contribution guide](CONTRIBUTING.md) for more details.
If you are looking for ideas to work on, then check out the following TODO items or the [issue tracker](https://github.com/sudar/Arduino-Makefile/issues/).
## Limitations / Know Issues / TODO's
## Limitations / Known Issues / TODO's
- Doesn't work with Arduino 1.5.x yet. Follow [issue #45](https://github.com/sudar/Arduino-Makefile/issues/45) for progress.
- Since it doesn't do any pre processing like Arduino IDE, you have to declare all methods before you use them ([issue #59](https://github.com/sudar/Arduino-Makefile/issues/59))
- More than one .ino or .pde file is not supported yet ([issue #49](https://github.com/sudar/Arduino-Makefile/issues/49))
- When you compile for the first time, it builds all libs inside Arduino directory even if it is not needed. But while linking only the relevant files are linked. ([issue #29](https://github.com/sudar/Arduino-Makefile/issues/29)). Even Arduino IDE does the same thing though.
- This makefile doesn't support boards or IDE from Arduino.org.
If you find an issue or have an idea for a feature then log them in the [issue tracker](https://github.com/sudar/Arduino-Makefile/issues/)
## Interfacing with other projects/frameworks/IDE's
### Colorgcc
It is possible to use [`colorgcc`](https://github.com/colorgcc/colorgcc) with this makefile. Check out [this comment](http://hardwarefun.com/tutorials/compiling-arduino-sketches-using-makefile#comment-1408) to find usage instructions.
### Emacs/Flymake support
On-the-fly syntax checking in Emacs using the [Flymake](http://www.emacswiki.org/emacs/FlyMake) minor mode is now possible.
First, the flymake mode must be configured to recognize ino files :
Edit the flymake configuration :
```
M-x customize-option RET
flymake-allowed-file-name-masks RET
```
Add the line :
```
("\\.ino\\'" flymake-simple-make-init)
```
Then click on "Apply and Save" button
Then, the following line must be added to the project Makefile :
```make
check-syntax:
$(CXX) -c -include Arduino.h -x c++ $(CXXFLAGS) $(CPPFLAGS) -fsyntax-only $(CHK_SOURCES)
```
### Code:Blocks integration
In Code:Blocks open Project -> Properties -> Project settings tab -> check "This is custom Makefile".
Now go to Settings -> Environment -> Environment variables -> Add
Add three keys with paths as values, using full paths (!):
```make
ARDUINO_DIR=/full/path/to/arduino-1.0.6
ARDMK_DIR=/full/path/to/sketchbook
AVR_TOOLS_DIR=/usr
```
Now to set DEBUG target (this will compile the project) go to Build options -> Debug -> "Make" commands
In Build Project/Target remove $target:
```sh
$make -f $makefile
```
In Clean Project/Target remove $target:
```sh
$make -f $makefile clean
```
To set the RELEASE target (which will compile and upload) go to Build options -> Release -> "Make" commands
In Build Project/Target put:
```sh
$make -f $makefile upload
```
In Clean Project/Target remove $target:
```sh
$make -f $makefile clean
```
## Test Suite
This project includes a suite of example Makefiles and small Arduino and chipKIT
programs to assist the maintainers of the Makefile. Run
`tests/script/bootstrap.sh` to attempt to automatically install the dependencies
(Arduino IDE, MPIDE, etc.). Run `tests/script/runtests.sh` to attempt to compile
all of the examples. The bootstrap script is primarily intended for use by a
continuous integration server, specifically Travis CI. It is not intended for
normal users.
## Makefile Generator and Project Initialisation
`ardmk-init` within the bin/ folder is a utility Python script to create a
Arduino-mk Makefile for a project and also has option to create a traditional *tree*
organization (src, lib, bin). It can be used as with commanline arguments or
prompted - see examples below (append `$ARDMK_DIR/bin/` to command if not on path):
* Run prompted within current working directory: `ardmk-init`
* Create Arduino Uno Makefile (useful within a library example): `ardmk-init -qb uno`
* Create boilerplate Arduino Uno project in current working directory of same
name: `ardmk-init -b uno --quiet --project`
* Create Arduino-mk nano Makefile in current working directory with template .ino: `ardmk-init -b nano -u atmega328 -qtn my-project`
* See `ardmk-init --help` for more.
### Bare-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.
Similar to HTML frameworks, [Bare-ArduinoProject](https://github.com/WeAreLeka/Bare-Arduino-Project) aims at providing a basic `tree` organization, `Makefile` configurations for both OS X and Linux and a handful of instruction on how to get started with a robust Arduino project architecture.
Further information are available in the [README.md](https://github.com/WeAreLeka/Bare-Arduino-Project/blob/master/README.md) as well as in the [use/installation procedure](https://github.com/WeAreLeka/Bare-Arduino-Project/blob/master/INSTALL.md).
Please be sure to report issues to [Bare-ArduinoProject](https://github.com/WeAreLeka/Bare-Arduino-Project/issues) if you use it instead of this project.
## Credits
This makefile was originally created by [Martin Oldfield](http://mjo.tc/atelier/2009/02/arduino-cli.html) and he maintained it till v0.10.2.
From May 2013, it is maintained by [Sudar](http://hardwarefun.com/tutorials/compiling-arduino-sketches-using-makefile)
From May 2013, it is maintained by [Sudar Muthu](http://hardwarefun.com/tutorials/compiling-arduino-sketches-using-makefile) and [Simon John](https://github.com/sej7278) with the help of [40+ contributors](https://github.com/sudar/Arduino-Makefile/graphs/contributors).
## Similar works
- It's not a derivative of this, but Alan Burlison has written a [similar thing](http://bleaklow.com/2010/06/04/a_makefile_for_arduino_sketches.html).

463
Sam.mk 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 $* = $($*)

137
Teensy.mk Normal file
View file

@ -0,0 +1,137 @@
########################################################################
#
# Support for Teensy 3.x boards
#
# https://www.pjrc.com/teensy/
#
# You must install teensyduino for this Makefile to work:
#
# http://www.pjrc.com/teensy/teensyduino.html
#
# Copyright (C) 2014 Jeremy Shaw <jeremy@n-heptane.com> based on
# work that is copyright Sudar, Nicholas Zambetti, David A. Mellis
# & Hernando Barragan.
#
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation; either version 2.1 of the
# License, or (at your option) any later version.
#
# Adapted from Arduino 0011 Makefile by M J Oldfield
#
# Original Arduino adaptation by mellis, eighthave, oli.keller
#
# Refer to HISTORY.md file for complete history of changes
#
########################################################################
ifndef ARDMK_DIR
ARDMK_DIR := $(realpath $(dir $(realpath $(lastword $(MAKEFILE_LIST)))))
endif
# include Common.mk now we know where it is
include $(ARDMK_DIR)/Common.mk
ARDMK_VENDOR = teensy
ARDUINO_CORE_PATH = $(ARDUINO_DIR)/hardware/teensy/avr/cores/teensy3
BOARDS_TXT = $(ARDUINO_DIR)/hardware/$(ARDMK_VENDOR)/avr/boards.txt
ifndef F_CPU
ifndef BOARD_SUB
SPEEDS := $(call PARSE_BOARD,"$(BOARD_TAG),menu.speed.*.build.fcpu") # Obtain sequence of supported frequencies.
SPEEDS := $(shell printf "%d\n" $(SPEEDS) | sort -g) # Sort it, just in case. Printf to re-append newlines so that sort works.
F_CPU := $(lastword $(SPEEDS)) # List is sorted in ascending order. Take the fastest speed.
#$(info "speeds is " $(SPEEDS)) # Good for debugging
else
F_CPU := $(call PARSE_BOARD,$(BOARD_TAG),menu.speed.$(BOARD_SUB).build.fcpu)
endif
endif
# if boards.txt gets modified, look there, else hard code it
ARCHITECTURE = $(call PARSE_BOARD,$(BOARD_TAG),build.architecture)
ifeq ($(strip $(ARCHITECTURE)),)
ARCHITECTURE = arm
endif
AVR_TOOLS_DIR = $(call dir_if_exists,$(ARDUINO_DIR)/hardware/tools/$(ARCHITECTURE))
# define plaform lib dir ignoring teensy's oversight on putting it all in avr
ifndef ARDUINO_PLATFORM_LIB_PATH
ARDUINO_PLATFORM_LIB_PATH = $(ARDUINO_DIR)/hardware/$(ARDMK_VENDOR)/avr/libraries
$(call show_config_variable,ARDUINO_PLATFORM_LIB_PATH,[COMPUTED],(from ARDUINO_DIR))
endif
########################################################################
# command names
TOOL_PREFIX = arm-none-eabi
# processor stuff
ifndef MCU
MCU := $(call PARSE_BOARD,$(BOARD_TAG),build.mcu)
endif
ifndef MCU_FLAG_NAME
MCU_FLAG_NAME=mcpu
endif
########################################################################
# FLAGS
ifndef USB_TYPE
USB_TYPE = USB_SERIAL
endif
CPPFLAGS += -DLAYOUT_US_ENGLISH -D$(USB_TYPE)
CPPFLAGS += $(call PARSE_BOARD,$(BOARD_TAG),build.option)
CXXFLAGS += $(call PARSE_BOARD,$(BOARD_TAG),build.cppoption)
ifeq ("$(call PARSE_BOARD,$(BOARD_TAG),build.gnu0x)","true")
CXXFLAGS_STD += -std=gnu++0x
endif
ifeq ("$(call PARSE_BOARD,$(BOARD_TAG),build.elide_constructors)", "true")
CXXFLAGS += -felide-constructors
endif
CXXFLAGS += $(call PARSE_BOARD,$(BOARD_TAG),build.flags.common)
CXXFLAGS += $(call PARSE_BOARD,$(BOARD_TAG),build.flags.cpu)
CXXFLAGS += $(call PARSE_BOARD,$(BOARD_TAG),build.flags.defs)
CXXFLAGS += $(call PARSE_BOARD,$(BOARD_TAG),build.flags.cpp)
CFLAGS += $(call PARSE_BOARD,$(BOARD_TAG),build.flags.common)
CFLAGS += $(call PARSE_BOARD,$(BOARD_TAG),build.flags.cpu)
CFLAGS += $(call PARSE_BOARD,$(BOARD_TAG),build.flags.defs)
ASFLAGS += $(call PARSE_BOARD,$(BOARD_TAG),build.flags.common)
ASFLAGS += $(call PARSE_BOARD,$(BOARD_TAG),build.flags.cpu)
ASFLAGS += $(call PARSE_BOARD,$(BOARD_TAG),build.flags.defs)
ASFLAGS += $(call PARSE_BOARD,$(BOARD_TAG),build.flags.S)
LDFLAGS += $(call PARSE_BOARD,$(BOARD_TAG),build.flags.cpu)
AMCU := $(call PARSE_BOARD,$(BOARD_TAG),build.mcu)
LDFLAGS += -Wl,--gc-sections,--relax
LINKER_SCRIPTS ?= -T${ARDUINO_CORE_PATH}/${AMCU}.ld
OTHER_LIBS = $(call PARSE_BOARD,$(BOARD_TAG),build.flags.libs)
CPUFLAGS = $(call PARSE_BOARD,$(BOARD_TAG),build.flags.cpu)
# usually defined as per teensy31.build.mcu=mk20dx256 but that isn't valid switch
MCU := $(shell echo ${CPUFLAGS} | sed -n -e 's/.*-mcpu=\([a-zA-Z0-9_-]*\).*/\1/p')
########################################################################
# some fairly odd settings so that 'make upload' works
#
# may require additional patches for Windows support
do_upload: override get_monitor_port=""
AVRDUDE=@true
RESET_CMD = nohup $(ARDUINO_DIR)/hardware/tools/teensy_post_compile -board=$(BOARD_TAG) -tools=$(abspath $(ARDUINO_DIR)/hardware/tools) -path=$(abspath $(OBJDIR)) -file=$(TARGET) > /dev/null ; $(ARDUINO_DIR)/hardware/tools/teensy_reboot
########################################################################
# automatially include Arduino.mk for the user
include $(ARDMK_DIR)/Arduino.mk

48
ard-reset-arduino.1 Normal file
View file

@ -0,0 +1,48 @@
.TH ARD-RESET-ARDUINO "1" "January 2017" "ard-reset-arduino 1.6.0" "Arduino CLI Reset"
.SH NAME
ard-reset-arduino - Reset Arduino board
.SH SYNOPSIS
.B ard-reset-arduino
[OPTION]... [PORT]
.SH DESCRIPTION
To reset Arduinos, we either pulse the DTR line or open the USB port
at 1200 baud and close it again.
.SH OPTIONS
.B \-\-verbose
Watch what's going on on STDERR.
.B \-\-period
Specify the DTR pulse width in seconds.
.B \-\-caterina
Reset a Leonardo, Micro, Robot, LilyPadUSB or similar 32u4-based device.
.SH EXAMPLES
ard-reset-arduino /dev/ttyACM0
.PP
ard-reset-arduino \-\-verbose \-\-period=0.1 /dev/cu.usb*
.PP
ard-reset-arduino \-\-verbose \-\-caterina /dev/ttyUSB0
.SH BUGS
There are no known bugs in this application. Please report problems
to the author. Patches are welcome.
.SH AUTHOR
Simon John, git@the-jedi.co.uk
.SH LICENSE
Copyright (c) 2014, Simon John. All rights reserved.
.PP
This file is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
.PP
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

60
ardmk-init.1 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.

2002
arduino-mk-vars.md Normal file

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,38 +0,0 @@
# Useful functions
# Returns the first argument (typically a directory), if the file or directory
# named by concatenating the first and optionally second argument
# (directory and optional filename) exists
dir_if_exists = $(if $(wildcard $(1)$(2)),$(1))
# For message printing: pad the right side of the first argument with spaces to
# the number of bytes indicated by the second argument.
space_pad_to = $(shell echo $(1) " " | head -c$(2))
# Call with some text, and a prefix tag if desired (like [AUTODETECTED]),
show_config_info = $(call arduino_output,- $(call space_pad_to,$(2),20) $(1))
# Call with the name of the variable, a prefix tag if desired (like [AUTODETECTED]),
# and an explanation if desired (like (found in $$PATH)
show_config_variable = $(call show_config_info,$(1) = $($(1)) $(3),$(2))
# Just a nice simple visual separator
show_separator = $(call arduino_output,-------------------------)
$(call show_separator)
$(call arduino_output,Arduino.mk Configuration:)
########################################################################
#
# Detect OS
ifeq ($(OS),Windows_NT)
CURRENT_OS = WINDOWS
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
CURRENT_OS = LINUX
endif
ifeq ($(UNAME_S),Darwin)
CURRENT_OS = MAC
endif
endif
$(call show_config_variable,CURRENT_OS,[AUTODETECTED])

View file

@ -1,147 +1,126 @@
#!/usr/bin/env perl
#!/usr/bin/python3
use strict;
use warnings;
import serial
import serial.tools.list_ports
import os.path
import argparse
from time import sleep
use Device::SerialPort;
use Getopt::Long;
use Pod::Usage;
my %Opt =
(
period => 0.1,
);
GetOptions(\%Opt,
"period=f", # width of reset pulse in seconds
"verbose!",
"help!",
"info!",
"caterina!",
);
if ($Opt{help} || $Opt{info})
{
usage();
}
die "No Arduinos found!\n"
unless @ARGV;
foreach my $dev (@ARGV)
{
my $p = Device::SerialPort->new($dev)
or die "Unable to open $dev: $!\n";
if ($Opt{caterina})
{
$p->baudrate(1200);
$p->write_settings;
$p->close;
print STDERR "Forcing reset using 1200bps open/close on port $dev\n"
if $Opt{verbose};
# wait for it to come back
sleep 1;
while( ! -e $dev ) {
print STDERR "Waiting for $dev to come back\n"
if $Opt{verbose};
sleep 1;
}
print STDERR "$dev has come back after reset\n"
if $Opt{verbose};
}
else
{
my $dt = $Opt{period};
print STDERR "Setting DTR high for ${dt}s on $dev\n"
if $Opt{verbose};
die "Invalid pulse width ($dt), "
unless $dt > 0.0;
$p->pulse_dtr_on($dt * 1000.0);
}
}
## here endeth the main
sub usage
{
pod2usage(-verbose => 2);
}
__END__
=head1 NAME
ard-reset-arduino - Reset an Arduino
=head1 USAGE
$ ard-reset-arduino /dev/cu.usb*
$ ard-reset-arduino --verbose --period=0.1 /dev/cu.usb*
$ ard-reset-arduino --verbose --caterina /dev/ttyUSB0
=head1 DESCRIPTION
To reset (most) Arduinos, it's enough to just pulse the DTR line.
You can do that from the shell with stty, but there's an interesting
diversity of command flags. This little program gives a uniform interface
at the cost of requiring C<Device::SerialPort>.
=head1 OPTIONS
=over
=item --verbose
Watch what's going on on STDERR.
=item --period=0.25
Specify the DTR pulse width in seconds.
=item --caterina
Reset a Leonardo, Micro, Robot or LilyPadUSB.
=back
=head1 BUGS AND LIMITATIONS
There are no known bugs in this application.
Please report problems to the author.
Patches are welcome.
=head1 AUTHOR
Martin Oldfield, ex-atelier@mjo.tc
Support for Leonardo/Micro added by sej7278, https://github.com/sej7278
Thanks to Daniele Vergini who suggested this to me, and supplied
a command line version.
=head1 LICENCE AND COPYRIGHT
Copyright (c) 2012, Martin Oldfield. All rights reserved.
This file is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
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()
def list_ports(output=False):
""" Lists serial ports attached
:returns
A list of paths to serial ports on system
"""
ports = serial.tools.list_ports.comports()
connected = [port[0] for port in ports]
if output:
print(connected)
return connected
def new_port(old, new):
""" Checks if a new port has attached
Args:
old: previous list of ports to check
new: current list of ports to check
Returns:
index of port in 'new' if new port found, otherwise -1
"""
new_port = -1
for port in new:
if port not in old:
new_port = new.index(port)
break
return new_port
if args.zero:
# number of trys to attempt
zero_attempts = 20 # ~2 seconds
initial_ports = list_ports(args.verbose)
if args.verbose:
print('Attempting to enter bootloader using 1200 bps open/close on port %s' % args.port[0])
ser = serial.Serial(args.port[0], 57600)
ser.close()
ser.baudrate = 1200
# do the open/close at 1200 BAUD
ser.open()
ser.close()
if args.verbose:
print('Done. Waiting for bootloader port to attach...')
# get new list of ports
reset_ports = list_ports(args.verbose)
# wait for new port or port to return
port_index = new_port(initial_ports, reset_ports)
# keep checking until new port appears or timeout
while port_index < 0:
# count down attempts and leave if expired
zero_attempts -= 1
if zero_attempts < 0:
break
sleep(0.1)
# get list of ports after bootloader toggle performed
reset_ports = list_ports(args.verbose)
# if a port drops, set initial ports to reset ports so that
# next attached device will be new port
if (len(reset_ports) < len(initial_ports)):
initial_ports = reset_ports
# check if a new port has attached and return the index if it has
port_index = new_port(initial_ports, reset_ports)
# return the new port if detected, otherwise return passed port
if port_index == -1:
bootloader_port = args.port[0]
else:
bootloader_port = reset_ports[port_index]
# print so that `tail -1` can be piped for bootloader port
print(bootloader_port)
elif args.caterina:
if args.verbose: print('Forcing reset using 1200bps open/close on port %s' % args.port[0])
ser = serial.Serial(args.port[0], 57600)
ser.close()
if pyserial_version < 3:
ser.setBaudrate (1200)
else:
ser.baudrate = 1200
ser.open()
ser.setRTS(True) # RTS line needs to be held high and DTR low
ser.setDTR(False) # (see Arduino IDE source code)
ser.close()
sleep(1)
while not os.path.exists(args.port[0]):
if args.verbose: print('Waiting for %s to come back' % args.port[0])
sleep(1)
if args.verbose: print('%s has come back after reset' % args.port[0])
else:
if args.verbose: print('Setting DTR high on %s for %ss' % (args.port[0],args.period))
ser = serial.Serial(args.port[0], 115200)
ser.setDTR(False)
sleep(args.period)
ser.setDTR(True)
ser.close()

278
bin/ardmk-init 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

@ -27,23 +27,11 @@
# The show_config_variable is unavailable before we include the common makefile,
# so we defer logging the ARDMK_DIR info until it happens in Arduino.mk
ifndef ARDMK_DIR
# presume it's a level above the path to our own file
ARDMK_DIR := $(realpath $(dir $(realpath $(lastword $(MAKEFILE_LIST))))/..)
# presume it's the same path to our own file
ARDMK_DIR := $(realpath $(dir $(realpath $(lastword $(MAKEFILE_LIST)))))
endif
ifndef ARDMK_PATH
ARDMK_PATH = $(ARDMK_DIR)/bin
endif
ifneq ($(wildcard $(ARDMK_DIR)/arduino-mk/Common.mk),)
# git checkout
include $(ARDMK_DIR)/arduino-mk/Common.mk
else
ifneq ($(wildcard $(ARDMK_DIR)/Common.mk),)
# package install
include $(ARDMK_DIR)/Common.mk
endif
endif
include $(ARDMK_DIR)/Common.mk
ifndef MPIDE_DIR
AUTO_MPIDE_DIR := $(firstword \
@ -59,6 +47,12 @@ else
$(call show_config_variable,MPIDE_DIR,[USER])
endif
ifeq ($(CURRENT_OS),WINDOWS)
ifneq ($(shell echo $(ARDUINO_DIR) | egrep '^(/|[a-zA-Z]:\\)'),)
echo $(error On Windows, MPIDE_DIR must be a relative path)
endif
endif
ifndef MPIDE_PREFERENCES_PATH
AUTO_MPIDE_PREFERENCES_PATH := $(firstword \
$(call dir_if_exists,$(HOME)/.mpide/preferences.txt) \
@ -69,34 +63,42 @@ ifndef MPIDE_PREFERENCES_PATH
endif
endif
# The same as in Arduino, the Linux distribution contains avrdude and #
# avrdude.conf in a different location, but for chipKIT it's even slightly
# different than the Linux paths for Arduino, so we have to "double override".
ifeq ($(CURRENT_OS),LINUX)
AVRDUDE_DIR = $(ARDUINO_DIR)/hardware/tools
AVRDUDE = $(AVRDUDE_DIR)/avrdude
AVRDUDE_CONF = $(AVRDUDE_DIR)/avrdude.conf
endif
AVR_TOOLS_DIR = $(ARDUINO_DIR)/hardware/pic32/compiler/pic32-tools
AVRDUDE_DIR = $(ARDUINO_DIR)/hardware/tools
AVRDUDE = $(AVRDUDE_DIR)/avrdude
AVRDUDE_CONF = $(AVRDUDE_DIR)/avrdude.conf
ALTERNATE_CORE = pic32
ALTERNATE_CORE_PATH = $(MPIDE_DIR)/hardware/pic32
ARDUINO_CORE_PATH = $(ALTERNATE_CORE_PATH)/cores/$(ALTERNATE_CORE)
ARDUINO_PREFERENCES_PATH = $(MPIDE_PREFERENCES_PATH)
ARDUINO_DIR = $(MPIDE_DIR)
CORE_AS_SRCS = $(ARDUINO_CORE_PATH)/vector_table.S \
$(ARDUINO_CORE_PATH)/cpp-startup.S \
$(ARDUINO_CORE_PATH)/crti.S \
$(ARDUINO_CORE_PATH)/crtn.S \
$(ARDUINO_CORE_PATH)/pic32_software_reset.S
ARDUINO_VERSION = 23
CC_NAME = pic32-gcc
CXX_NAME = pic32-g++
AR_NAME = pic32-ar
OBJDUMP_NAME = pic32-objdump
OBJCOPY_NAME = pic32-objcopy
SIZE_NAME = pic32-size
TOOL_PREFIX = pic32
LDSCRIPT = $(call PARSE_BOARD,$(BOARD_TAG),ldscript)
LDSCRIPT_FILE = $(ARDUINO_CORE_PATH)/$(LDSCRIPT)
MCU_FLAG_NAME=mprocessor
LDFLAGS += -T$(ARDUINO_CORE_PATH)/$(LDSCRIPT)
CPPFLAGS += -mno-smart-io -fno-short-double
LDFLAGS += -mdebugger -mno-peripheral-libs -nostartfiles -Wl,--gc-sections
LINKER_SCRIPTS += -T $(ARDUINO_CORE_PATH)/$(LDSCRIPT)
LINKER_SCRIPTS += -T $(ARDUINO_CORE_PATH)/chipKIT-application-COMMON.ld
CPPFLAGS += -mno-smart-io -fno-short-double -fframe-base-loclist \
-g3 -Wcast-align -D_BOARD_MEGA_
CFLAGS_STD =
include $(ARDMK_DIR)/arduino-mk/Arduino.mk
include $(ARDMK_DIR)/Arduino.mk

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
include $(ARDMK_DIR)/arduino-mk/Arduino.mk
# Examples - obviously pick only one and comment/delete the rest:
# !!! Important. You have to use make ispload to upload when using ISP programmer
# ------------------------------------------------------------------ #
# https://github.com/SpenceKonde/ATTinyCore (1.5+)
ALTERNATE_CORE = ATTinyCore
BOARD_TAG = attinyx4
BOARD_SUB = 84
VARIANT = tinyX4
F_CPU = 8000000L
#BOARD_TAG = attinyx313
#BOARD_SUB = 4313
#BOARD_TAG = attinyx61
#BOARD_SUB = 861
#F_CPU = 8000000L
# ------------------------------------------------------------------ #
# https://github.com/Coding-Badly/TinyCore1 (1.5+)
ALTERNATE_CORE = tiny
BOARD_TAG = attiny85at8
#BOARD_TAG = attiny2313at1
# https://github.com/Coding-Badly/arduino-tiny (1.0)
ALTERNATE_CORE = tiny
BOARD_TAG = attiny85at8
#BOARD_TAG = attiny44at8
#BOARD_TAG = attiny84at8
ARDUINO_VAR_PATH = $(HOME)/arduino/hardware/tiny/cores/tiny
ARDUINO_CORE_PATH = $(HOME)/arduino/hardware/tiny/cores/tiny
# ------------------------------------------------------------------ #
# https://github.com/damellis/attiny (1.5+)
ALTERNATE_CORE = attiny-master
BOARD_TAG = attiny
BOARD_SUB = attiny85
F_CPU = 16000000L
# https://github.com/damellis/attiny (1.0)
ALTERNATE_CORE = attiny-master
BOARD_TAG = attiny85
#BOARD_TAG = attiny44-8
#BOARD_TAG = attiny84-20
# ------------------------------------------------------------------ #
# Path to the Arduino Makefile
include $(ARDMK_DIR)/Arduino.mk
# !!! Important. You have to use 'make ispload' when using an ISP.

View file

@ -1,5 +1,4 @@
BOARD_TAG = uno
MONITOR_PORT = /dev/cu.usb*
ARDUINO_LIBS =
include ../../arduino-mk/Arduino.mk
include $(ARDMK_DIR)/Arduino.mk

View file

@ -1,7 +1,6 @@
/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.
This example code is in the public domain.
*/

View file

@ -1,6 +1,121 @@
# Arduino Make file. Refer to https://github.com/sudar/Arduino-Makefile
BOARD_TAG = uno
MONITOR_PORT = /dev/cu.usb*
ARDUINO_LIBS =
include $(ARDMK_DIR)/Arduino.mk
include ../../arduino-mk/Arduino.mk
# --- leonardo (or pro micro w/leo bootloader)
#BOARD_TAG = leonardo
#MONITOR_PORT = /dev/ttyACM0
#include /usr/share/arduino/Arduino.mk
# --- mega2560 ide 1.0
#BOARD_TAG = mega2560
#ARDUINO_PORT = /dev/ttyACM0
#include /usr/share/arduino/Arduino.mk
# --- mega2560 ide 1.6
#BOARD_TAG = mega
#BOARD_SUB = atmega2560
#MONITOR_PORT = /dev/ttyACM0
#ARDUINO_DIR = /where/you/installed/arduino-1.6.5
#include /usr/share/arduino/Arduino.mk
# --- nano ide 1.0
#BOARD_TAG = nano328
#MONITOR_PORT = /dev/ttyUSB0
#include /usr/share/arduino/Arduino.mk
# --- nano ide 1.6
#BOARD_TAG = nano
#BOARD_SUB = atmega328
#ARDUINO_DIR = /where/you/installed/arduino-1.6.5
#include /usr/share/arduino/Arduino.mk
# --- pro mini
#BOARD_TAG = pro5v328
#MONITOR_PORT = /dev/ttyUSB0
#include /usr/share/arduino/Arduino.mk
# --- sparkfun pro micro
#BOARD_TAG = promicro16
#ALTERNATE_CORE = promicro
#BOARDS_TXT = $(HOME)/arduino/hardware/promicro/boards.txt
#BOOTLOADER_PARENT = $(HOME)/arduino/hardware/promicro/bootloaders
#BOOTLOADER_PATH = caterina
#BOOTLOADER_FILE = Caterina-promicro16.hex
#ISP_PROG = usbasp
#AVRDUDE_OPTS = -v
#include /usr/share/arduino/Arduino.mk
# --- chipkit
#BOARD_TAG = mega_pic32
#MPIDE_DIR = /where/you/installed/mpide-0023-linux64-20130817-test
#include /usr/share/arduino/chipKIT.mk
# --- pinoccio
#BOARD_TAG = pinoccio256
#ALTERNATE_CORE = pinoccio
#BOOTLOADER_PARENT = $(HOME)/arduino/hardware/pinoccio/bootloaders
#BOOTLOADER_PATH = STK500RFR2/release_0.51
#BOOTLOADER_FILE = boot_pinoccio.hex
#CFLAGS_STD = -std=gnu99
#CXXFLAGS_STD = -std=gnu++11
#include /usr/share/arduino/Arduino.mk
# --- fio
#BOARD_TAG = fio
#include /usr/share/arduino/Arduino.mk
# --- atmega-ng ide 1.6
#BOARD_TAG = atmegang
#BOARD_SUB = atmega168
#MONITOR_PORT = /dev/ttyACM0
#ARDUINO_DIR = /where/you/installed/arduino-1.6.5
#include /usr/share/arduino/Arduino.mk
# --- teensy3
#BOARD_TAG = teensy31
#ARDUINO_DIR = /where/you/installed/the/patched/teensy/arduino-1.0.6
#include /usr/share/arduino/Teensy.mk
# --- mighty 1284p
#BOARD_TAG = mighty_opt
#BOARDS_TXT = $(HOME)/arduino/hardware/mighty-1284p/boards.txt
#BOOTLOADER_PARENT = $(HOME)/arduino/hardware/mighty-1284p/bootloaders
#BOOTLOADER_PATH = optiboot
#BOOTLOADER_FILE = optiboot_atmega1284p.hex
#ISP_PROG = usbasp
#AVRDUDE_OPTS = -v
#include /usr/share/arduino/Arduino.mk
# --- mightycore
#ALTERNATE_CORE = MightyCore
#BOARD_TAG = 1284
#MCU = atmega1284p
#BOARD_TAG = 644
#MCU = atmega644p
#VARIANT = standard
#F_CPU = 16000000L
#include /usr/share/arduino/Arduino.mk
# --- megacore
#BOARD_TAG = 128
#ALTERNATE_CORE = megacore
#F_CPU = 16000000L
#include /usr/share/arduino/Arduino.mk
# --- sanguino 644p
#BOARD_TAG = atmega644p
#ALTERNATE_CORE = sanguino
#ISP_PROG = usbasp
#AVRDUDE_OPTS = -v
#include /usr/share/arduino/Arduino.mk
# --- atmega328p on breadboard
#BOARD_TAG = atmega328bb
#ISP_PROG = usbasp
#AVRDUDE_OPTS = -v
#BOARDS_TXT = $(HOME)/arduino/hardware/breadboard/boards.txt
#include /usr/share/arduino/Arduino.mk

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,6 +1,5 @@
BOARD_TAG = mega_pic32
MONITOR_PORT = /dev/cu.usb*
ARDUINO_LIBS =
include ../../arduino-mk/chipKIT.mk
include $(ARDMK_DIR)/chipKIT.mk

View file

@ -10,8 +10,7 @@ F_CPU = 8000000L
ISP_PROG = stk500v1
AVRDUDE_ISP_BAUDRATE = 19200
ISP_PORT = /dev/ttyACM*
include $(ARDMK_DIR)/arduino-mk/Arduino.mk
include $(ARDMK_DIR)/Arduino.mk
# !!! Important. You have to use make ispload to upload when using ISP programmer

View file

@ -1,5 +1,5 @@
/*
* © Anil Kumar Pugalia, 2010. Email: email@sarika-pugs.com
* (c) Anil Kumar Pugalia, 2010. Email: email@sarika-pugs.com
*
* ATmega48/88/168, ATmega16/32
*

View file

@ -0,0 +1,23 @@
/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.
This example code is in the public domain.
*/
// Connect a LED to Pin 3. It might be different in different ATtiny micro controllers
int led = 3;
// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
pinMode(led, OUTPUT);
}
// the loop routine runs over and over again forever:
void loop() {
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}

View file

@ -0,0 +1,46 @@
# Arduino Make file. Refer to https://github.com/sudar/Arduino-Makefile
# Tested and working with a linuxspi programmer on a remote Raspberry Pi
# Refer to https://github.com/kcuzner/avrdude for linuxspi.
# Should work with ISP as well if you replace $(AVRDUDE_ARD_OPTS) with
# $(AVRDUDE_ISP_OPTS) in the net_set_fuses rule.
# Alternate core from https://code.google.com/p/arduino-tiny
ALTERNATE_CORE = tiny
BOARD_TAG = attiny85at8
# Avrdude config path on the remote Raspberry Pi
AVRDUDE_CONF=/usr/local/etc/avrdude.conf
# Skip the monitor port existance check since it's not on our machine.
FORCE_MONITOR_PORT=true
MONITOR_PORT=/dev/spidev0.0
include $(ARDMK_DIR)/Arduino.mk
# Additional rules to use a remote Raspberry Pi programmer
# Note that it's recommended not to use root for this task,
# but to setup spidev access on a normal user instead.
HOST = root@alarmpi
SSH_AVRDUDE = ssh $(HOST) /usr/local/bin/avrdude
CAT_HEX = cat $(TARGET_HEX)
AVRDUDE_UPLOAD_PIPE = -U flash:w:-:i
.PHONY: net_upload net_set_fuses
net_upload: $(TARGET_HEX) verify_size
$(CAT_HEX) | $(SSH_AVRDUDE) $(AVRDUDE_COM_OPTS) $(AVRDUDE_ARD_OPTS) \
$(AVRDUDE_UPLOAD_PIPE)
net_set_fuses:
ifneq ($(strip $(AVRDUDE_ISP_FUSES_PRE)),)
$(SSH_AVRDUDE) $(AVRDUDE_COM_OPTS) $(AVRDUDE_ARD_OPTS) -e \
$(AVRDUDE_ISP_FUSES_PRE)
endif
ifneq ($(strip $(AVRDUDE_ISP_FUSES_POST)),)
$(SSH_AVRDUDE) $(AVRDUDE_COM_OPTS) $(AVRDUDE_ARD_OPTS) \
$(AVRDUDE_ISP_FUSES_POST)
endif

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

@ -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,4 @@
BOARD_TAG = teensy31
ARDUINO_LIBS =
include $(ARDMK_DIR)/Teensy.mk

View file

@ -1,5 +1,4 @@
BOARD_TAG = uno
MONITOR_PORT = /dev/cu.usb*
ARDUINO_LIBS =
include ../../arduino-mk/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,5 +1,4 @@
BOARD_TAG = uno
MONITOR_PORT = /dev/cu.usb*
ARDUINO_LIBS =
include ../../arduino-mk/Arduino.mk
include $(ARDMK_DIR)/Arduino.mk

View file

@ -1,5 +1,4 @@
BOARD_TAG = uno
MONITOR_PORT = /dev/cu.usb*
ARDUINO_LIBS = LiquidCrystal
include ../../arduino-mk/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

@ -0,0 +1,74 @@
### DISCLAIMER
### This is an example Makefile and it MUST be configured to suit your needs.
### For detailed explanations about all of the available options, please refer
### to https://github.com/sudar/Arduino-Makefile/blob/master/arduino-mk-vars.md
### Original project where this Makefile comes from: https://github.com/WeAreLeka/Bare-Arduino-Project
### PROJECT_DIR
### This is the path to where you have created/cloned your project
PROJECT_DIR = /Users/MyUserName/path/to/my/Project
### ARDMK_DIR
### Path to the Arduino-Makefile directory.
ARDMK_DIR = $(PROJECT_DIR)/Arduino-Makefile
### ARDUINO_DIR
### Path to the Arduino application and resources directory.
### On OS X:
ARDUINO_DIR = /Applications/Arduino.app/Contents/Java
### or on Linux: (remove the one you don't want)
ARDUINO_DIR = /usr/share/arduino
### USER_LIB_PATH
### Path to where the your project's libraries are stored.
USER_LIB_PATH := $(PROJECT_DIR)/lib
### BOARD_TAG
### It must be set to the board you are currently using. (i.e uno, mega2560, etc.)
BOARD_TAG = uno
### MONITOR_BAUDRATE
### It must be set to Serial baudrate value you are using.
MONITOR_BAUDRATE = 115200
### AVR_TOOLS_DIR
### Path to the AVR tools directory such as avr-gcc, avr-g++, etc.
### On OS X with `homebrew`:
AVR_TOOLS_DIR = /usr/local
### or on Linux: (remove the one you don't want)
AVR_TOOLS_DIR = /usr
### AVRDUDE
### Path to avrdude directory.
### On OS X with `homebrew`:
AVRDUDE = /usr/local/bin/avrdude
### or on Linux: (remove the one you don't want)
AVRDUDE = /usr/bin/avrdude
### CFLAGS_STD
### Set the C standard to be used during compilation. Documentation (https://github.com/WeAreLeka/Arduino-Makefile/blob/std-flags/arduino-mk-vars.md#cflags_std)
CFLAGS_STD = -std=gnu11
### CXXFLAGS_STD
### Set the C++ standard to be used during compilation. Documentation (https://github.com/WeAreLeka/Arduino-Makefile/blob/std-flags/arduino-mk-vars.md#cxxflags_std)
CXXFLAGS_STD = -std=gnu++11
### CXXFLAGS
### Flags you might want to set for debugging purpose. Comment to stop.
CXXFLAGS += -pedantic -Wall -Wextra
### MONITOR_PORT
### The port your board is connected to. Using an '*' tries all the ports and finds the right one.
MONITOR_PORT = /dev/tty.usbmodem*
### CURRENT_DIR
### Do not touch - used for binaries path
CURRENT_DIR = $(shell basename $(CURDIR))
### OBJDIR
### This is where you put the binaries you just compile using 'make'
OBJDIR = $(PROJECT_DIR)/bin/$(BOARD_TAG)/$(CURRENT_DIR)
### Do not touch - the path to Arduino.mk, inside the ARDMK_DIR
include $(ARDMK_DIR)/Arduino.mk

9
examples/README.md Normal file
View file

@ -0,0 +1,9 @@
This folder contains the list of example Arduino sketches and makefile showing
the different usage patterns
- BlinkInAVRC - Shows how to use plain AVR C code
- ATtinyBlink - Shows how to use different cores like ATtiny
- Blink - Shows normal usage
- HelloWorld - Shows how to include Arduino libraries
- SerialPrint - Shows how serial monitor can be used
- BlinkChipKIT - Shows how to use ChipKIT

View file

@ -0,0 +1,5 @@
# Arduino Make file. Refer to https://github.com/sudar/Arduino-Makefile
BOARD_TAG = uno
include $(ARDMK_DIR)/Arduino.mk

View file

@ -0,0 +1,10 @@
void setup() {
Serial.begin(9600);
Serial.print("Press any key: ");
}
void loop() {
if (Serial.available()) {
Serial.println(Serial.read());
}
}

View file

@ -5,11 +5,16 @@ ALTERNATE_CORE = attiny
# If not, you might have to include the full path.
#ALTERNATE_CORE_PATH = /home/sudar/Dropbox/code/arduino-sketches/hardware/attiny/
BOARD_TAG = attiny85-8
ISP_PORT = /dev/ttyACM*
# !!! Important. You have to use "make ispload" to upload when using ISP programmer
ISP_PROG = usbasp
# 1.5+ example of submenu cpu
BOARD_TAG = attiny
BOARD_SUB = attiny85
# clock is a submenu too
F_CPU = 16000000L
ARDUINO_LIBS = SoftwareSerial
include $(ARDMK_DIR)/arduino-mk/Arduino.mk
# !!! Important. You have to use make ispload to upload when using ISP programmer
include $(ARDMK_DIR)/Arduino.mk

View file

@ -1,7 +1,6 @@
# Arduino Make file. Refer to https://github.com/sudar/Arduino-Makefile
BOARD_TAG = uno
MONITOR_PORT = /dev/cu.usb*
ARDUINO_LIBS = Ethernet SPI
include ../../arduino-mk/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

@ -1,7 +1,6 @@
# Arduino Make file. Refer to https://github.com/sudar/Arduino-Makefile
BOARD_TAG = uno
MONITOR_PORT = /dev/cu.usb*
ARDUINO_LIBS = Wire
include ../../arduino-mk/Arduino.mk
include $(ARDMK_DIR)/Arduino.mk

View file

@ -1,5 +1,4 @@
BOARD_TAG = uno
MONITOR_PORT = /dev/cu.usb*
ARDUINO_LIBS =
include ../../arduino-mk/Arduino.mk
include $(ARDMK_DIR)/Arduino.mk

View file

@ -0,0 +1,23 @@
# How to compile a Deb package
Use these instructions to build your own Deb package from your local sources.
For the latest official packages go to [Debian](http://packages.debian.org/arduino-mk)
or [Ubuntu](https://launchpad.net/ubuntu/+source/arduino-mk) or use apt.
First install the dependencies as root:
apt-get build-dep arduino-mk
apt-get install arduino-core build-essential dpkg-dev fakeroot devscripts
Fetch the Debian source:
apt-get source arduino-mk
Make any local changes to want within the arduino-mk-* directory and update the package version:
cd arduino-mk-*
dch -i
Then compile. This will create a binary Deb:
dpkg-buildpackage -b

View file

@ -0,0 +1,45 @@
# How to compile an RPM
First install the dependencies as root:
```sh
yum install arduino-core rpm-build
# or on Fedora 22+
dnf install arduino-core rpmdevtools
```
From the top-level Arduino-Makefile directory you've checked out of github, run the following (as unprivileged user) to create a compressed tarball using the naming conventions required by rpmbuild:
git archive HEAD --prefix=arduino-mk-1.5/ -o ../arduino-mk-1.5.tar.gz
If you don't already have a rpmbuild setup (e.g. you've not installed the SRPM) you will need to create the directories:
mkdir -p ~/rpmbuild/{SOURCES,SPECS}
Then copy the tarball and specfile into those directories:
cp ../arduino-mk-1.5.tar.gz ~/rpmbuild/SOURCES/
cp packaging/fedora/arduino-mk.spec ~/rpmbuild/SPECS/
Then compile. This will create a binary and source RPM:
cd ~/rpmbuild/SPECS/
rpmbuild -ba arduino-mk.spec
Fedora's AVR compilers use ccache, so you may have to override some of the paths to the AVR tools in your sketch's Makefile, for example:
```Makefile
OVERRIDE_EXECUTABLES = 1
CC = /usr/lib64/ccache/$(CC_NAME)
CXX = /usr/lib64/ccache/$(CXX_NAME)
AS = /usr/bin/$(AS_NAME)
OBJCOPY = /usr/bin/$(OBJCOPY_NAME)
OBJDUMP = /usr/bin/$(OBJDUMP_NAME)
AR = /usr/bin/$(AR_NAME)
SIZE = /usr/bin/$(SIZE_NAME)
NM = /usr/bin/$(NM_NAME)
```
Or if you don't want to use ccache, then just set ```AVR_TOOLS_PATH=/usr``` and none of the above will be necessary.

View file

@ -0,0 +1,83 @@
Name: arduino-mk
Version: 1.6.0
Release: 2%{dist}
Summary: Program your Arduino from the command line
Packager: Simon John <git@the-jedi.co.uk>
URL: https://github.com/sudar/Arduino-Makefile
Source: %{name}-%{version}.tar.gz
Group: Development/Tools
License: LGPLv2+
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
Requires: arduino-core python3-pyserial
%description
Arduino is an open-source electronics prototyping platform based on
flexible, easy-to-use hardware and software. It's intended for artists,
designers, hobbyists, and anyone interested in creating interactive
objects or environments.
This package will install a Makefile to allow for CLI programming of the
Arduino platform.
%prep
%setup -q
%install
mkdir -p %{buildroot}/%{_datadir}/arduino
mkdir -p %{buildroot}/%{_bindir}
mkdir -p %{buildroot}/%{_mandir}/man1
mkdir -p %{buildroot}/%{_docdir}/%{name}/examples
install -m 755 -d %{buildroot}/%{_docdir}/%{name}
install -m 755 -d %{buildroot}/%{_docdir}/%{name}/examples
for dir in `find examples -type d` ; do install -m 755 -d %{buildroot}/%{_docdir}/%{name}/$dir ; done
for file in `find examples -type f ! -name .gitignore` ; do install -m 644 $file %{buildroot}/%{_docdir}/%{name}/$file ; done
install -m 644 *.mk arduino-mk-vars.md %{buildroot}/%{_datadir}/arduino
install -m 644 licence.txt %{buildroot}/%{_docdir}/%{name}
install -m 755 bin/ard-reset-arduino %{buildroot}/%{_bindir}/ard-reset-arduino
install -m 644 ard-reset-arduino.1 %{buildroot}/%{_mandir}/man1
install -m 755 bin/robotis-loader %{buildroot}/%{_bindir}/robotis-loader
install -m 644 robotis-loader.1 %{buildroot}/%{_mandir}/man1
install -m 755 bin/ardmk-init %{buildroot}/%{_bindir}/ardmk-init
install -m 644 ardmk-init.1 %{buildroot}/%{_mandir}/man1
%clean
rm -rf %{buildroot}
%files
%defattr(-,root,root,-)
%{_bindir}/ard-reset-arduino
%{_mandir}/man1/ard-reset-arduino.1*
%{_bindir}/robotis-loader
%{_mandir}/man1/robotis-loader.1*
%{_bindir}/ardmk-init
%{_mandir}/man1/ardmk-init.1*
%{_datadir}/arduino/*.mk
%{_datadir}/arduino/arduino-mk-vars.md
%doc %{_docdir}/%{name}/licence.txt
%docdir %{_docdir}/%{name}/examples
%{_docdir}/%{name}/examples
%changelog
* Thu Oct 24 2019 Simon John <git@the-jedi.co.uk>
- Removed BuildRequires
* Thu Oct 05 2017 Simon John <git@the-jedi.co.uk>
- Added ardmk-init binary and manpage
* Tue Jul 11 2017 Karl Semich <fuzzyTew@gmail.com>
- Added robotis-loader binary and manpage
* Sat Apr 12 2014 Simon John <git@the-jedi.co.uk>
- Put manpage back.
* Fri Apr 04 2014 Simon John <git@the-jedi.co.uk>
- Removed BuildRequires of python3/pyserial.
* Wed Apr 02 2014 Simon John <git@the-jedi.co.uk>
- Added BuildRequires of python3-pyserial. Need to look into Requires.
* Mon Mar 24 2014 Simon John <git@the-jedi.co.uk>
- Replaced perl/help2man with pyserial for reset script.
* Tue Feb 04 2014 Simon John <git@the-jedi.co.uk>
- Added arduino-mk-vars.md to the files to be installed/packaged.
* Sat Feb 01 2014 Simon John <git@the-jedi.co.uk>
- Updated version.
* Mon Jan 13 2014 Simon John <git@the-jedi.co.uk>
- Removed arduino-mk subdirectory
* Mon Dec 30 2013 Simon John <git@the-jedi.co.uk>
- Initial release.

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.

10
tests/script/bootstrap.sh Executable file
View file

@ -0,0 +1,10 @@
#!/usr/bin/env bash
set -e
SCRIPTS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
pushd $SCRIPTS_DIR/..
source $SCRIPTS_DIR/bootstrap/chipkit.sh
source $SCRIPTS_DIR/bootstrap/arduino.sh
source $SCRIPTS_DIR/bootstrap/samd.sh

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 Arduino"
if [ -z "$ARDUINO_DIR" ] || ! test -e $ARDUINO_DIR || [ $OS == "cygwin" ]; then
echo "Installing Arduino..."
ARDUINO_BASENAME="arduino-1.8.11"
if [ $OS == "cygwin" ]; then
ARDUINO_FILE="$ARDUINO_BASENAME-windows".zip
EXTRACT_COMMAND="unzip -q"
elif [ $OS == "mac" ]; then
ARDUINO_FILE="$ARDUINO_BASENAME-macosx".zip
EXTRACT_COMMAND="unzip -q"
else
ARDUINO_FILE="$ARDUINO_BASENAME-linux64".tar.xz
EXTRACT_COMMAND="tar -xf"
fi
ARDUINO_URL=http://arduino.cc/download.php?f=/$ARDUINO_FILE
_pushd $DEPENDENCIES_FOLDER
if ! test -e $ARDUINO_FILE
then
echo "Downloading Arduino IDE..."
download $ARDUINO_URL $ARDUINO_FILE
fi
if ! test -d $ARDUINO_BASENAME
then
echo "Installing Arduino to local folder..."
$EXTRACT_COMMAND $ARDUINO_FILE
mv $ARDUINO_BASENAME arduino
echo "Arduino installed"
fi
_popd
fi
echo
echo "${bldgreen}Arduino dependencies installed.$txtrst"

View file

@ -0,0 +1,61 @@
set -e
BOOTSTRAP_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $BOOTSTRAP_DIR/common.sh
echo "Installing dependencies for building for the chipKIT"
if [ -z "$MPIDE_DIR" ] || ! test -e $MPIDE_DIR || [ $OS == "cygwin" ]; then
echo "Installing MPIDE..."
if [ $OS == "cygwin" ]; then
MPIDE_BASENAME="mpide-0023-windows-20130715"
MPIDE_FILE="$MPIDE_BASENAME".zip
EXTRACT_COMMAND="unzip -q"
if ! command -v unzip >/dev/null 2>&1; then
_cygwin_error "unzip"
fi
elif [ $OS == "mac" ]; then
MPIDE_BASENAME=mpide-0023-macosx-20130715
MPIDE_FILE="$MPIDE_BASENAME".dmg
else
MPIDE_BASENAME=mpide-0023-linux64-20130817-test
MPIDE_FILE="$MPIDE_BASENAME".tgz
EXTRACT_COMMAND="tar -xzf"
fi
MPIDE_URL=http://chipkit.s3.amazonaws.com/builds/$MPIDE_FILE
_pushd $DEPENDENCIES_FOLDER
if ! test -e $MPIDE_FILE
then
echo "Downloading MPIDE..."
download $MPIDE_URL $MPIDE_FILE
fi
if ! test -d $MPIDE_BASENAME
then
echo "Installing MPIDE to local folder..."
if [ $OS == "mac" ]; then
hdiutil attach $MPIDE_FILE
cp -R /Volumes/Mpide/Mpide.app/Contents/Resources/Java $MPIDE_BASENAME
hdiutil detach /Volumes/Mpide
else
$EXTRACT_COMMAND $MPIDE_FILE
fi
echo "MPIDE installed"
fi
if [ $OS == "cygwin" ]; then
chmod a+x mpide/hardware/pic32/compiler/pic32-tools/bin/*
chmod a+x -R mpide/hardware/pic32/compiler/pic32-tools/pic32mx/
chmod a+x mpide/*.dll
chmod a+x mpide/hardware/tools/avr/bin/*
fi
_popd
fi
echo
echo "${bldgreen}chipKIT dependencies installed.$txtrst"

View file

@ -0,0 +1,182 @@
#!/usr/bin/env bash
set -e
BOOTSTRAP_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [ -z $COMMON_SOURCED ]; then
# TODO this is kind of a hacky way of determining if root is required -
# ideally we wouuld set up a little virtualenv in the dependencies folder
SUDO_CMD=
if command -v sudo >/dev/null 2>&1; then
SUDO_CMD="sudo -E"
if [ -z $CI ] && [ -z $VAGRANT ]; then
echo "The bootstrap script needs to install a few packages to your system as an admin, and we will use the 'sudo' command - enter your password to continue"
$SUDO_CMD ls > /dev/null
fi
fi
KERNEL=`uname`
ARCH=`uname -m`
if [ ${KERNEL:0:7} == "MINGW32" ]; then
OS="windows"
elif [ ${KERNEL:0:6} == "CYGWIN" ]; then
OS="cygwin"
elif [ $KERNEL == "Darwin" ]; then
OS="mac"
else
OS="linux"
if ! command -v lsb_release >/dev/null 2>&1; then
# Arch Linux
if command -v pacman>/dev/null 2>&1; then
$SUDO_CMD pacman -S lsb-release
fi
fi
DISTRO=`lsb_release -si`
fi
die() {
echo >&2 "${bldred}$@${txtrst}"
exit 1
}
_cygwin_error() {
echo
echo "${bldred}Missing \"$1\"${txtrst} - run the Cygwin installer again and select the base package set:"
echo " $CYGWIN_PACKAGES"
echo "After installing the packages, re-run this bootstrap script."
die
}
if ! command -v tput >/dev/null 2>&1; then
if [ $OS == "cygwin" ]; then
echo "OPTIONAL: Install the \"ncurses\" package in Cygwin to get colored shell output"
fi
else
set +e
# These exit with 1 when provisioning in a Vagrant box...?
txtrst=$(tput sgr0) # reset
bldred=${txtbld}$(tput setaf 1)
bldgreen=${txtbld}$(tput setaf 2)
set -e
fi
_pushd() {
pushd $1 > /dev/null
}
_popd() {
popd > /dev/null
}
_wait() {
if [ -z $CI ] && [ -z $VAGRANT ]; then
echo "Press Enter when done"
read
fi
}
_install() {
if [ $OS == "cygwin" ]; then
_cygwin_error $1
elif [ $OS == "mac" ]; then
# brew exists with 1 if it's already installed
set +e
brew install $1
set -e
else
if [ -z $DISTRO ]; then
echo
echo "Missing $1 - install it using your distro's package manager or build from source"
_wait
else
if [ $DISTRO == "arch" ]; then
$SUDO_CMD pacman -S $1
elif [ $DISTRO == "Ubuntu" ]; then
$SUDO_CMD apt-get update -qq
$SUDO_CMD apt-get install $1 -y
else
echo
echo "Missing $1 - install it using your distro's package manager or build from source"
_wait
fi
fi
fi
}
download() {
url=$1
filename=$2
curl $url -L -o $filename
}
if [ `id -u` == 0 ]; then
die "Error: running as root - don't use 'sudo' with this script"
fi
if ! command -v unzip >/dev/null 2>&1; then
_install "unzip"
fi
if ! command -v curl >/dev/null 2>&1; then
if [ $OS == "cygwin" ]; then
_cygwin_error "curl"
else
_install curl
fi
fi
echo "Storing all downloaded dependencies in the \"dependencies\" folder"
DEPENDENCIES_FOLDER="/var/tmp/Arduino-Makefile-testing-dependencies"
mkdir -p $DEPENDENCIES_FOLDER
if ! command -v make >/dev/null 2>&1; then
if [ $OS == "cygwin" ]; then
_cygwin_error "make"
elif [ $OS == "mac" ]; then
die "Missing 'make' - install the Xcode CLI tools"
else
if [ $DISTRO == "arch" ]; then
_install "base-devel"
elif [ $DISTRO == "Ubuntu" ]; then
_install "build-essential"
fi
fi
fi
if [ $DISTRO == "Ubuntu" ] && [ $ARCH == "x86_64" ]; then
_install "libc6-i386"
_install "lib32gcc1"
fi
if ! command -v g++ >/dev/null 2>&1; then
if [ $DISTRO == "Ubuntu" ]; then
_install "g++"
fi
fi
if ! command -v python3 >/dev/null 2>&1; then
echo "Installing Python..."
_install "python3"
fi
if ! command -v pip3 >/dev/null 2>&1; then
echo "Installing Pip..."
_install "python3-pip"
fi
PIP_SUDO_CMD=
if [ -z $VIRTUAL_ENV ]; then
# Only use sudo if the user doesn't have an active virtualenv
PIP_SUDO_CMD=$SUDO_CMD
fi
$PIP_SUDO_CMD pip3 install --src dependencies --pre -Ur $BOOTSTRAP_DIR/pip-requirements.txt
COMMON_SOURCED=1
fi

View file

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

100
tests/script/runtests.sh Executable file
View file

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