Skip to content

Commit b630df3

Browse files
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.
1 parent 4cc9ea1 commit b630df3

File tree

3 files changed

+36
-83
lines changed

3 files changed

+36
-83
lines changed

package/package_esp8266com_index.template.json

+1-54
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,6 @@
107107
}
108108
],
109109
"toolsDependencies": [
110-
{
111-
"packager": "esp8266",
112-
"version": "2.5.0-3-20ed2b9",
113-
"name": "esptool"
114-
},
115110
{
116111
"packager": "esp8266",
117112
"version": "2.5.0-3-20ed2b9",
@@ -260,54 +255,6 @@
260255
}
261256
]
262257
},
263-
{
264-
"version": "2.5.0-3-20ed2b9",
265-
"name": "esptool",
266-
"systems": [
267-
{
268-
"host": "aarch64-linux-gnu",
269-
"url": "https://github.com/earlephilhower/esp-quick-toolchain/releases/download/2.5.0-3/aarch64-linux-gnu.esptool-f80ae31.tar.gz",
270-
"archiveFileName": "aarch64-linux-gnu.esptool-f80ae31.tar.gz",
271-
"checksum": "SHA-256:888425ff1e33a97ea155b6f128de6b578c34468895ba9b4acd1e4f28608d917a",
272-
"size": "14681"
273-
},
274-
{
275-
"host": "arm-linux-gnueabihf",
276-
"url": "https://github.com/earlephilhower/esp-quick-toolchain/releases/download/2.5.0-3/arm-linux-gnueabihf.esptool-f80ae31.tar.gz",
277-
"archiveFileName": "arm-linux-gnueabihf.esptool-f80ae31.tar.gz",
278-
"checksum": "SHA-256:71c878ac6a21ee69dcd615cd28f2dccd29a87079e0b3069eba625089d89e5058",
279-
"size": "13873"
280-
},
281-
{
282-
"host": "i686-mingw32",
283-
"url": "https://github.com/earlephilhower/esp-quick-toolchain/releases/download/2.5.0-3/i686-w64-mingw32.esptool-f80ae31.zip",
284-
"archiveFileName": "i686-w64-mingw32.esptool-f80ae31.zip",
285-
"checksum": "SHA-256:e30f25a19a78635000401b083b479e111d591bac20cfd89b1bfdf36a60e9ee20",
286-
"size": "16466"
287-
},
288-
{
289-
"host": "x86_64-apple-darwin",
290-
"url": "https://github.com/earlephilhower/esp-quick-toolchain/releases/download/2.5.0-3/x86_64-apple-darwin14.esptool-f80ae31.tar.gz",
291-
"archiveFileName": "x86_64-apple-darwin14.esptool-f80ae31.tar.gz",
292-
"checksum": "SHA-256:0f51e487706a476b0b87299a769282ad65623774770655168a79d1748d2506e7",
293-
"size": "15003"
294-
},
295-
{
296-
"host": "x86_64-pc-linux-gnu",
297-
"url": "https://github.com/earlephilhower/esp-quick-toolchain/releases/download/2.5.0-3/x86_64-linux-gnu.esptool-f80ae31.tar.gz",
298-
"archiveFileName": "x86_64-linux-gnu.esptool-f80ae31.tar.gz",
299-
"checksum": "SHA-256:bded1dca953377838b6086a9bcd40a1dc5286ba5f69f2372c22a1d1819baad24",
300-
"size": "16526"
301-
},
302-
{
303-
"host": "x86_64-mingw32",
304-
"url": "https://github.com/earlephilhower/esp-quick-toolchain/releases/download/2.5.0-3/x86_64-w64-mingw32.esptool-f80ae31.zip",
305-
"archiveFileName": "x86_64-w64-mingw32.esptool-f80ae31.zip",
306-
"checksum": "SHA-256:d6d5976fde82d07e93d5a01f38bbb4f84a7796187ff0541ee62650041791d0e8",
307-
"size": "19724"
308-
}
309-
]
310-
},
311258
{
312259
"version": "2.5.0-3-20ed2b9",
313260
"name": "xtensa-lx106-elf-gcc",
@@ -409,4 +356,4 @@
409356
"name": "esp8266"
410357
}
411358
]
412-
}
359+
}

platform.txt

+13-14
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ version=2.5.0-dev
1111
runtime.tools.xtensa-lx106-elf-gcc.path={runtime.platform.path}/tools/xtensa-lx106-elf
1212
runtime.tools.esptool.path={runtime.platform.path}/tools/esptool
1313
runtime.tools.signing={runtime.platform.path}/tools/signing.py
14+
runtime.tools.elf2bin={runtime.platform.path}/tools/elf2bin.py
15+
runtime.tools.eboot={runtime.platform.path}/bootloaders/eboot/eboot.elf
16+
runtime.tools.python=python
17+
runtime.tools.python.windows={runtime.platform.path}/tools/python/python.exe
1418

1519
compiler.warning_flags=-w
1620
compiler.warning_flags.none=-w
@@ -76,7 +80,7 @@ compiler.elf2hex.extra_flags=
7680

7781
## generate file with git version number
7882
## needs bash, git, and echo
79-
recipe.hooks.core.prebuild.1.pattern=python "{runtime.tools.signing}" --mode header --publickey "{build.source.path}/public.key" --out "{build.path}/core/Updater_Signing.h"
83+
recipe.hooks.core.prebuild.1.pattern="{runtime.tools.python}" "{runtime.tools.signing}" --mode header --publickey "{build.source.path}/public.key" --out "{build.path}/core/Updater_Signing.h"
8084
recipe.hooks.core.prebuild.2.pattern=bash -c "mkdir -p {build.path}/core && echo \#define ARDUINO_ESP8266_GIT_VER 0x`git --git-dir {runtime.platform.path}/.git rev-parse --short=8 HEAD 2>/dev/null || echo ffffffff` >{build.path}/core/core_version.h"
8185
recipe.hooks.core.prebuild.3.pattern=bash -c "mkdir -p {build.path}/core && echo \#define ARDUINO_ESP8266_GIT_DESC `cd "{runtime.platform.path}"; git describe --tags 2>/dev/null || echo unix-{version}` >>{build.path}/core/core_version.h"
8286

@@ -107,14 +111,8 @@ recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {build.exception_
107111
recipe.objcopy.eep.pattern=
108112

109113
## Create hex
110-
#recipe.objcopy.hex.pattern="{compiler.path}{compiler.elf2hex.cmd}" {compiler.elf2hex.flags} {compiler.elf2hex.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.hex"
111-
112-
recipe.objcopy.hex.1.pattern="{runtime.tools.esptool.path}/{compiler.esptool.cmd}" -eo "{runtime.platform.path}/bootloaders/eboot/eboot.elf" -bo "{build.path}/{build.project_name}.bin" -bm {build.flash_mode} -bf {build.flash_freq} -bz {build.flash_size} -bs .text -bp 4096 -ec -eo "{build.path}/{build.project_name}.elf" -bs .irom0.text -bs .text -bs .data -bs .rodata -bc -ec
113-
recipe.objcopy.hex.2.pattern=python "{runtime.tools.signing}" --mode sign --privatekey "{build.source.path}/private.key" --bin "{build.path}/{build.project_name}.bin" --out "{build.path}/{build.project_name}.bin.signed"
114-
115-
# No signing on Windows
116-
recipe.objcopy.hex.1.pattern.windows="{runtime.tools.esptool.path}/{compiler.esptool.cmd}" -eo "{runtime.platform.path}/bootloaders/eboot/eboot.elf" -bo "{build.path}/{build.project_name}.bin" -bm {build.flash_mode} -bf {build.flash_freq} -bz {build.flash_size} -bs .text -bp 4096 -ec -eo "{build.path}/{build.project_name}.elf" -bs .irom0.text -bs .text -bs .data -bs .rodata -bc -ec
117-
recipe.objcopy.hex.2.pattern.windows=
114+
recipe.objcopy.hex.1.pattern="{runtime.tools.python}" "{runtime.tools.elf2bin}" --eboot "{runtime.tools.eboot}" --app "{build.path}/{build.project_name}.elf" --flash_mode {build.flash_mode} --flash_freq {build.flash_freq} --flash_size {build.flash_size} --path "{runtime.tools.xtensa-lx106-elf-gcc.path}/bin" --out "{build.path}/{build.project_name}.bin"
115+
recipe.objcopy.hex.2.pattern="{runtime.tools.python}" "{runtime.tools.signing}" --mode sign --privatekey "{build.source.path}/private.key" --bin "{build.path}/{build.project_name}.bin" --out "{build.path}/{build.project_name}.bin.signed"
118116

119117
## Save hex
120118
recipe.output.tmp_file={build.project_name}.bin
@@ -128,17 +126,18 @@ recipe.size.regex.data=^(?:\.data|\.rodata|\.bss)\s+([0-9]+).*
128126

129127
# ------------------------------
130128

131-
tools.esptool.cmd=esptool
132-
tools.esptool.cmd.windows=esptool.exe
133-
tools.esptool.path={runtime.platform.path}/tools/esptool
129+
# Need to duplicate the python path because Arduino does not replace properly in this stage
130+
tools.esptool.cmd=python
131+
tools.esptool.cmd.windows={runtime.platform.path}/tools/python/python.exe
132+
tools.esptool.path=
134133
tools.esptool.network_cmd=python
135-
tools.esptool.network_cmd.windows=python.exe
134+
tools.esptool.network_cmd.windows={runtime.platform.path}/tools/python/python.exe
136135

137136
tools.esptool.upload.protocol=esp
138137
tools.esptool.upload.params.verbose=--trace
139138
tools.esptool.upload.params.quiet=
140139

141-
tools.esptool.upload.pattern="python" -c "import sys; sys.path.append('{runtime.platform.path}/tools/pyserial'); execfile('{runtime.platform.path}/tools/esptool/esptool.py')" --chip esp8266 --port "{serial.port}" --baud "{upload.speed}" "{upload.verbose}" write_flash 0x0 "{build.path}/{build.project_name}.bin"
140+
tools.esptool.upload.pattern="{cmd}" -c "import sys; sys.path.append('{runtime.platform.path}/tools/pyserial'); execfile('{runtime.platform.path}/tools/esptool/esptool.py')" --chip esp8266 --port "{serial.port}" --baud "{upload.speed}" "{upload.verbose}" write_flash 0x0 "{build.path}/{build.project_name}.bin"
142141

143142
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"
144143

tools/makebin.py renamed to tools/elf2bin.py

+22-15
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@
2222
import re
2323
import os
2424
import subprocess
25+
import sys
2526
import tempfile
2627

27-
fmodeb = { 'DOUT': 3, 'DIO': 2, 'QOUT': 1, 'QIO': 0 }
28+
fmodeb = { 'dout': 3, 'dio': 2, 'quot': 1, 'qio': 0 }
2829
ffreqb = { '40': 0, '26': 1, '20': 2, '80': 15 }
2930
fsizeb = { '512K': 0, '256K': 1, '1M': 2, '2M': 3, '4M': 4, '8M': 8, '16M': 9 }
3031

@@ -87,21 +88,27 @@ def write_bin(out, elf, segments, to_addr, flash_mode, flash_size, flash_freq, p
8788
while total_size < to_addr:
8889
out.write(bytearray([0xaa]))
8990
total_size += 1
91+
def main():
92+
parser = argparse.ArgumentParser(description='Create a BIN file from eboot.elf and Arduino sketch.elf for upload by esptool.py')
93+
parser.add_argument('-e', '--eboot', action='store', required=True, help='Path to the Arduino eboot.elf bootloader')
94+
parser.add_argument('-a', '--app', action='store', required=True, help='Path to the Arduino sketch ELF')
95+
parser.add_argument('-m', '--flash_mode', action='store', required=True, choices=['dout', 'dio', 'qout', 'qio'], help='SPI flash mode')
96+
parser.add_argument('-f', '--flash_freq', action='store', required=True, choices=['20', '26', '40', '80'], help='SPI flash speed')
97+
parser.add_argument('-s', '--flash_size', action='store', required=True, choices=['256K', '512K', '1M', '2M', '4M', '8M', '16M'], help='SPI flash size')
98+
parser.add_argument('-o', '--out', action='store', required=True, help='Output BIN filename')
99+
parser.add_argument('-p', '--path', action='store', required=True, help='Path to Xtensa toolchain binaries')
90100

91-
parser = argparse.ArgumentParser(description='Create a BIN file from eboot.elf and Arduino sketch.elf for upload by esptool.py')
92-
parser.add_argument('-e', '--eboot', action='store', required=True, help='Path to the Arduino eboot.elf bootloader')
93-
parser.add_argument('-a', '--app', action='store', required=True, help='Path to the Arduino sketch ELF')
94-
parser.add_argument('-m', '--flash_mode', action='store', required=True, choices=['DOUT', 'DIO', 'QOUT', 'QIO'], help='SPI flash mode')
95-
parser.add_argument('-f', '--flash_freq', action='store', required=True, choices=['20', '26', '40', '80'], help='SPI flash speed')
96-
parser.add_argument('-s', '--flash_size', action='store', required=True, choices=['256K', '512K', '1M', '2M', '4M', '8M', '16M'], help='SPI flash size')
97-
parser.add_argument('-o', '--out', action='store', required=True, help='Output BIN filename')
98-
parser.add_argument('-p', '--path', action='store', required=True, help='Path to Xtensa toolchain binaries')
101+
args = parser.parse_args()
99102

100-
args = parser.parse_args()
103+
print 'Creating BIN file "' + args.out + '" using "' + args.app + '"'
101104

102-
print 'Creating BIN file "' + args.out + '" using "' + args.app + '"'
105+
out = open(args.out, "wb")
106+
write_bin(out, args.eboot, ['.text'], 4096, args.flash_mode, args.flash_size, args.flash_freq, args.path)
107+
write_bin(out, args.app, ['.irom0.text', '.text', '.data', '.rodata'], 0, args.flash_mode, args.flash_size, args.flash_freq, args.path)
108+
out.close()
103109

104-
out = open(args.out, "wb")
105-
write_bin(out, args.eboot, ['.text'], 4096, args.flash_mode, args.flash_size, args.flash_freq, args.path)
106-
write_bin(out, args.app, ['.irom0.text', '.text', '.data', '.rodata'], 0, args.flash_mode, args.flash_size, args.flash_freq, args.path)
107-
out.close()
110+
return 0
111+
112+
113+
if __name__ == '__main__':
114+
sys.exit(main())

0 commit comments

Comments
 (0)