Skip to content

espota.py passes wrong .bin file #6323

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
5 of 6 tasks
thangktran opened this issue Jul 21, 2019 · 6 comments · Fixed by #6334
Closed
5 of 6 tasks

espota.py passes wrong .bin file #6323

thangktran opened this issue Jul 21, 2019 · 6 comments · Fixed by #6334

Comments

@thangktran
Copy link
Contributor

Basic Infos

  • This issue complies with the issue POLICY doc.
  • I have read the documentation at readthedocs and the issue is not addressed there.
  • I have tested that the issue is present in current master branch (aka latest git).
  • I have searched the issue tracker for a similar issue.
  • If there is a stack dump, I have decoded it.
  • I have filled out all fields below.

Platform

  • Hardware: [ESP-12]
  • Core Version: [2.5.2]
  • Development Env: [Arduino IDE]
  • Operating System: [Ubuntu]

Problem Description

I tried to upload a sketch using BasicOTA.ino example with bin signing and have put private.key and public.key in the same folder as the project folder.
The bin was signed, however, when espota.py is called from Arduino IDE, the standard bin *.bin is selected instead of the signed *.bin.signed one.

I would like to do a PR for this Issue as well if someone could guide me where to look into.

Thank you.

Debug Messages

Creating BIN file "/tmp/arduino_build_392120/sketch_jul09a.ino.bin" using "/tmp/arduino_build_392120/sketch_jul09a.ino.elf"
/home/ubuntu/.arduino15/packages/esp8266/tools/python/3.7.2-post1/python /home/ubuntu/.arduino15/packages/esp8266/hardware/esp8266/2.5.2/tools/signing.py --mode sign --privatekey /home/ubuntu/Desktop/sketch_jul09a/private.key --bin /tmp/arduino_build_392120/sketch_jul09a.ino.bin --out /tmp/arduino_build_392120/sketch_jul09a.ino.bin.signed
Signed binary: /tmp/arduino_build_392120/sketch_jul09a.ino.bin.signed
Using library ESP8266WiFi at version 1.0 in folder: /home/ubuntu/.arduino15/packages/esp8266/hardware/esp8266/2.5.2/libraries/ESP8266WiFi 
Using library ESP8266mDNS at version 1.2 in folder: /home/ubuntu/.arduino15/packages/esp8266/hardware/esp8266/2.5.2/libraries/ESP8266mDNS 
Using library ArduinoOTA at version 1.0 in folder: /home/ubuntu/.arduino15/packages/esp8266/hardware/esp8266/2.5.2/libraries/ArduinoOTA 
Using library NTPClient at version 3.1.0 in folder: /home/ubuntu/Arduino/libraries/NTPClient 
/home/ubuntu/.arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-3-20ed2b9/bin/xtensa-lx106-elf-size -A /tmp/arduino_build_392120/sketch_jul09a.ino.elf
Sketch uses 347800 bytes (33%) of program storage space. Maximum is 1044464 bytes.
Global variables use 29312 bytes (35%) of dynamic memory, leaving 52608 bytes for local variables. Maximum is 81920 bytes.
/home/ubuntu/.arduino15/packages/esp8266/tools/python/3.7.2-post1/python /home/ubuntu/.arduino15/packages/esp8266/hardware/esp8266/2.5.2/tools/espota.py -i 192.168.0.101 -p 43434 --auth=********** -f /tmp/arduino_build_392120/sketch_jul09a.ino.bin
@earlephilhower
Copy link
Collaborator

@thangktran
Copy link
Contributor Author

@earlephilhower Thank you for your answer.
What i meant was I would like to do a PR for this Issue as well if someone could guide me to which module/function/file i should look into and suggestions how should it be fixed

@earlephilhower
Copy link
Collaborator

It's probably being set in the espota.py command line from platform.txt. Inserting logic there to swap between filenames may be a big ugly, good luck!

@thangktran
Copy link
Contributor Author

thangktran commented Jul 21, 2019

It's probably being set in the espota.py command line from platform.txt. Inserting logic there to swap between filenames may be a big ugly, good luck!

@earlephilhower Thank you for your hint.
What is your opinion for the following solution:
remove the file extension .bin from -f "{build.path}/{build.project_name}.bin"

tools.esptool.upload.network_pattern="{network_cmd}" "{runtime.platform.path}/tools/espota.py" -i "{serial.port}" -p "{network.port}" "--auth={network.password}" -f "{build.path}/{build.project_name}.bin"

==>tools.esptool.upload.network_pattern="{network_cmd}" "{runtime.platform.path}/tools/espota.py" -i "{serial.port}" -p "{network.port}" "--auth={network.password}" -f "{build.path}/{build.project_name}"

then we let espota.py decide to use *.bin or *.bin.signed.
Since the file *.bin.signed only exists when Signed Updates is used, this file should be uploaded.
Otherwise *.bin should be used instead.

@devyte
Copy link
Collaborator

devyte commented Jul 23, 2019

The solution sounds good to me. Please make a PR for review and further discussion.

@thangktran
Copy link
Contributor Author

The solution sounds good to me. Please make a PR for review and further discussion.

@devyte Thank you for your feedback. I'll be working on this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants