Merge pull request #525 from tuna-f1sh/master
Update Windows documentation to allow non-relative paths
This commit is contained in:
commit
9708e8265d
4 changed files with 83 additions and 36 deletions
43
Arduino.mk
43
Arduino.mk
|
@ -62,20 +62,23 @@
|
|||
# AVR_TOOLS_DIR = /usr
|
||||
#
|
||||
# On Windows declare this environmental variables using the windows
|
||||
# configuration options. Control Panel > System > Advanced system settings
|
||||
# Also take into account that when you set them you have to add '\' on
|
||||
# all spaces and special characters.
|
||||
# ARDUINO_DIR and AVR_TOOLS_DIR have to be relative and not absolute.
|
||||
# This are just examples, you have to adapt this variables accordingly to
|
||||
# your system.
|
||||
# configuration options or Cygwin .bashrc. Control Panel > System > Advanced system settings
|
||||
# The paths must use Unix style forward slash and not have any spaces
|
||||
# or escape charactors. One must use a symbolic link if the path does
|
||||
# contain spaces.
|
||||
#
|
||||
# ARDUINO_DIR =../../../../../Arduino
|
||||
# AVR_TOOLS_DIR =../../../../../Arduino/hardware/tools/avr
|
||||
# This are just examples, you have to adapt this variables accordingly to
|
||||
# your system. Note the difference between ARDMK_DIR, which can use /cygdrive/
|
||||
# and USER_LIB_PATH, which cannnot due to invoking with the build tools.
|
||||
# It is best practice to avoid cygdrive all together.
|
||||
#
|
||||
# ARDUINO_DIR = C:/Arduino
|
||||
# AVR_TOOLS_DIR = C:/Arduino/hardware/tools/avr
|
||||
# ARDMK_DIR = /cygdrive/c/Users/"YourUser"/Arduino-Makefile
|
||||
#
|
||||
# On Windows it is highly recommended that you create a symbolic link directory
|
||||
# for avoiding using the normal directories name of windows such as
|
||||
# c:\Program Files (x86)\Arduino
|
||||
# C:\Program Files (x86)\Arduino
|
||||
# For this use the command mklink on the console.
|
||||
#
|
||||
#
|
||||
|
@ -364,9 +367,15 @@ ifndef ARDUINO_SKETCHBOOK
|
|||
ifneq ($(ARDUINO_SKETCHBOOK),)
|
||||
$(call show_config_variable,ARDUINO_SKETCHBOOK,[AUTODETECTED],(from arduino preferences file))
|
||||
else
|
||||
ARDUINO_SKETCHBOOK := $(firstword \
|
||||
$(call dir_if_exists,$(HOME)/sketchbook) \
|
||||
$(call dir_if_exists,$(HOME)/Documents/Arduino) )
|
||||
ifeq ($(CURRENT_OS), WINDOWS)
|
||||
ARDUINO_SKETCHBOOK := $(firstword \
|
||||
$(call dir_if_exists,$(USERPROFILE)/sketchbook) \
|
||||
$(call dir_if_exists,$(USERPROFILE)/Documents/Arduino) )
|
||||
else
|
||||
ARDUINO_SKETCHBOOK := $(firstword \
|
||||
$(call dir_if_exists,$(HOME)/sketchbook) \
|
||||
$(call dir_if_exists,$(HOME)/Documents/Arduino) )
|
||||
endif
|
||||
$(call show_config_variable,ARDUINO_SKETCHBOOK,[DEFAULT])
|
||||
endif
|
||||
else
|
||||
|
@ -744,13 +753,23 @@ ifndef RESET_CMD
|
|||
endif
|
||||
ifneq ($(CATERINA),)
|
||||
ifneq (,$(findstring CYGWIN,$(shell uname -s)))
|
||||
# confirm user is using default cygwin unix Python (which uses ttySx) and not Windows Python (which uses COMx)
|
||||
ifeq ($(shell which python),/usr/bin/python)
|
||||
RESET_CMD = $(ARD_RESET_ARDUINO) --caterina $(ARD_RESET_OPTS) $(DEVICE_PATH)
|
||||
else
|
||||
RESET_CMD = $(ARD_RESET_ARDUINO) --caterina $(ARD_RESET_OPTS) $(call get_monitor_port)
|
||||
endif
|
||||
else
|
||||
RESET_CMD = $(ARD_RESET_ARDUINO) --caterina $(ARD_RESET_OPTS) $(call get_monitor_port)
|
||||
endif
|
||||
else
|
||||
ifneq (,$(findstring CYGWIN,$(shell uname -s)))
|
||||
# confirm user is using default cygwin unix Python (which uses ttySx) and not Windows Python (which uses COMx)
|
||||
ifeq ($(shell which python),/usr/bin/python)
|
||||
RESET_CMD = $(ARD_RESET_ARDUINO) $(ARD_RESET_OPTS) $(DEVICE_PATH)
|
||||
else
|
||||
RESET_CMD = $(ARD_RESET_ARDUINO) $(ARD_RESET_OPTS) $(call get_monitor_port)
|
||||
endif
|
||||
else
|
||||
RESET_CMD = $(ARD_RESET_ARDUINO) $(ARD_RESET_OPTS) $(call get_monitor_port)
|
||||
endif
|
||||
|
|
|
@ -81,7 +81,7 @@ else
|
|||
endif
|
||||
|
||||
ifeq ($(CURRENT_OS),WINDOWS)
|
||||
ifneq ($(shell echo $(ARDUINO_DIR) | egrep '^(/|[a-zA-Z]:\\)'),)
|
||||
echo $(error On Windows, ARDUINO_DIR must be a relative path)
|
||||
ifneq ($(shell echo $(ARDUINO_DIR) | egrep '\\|[[:space:]]|cygdrive'),)
|
||||
echo $(error On Windows, ARDUINO_DIR and other defines must use forward slash and not contain spaces, special characters or be cygdrive relative)
|
||||
endif
|
||||
endif
|
||||
|
|
|
@ -9,6 +9,8 @@ I tried to give credit whenever possible. If I have missed anyone, kindly add it
|
|||
- Fix: Quote the prefix tag in the space_pad_to function
|
||||
- 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)
|
||||
- New: Added -fdiagnostics-color to *STD flags (https://github.com/sej7278)
|
||||
- New: Add generation of tags file using ctags, which automatically includes project libs and Arduino core. (https://github.com/tuna-f1sh)
|
||||
|
||||
|
|
70
README.md
70
README.md
|
@ -127,8 +127,7 @@ You need to install Cygwin and its packages for Make, Perl and the following Ser
|
|||
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```
|
||||
2. extract downloaded package running `tar xvzf dowloaded_package_name.tar.gz`
|
||||
3. navigate to extracted package folder
|
||||
4. build and install Python module:
|
||||
|
||||
|
@ -137,6 +136,16 @@ python setup.py build
|
|||
python setup.py install
|
||||
```
|
||||
|
||||
Alternatively, if you have setup Cygwin to use a Windows Python installation,
|
||||
simply install using pip:
|
||||
|
||||
```
|
||||
pip 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.
|
||||
|
@ -144,7 +153,7 @@ Download a copy of this repo somewhere to your system or install it through a pa
|
|||
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:
|
||||
### Mac
|
||||
|
||||
On the Mac with IDE 1.0 you might want to set:
|
||||
|
||||
|
@ -158,24 +167,28 @@ On the Mac with IDE 1.0 you might want to set:
|
|||
|
||||
On the Mac with IDE 1.5+ it's like above but with
|
||||
|
||||
```
|
||||
```make
|
||||
ARDUINO_DIR = /Applications/Arduino.app/Contents/Java
|
||||
```
|
||||
LINUX:
|
||||
### 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:
|
||||
|
||||
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
|
||||
```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:
|
||||
|
||||
|
@ -184,17 +197,22 @@ Example of the project's make file:
|
|||
MONITOR_PORT = /dev/ttyACM0
|
||||
```
|
||||
|
||||
WINDOWS:
|
||||
### Windows
|
||||
|
||||
On Windows (using cygwin), you might want to set:
|
||||
On Windows (using Cygwin), you might want to set:
|
||||
|
||||
```make
|
||||
ARDUINO_DIR = ../../arduino
|
||||
# Symbolic link to Arduino installation directory - see below
|
||||
ARDUINO_DIR = C:/Arduino
|
||||
ARDMK_DIR = path/to/mkfile
|
||||
MONITOR_PORT = com3
|
||||
BOARD_TAG = mega2560
|
||||
```
|
||||
|
||||
**NOTE: Use forward slash not backslash and there should be no spaces or
|
||||
special characters in the Windows paths (due to Win/Unix crossover). The paths
|
||||
should not be *cygdrive* paths.**
|
||||
|
||||
On Windows (using MSYS and PuTTY), you might want to set the following extra parameters:
|
||||
|
||||
```make
|
||||
|
@ -205,45 +223,53 @@ On Windows (using MSYS and PuTTY), you might want to set the following extra par
|
|||
On Arduino 1.5+ installs, you should set the architecture to either `avr` or `sam` and if using a submenu CPU type, then also set that:
|
||||
|
||||
```make
|
||||
ARCHITECTURE = avr
|
||||
ARCHITECTURE = avr
|
||||
BOARD_TAG = atmegang
|
||||
BOARD_SUB = atmega168
|
||||
```
|
||||
|
||||
It is recommended in Windows that you create a symbolic link to avoid problems with file naming conventions on Windows. For example, if your your Arduino directory is in:
|
||||
#### Symbolic Link
|
||||
|
||||
c:\Program Files (x86)\Arduino
|
||||
It is recommended in Windows that you create a symbolic link to avoid problems with file naming conventions on Windows; unless one installs to a non-default location. For example, if your your Arduino directory is in:
|
||||
|
||||
C:\Program Files (x86)\Arduino
|
||||
|
||||
You will get problems with the special characters on the directory name. More details about this can be found in [issue #94](https://github.com/sudar/Arduino-Makefile/issues/94)
|
||||
|
||||
To create a symbolic link, you can use the command “mklink” on Windows, e.g.
|
||||
|
||||
```sh
|
||||
mklink /d c:\Arduino c:\Program Files (x86)\Arduino
|
||||
mklink /d C:\Arduino C:\Program Files (x86)\Arduino
|
||||
```
|
||||
Alternatively if you've setup Cygwin hard symbolic links ([CYGWIN=winsymlinks:native](https://www.cygwin.com/cygwin-ug-net/using-cygwinenv.html)):
|
||||
|
||||
```sh
|
||||
ln -s /cygdrive/c/Program Files\ \(x86\)/Arduino/ C:/Arduino
|
||||
```
|
||||
|
||||
After which, the variables should be:
|
||||
|
||||
```make
|
||||
ARDUINO_DIR=../../../../../Arduino
|
||||
ARDUINO_DIR=C:/Arduino
|
||||
```
|
||||
|
||||
Instead of:
|
||||
|
||||
```make
|
||||
ARDUINO_DIR=../../../../../Program\ Files\ \(x86\)/Arduino
|
||||
ARDUINO_DIR=C:/Program\ Files\ \(x86\)/Arduino
|
||||
```
|
||||
|
||||
Usefull Variables:
|
||||
### 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. In Cygwin in Windows this path must be
|
||||
relative, not absolute (e.g. "../../arduino" and not "/c/cygwin/Arduino").
|
||||
- `ARDMK_DIR` - Path where the `*.mk` are present. If you installed the package, then it is usually `/usr/share/arduino`
|
||||
- `AVR_TOOLS_DIR` - Path where the avr tools chain binaries are present. If you are going to use the binaries that came with Arduino installation, then you don't have to set it. Otherwise set it realtive and not absolute.
|
||||
- `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.
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue