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.
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.
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.
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.
`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).
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"
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
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.
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.
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.
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.
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
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
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.
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.
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.
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.