Can't upload to genuino zero, can't run openocd.

I have been using arduino 1.8.0 for a while and it has been working fine, today however it started giving an error when I try to upload to a Genuino Zero. I have tried 1.8.1 and got the same error, pasted below.

Any ideas how to resolve the issue?

Thanks.

java.io.IOException: Cannot run program "{runtime.tools.openocd-0.9.0-arduino.path}/bin/openocd": error=2, No such file or directory
	at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
	at java.lang.Runtime.exec(Runtime.java:620)
	at java.lang.Runtime.exec(Runtime.java:485)
	at processing.app.helpers.ProcessUtils.exec(ProcessUtils.java:11)
	at cc.arduino.packages.Uploader.executeUploadCommand(Uploader.java:129)
	at cc.arduino.packages.uploaders.SerialUploader.uploadUsingPreferences(SerialUploader.java:207)
	at cc.arduino.UploaderUtils.upload(UploaderUtils.java:78)
	at processing.app.SketchController.upload(SketchController.java:709)
	at processing.app.SketchController.exportApplet(SketchController.java:682)
	at processing.app.Editor$DefaultExportHandler.run(Editor.java:2190)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.IOException: error=2, No such file or directory
	at java.lang.UNIXProcess.forkAndExec(Native Method)
	at java.lang.UNIXProcess.<init>(UNIXProcess.java:247)
	at java.lang.ProcessImpl.start(ProcessImpl.java:134)
	at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
	... 10 more
An error occurred while uploading the sketch

That's a weird one, it looks like it's failing to resolve the path to openocd. I'd uninstall, blow away the Arduino15 folder, and reinstall (this is a brute force solution). I've never seen this issue go by before. .

Folder location - note that on windows, AppData is a hidden folder.

On Mac OS X:
/Users/(username)/Library/Arduino15

On Windows:
Arduino IDE 1.6.5r5 and previous:
C:\Users(username)\AppData\Roaming\Arduino15
Arduino IDE 1.6.6 and later:
C:\Users(username)\AppData\Local\Arduino15

On Linux:
/home/(username)/.arduino15 (a.k.a. ~/.arduino15)

Aha, that gave me an idea.

Rather than remove the .ardunio15 folder, I renamed it...

mv ~/.ardunio15 ~/.ardunio15_old

I then started the arduino IDE, reinstalled the package for the zero boards and did a diff of the new arduino15 folder and the old one. I found that in the new one, the openocd path is slightly different in the file: ~/.arduino15/packages/arduino/hardware/samd/1.6.12/platform.txt

Old file:
tools.openocd.path={runtime.tools.openocd-0.9.0-arduino.path}

New file:
tools.openocd.path={runtime.tools.openocd-0.9.0-arduino5-static.path}

I don't know enough about the way the IDE works to know if this change was part of the problem, but it works fine with the updated version. Seems like the solution was just to update the plugin for the zero boards.

Thanks.

It most definitely was the cause.

Hey there, I just got an Genuino Zero and have simply been trying to upload any program to the board, but I keep getting an error message similar to the one shown above. The exact error message is as follows:

Arduino: 1.8.2 (Mac OS X), Board: "Arduino/Genuino Zero (Programming Port)"

Archiving built core (caching) in: /var/folders/wb/l27d14dj61gb4w9r9g5v1b580000gn/T/arduino_cache_268495/core/core_arduino_samd_arduino_zero_edbg_f8a173f7d426ec1c7eeed0aac585ff92.a
Sketch uses 9928 bytes (3%) of program storage space. Maximum is 262144 bytes.
java.io.IOException: Cannot run program "{runtime.tools.openocd-0.9.0-arduino5-static.path}/bin/openocd": error=2, No such file or directory
 at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
 at java.lang.Runtime.exec(Runtime.java:620)
 at java.lang.Runtime.exec(Runtime.java:485)
 at processing.app.helpers.ProcessUtils.exec(ProcessUtils.java:11)
 at cc.arduino.packages.Uploader.executeUploadCommand(Uploader.java:129)
 at cc.arduino.packages.uploaders.SerialUploader.uploadUsingPreferences(SerialUploader.java:207)
 at cc.arduino.UploaderUtils.upload(UploaderUtils.java:78)
 at processing.app.SketchController.upload(SketchController.java:713)
 at processing.app.SketchController.exportApplet(SketchController.java:686)
 at processing.app.Editor$DefaultExportHandler.run(Editor.java:2135)
 at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.IOException: error=2, No such file or directory
 at java.lang.UNIXProcess.forkAndExec(Native Method)
 at java.lang.UNIXProcess.<init>(UNIXProcess.java:247)
 at java.lang.ProcessImpl.start(ProcessImpl.java:134)
 at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
 ... 10 more
An error occurred while uploading the sketch

I have tried removing and reinstalling the Arduino SAMD board information, version 1.6.13. I've tried restarting my computer and reseting the board, but I have had zero success.

Any help here would be appreciated. Thanks

Follow-up: I went into my Library and found that my folder was named "0.9.0-arduino6-static" and I see that the directory being referenced in the error message says "0.9.0-arduino5-static". I don't know why this is. I tried changing the name too (as mentioned as the solution above), restarting the IDE, but to no avail.

@dejohnso please don't cross-post.

Arduino has now released a new version of Arduino SAMD Boards (1.6.14) that fixes this issue. To install it do this:

  • Tools > Board > Boards Manager
  • Wait for downloads to complete
  • Click on the "Arduino SAMD Boards" entry
  • Click the "Update" button.
  • Wait for the update to complete
  • Click the "Close" button.