Test the makefile in windows
sudar opened this issue · 22 comments
The current state of makefile in windows is "supposed to work". I don't think anyone has tested the makefile in Windows to confirm whether it works or not.
It would be nice if someone who has access to a Windows box tests and reports whether it works properly or not.
@ibespwn posted this at #128 (comment)
If you want, I can work with you in this thread to help test it in Windows. Or we can use the Issue link you provided.
Bear in mind, I'm using cygwin, so it may work better/worse with GNU Make and Windows Command Prompt.
I'm working out of your examples/Blink directory.
Cygwin adds some confusion in that executables compiled for Windows (like cc1plus.exe) expect Windows style paths (C:\arduino-1.0.5), but Cygwin uses unix style paths (/cygdrive/c/arduino-1.0.5/). Cygwin also seems to get Windows applications (even Windows Command Prompt) to recognize forward slashes as directory delimiters, though, so it recognizes "C:/arduino-1.0.5/" as well.
I had to modify Arduino.mk to get it to find Arduino.h with ARDUINO_HEADER in a couple places. If this was a mistake (maybe I pointed to the wrong one or something), let me know!
$ git diff
diff --git a/arduino-mk/Arduino.mk b/arduino-mk/Arduino.mk
index 3ecfbb5..7def2f0 100644
--- a/arduino-mk/Arduino.mk
+++ b/arduino-mk/Arduino.mk
@@ -912,7 +912,7 @@ $(OBJDIR)/%.o: %.pde $(COMMON_DEPS) | $(OBJDIR)
# the ino -> o file
$(OBJDIR)/%.o: %.ino $(COMMON_DEPS) | $(OBJDIR)
@$(MKDIR) $(dir $@)
- $(CXX) -x c++ -include Arduino.h -MMD -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
+ $(CXX) -x c++ -include $(ARDUINO_HEADER) -MMD -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
# generated assembly
$(OBJDIR)/%.s: %.pde $(COMMON_DEPS) | $(OBJDIR)
@@ -921,7 +921,7 @@ $(OBJDIR)/%.s: %.pde $(COMMON_DEPS) | $(OBJDIR)
$(OBJDIR)/%.s: %.ino $(COMMON_DEPS) | $(OBJDIR)
@$(MKDIR) $(dir $@)
- $(CXX) -x c++ -include Arduino.h -MMD -S -fverbose-asm $(CPPFLAGS) $(CXXFLAGS) $< -o $@
+ $(CXX) -x c++ -include $(ARDUINO_HEADER) -MMD -S -fverbose-asm $(CPPFLAGS) $(CXXFLAGS) $< -o $@
#$(OBJDIR)/%.lst: $(OBJDIR)/%.s
# $(AS) -$(MCU_FLAG_NAME)=$(MCU) -alhnd $< > $@
Here's what my makefile looks like:
BOARD_TAG = uno
MONITOR_PORT = /dev/cu.usb*
ARDUINO_LIBS =
ARDUINO_DIR = /cygdrive/c/arduino-1.0.5
ARDUINO_HEADER="/arduino-1.0.5/hardware/arduino/cores/arduino/Arduino.h"
ARDUINO_CORE_PATH="/arduino-1.0.5/hardware/arduino/cores"
# This VARIANT line is not working as I would expect (I expected it to include this in source to get rid of this error:
# In file included from <command-line>:0:
# /arduino-1.0.5/hardware/arduino/cores/arduino/Arduino.h:213:26: error: pins_arduino.h: No such file or directory
VARIANT=standard/pins_arduino.h
include ../../arduino-mk/Arduino.mk
When I try to compile:
/cygdrive/c/dev/arduino-makefile/Arduino-Makefile/examples/Blink
$ make
-------------------------
Arduino.mk Configuration:
- [AUTODETECTED] CURRENT_OS = WINDOWS
- [COMPUTED] ARDMK_DIR = /cygdrive/c/dev/arduino-makefile/Arduino-Makefile (relative to Common.mk)
- [COMPUTED] ARDMK_PATH = /cygdrive/c/dev/arduino-makefile/Arduino-Makefile/bin (relative to ARDMK_DIR)
- [USER] ARDUINO_DIR = /cygdrive/c/arduino-1.0.5
- [AUTODETECTED] ARDUINO_VERSION = 105
- ARDUINO_SKETCHBOOK = .
- [BUNDLED] AVR_TOOLS_DIR = /cygdrive/c/arduino-1.0.5/hardware/tools/avr (in Arduino distribution)
- [COMPUTED] ARDUINO_LIB_PATH = /cygdrive/c/arduino-1.0.5/libraries (from ARDUINO_DIR)
- [USER] ARDUINO_CORE_PATH = "/arduino-1.0.5/hardware/arduino/cores"
- [COMPUTED] ARDUINO_VAR_PATH = /cygdrive/c/arduino-1.0.5/hardware/arduino/variants (from ARDUINO_DIR)
- [COMPUTED] BOARDS_TXT = /cygdrive/c/arduino-1.0.5/hardware/arduino/boards.txt (from ARDUINO_DIR)
- [DEFAULT] USER_LIB_PATH = ./libraries (in user sketchbook)
- [USER] BOARD_TAG = uno
- [COMPUTED] OBJDIR = build-uno (from BOARD_TAG)
- [ASSUMED] MONITOR_BAUDRATE = 9600
- [DEFAULT] OPTIMIZATION_LEVEL = s
- [DEFAULT] MCU_FLAG_NAME = mmcu
- [DEFAULT] CFLAGS_STD = -std=gnu99
- [AUTODETECTED] Size utility: AVR-aware for enhanced output
-------------------------
mkdir -p build-uno
/cygdrive/c/arduino-1.0.5/hardware/tools/avr/bin/avr-g++ -x c++ -include "/arduino-1.0.5/hardware/arduino/cores/arduino/Arduino.h" -MMD -c -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=105 -I. -I"/arduino-1.0.5/hardware/arduino/cores" -I/cygdrive/c/arduino-1.0.5/hardware/arduino/variants/standard/* -Wall -ffunction-sections -fdata-sections -Os -fno-exceptions Blink.ino -o build-uno/Blink.o
In file included from /arduino-1.0.5/hardware/arduino/cores/arduino/Print.h:27,
from /arduino-1.0.5/hardware/arduino/cores/arduino/Stream.h:26,
from /arduino-1.0.5/hardware/arduino/cores/arduino/HardwareSerial.h:28,
from /arduino-1.0.5/hardware/arduino/cores/arduino/Arduino.h:193,
from <command-line>:0:
/arduino-1.0.5/hardware/arduino/cores/arduino/Printable.h:23:17: warning: new.h: No such file or directory
/cygdrive/c/arduino-1.0.5/hardware/tools/avr/bin/avr-ar rcs build-uno/libcore.a
/cygdrive/c/arduino-1.0.5/hardware/tools/avr/bin/avr-gcc -mmcu=atmega328p -Wl,--gc-sections -Os -o build-uno/Blink.elf build-uno/Blink.o build-uno/libcore.a -lc -lm
c:/arduino-1.0.5/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/lib/avr5/crtm328p.o:(.init9+0x0): undefined reference to `main'
../../arduino-mk/Arduino.mk:1076: recipe for target `build-uno/Blink.elf' failed
make: *** [build-uno/Blink.elf] Error 1
At this point, we're getting outside of my realm of understanding, and I'm not sure where to go to continue finding ways to fix the compile errors.
I had to modify Arduino.mk to get it to find Arduino.h with ARDUINO_HEADER in a couple places. If this was a mistake (maybe I pointed to the wrong one or something), let me know!
You are correct, it's a bug. I have created a separate issue to track it - #131
In your makefile you are defining this ARDUINO_HEADER="/arduino-1.0.5/hardware/arduino/cores/arduino/Arduino.h"
. This is not needed. The makefile will determine the proper header file (Arduino.h or WProgram.h) based on Arduino version.
In your makefile you are also defining the following
ARDUINO_CORE_PATH="/arduino-1.0.5/hardware/arduino/cores"
VARIANT=standard/pins_arduino.h
These are needed only if you are using a non-standard or unofficial Arduino board. It seems you are trying this in Uno, so you don't have to declare them.
Kindly remove these 3 lines from your makefile and let me know if that helps.
Without those three files included.
$ make
-------------------------
Arduino.mk Configuration:
- [AUTODETECTED] CURRENT_OS = WINDOWS
- [COMPUTED] ARDMK_DIR = /cygdrive/c/dev/Arduino-Makefile (relative to Common.mk)
- [COMPUTED] ARDMK_PATH = /cygdrive/c/dev/Arduino-Makefile/bin (relative to ARDMK_DIR)
- [USER] ARDUINO_DIR = /cygdrive/c/arduino-1.0.5
- [AUTODETECTED] ARDUINO_VERSION = 105
- ARDUINO_SKETCHBOOK = .
- [BUNDLED] AVR_TOOLS_DIR = /cygdrive/c/arduino-1.0.5/hardware/tools/avr (in Arduino distribution)
- [COMPUTED] ARDUINO_LIB_PATH = /cygdrive/c/arduino-1.0.5/libraries (from ARDUINO_DIR)
- [DEFAULT] ARDUINO_CORE_PATH = /cygdrive/c/arduino-1.0.5/hardware/arduino/cores/arduino
- [COMPUTED] ARDUINO_VAR_PATH = /cygdrive/c/arduino-1.0.5/hardware/arduino/variants (from ARDUINO_DIR)
- [COMPUTED] BOARDS_TXT = /cygdrive/c/arduino-1.0.5/hardware/arduino/boards.txt (from ARDUINO_DIR)
- [DEFAULT] USER_LIB_PATH = ./libraries (in user sketchbook)
- [USER] BOARD_TAG = uno
- [COMPUTED] OBJDIR = build-uno (from BOARD_TAG)
- [ASSUMED] MONITOR_BAUDRATE = 9600
- [DEFAULT] OPTIMIZATION_LEVEL = s
- [DEFAULT] MCU_FLAG_NAME = mmcu
- [DEFAULT] CFLAGS_STD = -std=gnu99
- [AUTODETECTED] Size utility: AVR-aware for enhanced output
-------------------------
/cygdrive/c/arduino-1.0.5/hardware/tools/avr/bin/avr-g++ -x c++ -include Arduino.h -MMD -c -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=105 -I. -I/cygdrive/c/arduino-1.0.5/hardware/arduino/cores/arduino -I/cygdrive/c/arduino-1.0.5/hardware/arduino/variants/standard -Wall -ffunction-sections -fdata-sections -Os -fno-exceptions Blink.ino -o build-uno/Blink.o
<command-line>:208:53: error: Arduino.h: No such file or directory
Blink.ino: In function 'void setup()':
Blink.ino:11: error: 'OUTPUT' was not declared in this scope
Blink.ino:11: error: 'pinMode' was not declared in this scope
Blink.ino: In function 'void loop()':
Blink.ino:15: error: 'HIGH' was not declared in this scope
Blink.ino:15: error: 'digitalWrite' was not declared in this scope
Blink.ino:16: error: 'delay' was not declared in this scope
Blink.ino:17: error: 'LOW' was not declared in this scope
../../arduino-mk/Arduino.mk:914: recipe for target `build-uno/Blink.o' failed
make: *** [build-uno/Blink.o] Error 1
With just ARDUINO_HEADER="/arduino-1.0.5/hardware/arduino/cores/arduino/Arduino.h"
$ make
-------------------------
Arduino.mk Configuration:
- [AUTODETECTED] CURRENT_OS = WINDOWS
- [COMPUTED] ARDMK_DIR = /cygdrive/c/dev/Arduino-Makefile (relative to Common.mk)
- [COMPUTED] ARDMK_PATH = /cygdrive/c/dev/Arduino-Makefile/bin (relative to ARDMK_DIR)
- [USER] ARDUINO_DIR = /cygdrive/c/arduino-1.0.5
- [AUTODETECTED] ARDUINO_VERSION = 105
- ARDUINO_SKETCHBOOK = .
- [BUNDLED] AVR_TOOLS_DIR = /cygdrive/c/arduino-1.0.5/hardware/tools/avr (in Arduino distribution)
- [COMPUTED] ARDUINO_LIB_PATH = /cygdrive/c/arduino-1.0.5/libraries (from ARDUINO_DIR)
- [DEFAULT] ARDUINO_CORE_PATH = /cygdrive/c/arduino-1.0.5/hardware/arduino/cores/arduino
- [COMPUTED] ARDUINO_VAR_PATH = /cygdrive/c/arduino-1.0.5/hardware/arduino/variants (from ARDUINO_DIR)
- [COMPUTED] BOARDS_TXT = /cygdrive/c/arduino-1.0.5/hardware/arduino/boards.txt (from ARDUINO_DIR)
- [DEFAULT] USER_LIB_PATH = ./libraries (in user sketchbook)
- [USER] BOARD_TAG = uno
- [COMPUTED] OBJDIR = build-uno (from BOARD_TAG)
- [ASSUMED] MONITOR_BAUDRATE = 9600
- [DEFAULT] OPTIMIZATION_LEVEL = s
- [DEFAULT] MCU_FLAG_NAME = mmcu
- [DEFAULT] CFLAGS_STD = -std=gnu99
- [AUTODETECTED] Size utility: AVR-aware for enhanced output
-------------------------
/cygdrive/c/arduino-1.0.5/hardware/tools/avr/bin/avr-g++ -x c++ -include "/arduino-1.0.5/hardware/arduino/cores/arduino/Arduino.h" -MMD -c -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=105 -I. -I/cygdrive/c/arduino-1.0.5/hardware/arduino/cores/arduino -I/cygdrive/c/arduino-1.0.5/hardware/arduino/variants/standard -Wall -ffunction-sections -fdata-sections -Os -fno-exceptions Blink.ino -o build-uno/Blink.o
In file included from /arduino-1.0.5/hardware/arduino/cores/arduino/Print.h:27,
from /arduino-1.0.5/hardware/arduino/cores/arduino/Stream.h:26,
from /arduino-1.0.5/hardware/arduino/cores/arduino/HardwareSerial.h:28,
from /arduino-1.0.5/hardware/arduino/cores/arduino/Arduino.h:193,
from <command-line>:0:
/arduino-1.0.5/hardware/arduino/cores/arduino/Printable.h:23:17: warning: new.h: No such file or directory
In file included from <command-line>:0:
/arduino-1.0.5/hardware/arduino/cores/arduino/Arduino.h:213:26: error: pins_arduino.h: No such file or directory
../../arduino-mk/Arduino.mk:914: recipe for target `build-uno/Blink.o' failed
make: *** [build-uno/Blink.o] Error 1
For some reason in windows, the compiler is not able to find the include header files.
Can you enable verbose mode in Arduino IDE and then post the compilation message in a gist?
I've had some success in Windows if you use a relative path for ARDUINO_DIR instead of an absolute path. If you give the compiler an absolute path, it seems to expect it to be a Windows-style path and not UNIX (i.e. with forward slashes).
Building from master today (xxx) it works for the BlinkChipKIT example if I set a relative path for MPIDE_DIR, e.g. just mpide
(it's in the local directory):
> make 1
-------------------------
Arduino.mk Configuration:
- [AUTODETECTED] CURRENT_OS = WINDOWS
- [USER] ARDMK_DIR = /home/cpeplin/dev/Arduino-Makefile
- [USER] ARDMK_PATH = /home/cpeplin/dev/Arduino-Makefile/bin
- [USER] ARDUINO_DIR = mpide
- [USER] ARDUINO_VERSION = 23
- [USER] ARDUINO_PREFERENCES_PATH =
- [DEFAULT] ARDUINO_SKETCHBOOK = /home/cpeplin/sketchbook
- [USER] AVR_TOOLS_DIR = mpide/hardware/pic32/compiler/pic32-tools
- [COMPUTED] ARDUINO_LIB_PATH = mpide/libraries (from ARDUINO_DIR)
- [USER] ARDUINO_CORE_PATH = mpide/hardware/pic32/cores/pic32
- [USER] ALTERNATE_CORE = pic32
- [COMPUTED] ALTERNATE_CORE_PATH = mpide/hardware/pic32 (from ARDUINO_SKETCHBOOK and ALTERNATE_CORE)
- [COMPUTED] ARDUINO_VAR_PATH = mpide/hardware/pic32/variants (from ALTERNATE_CORE_PATH)
- [COMPUTED] BOARDS_TXT = mpide/hardware/pic32/boards.txt (from ALTERNATE_CORE_PATH)
- [DEFAULT] USER_LIB_PATH = /home/cpeplin/sketchbook/libraries (in user sketchbook)
- [USER] BOARD_TAG = mega_pic32
- [COMPUTED] OBJDIR = build-mega_pic32 (from BOARD_TAG)
- [ASSUMED] MONITOR_BAUDRATE = 9600
- [DEFAULT] OPTIMIZATION_LEVEL = s
- [USER] MCU_FLAG_NAME = mprocessor
- [DEFAULT] CFLAGS_STD = -std=gnu99
- [AUTODETECTED] Size utility: Basic (not AVR-aware)
-------------------------
mpide/hardware/pic32/compiler/pic32-tools/bin/pic32-g++ -x c++ -include WProgram.h -MMD -c -mno-smart-io -fno-short-double -mprocessor=32MX795F512L -DF_CPU=80000000L -DARDUINO=23 -I. -Impide/hardware/pic32/cores/pic32 -Impide/hardware/pic32/variants/Max32 -Wall -ffunction-sections -fdata-sections -Os -fno-exceptions BlinkChipKIT.pde -o build-mega_pic32/BlinkChipKIT.o
In file included from mpide/hardware/pic32/cores/pic32/pins_arduino.h:219:0,
from mpide/hardware/pic32/cores/pic32/WProgram.h:9,
from <command-line>:0:
mpide/hardware/pic32/variants/Max32/Board_Defs.h:226:1: warning: "/*" within comment
In file included from mpide/hardware/pic32/cores/pic32/wiring.h:43:0,
from mpide/hardware/pic32/cores/pic32/WProgram.h:12,
from <command-line>:0:
mpide/hardware/pic32/cores/pic32/p32_defs.h:341:0: warning: "OCCON_ON" redefined
C:\cygwin\home\cpeplin\dev\Arduino-Makefile\examples\BlinkChipKIT\mpide\hardware\pic32\compiler\pic32-tools\bin\../lib/gcc/pic32mx/4.5.1/../../../../pic32mx/include/proc/ppic32mx.h:796:0: note: this is the location of the previous definition
mpide/hardware/pic32/cores/pic32/p32_defs.h:347:0: warning: "OCCON_OCFLT" redefined
C:\cygwin\home\cpeplin\dev\Arduino-Makefile\examples\BlinkChipKIT\mpide\hardware\pic32\compiler\pic32-tools\bin\../lib/gcc/pic32mx/4.5.1/../../../../pic32mx/include/proc/ppic32mx.h:792:0: note: this is the location of the previous definition
<...snip...>
mpide/hardware/pic32/cores/pic32/p32_defs.h:347:0: warning: "OCCON_OCFLT" redefined
C:\cygwin\home\cpeplin\dev\Arduino-Makefile\examples\BlinkChipKIT\mpide\hardware\pic32\compiler\pic32-tools\bin\../lib/gcc/pic32mx/4.5.1/../../../../pic32mx/include/proc/ppic32mx.h:792:0: note: this is the location of the previous definition
mpide/hardware/pic32/compiler/pic32-tools/bin/pic32-gcc -MMD -c -mno-smart-io -fno-short-double -mprocessor=32MX795F512L -DF_CPU=80000000L -DARDUINO=23 -I. -Impide/hardware/pic32/cores/pic32 -Impide/hardware/pic32/variants/Max32 -Wall -ffunction-sections -fdata-sections -Os -x assembler-with-cpp mpide/hardware/pic32/cores/pic32/vector_table.S -o build-mega_pic32/vector_table.o
mpide/hardware/pic32/compiler/pic32-tools/bin/pic32-ar rcs build-mega_pic32/libcore.a build-mega_pic32/WSystem.o build-mega_pic32/pins_arduino.o build-mega_pic32/wiring_pulse.o build-mega_pic32/wiring_digital.o build-mega_pic32/task_manager.o build-mega_pic32/wiring_analog.o build-mega_pic32/wiring.o build-mega_pic32/HardwareSerial_cdcacm.o build-mega_pic32/HardwareSerial_usb.o build-mega_pic32/WInterrupts.o build-mega_pic32/exceptions.o build-mega_pic32/wiring_shift.o build-mega_pic32/WString.o build-mega_pic32/Tone.o build-mega_pic32/WMath.o build-mega_pic32/HardwareSerial.o build-mega_pic32/main.o build-mega_pic32/Print.o build-mega_pic32/vector_table.o
mpide/hardware/pic32/compiler/pic32-tools/bin/pic32-gcc -Tmpide/hardware/pic32/cores/pic32/chipKIT-application-32MX795F512.ld -Tmpide/hardware/pic32/cores/pic32/chipKIT-application-COMMON.ld -mprocessor=32MX795F512L -Wl,--gc-sections -Os -o build-mega_pic32/BlinkChipKIT.elf build-mega_pic32/BlinkChipKIT.o build-mega_pic32/libcore.a -lc -lm
mpide/hardware/pic32/compiler/pic32-tools/bin/pic32-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" \
--change-section-lma .eeprom=0 -O ihex build-mega_pic32/BlinkChipKIT.elf build-mega_pic32/BlinkChipKIT.eep
C:\cygwin\home\cpeplin\dev\Arduino-Makefile\examples\BlinkChipKIT\mpide\hardware\pic32\compiler\pic32-tools\bin\pic32-objcopy.exe: --change-section-lma .eeprom=0x00000000 never used
mpide/hardware/pic32/compiler/pic32-tools/bin/pic32-objcopy -O ihex -R .eeprom build-mega_pic32/BlinkChipKIT.elf build-mega_pic32/BlinkChipKIT.hex
mpide/hardware/pic32/compiler/pic32-tools/bin/pic32-size build-mega_pic32/BlinkChipKIT.hex
text data bss dec hex filename
0 5856 0 5856 16e0 build-mega_pic32/BlinkChipKIT.hex
If I set an absolute path for MPIDE_DIR, it fails:
> make
-------------------------
Arduino.mk Configuration:
- [AUTODETECTED] CURRENT_OS = WINDOWS
- [USER] ARDMK_DIR = /home/cpeplin/dev/Arduino-Makefile
- [USER] ARDMK_PATH = /home/cpeplin/dev/Arduino-Makefile/bin
- [USER] ARDUINO_DIR = /home/cpeplin/dev/Arduino-Makefile/examples/BlinkChipKIT/mpide
- [USER] ARDUINO_VERSION = 23
- [USER] ARDUINO_PREFERENCES_PATH =
- [DEFAULT] ARDUINO_SKETCHBOOK = /home/cpeplin/sketchbook
- [USER] AVR_TOOLS_DIR = /home/cpeplin/dev/Arduino-Makefile/examples/BlinkChipKIT/mpide/hardware/pic32/compiler/pic32-tools
- [COMPUTED] ARDUINO_LIB_PATH = /home/cpeplin/dev/Arduino-Makefile/examples/BlinkChipKIT/mpide/libraries (from ARDUINO_DIR)
- [USER] ARDUINO_CORE_PATH = /home/cpeplin/dev/Arduino-Makefile/examples/BlinkChipKIT/mpide/hardware/pic32/cores/pic32
- [USER] ALTERNATE_CORE = pic32
- [COMPUTED] ALTERNATE_CORE_PATH = /home/cpeplin/dev/Arduino-Makefile/examples/BlinkChipKIT/mpide/hardware/pic32 (from ARDUINO_SKETCHBOOK and ALTERNATE_CORE)
- [COMPUTED] ARDUINO_VAR_PATH = /home/cpeplin/dev/Arduino-Makefile/examples/BlinkChipKIT/mpide/hardware/pic32/variants (from ALTERNATE_CORE_PATH)
- [COMPUTED] BOARDS_TXT = /home/cpeplin/dev/Arduino-Makefile/examples/BlinkChipKIT/mpide/hardware/pic32/boards.txt (from ALTERNATE_CORE_PATH)
- [DEFAULT] USER_LIB_PATH = /home/cpeplin/sketchbook/libraries (in user sketchbook)
- [USER] BOARD_TAG = mega_pic32
- [COMPUTED] OBJDIR = build-mega_pic32 (from BOARD_TAG)
- [ASSUMED] MONITOR_BAUDRATE = 9600
- [DEFAULT] OPTIMIZATION_LEVEL = s
- [USER] MCU_FLAG_NAME = mprocessor
- [DEFAULT] CFLAGS_STD = -std=gnu99
- [AUTODETECTED] Size utility: Basic (not AVR-aware)
-------------------------
mkdir -p build-mega_pic32
/home/cpeplin/dev/Arduino-Makefile/examples/BlinkChipKIT/mpide/hardware/pic32/compiler/pic32-tools/bin/pic32-g++ -x c++ -include WProgram.h -MMD -c -mno-smart-io -fno-short-double -mprocessor=32MX795F512L -DF_CPU=80000000L -DARDUINO=23 -I. -I/home/cpeplin/dev/Arduino-Makefile/examples/BlinkChipKIT/mpide/hardware/pic32/cores/pic32 -I/home/cpeplin/dev/Arduino-Makefile/examples/BlinkChipKIT/mpide/hardware/pic32/variants/Max32 -Wall -ffunction-sections -fdata-sections -Os -fno-exceptions BlinkChipKIT.pde -o build-mega_pic32/BlinkChipKIT.o
cc1plus.exe: fatal error: WProgram.h: No such file or directory
compilation terminated.
/home/cpeplin/dev/Arduino-Makefile/arduino-mk/Arduino.mk:911: recipe for target `build-mega_pic32/BlinkChipKIT.o' failed
make: *** [build-mega_pic32/BlinkChipKIT.o] Error 1
Building the Blink
example with Arduino 1.0.5 has the same issue. Using a relative path, it works fine:
> make
-------------------------
Arduino.mk Configuration:
- [AUTODETECTED] CURRENT_OS = WINDOWS
- [COMPUTED] ARDMK_DIR = /home/cpeplin/dev/Arduino-Makefile (relative to Common.mk)
- [COMPUTED] ARDMK_PATH = /home/cpeplin/dev/Arduino-Makefile/bin (relative to ARDMK_DIR)
- [USER] ARDUINO_DIR = arduino-1.0.5
- [AUTODETECTED] ARDUINO_VERSION = 105
- [DEFAULT] ARDUINO_SKETCHBOOK = /home/cpeplin/sketchbook
- [BUNDLED] AVR_TOOLS_DIR = arduino-1.0.5/hardware/tools/avr (in Arduino distribution)
- [COMPUTED] ARDUINO_LIB_PATH = arduino-1.0.5/libraries (from ARDUINO_DIR)
- [DEFAULT] ARDUINO_CORE_PATH = arduino-1.0.5/hardware/arduino/cores/arduino
- [COMPUTED] ARDUINO_VAR_PATH = arduino-1.0.5/hardware/arduino/variants (from ARDUINO_DIR)
- [COMPUTED] BOARDS_TXT = arduino-1.0.5/hardware/arduino/boards.txt (from ARDUINO_DIR)
- [DEFAULT] USER_LIB_PATH = /home/cpeplin/sketchbook/libraries (in user sketchbook)
- [USER] BOARD_TAG = uno
- [COMPUTED] OBJDIR = build-uno (from BOARD_TAG)
- [ASSUMED] MONITOR_BAUDRATE = 9600
- [DEFAULT] OPTIMIZATION_LEVEL = s
- [DEFAULT] MCU_FLAG_NAME = mmcu
- [DEFAULT] CFLAGS_STD = -std=gnu99
- [AUTODETECTED] Size utility: AVR-aware for enhanced output
-------------------------
mkdir -p build-uno
arduino-1.0.5/hardware/tools/avr/bin/avr-g++ -x c++ -include Arduino.h -MMD -c -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=105 -I. -Iarduino-1.0.5/hardware/arduino/cores/arduino -Iarduino-1.0.5/hardware/arduino/variants/standard -Wall -ffunction-sections -fdata-sections -Os -fno-exceptions Blink.ino -o build-uno/Blink.o
arduino-1.0.5/hardware/tools/avr/bin/avr-gcc -MMD -c -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=105 -I. -Iarduino-1.0.5/hardware/arduino/cores/arduino -Iarduino-1.0.5/hardware/arduino/variants/standard -Wall -ffunction-sections -fdata-sections -Os arduino-1.0.5/hardware/arduino/cores/arduino/wiring_shift.c -o build-uno/wiring_shift.o
arduino-1.0.5/hardware/tools/avr/bin/avr-gcc -MMD -c -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=105 -I. -Iarduino-1.0.5/hardware/arduino/cores/arduino -Iarduino-1.0.5/hardware/arduino/variants/standard -Wall -ffunction-sections -fdata-sections -Os arduino-1.0.5/hardware/arduino/cores/arduino/wiring_analog.c -o build-uno/wiring_analog.o
arduino-1.0.5/hardware/tools/avr/bin/avr-gcc -MMD -c -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=105 -I. -Iarduino-1.0.5/hardware/arduino/cores/arduino -Iarduino-1.0.5/hardware/arduino/variants/standard -Wall -ffunction-sections -fdata-sections -Os arduino-1.0.5/hardware/arduino/cores/arduino/wiring_pulse.c -o build-uno/wiring_pulse.o
arduino-1.0.5/hardware/tools/avr/bin/avr-gcc -MMD -c -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=105 -I. -Iarduino-1.0.5/hardware/arduino/cores/arduino -Iarduino-1.0.5/hardware/arduino/variants/standard -Wall -ffunction-sections -fdata-sections -Os arduino-1.0.5/hardware/arduino/cores/arduino/wiring_digital.c -o build-uno/wiring_digital.o
arduino-1.0.5/hardware/tools/avr/bin/avr-gcc -MMD -c -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=105 -I. -Iarduino-1.0.5/hardware/arduino/cores/arduino -Iarduino-1.0.5/hardware/arduino/variants/standard -Wall -ffunction-sections -fdata-sections -Os arduino-1.0.5/hardware/arduino/cores/arduino/WInterrupts.c -o build-uno/WInterrupts.o
arduino-1.0.5/hardware/tools/avr/bin/avr-gcc -MMD -c -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=105 -I. -Iarduino-1.0.5/hardware/arduino/cores/arduino -Iarduino-1.0.5/hardware/arduino/variants/standard -Wall -ffunction-sections -fdata-sections -Os arduino-1.0.5/hardware/arduino/cores/arduino/wiring.c -o build-uno/wiring.o
arduino-1.0.5/hardware/tools/avr/bin/avr-g++ -MMD -c -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=105 -I. -Iarduino-1.0.5/hardware/arduino/cores/arduino -Iarduino-1.0.5/hardware/arduino/variants/standard -Wall -ffunction-sections -fdata-sections -Os -fno-exceptions arduino-1.0.5/hardware/arduino/cores/arduino/CDC.cpp -o build-uno/CDC.o
arduino-1.0.5/hardware/tools/avr/bin/avr-g++ -MMD -c -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=105 -I. -Iarduino-1.0.5/hardware/arduino/cores/arduino -Iarduino-1.0.5/hardware/arduino/variants/standard -Wall -ffunction-sections -fdata-sections -Os -fno-exceptions arduino-1.0.5/hardware/arduino/cores/arduino/HardwareSerial.cpp -o build-uno/HardwareSerial.o
arduino-1.0.5/hardware/arduino/cores/arduino/HardwareSerial.cpp: In function 'void store_char(unsigned char, ring_buffer*)':
arduino-1.0.5/hardware/arduino/cores/arduino/HardwareSerial.cpp:98: warning: comparison between signed and unsigned integer expressions
arduino-1.0.5/hardware/arduino/cores/arduino/HardwareSerial.cpp: In function 'void __vector_18()':
arduino-1.0.5/hardware/arduino/cores/arduino/HardwareSerial.cpp:127: warning: unused variable 'c'
arduino-1.0.5/hardware/arduino/cores/arduino/HardwareSerial.cpp: In member function 'void HardwareSerial::begin(long unsigned int, byte)':
arduino-1.0.5/hardware/arduino/cores/arduino/HardwareSerial.cpp:368: warning: unused variable 'current_config'
arduino-1.0.5/hardware/arduino/cores/arduino/HardwareSerial.cpp: In member function 'virtual size_t HardwareSerial::write(uint8_t)':
arduino-1.0.5/hardware/arduino/cores/arduino/HardwareSerial.cpp:467: warning: comparison between signed and unsigned integer expressions
arduino-1.0.5/hardware/tools/avr/bin/avr-g++ -MMD -c -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=105 -I. -Iarduino-1.0.5/hardware/arduino/cores/arduino -Iarduino-1.0.5/hardware/arduino/variants/standard -Wall -ffunction-sections -fdata-sections -Os -fno-exceptions arduino-1.0.5/hardware/arduino/cores/arduino/main.cpp -o build-uno/main.o
arduino-1.0.5/hardware/tools/avr/bin/avr-g++ -MMD -c -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=105 -I. -Iarduino-1.0.5/hardware/arduino/cores/arduino -Iarduino-1.0.5/hardware/arduino/variants/standard -Wall -ffunction-sections -fdata-sections -Os -fno-exceptions arduino-1.0.5/hardware/arduino/cores/arduino/WMath.cpp -o build-uno/WMath.o
arduino-1.0.5/hardware/tools/avr/bin/avr-g++ -MMD -c -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=105 -I. -Iarduino-1.0.5/hardware/arduino/cores/arduino -Iarduino-1.0.5/hardware/arduino/variants/standard -Wall -ffunction-sections -fdata-sections -Os -fno-exceptions arduino-1.0.5/hardware/arduino/cores/arduino/USBCore.cpp -o build-uno/USBCore.o
arduino-1.0.5/hardware/tools/avr/bin/avr-g++ -MMD -c -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=105 -I. -Iarduino-1.0.5/hardware/arduino/cores/arduino -Iarduino-1.0.5/hardware/arduino/variants/standard -Wall -ffunction-sections -fdata-sections -Os -fno-exceptions arduino-1.0.5/hardware/arduino/cores/arduino/Stream.cpp -o build-uno/Stream.o
arduino-1.0.5/hardware/tools/avr/bin/avr-g++ -MMD -c -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=105 -I. -Iarduino-1.0.5/hardware/arduino/cores/arduino -Iarduino-1.0.5/hardware/arduino/variants/standard -Wall -ffunction-sections -fdata-sections -Os -fno-exceptions arduino-1.0.5/hardware/arduino/cores/arduino/HID.cpp -o build-uno/HID.o
arduino-1.0.5/hardware/tools/avr/bin/avr-g++ -MMD -c -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=105 -I. -Iarduino-1.0.5/hardware/arduino/cores/arduino -Iarduino-1.0.5/hardware/arduino/variants/standard -Wall -ffunction-sections -fdata-sections -Os -fno-exceptions arduino-1.0.5/hardware/arduino/cores/arduino/Print.cpp -o build-uno/Print.o
arduino-1.0.5/hardware/arduino/cores/arduino/Print.cpp: In member function 'size_t Print::print(const __FlashStringHelper*)':
arduino-1.0.5/hardware/arduino/cores/arduino/Print.cpp:44: warning: '__progmem__' attribute ignored
arduino-1.0.5/hardware/tools/avr/bin/avr-g++ -MMD -c -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=105 -I. -Iarduino-1.0.5/hardware/arduino/cores/arduino -Iarduino-1.0.5/hardware/arduino/variants/standard -Wall -ffunction-sections -fdata-sections -Os -fno-exceptions arduino-1.0.5/hardware/arduino/cores/arduino/Tone.cpp -o build-uno/Tone.o
arduino-1.0.5/hardware/arduino/cores/arduino/Tone.cpp:119: warning: only initialized variables can be placed into program memory area
arduino-1.0.5/hardware/tools/avr/bin/avr-g++ -MMD -c -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=105 -I. -Iarduino-1.0.5/hardware/arduino/cores/arduino -Iarduino-1.0.5/hardware/arduino/variants/standard -Wall -ffunction-sections -fdata-sections -Os -fno-exceptions arduino-1.0.5/hardware/arduino/cores/arduino/WString.cpp -o build-uno/WString.o
arduino-1.0.5/hardware/tools/avr/bin/avr-g++ -MMD -c -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=105 -I. -Iarduino-1.0.5/hardware/arduino/cores/arduino -Iarduino-1.0.5/hardware/arduino/variants/standard -Wall -ffunction-sections -fdata-sections -Os -fno-exceptions arduino-1.0.5/hardware/arduino/cores/arduino/new.cpp -o build-uno/new.o
arduino-1.0.5/hardware/tools/avr/bin/avr-g++ -MMD -c -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=105 -I. -Iarduino-1.0.5/hardware/arduino/cores/arduino -Iarduino-1.0.5/hardware/arduino/variants/standard -Wall -ffunction-sections -fdata-sections -Os -fno-exceptions arduino-1.0.5/hardware/arduino/cores/arduino/IPAddress.cpp -o build-uno/IPAddress.o
arduino-1.0.5/hardware/tools/avr/bin/avr-ar rcs build-uno/libcore.a build-uno/wiring_digital.o build-uno/wiring_analog.o build-uno/wiring_pulse.o build-uno/wiring.o build-uno/WInterrupts.o build-uno/wiring_shift.o build-uno/CDC.o build-uno/HID.o build-uno/USBCore.o build-uno/WMath.o build-uno/IPAddress.o build-uno/HardwareSerial.o build-uno/main.o build-uno/WString.o build-uno/Stream.o build-uno/new.o build-uno/Print.o build-uno/Tone.o
arduino-1.0.5/hardware/tools/avr/bin/avr-gcc -mmcu=atmega328p -Wl,--gc-sections -Os -o build-uno/Blink.elf build-uno/Blink.o build-uno/libcore.a -lc -lm
arduino-1.0.5/hardware/tools/avr/bin/avr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" \
--change-section-lma .eeprom=0 -O ihex build-uno/Blink.elf build-uno/Blink.eep
C:\cygwin\home\cpeplin\dev\Arduino-Makefile\examples\Blink\arduino-1.0.5\hardware\tools\avr\bin\avr-objcopy.exe: --change-section-lma .eeprom=0x00000000 never used
arduino-1.0.5/hardware/tools/avr/bin/avr-objcopy -O ihex -R .eeprom build-uno/Blink.elf build-uno/Blink.hex
arduino-1.0.5/hardware/tools/avr/bin/avr-size --mcu=atmega328p -C --format=avr build-uno/Blink.elf
AVR Memory Usage
----------------
Device: atmega328p
Program: 1082 bytes (3.3% Full)
(.text + .data + .bootloader)
Data: 9 bytes (0.4% Full)
(.data + .bss + .noinit)
and with an absolute path for ARDUINO_DIR, I see the same errors as @ibespwn:
> make
-------------------------
Arduino.mk Configuration:
- [AUTODETECTED] CURRENT_OS = WINDOWS
- [COMPUTED] ARDMK_DIR = /home/cpeplin/dev/Arduino-Makefile (relative to Common.mk)
- [COMPUTED] ARDMK_PATH = /home/cpeplin/dev/Arduino-Makefile/bin (relative to ARDMK_DIR)
- [USER] ARDUINO_DIR = /home/cpeplin/dev/Arduino-Makefile/examples/Blink/arduino-1.0.5
- [AUTODETECTED] ARDUINO_VERSION = 105
- [DEFAULT] ARDUINO_SKETCHBOOK = /home/cpeplin/sketchbook
- [BUNDLED] AVR_TOOLS_DIR = /home/cpeplin/dev/Arduino-Makefile/examples/Blink/arduino-1.0.5/hardware/tools/avr (in Arduino distribution)
- [COMPUTED] ARDUINO_LIB_PATH = /home/cpeplin/dev/Arduino-Makefile/examples/Blink/arduino-1.0.5/libraries (from ARDUINO_DIR)
- [DEFAULT] ARDUINO_CORE_PATH = /home/cpeplin/dev/Arduino-Makefile/examples/Blink/arduino-1.0.5/hardware/arduino/cores/arduino
- [COMPUTED] ARDUINO_VAR_PATH = /home/cpeplin/dev/Arduino-Makefile/examples/Blink/arduino-1.0.5/hardware/arduino/variants (from ARDUINO_DIR)
- [COMPUTED] BOARDS_TXT = /home/cpeplin/dev/Arduino-Makefile/examples/Blink/arduino-1.0.5/hardware/arduino/boards.txt (from ARDUINO_DIR)
- [DEFAULT] USER_LIB_PATH = /home/cpeplin/sketchbook/libraries (in user sketchbook)
- [USER] BOARD_TAG = uno
- [COMPUTED] OBJDIR = build-uno (from BOARD_TAG)
- [ASSUMED] MONITOR_BAUDRATE = 9600
- [DEFAULT] OPTIMIZATION_LEVEL = s
- [DEFAULT] MCU_FLAG_NAME = mmcu
- [DEFAULT] CFLAGS_STD = -std=gnu99
- [AUTODETECTED] Size utility: AVR-aware for enhanced output
-------------------------
mkdir -p build-uno
/home/cpeplin/dev/Arduino-Makefile/examples/Blink/arduino-1.0.5/hardware/tools/avr/bin/avr-g++ -x c++ -include Arduino.h -MMD -c -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=105 -I. -I/home/cpeplin/dev/Arduino-Makefile/examples/Blink/arduino-1.0.5/hardware/arduino/cores/arduino -I/home/cpeplin/dev/Arduino-Makefile/examples/Blink/arduino-1.0.5/hardware/arduino/variants/standard -Wall -ffunction-sections -fdata-sections -Os -fno-exceptions Blink.ino -o build-uno/Blink.o
cc1plus.exe: error: Arduino.h: No such file or directory
Blink.ino: In function 'void setup()':
Blink.ino:11: error: 'OUTPUT' was not declared in this scope
Blink.ino:11: error: 'pinMode' was not declared in this scope
Blink.ino: In function 'void loop()':
Blink.ino:15: error: 'HIGH' was not declared in this scope
Blink.ino:15: error: 'digitalWrite' was not declared in this scope
Blink.ino:16: error: 'delay' was not declared in this scope
Blink.ino:17: error: 'LOW' was not declared in this scope
../../arduino-mk/Arduino.mk:916: recipe for target `build-uno/Blink.o' failed
make: *** [build-uno/Blink.o] Error 1
@peplin Thanks for testing this. I was under the impression that lot of things were broken in Windows. Didn't realize that just using relative paths will solve most of it.
Also did you try to upload it to the board or you just tried to compile them alone?
Tonight I tried uploading and I ran into some issues. I think it has to do with the naming of the serial device. The Windows tools need the COM port style names, e.g. "com16" but the Makefile is too aggressively rejecting that device name because it can't find the file (e.g. it's expecting something like /dev/ttyACM0).
In Cygwin, a /dev/ttyS15
device does show up when I attach an Arduino, but it doesn't work - it seems like that's not a legit interface. If I modify Arduino.mk to just accept the MONITOR_PORT
verbatim (i.e. com16
) without checking to see if it exists, I can get a little farther. If I run make do_upload
, it works. If I run make upload
to get the board reset, it fails in ard-reset-arduino
with:
/home/peplin/Arduino-Makefile/bin/ard-reset-arduino com16
Unable to open com16: No such file or directory
I tested ard-reset-arduino in isolation, and it chokes on any name I give it: com16, COM16, /dev/ttyS15. Digging around online, it seems like you may have to use Win32::SerialPort
instead of Device::SerialPort
. I tried to install this, but I'm on 64-bit Windows 7 and cpan says No support for OS
and doesn't install it.
If I modify Arduino.mk to just accept the MONITOR_PORT verbatim (i.e. com16) without checking to see if it exists, I can get a little farther.
What was the exact change that you did? I thought we weren't doing any check on MONITOR_PORT
.
I tested ard-reset-arduino in isolation, and it chokes on any name I give it: com16, COM16, /dev/ttyS15. Digging around online, it seems like you may have to use Win32::SerialPort instead of Device::SerialPort.
I have created a new issue to track this #139. Hopefully someone with a better Perl skill than mine could fix it so that it works on Windows as well.
I changed the get_monitor_port
function to just return $(MONITOR_PORT)
, which let me progress past these two:
AVRDUDE_ARD_OPTS = -c $(AVRDUDE_ARD_PROGRAMMER) -b $(AVRDUDE_ARD_BAUDRATE) -P $(call get_monitor_port)
and
ifndef RESET_CMD
ifneq ($(CATERINA),)
RESET_CMD = $(ARDMK_PATH)/ard-reset-arduino --caterina \
$(ARD_RESET_OPTS) $(call get_monitor_port)
else
RESET_CMD = $(ARDMK_PATH)/ard-reset-arduino \
$(ARD_RESET_OPTS) $(call get_monitor_port)
endif
endif
Yeah, I'm able to compile for and flash both an Arduino Uno and the chipKIT Max32 from Cygwin. We definitely need another person or two to give it a test to make sure all is well, though.
@sej7278 - Yeah definitely. I generally try to adhere to Semantic Versioning and will never change a release (or tag) after it is released. I have already created a github milestone for 1.3.0 and all these changes would go into v1.3.0. Also we can update the package once v1.3.0 is released.
@sudar done (after some minor testing on my mega): http://www.the-jedi.co.uk/downloads/arduino/
i'll inform @maqifrnswa in a mo
Hallo,
I have been trying to use the makefile for Windows and I have gotten some issues. So far I have been able to overcome must of them and the reason of this post is just to let you know about them because others that want to use the makefile on Windows might face them as well. The main issue was due to the folder naming conventions on Windows. By the way I am using Cygwin. My Arduino folder is in "C:\Program Files (x86)\Arduino" First to overcome this I added to the makefile quotation marks (“”) every time the variables ARDUINO_DIR and AVR_TOOLS_DIR are used, e.g.
VERSION_FILE := “$(ARDUINO_DIR)”/lib/version.txt
In my case these two variables had to be relative otherwise the files would not be found. This worked more or less but I was not able to get all the core files compiled. After some tries I found that the $(wildcard) function on which the folders directory was used to search for some files, did not detect well the parenthesis and was giving as a result an empty string. For example in this line
CORE_C_SRCS =
Even by hardcoding ( so the parenthesis by taken into account as a special string, still was not working.
At the end to avoid all of this I made a symbolic link using the command “mklink” on Windows so my variables end up being
ARDUINO_DIR=../../../../../Arduino
Instead of
ARDUINO_DIR=../../../../../Program\ Files\ (x86)/Arduino
I created a directory symbolic link by typing on the windows console
Mklink /d c:\Arduino c:\Program Files (x86)\Arduino
So far this is what I have done and still I have other problems. The next issue is that I get
../../Arduino.mk:940: *** multiple target patterns. Stop.
But still have not being able to found the solution. Any idea would be well appreciated :D
ps. Hope this is the right place to post this
Found the problem... The other variable ARDMK_DIR was sent like this
ARDMK_DIR=C:\Users"YourUser"\Arduino-Makefile
and Cygwin is not converting them to its naming convention. The only variable that is convert is Home. At the end my variable end up being
ARDMK_DIR=/cygdrive/c/Users/"YourUser"/Arduino-Makefile
Hope this information is useful for someone else that wants to use this Makefile on Windows
I actually had to include one line for detecting the conf file for the AVR_DUDE... will create a fork and make a pull request.