Problem with teensy3 Makefile using mingw/msys make under Windows - solved

I ran into two problems when trying to use the "make" from mingw-w64/msys with the teensy3 Makefile. The problems occurred when trying to run "make" in hardware/teensy/avr/cores/teensy3/ using the default (unmodified) main.cpp therein.

1) The first was caused by spaces in the default Arduino installation pathname, specifically the "Program Files (x86)" component. It caused this error message:

Code:
c:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy3>make
/c/Program Files (x86)/Arduino/hardware/tools/arm/bin/arm-none-eabi-gcc  -Wall -g -Os -mcpu=cortex-m4 -mthumb -MMD -DF_CPU=48000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -DUSING_MAKEFILE -D__MK20DX256__ -DARDUINO=10600 -DTEENSYDUINO=121 -I.  -c -o analog.o analog.c
/bin/sh: -c: line 0: syntax error near unexpected token `('
/bin/sh: -c: line 0: `/c/Program Files (x86)/Arduino/hardware/tools/arm/bin/arm-none-eabi-gcc  -Wall -g -Os -mcpu=cortex-m4 -mthumb -MMD -DF_CPU=48000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -DUSING_MAKEFILE -D__MK20DX256__ -DARDUINO=10600 -DTEENSYDUINO=121 -I.  -c -o analog.o analog.c'
make: *** [analog.o] Error 2

The solution was to move the Arduino install directory from C:\Program Files (x86)\Arduino to C:\Arduino

2) The second was a bad expansion of the TOOLSPATH macro. The symptom was this error message at the very end of an otherwise successful compile:

Code:
/c/Arduino/hardware/tools/arm/bin/arm-none-eabi-objcopy -O ihex -R .eeprom main.elf main.hex
/c/Arduino/hardware/tools   /teensy_post_compile -file=main -path=/c/Arduino/hardware/teensy/avr/cores/teensy3 -tools=/c/Arduino/hardware/tools   
make: /c/Arduino/hardware/tools: Command not found
make: *** [main.hex] Error 127

The solution was to remove the " # Linux" from the line

Code:
TOOLSPATH = $(abspath $(ARDUINOPATH)/hardware/tools)   # Linux

leaving just

Code:
TOOLSPATH = $(abspath $(ARDUINOPATH)/hardware/tools)

With those changes, the compilation succeeded.
 
Back
Top