Skip to content

Commit 0c019c4

Browse files
Make upload.py compatible with existing FS upload
PR esp8266#6765 introduced an incompatibility with the existing Java uploaders for SPIFFS and LittleFS, breaking them because of the upload.py parameter format change to support single stage erase/upload. Add in patch to silently eat the single --end and to parse the write address and filename properly as generated by calls from the plugins, while retaining compatibility with the current IDE changes.
1 parent 25f74bb commit 0c019c4

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

tools/upload.py

+12-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
cmdline = []
2424
write_option = ''
25+
write_addr = '0x0'
2526
erase_addr = ''
2627
erase_len = ''
2728

@@ -45,6 +46,16 @@
4546
erase_len = sys.argv.pop(0)
4647
thisarg = ''
4748

49+
# Backwards compatibility with fs upload tools, eat --end
50+
if thisarg == '--end':
51+
thisarg = ''
52+
53+
# Backwards compatibility with fs upload tools, parse write_flash for later use
54+
if thisarg == 'write_flash':
55+
write_addr = sys.argv.pop(0)
56+
binary = sys.argv.pop(0)
57+
thisarg = ''
58+
4859
if os.path.isfile(thisarg):
4960
binary = thisarg
5061
thisarg = ''
@@ -55,7 +66,7 @@
5566
cmdline = cmdline + ['write_flash']
5667
if len(write_option):
5768
cmdline = cmdline + [write_option]
58-
cmdline = cmdline + ['0x0', binary]
69+
cmdline = cmdline + [write_addr, binary]
5970

6071
erase_file = ''
6172
if len(erase_addr):

0 commit comments

Comments
 (0)