Sign up ×
Arduino Stack Exchange is a question and answer site for developers of open-source hardware and software that is compatible with Arduino. It's 100% free, no registration required.

I have an nmake file;

  srcpath = ..\pilot
  cmdline =  "C:\Program Files (x86)\Arduino\arduino.exe"
  cmdflags = --verify  --board arduino:avr:uno --port com4 -v --preserve-temp-files
  prefs = --pref sketchbook.path=$(srcpath) --pref build.path=build
  deps = $(srcpath)\pilot.ino $(srcpath)\commands.h $(srcpath)\publish.h $(srcpath)\motor.h 

  pilot.hex :$(deps)
    type $(srcpath)\pilot.ino
    $(cmdline) $(cmdflags) $(prefs) $(srcpath)\pilot.ino

The file types out fine, but Arduino returns an error;

"failed to open sketch ..\pilot\pilot.ino"

I am setting --pref sketchbook.path=$(srcpath), but I have tried with and without (and many variations of both) and get the same error.

This is the command that is currently being invoked, and looks correct to me;

"C:\Program Files (x86)\Arduino\arduino.exe" --verify  --board arduino:avr:uno --port com4 -v --preserve-temp-files --pref sketchbook.path=..\pilot --pref build.path=build ..\pilot\pilot.ino

Any ideas?

share|improve this question
1  
It looks like the given path is wrong. Have you tried supplying a full path? –  Federico Fissore May 11 at 19:32
    
You are kinda correct. I posted my own answer –  user6569 May 11 at 19:57

1 Answer 1

up vote 0 down vote accepted
srcPath = C:\Users\mikep\Documents\MWPRobotics\Pilot\Pilot
bldPath = $(srcPath)\build
arduinoCmd = "C:\Program Files (x86)\Arduino\arduino.exe"
arduinoFlags = --verify --board arduino:avr:uno --port com4 -v --preserve-temp-files --preferences-file $(bldPath)\pilotPrefs.txt
prefs = --pref sketchbook.path=$(srcPath) --pref build.path=$(bldPath)

deps = $(srcPath)\Pilot.ino $(srcPath)\commands.h $(srcPath)\publish.h  $(srcPath)\motor.h 

pilot.hex : $(deps)
#   type $(srcPath)\Pilot.ino
    $(arduinoCmd) $(arduinoFlags) $(prefs) $(srcPath)\Pilot.ino

Apparently it is really picky about absolute full paths (contrary to the comments that say it is relative)

share|improve this answer
    
I guess it's just a matter of understanding what is the working directory. If you're unsure about it, you can set it with --curdir (that, I've just found out, is undocumented), then you can use relative paths –  Federico Fissore May 12 at 7:01
    
The way the 'type' command succeeded, and Arduino would complain not found, tells me it was not doing working dir relative by default. And yes, I did not know of --curdir - that might have worked. It also seems to ignore the preferences-filename, but it put the file with its Arduino given name in the right place. I am just happy I can run from VS. –  user6569 May 12 at 9:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.