Skip to content

Point to proper uploaded python repackage w/subdir #5797

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

Merged
merged 3 commits into from
Feb 21, 2019

Conversation

earlephilhower
Copy link
Collaborator

Fixes problem of python files expanding in tools/ dir and not
in tools/python.

Fixes problem of python files expanding in tools/ dir and not
in tools/python.
@earlephilhower
Copy link
Collaborator Author

@d-a-v, let's get some feedback and see if I missed something else before merging...

Copy link
Collaborator

@d-a-v d-a-v left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

worksforme
on windows, this PR, get.py, compilation and signing OK with embedded python

edit

I didn't test effective flashing
This PR now may depend on #5789 (comment)

@earlephilhower
Copy link
Collaborator Author

earlephilhower commented Feb 21, 2019

I've got a better way to refactor this completely.

upload.py can just import esptool and pyserial directly and use esptool.main() to do the work, without messing around with threads or forks and winding up much simpler.

Simply import the pyserial and esptool modules directly into upload.py
instead of trying to fake things with os.fork()s.  Reduces code and is
more pythonic.
@earlephilhower
Copy link
Collaborator Author

Just did a compile and upload with full flash erase under Windows with the latest push, LGTM now. @reaper7 , et. al., please give this a try (be sure to run "git submodule init" and "git submodule update" at least once to make sure you have the esptool and pyserial submodule sources in your tree).

earlephilhower referenced this pull request Feb 21, 2019
…ows, too (#5635)

* Add esptool.py, pyserial, and python to JSON

Add installation of python on Win32/Win64, and on all systems install
esptool.py and pyserial.

* Initial esptool.py upload test

* First successfull esptool.py upload

* Patch in verbose flag operation

* Replace esptool-ck.exe with Python equivalent

Remove need for binary esptool-ck.exe by implementing the same logic as
esptool-ck uses in Python.  Only image creation is supported, and only
in the Arduino standard mode (with its custom bootloader and ROM
layout).

* Remove all esptool-ck.exe, hook Windows Python

Remove all references to esptool-ck and use Python on Windows and Linux
for all recipes where possible.

* Use python to make core_version as well

Avoid ugly bash and CMD.exe tricks in platform.txt by using python to
make the core_version header.

* Rename conflicting script, clean up packager

* Windows test passes

Need to make sure Python2 and Python3 compatible and paths are munged
properly to avoid eaccidentally escaping things when calling esptool.py

Able to compile, build a BIN and upload via esptool.py on a Windows
machine without Python installed globally, only as part of the Arduino
tools package.

* Use github sources for pyserial

* Erase calibration or all flash before programming

Add back in erase support by calling esptool.py twice (since it does not
support chained operations like esptool-ck.exe).

* Make 460K default speed, remove 961K

961K doesn't seem to work with esptool, so make 460K the default upload
speed and remove 961K.

Even at this lower speed, esptool.py is much faster to upload (even
before taking into account the compression when doing things like SPIFFS
and code upload).

* Make erase and upload work again

Arduino does not support a upload.#.cmd pattern, so we need to do
everything in a single command line.  Make it cleaner by introducing a
Python wrapper script which will run the same executable with different
sets of commands (since we need to erase a block w/a separate invocation
from the real upload).

Update boards.txt to use the new options format, placing the esptool
command as "version" when there is no "erase_flash" or "erase_region" to
be done to keep things simple.

* Move esptool/pyserial to submodules

Since esptool.py and pyserial are coming directly from github repos,
there is no need to include them as a tool in package.json.

* Restore 921K upload opt, silent downgrade to 460k

To enable full backward compatibility, restore the 921k option for
upload speed but silently change it to 460k in the upload.py script.

Add error checking on upload.py
@earlephilhower earlephilhower merged commit 472faf7 into esp8266:master Feb 21, 2019
@earlephilhower earlephilhower deleted the pythononwinisapain branch February 21, 2019 19:03
@reaper7
Copy link
Contributor

reaper7 commented Feb 21, 2019

@earlephilhower - looks OK!

Linking everything together...
"C:\\PROGRAMY\\Arduino\\hardware\\esp8266com\\esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-gcc" -CC -E -P -DVTABLES_IN_FLASH "C:\\PROGRAMY\\Arduino\\hardware\\esp8266com\\esp8266/tools/sdk/ld/eagle.app.v6.common.ld.h" -o "C:\\tmp\\arduino_build_246277/local.eagle.app.v6.common.ld"
"C:\\PROGRAMY\\Arduino\\hardware\\esp8266com\\esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-gcc" -fno-exceptions -Wl,-Map "-Wl,C:\\tmp\\arduino_build_246277/Blink.ino.map" -g -Wall -Wextra -Os -nostdlib -Wl,--no-check-sections -u app_entry -u _printf_float -u _scanf_float -Wl,-static "-LC:\\PROGRAMY\\Arduino\\hardware\\esp8266com\\esp8266/tools/sdk/lib" "-LC:\\PROGRAMY\\Arduino\\hardware\\esp8266com\\esp8266/tools/sdk/lib/NONOSDK221" "-LC:\\PROGRAMY\\Arduino\\hardware\\esp8266com\\esp8266/tools/sdk/ld" "-LC:\\PROGRAMY\\Arduino\\hardware\\esp8266com\\esp8266/tools/sdk/libc/xtensa-lx106-elf/lib" -Teagle.flash.4m.ld -Wl,--gc-sections -Wl,-wrap,system_restart_local -Wl,-wrap,spi_flash_read -o "C:\\tmp\\arduino_build_246277/Blink.ino.elf" -Wl,--start-group "C:\\tmp\\arduino_build_246277\\sketch\\Blink.ino.cpp.o" "C:\\tmp\\arduino_build_246277\\core\\core.a" -lhal -lphy -lpp -lnet80211 -llwip2-536-feat -lwpa -lcrypto -lmain -lwps -lbearssl -laxtls -lespnow -lsmartconfig -lairkiss -lwpa2 -lstdc++ -lm -lc -lgcc -Wl,--end-group "-LC:\\tmp\\arduino_build_246277"
"C:\\PROGRAMY\\Arduino\\hardware\\esp8266com\\esp8266/tools/python/python.exe" "C:\\PROGRAMY\\Arduino\\hardware\\esp8266com\\esp8266/tools/elf2bin.py" --eboot "C:\\PROGRAMY\\Arduino\\hardware\\esp8266com\\esp8266/bootloaders/eboot/eboot.elf" --app "C:\\tmp\\arduino_build_246277/Blink.ino.elf" --flash_mode dio --flash_freq 40 --flash_size 4M --path "C:\\PROGRAMY\\Arduino\\hardware\\esp8266com\\esp8266/tools/xtensa-lx106-elf/bin" --out "C:\\tmp\\arduino_build_246277/Blink.ino.bin"
Creating BIN file "C:\tmp\arduino_build_246277/Blink.ino.bin" using "C:\tmp\arduino_build_246277/Blink.ino.elf"

"C:\\PROGRAMY\\Arduino\\hardware\\esp8266com\\esp8266/tools/python/python.exe" "C:\\PROGRAMY\\Arduino\\hardware\\esp8266com\\esp8266/tools/signing.py" --mode sign --privatekey "C:\\PROGRAMY\\Arduino\\examples\\01.Basics\\Blink/private.key" --bin "C:\\tmp\\arduino_build_246277/Blink.ino.bin" --out "C:\\tmp\\arduino_build_246277/Blink.ino.bin.signed"
"C:\\PROGRAMY\\Arduino\\hardware\\esp8266com\\esp8266/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-size" -A "C:\\tmp\\arduino_build_246277/Blink.ino.elf"
Szkic używa 257256 bajtów (24%) pamięci programu. Maksimum to 1044464 bajtów.
Zmienne globalne używają 26556 bajtów (32%) pamięci dynamicznej, pozostawiając 55364 bajtów dla zmiennych lokalnych. Maksimum to 81920 bajtów.
esptool.py v2.6
2.6
esptool.py v2.6
Serial port COM14
Connecting....
Chip is ESP8266EX
Features: WiFi
MAC: xx:xx:xx:xx:xx:xx
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Auto-detected Flash size: 4MB
Compressed 261408 bytes to 190957...

Writing at 0x00000000... (8 %)
Writing at 0x00004000... (16 %)
Writing at 0x00008000... (25 %)
Writing at 0x0000c000... (33 %)
Writing at 0x00010000... (41 %)
Writing at 0x00014000... (50 %)
Writing at 0x00018000... (58 %)
Writing at 0x0001c000... (66 %)
Writing at 0x00020000... (75 %)
Writing at 0x00024000... (83 %)
Writing at 0x00028000... (91 %)
Writing at 0x0002c000... (100 %)
Wrote 261408 bytes (190957 compressed) at 0x00000000 in 4.5 seconds (effective 468.3 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...

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 this pull request may close these issues.

3 participants