digistump / DigistumpArduino

Files to add Digistump support (Digispark, Pro, DigiX) to Arduino 1.6.X (1.6.5+)
934 stars 377 forks source link

Upload failed Error opening #79

Open NathanHennigh opened 6 years ago

NathanHennigh commented 6 years ago

I was trying to setup my digispark with arduino ide but when I tried to upload it I got an Error opening. Below is the full console output

Sketch uses 2810 bytes (46%) of program storage space. Maximum is 6012 bytes. Global variables use 106 bytes of dynamic memory. Running Digispark Uploader... Plug in device now... (will timeout in 60 seconds)

Please plug in the device ... Press CTRL+C to terminate the program. Device is found! connecting: 16% complete connecting: 22% complete connecting: 28% complete connecting: 33% complete Device has firmware version 1.11 Available space for user applications: 6330 bytes Suggested sleep time between sending pages: 8ms Whole page count: 99 page size: 64 Erase function sleep duration: 792ms Error opening C:\Users\Nath: No such file or directory Error loading or parsing hex file.

pfeerick commented 6 years ago

Does the C:\Users\Nath folder exist? Is there any weird non-standard letters or spaces in the path? You You can turn on verbose messages in the Arduino IDE preferences to see the full path to the hex file (in amongst all the other spew of messages you'll then get) and then maybe get some idea as to what is playing up.

NathanHennigh commented 6 years ago

No that folder doesnt exist, its supposed to be C:\Users\Nathan Hennigh... I never set any path which is weird since it naturally chose one that is wrong.

pfeerick commented 6 years ago

Ok, I think I see the problem. In the platform.txt file which outlines all the compile and upload command lines, it looks like the path for hex file that gets sent to the digispark isn't as robust as it should be... it looks like it would fail in a situation exactly like yours... where there is a space in the path... as the path hasn't been enclosed in double quotes.

Try opening C:\Users\Nathan Hennigh\AppData\Local\Arduino15\packages\digistump\hardware\avr\1.6.7\platform.txt in Notepad++, WordPad, or some other editor that understands linux LF line endings (Notepad will just show it as a wall of text and mangle the file), go down to line 75 tools.micronucleus.upload.pattern and see what happens when you change it to

tools.micronucleus.upload.pattern="{cmd.path}" -cdigispark --timeout 60 -Uflash:w:"{build.path}/{build.project_name}.hex":i

I don't have a digispark handy so can't test if this is the proper solution or will fail. Will be two or three days until I can follow this up.

HerrZatacke commented 5 years ago

This has been over a year. I'm experiencing the exact same issue. (space in user folder - error message cut's of two letters before the space)

Is there any update?

---- edit ---- I created a new user on my machine without a blank in the name, re-downloaded the Arduino ID and installed the Digistump Boards in the IDE. With this user i can upload to the board without problems.

The minor issue is, the home folder of the new User takes up over 20GB on my HDD ...

I'd appreciate, to have this fixed.

I haven't looked any further into how AppData\Local\Arduino15\packages\digistump\hardware\avr\1.6.7\platform.txt is actually being handled, but I'd be happy to help if there are any further suggestions.

AnotherShen commented 5 years ago

Hacky Fix:

  1. Open Arduino App
  2. File -> Preferences
  3. Click the preferences.txt and close Arduino App
  4. Open preferences.txt
  5. Add "build.path=C:\ArduinoOut\" to the file and save
  6. Create C:\ArduinoOut folder
  7. Relaunch Arduino App
  8. Profit

It is also nice as you can quickly access the Hex Files instead of delving into %APPDATA%

pfeerick commented 5 years ago

It is also nice as you can quickly access the Hex Files instead of delving into %APPDATA%

Very true... Sketch -> Export compiled Binary followed by Sketch -> Show Sketch Folder works well enough if you want the Hex file, but does mean the sketch needs to be compiled again. I suspect changing the build.path would fix more than a few errors, including the odd path length error.

HerrZatacke commented 4 years ago

Any updates on this?

Buleste commented 3 years ago

This still seems to be an issue.

Sketch uses 718 bytes (11%) of program storage space. Maximum is 6012 bytes. Global variables use 9 bytes of dynamic memory. Running Digispark Uploader... Plug in device now... (will timeout in 60 seconds)

Please plug in the device ... Press CTRL+C to terminate the program. Device is found! connecting: 16% complete connecting: 22% complete connecting: 28% complete connecting: 33% complete Device has firmware version 2.2 Device signature: 0x1e930b Available space for user applications: 6522 bytes Suggested sleep time between sending pages: 7ms Whole page count: 102 page size: 64 Erase function sleep duration: 714ms Error opening C:\Users\Dunc: No such file or directory Error loading or parsing hex file.

The User should be C:\Users\Duncan Edwards

Any news on a fix for this?

ArminJo commented 3 years ago

Try https://github.com/ArminJo/DigistumpArduino

Buleste commented 3 years ago

Try https://github.com/ArminJo/DigistumpArduino

Similar results.

'C:\Users\Duncan' is not recognized as an internal or external command, operable program or batch file. exit status 1 Error compiling for board Digispark.

Managed to get the bootloader uploaded by downloading the micronucleus2.5 tools but still no luck because of the space in my Username

'C:\Users\Duncan' is not recognized as an internal or external command, operable program or batch file. exit status 1 Error compiling for board Digispark.

sumukhchitloor commented 1 year ago

Try https://github.com/ArminJo/DigistumpArduino

Similar results.

'C:\Users\Duncan' is not recognized as an internal or external command, operable program or batch file. exit status 1 Error compiling for board Digispark.

Managed to get the bootloader uploaded by downloading the micronucleus2.5 tools but still no luck because of the space in my Username

'C:\Users\Duncan' is not recognized as an internal or external command, operable program or batch file. exit status 1 Error compiling for board Digispark.

Any update on this ?

mszczuro commented 1 year ago

Fresh installation of the whole IDE, problem persists. Creating another user just for IDE is no solution for me. And it's been nearly 5 years now...

EDIT: SOLVED

In C:\Users[username]\AppData\Local\Arduino15\packages*\hardware\avr\x.y.z\platform.txt I added quotes around paths (where applicable) Was: _tools.micronucleus.upload.pattern="{cmd.path}" --no-ansi --run --timeout 60 {build.path}/{build.projectname}.hex tools.micronucleus.bootloader.pattern="{cmd.path}" --no-ansi --run --timeout 60 {runtime.platform.path}/bootloaders/{bootloader.file} Is: _tools.micronucleus.upload.pattern="{cmd.path}" --no-ansi --run --timeout 60 "{build.path}/{build.projectname}.hex" tools.micronucleus.bootloader.pattern="{cmd.path}" --no-ansi --run --timeout 60 "{runtime.platform.path}/bootloaders/{bootloader.file}"

I'm quite sure I added quotes also somewhere else but only within platform.txt files on all instances of avr. Now it works. Remember to reopen IDE.

DUDES, WHY ON EARTH NOT FIX THAT FOR 5 YEARS? It took me 2 hours of installing boards, various micronucleus versions, swapping executables, etc. until I found the real source of the error, but I did it and it wasn't really that complicated.

viralgupta commented 1 year ago

After facing the same problem for a year and trying out different solution which didn't work, I finally found the error and its Fix:

The problem is with digispark uploader as it doesn't uses 8.3 convention therefore it considers separation characters when parsing text lines, so if you have a space in your username i.e. in your path it will treat it as new line which is causing the issue.

FIX:

*Just make sure you are working on the same sketch(Digispark.ino) and opening new tab on same sketch instead of creating new sketch for each program

MuhammadUsman15 commented 1 year ago

did any one find a proper solution?

nawazawanswl commented 1 year ago

Go to C:\Users**"your user name"**\AppData\Local\Arduino15\packages\digistump\hardware\avr\1.6.7\

change the platform.txt as below or copy all the text below to platform.txt ( delete all text from platform.txt then past )


Arduino AVR Core and platform.

------------------------------

For more info:

https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5---3rd-party-Hardware-specification

name=Digistump AVR Boards version=1.5.4

AVR compile variables

---------------------

Default "compiler.path" is correct, change only if you want to overidde the initial value

compiler.path={runtime.tools.avr-gcc.path}/bin/ compiler.c.cmd=avr-gcc compiler.c.flags=-c -g -Os -w -ffunction-sections -fdata-sections -MMD compiler.c.elf.flags=-Os -Wl,--gc-sections compiler.c.elf.cmd=avr-gcc compiler.S.flags=-c -g -x assembler-with-cpp compiler.cpp.cmd=avr-g++ compiler.cpp.flags=-c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -MMD compiler.ar.cmd=avr-ar compiler.ar.flags=rcs compiler.objcopy.cmd=avr-objcopy compiler.objcopy.eep.flags=-O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 compiler.elf2hex.flags=-O ihex -R .eeprom compiler.elf2hex.cmd=avr-objcopy compiler.ldflags= compiler.size.cmd=avr-size

this can be overriden in boards.txt

build.extra_flags=

AVR compile patterns

--------------------

Compile c files

recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.c.flags} -mmcu={build.mcu} -DF_CPU={build.fcpu} -DARDUINO={runtime.ide.version} -DARDUINO{build.board} -DARDUINOARCH{build.arch} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"

Compile c++ files

recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} -mmcu={build.mcu} -DF_CPU={build.fcpu} -DARDUINO={runtime.ide.version} -DARDUINO{build.board} -DARDUINOARCH{build.arch} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"

Compile S files

recipe.S.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.S.flags} -mmcu={build.mcu} -DF_CPU={build.fcpu} -DARDUINO={runtime.ide.version} -DARDUINO{build.board} -DARDUINOARCH{build.arch} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"

Create archives

recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} "{archive_file_path}" "{object_file}"

Combine gc-sections, archives, and objects

recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} -mmcu={build.mcu} -o "C:\ArduinoOut/{build.project_name}.elf" {object_files} "{archive_file_path}" "-L C:\ArduinoOut" -lm

Create eeprom

recipe.objcopy.eep.pattern="{compiler.path}{compiler.objcopy.cmd}" {compiler.objcopy.eep.flags} "C:\ArduinoOut/{build.project_name}.elf" "C:\ArduinoOut/{build.project_name}.eep"

Create hex

recipe.objcopy.hex.pattern="{compiler.path}{compiler.elf2hex.cmd}" {compiler.elf2hex.flags} "C:\ArduinoOut/{build.project_name}.elf" "C:\ArduinoOut/{build.project_name}.hex"

Compute size

recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "C:\ArduinoOut/{build.project_name}.elf" recipe.size.regex=^(?:.text|.data|.bootloader)\s+([0-9]+). recipe.size.regex.data=^(?:.data|.bss|.noinit)\s+([0-9]+). recipe.size.regex.eeprom=^(?:.eeprom)\s+([0-9]+).*

AVR Uploader/Programmers tools

------------------------------

tools.micronucleus.cmd.path={runtime.ide.path}/hardware/digistump/avr/tools/avrdude

tools.micronucleus.cmd.path.linux={runtime.ide.path}/hardware/digistump/avr/tools/avrdude

tools.micronucleus.cmd.path={runtime.tools.micronucleus.path}/launcher

tools.micronucleus.upload.params.verbose= tools.micronucleus.upload.params.quiet=

tools.micronucleus.upload.pattern="{cmd.path}" --run --timeout 60 C:\ArduinoOut{build.project_name}.hex"

tools.micronucleus.upload.pattern="{cmd.path}" -cdigispark --timeout 60 -Uflash:w:C:\ArduinoOut{build.project_name}.hex:i

USB Default Flags

Default blank usb manufacturer will be filled it at compile time

- from numeric vendor ID, set to Unknown otherwise

build.usb_manufacturer= build.usb_flags=

copy text only not lines.......................it is working perfectly with Arduino IDE 2.10 hot it helps

nawazawanswl commented 1 year ago

Attached platform.txt platform.txt

Yogeshroy commented 1 year ago

the problem is with the launcher and micronucleus executables included with the digistump package as they fail to parse paths with spaces properly. you can use the latest micronucleus executable from the ATTinyCore package. replace the micronucleus executable with the latest one and make the following change to platform.txt.

line 70: tools.micronucleus.cmd.path={runtime.tools.micronucleus.path}\launcher change to: tools.micronucleus.cmd.path={runtime.tools.micronucleus.path}\micronucleus

line 75: tools.micronucleus.upload.pattern="{cmd.path}" -cdigispark --timeout 60 -Uflash:w:{build.path}/{build.project_name}.hex:i change to : tools.micronucleus.upload.pattern="{cmd.path}" --timeout 60 --run --no-ansi "{build.path}/{build.project_name}.hex"

Hope it helps