Skip to content

Can't upload compiled code on esp8266 #64

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
brusherru opened this issue Oct 10, 2018 · 6 comments · Fixed by #79
Closed

Can't upload compiled code on esp8266 #64

brusherru opened this issue Oct 10, 2018 · 6 comments · Fixed by #79
Assignees

Comments

@brusherru
Copy link

brusherru commented Oct 10, 2018

I want to upload code on esp8266 (wifi_slot).
I already applied patch from #35 and it works, so I can compile code, but I can't upload it...

Env

This bug can't be reproduced on Linux/MacOS.

Steps to reproduce

  1. Create and save sketch in the sketchbook directory.
  2. Compile it for the esp8266:esp8266:wifi_slot using properties in the FQBN (Why not --build-properties see below):
    arduino-cli --fqbn esp8266:esp8266:wifi_slot:CpuFrequency=80,Vtable=flash,FlashFreq=40,FlashMode=qio,FlashSize=1M0,LwIPVariant=v2mss536,Debug=Disabled,DebugLevel=None,FlashErase=none,UploadSpeed=921600 compile C:\Users\the-awesome-bob\arduino-projects\my-sketchbook\my_sketch
  3. Upload it:
    arduino-cli --fqbn esp8266:esp8266:wifi_slot:CpuFrequency=80,Vtable=flash,FlashFreq=40,FlashMode=qio,FlashSize=1M0,LwIPVariant=v2mss536,Debug=Disabled,DebugLevel=None,FlashErase=none,UploadSpeed=921600 --port COM5 upload C:\Users\the-awesome-bob\arduino-projects\my-sketchbook\my_sketch

Expected behavior

It uploaded and works fine.

Actual behavior

Arduino-cli exits with error:

No new serial port detected.
error: stat C:\Users\the-awesome-bob\arduino-projects\my-sketchbook\my_sketch/my_sketch.esp8266.esp8266.wifi_slot.CpuFrequency=80,Vtable=flash,FlashFreq=40,FlashMode=qio,FlashSize=1M0,LwIPVariant=v2mss536,Debug=Disabled,DebugLevel=None,FlashErase=none,UploadSpeed=921600.bin failed: No such file or directory
Error: exit status 2
Error during upload.

When I replace the path with UNC path \\localhost\c$\Users\... it exits with:

Compiled sketch not found. Please compile first.

Why not --build-properties

upload command does not have a special flag to specify upload properties. So it can't upload sketch even if you successfully compiled it with --build-properties.

Why it happens?

  1. First of all, you can see a wrong path separator in the path: "...sketchbook\my_sketch**/**my_sketch.esp8266..."
  2. The full path is longer than 260 symbols, so maybe this is the problem on Windows.
    This hypothesis is confirmed by next manipulations: I mounted a virtual drive to the folder (subst Z: C:\Users\the-awesome-bob\arduino-projects\my-sketchbook\) and then tell uploader the shorter path to my sketch: Z:\my_sketch — it uploads!

How to fix it

I propose two ways to fix it:

  1. Just remove properties from the filename (my_sketch.esp8266.esp8266.wifi_slot.bin).
  2. Add a special flag to upload command.
@embhobbb
Copy link

i am also facing same problem.

@brusherru
Copy link
Author

@embhobbb place thumb up in this case.
Probably, it will help the developers to measure how important this task is ;)

@embhobbb
Copy link

@brusherru Did you get any solution yet?

@cmaglie cmaglie added this to the next alpha milestone Oct 25, 2018
@cmaglie cmaglie added the bug label Oct 25, 2018
@cmaglie cmaglie self-assigned this Oct 25, 2018
@cmaglie
Copy link
Member

cmaglie commented Oct 26, 2018

Ok it seems that the problem is the path of the compiled sketch.bin that is too long. Some improvements that comes to mind:

  1. remove the "options" part from the filename and call the file just my_sketch.esp8266.esp8266.wifi_slot.bin instead of my_sketch.esp8266.esp8266.wifi_slot.CpuFrequency=80,Vtable=flash,FlashFreq=40,FlashMode=qio,FlashSize=1M0,LwIPVariant=v2mss536,Debug=Disabled,DebugLevel=None,FlashErase=none,UploadSpeed=921600.bin.

  2. make the upload command become "compile+upload". This would mimic the IDE behavior and it will make the cli tolerant to cores that do not define a property to export the compiled binary.

  3. add options to specify file name like arduino-cli compile --output myname.bin and arduino-cli upload --input myname.bin

I'd implement 1) to begin with, but also 2) and 3) may be part of the next alpha as well.

@cmaglie
Copy link
Member

cmaglie commented Oct 29, 2018

@brusherru @embhobbb would you like to try this build?
#79 (comment)
I've implemented 1. and 3. of my previous post.

@brusherru
Copy link
Author

@cmaglie it works! 👏

per1234 pushed a commit that referenced this issue Nov 16, 2020
per1234 added a commit that referenced this issue Aug 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants