earlephilhower / arduino-pico

Raspberry Pi Pico Arduino core, for all RP2040 and RP2350 boards
GNU Lesser General Public License v2.1
2.06k stars 431 forks source link

Compiles code successfully for Pico, but crashes when trying to program ("cannot find the file specified") #474

Closed heliophagus closed 2 years ago

heliophagus commented 2 years ago

Greetings,

This is my 2nd attempt at getting this build of the Arduino environment for the RPi Pico to program the Pico - alas, with complete lack of success. I'm running 64-bit Win10 & Arduino 1.8.19. Removing the Philhower package & re-installing it has made no difference. Any help would be GREATLY appreciated!

Here are the errors I get when trying to upload:

Resetting COM7 Traceback (most recent call last): Converting to uf2, output size: 137216, start address: 0x2000 File "C:\Users\xxxx\AppData\Local\Arduino15\packages\rp2040\hardware\rp2040\1.10.0/tools/uf2conv.py", line 380, in main() File "C:\Users\xxxx\AppData\Local\Arduino15\packages\rp2040\hardware\rp2040\1.10.0/tools/uf2conv.py", line 360, in main drives = get_drives() File "C:\Users\xxxx\AppData\Local\Arduino15\packages\rp2040\hardware\rp2040\1.10.0/tools/uf2conv.py", line 233, in get_drives "FileSystem,", "DriveType"]) File "D:\obj\Windows-Release\37win32_Release\msi_python\zip_win32\subprocess.py", line 395, in check_output File "D:\obj\Windows-Release\37win32_Release\msi_python\zip_win32\subprocess.py", line 472, in run File "D:\obj\Windows-Release\37win32_Release\msi_python\zip_win32\subprocess.py", line 775, in init File "D:\obj\Windows-Release\37win32_Release\msi_python\zip_win32\subprocess.py", line 1178, in _execute_child FileNotFoundError: [WinError 2] The system cannot find the file specified FileNotFoundError: [WinError 2] The system cannot find the file specified

I do not have a folder called "obj" on my D drive (and yes, "hidden" folders are visible in my system). Very strange.

I'm at a complete impasse. Please help. Thanks in advance!

Andy2No commented 2 years ago

Judging by the AppData path, it's trying to use version 1.10.0 of arduino-pico. The release I have currently have installed is 1.9.15, and mine's working fine, so you could try reverting to that, to see if the problem relates to the new release or not.

I'm still on Arduino 1.8.13, though the difference there seems less likely to be important.

It seems there may be some limitations, not necessarily relevant to this, if you installed the Windows App Store version of Arduino. I read that the Teensy package can't be added to it, which suggests permissions problems. The solution to that was to install it from the Arduino website instead. If you can't install over the one from the App Store, or it still doesn't work, you'll need to uninstall that one.

You should probably detail what you've done to get this far. You can install arduino-pico from the Boards Manager, on the Boards menu, or install it manually following instructions in the Readme for this repository. I described the process in discussion #199 (about half way down the page), but it's fairly simple.

I stick to using the Boards Manager, but there can be problems caused by MalwareBytes Anti Malware - I've detailed some workarounds, in #133, and they may apply to other anti malware / antivirus software.

MBAM tends to lock files that the boards manager needs to overwrite, causing an error message during an update using the Boards Manager, because it can't replace those files. One simple thing to try, when that happens, is to just reboot, then try it again before doing anything else.

earlephilhower commented 2 years ago

That line of the script is trying to run wmic which is a standard Windows management tool. Can you try opening up a command prompt and running:

wmic PATH Win32_LogicalDisk get DeviceID VolumeName FileSystem DriveType

If that gives an error (copy it here) you'll have to figure out how to install it on your system. I've never met a Windows install w/o it, though. The line of code in question (and the UF2 upload tool) actually comes from Microsoft Corp. directly. :)

And @Andy2No's comments about the App Store version are correct, it's borked in many instances (but we really are on release 1.10.0). So don't use the App Store one, use the Arduino.cc MSI installer.

Andy2No commented 2 years ago

I somehow missed the update notice, @earlephilhower :) I also didn't see your post until after I'd edited that one to correct myself, after I checked the Releases page.

heliophagus commented 2 years ago

Aha! Thanks so much for replying. I'm using a standard Arduino install directly from the site (not via the Windows app store). And indeed, when I try to run

wmic PATH Win32_LogicalDisk get DeviceID VolumeName FileSystem DriveType

I get the following message: "Windows cannot find 'WMIC'".

And this is not surprising, because Microsoft says ( https://docs.microsoft.com/en-us/windows/win32/wmisdk/wmic ):

The WMI command-line (WMIC) utility is deprecated as of Windows 10, version 21H1, and as of the 21H1 semi-annual channel release of Windows Server. This utility is superseded by Windows PowerShell for WMI (see Chapter 7—Working with WMI). This deprecation applies only to the WMI command-line (WMIC) utility; Windows Management Instrumentation (WMI) itself is not affected.

But I do find WMEC in C:\Windows\System32\wbem.....

Probably a PATH snafu. I'll dig further & update when I have more info.

Again, thanks, your help means a lot.

heliophagus commented 2 years ago

Aha! Again. I found this reference:

https://superuser.com/questions/1178674/wmic-is-not-recognized-as-an-internal-or-external-command-operable-program-or

And Ben N in that thread recommended that I add this to the PATH: %SystemRoot%\System32\Wbem

And now, touch wood (knocks head), I can upload!! I hope this will help others to get the best use from your board package, Earl. It might be a good idea to re-cast the upload routine to allow for the impending deprecation of wmic.

And thanks again for being so responsive.

heliophagus commented 2 years ago

And thanks to @Andy2No as well, of course! :)

earlephilhower commented 2 years ago

Reopening. I can add a fallback to call powershell w/the appropriate command simply enough. Should be less than 5 lines of Python...(famous last words).