Skip to content

Can't upload compiled code on esp8266 #64

@brusherru

Description

@brusherru

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

  • Windows 10
  • arduino-cli@0.2.2

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.

Activity

embhobbb

embhobbb commented on Oct 14, 2018

@embhobbb

i am also facing same problem.

brusherru

brusherru commented on Oct 19, 2018

@brusherru
Author

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

embhobbb

embhobbb commented on Oct 21, 2018

@embhobbb

@brusherru Did you get any solution yet?

added this to the next alpha milestone on Oct 25, 2018
self-assigned this
on Oct 25, 2018
cmaglie

cmaglie commented on Oct 26, 2018

@cmaglie
Member

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.

added a commit that references this issue on Oct 26, 2018
504a77b
cmaglie

cmaglie commented on Oct 29, 2018

@cmaglie
Member

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

brusherru

brusherru commented on Oct 30, 2018

@brusherru
Author

@cmaglie it works! 👏

added a commit that references this issue on Oct 30, 2018
76d471d
added a commit that references this issue on Jul 16, 2019
b381027
added a commit that references this issue on Nov 16, 2020
65297c7
added a commit that references this issue on Aug 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

    Development

    Participants

    @cmaglie@brusherru@embhobbb

    Issue actions

      Can't upload compiled code on esp8266 · Issue #64 · arduino/arduino-cli