Closed leohxj closed 1 year ago
The script is supposed to trigger the generation of that file by starting esptool.py
, but in the output you can see it failed.
scons: *** [downloadfs] "/Users/leohxj/.platformio/penv/bin/python" "/Users/leohxj/.platformio/packages/tool-esptoolpy/esptool.py" --chip esp8266 --port "/dev/cu.usbserial-0001" --baud 115200 --before default_reset --after hard_reset read_flash 0x300000 0xfa000 "/Users/leohxj/Documents/PlatformIO/Projects/access-point/downloaded_fs_0x300000_0xfa000.bin": No such file or directory
I think I remember a bug report saying that quoting the executable (python
) does not work like that on a Mac (but does on my Windows machine).
Can you change this line in the method of the SPIFFSInfo
class
to
def get_extract_cmd(self, input_file, output_dir):
return f'{self.tool} -b {self.block_size} -p {self.page_size} --unpack "{output_dir}" "{input_file}"'
and retry?
yes, I am on MacOS. I change the code below, but it also gets errors like before.
then I print log in get_extract_cmd
, but it does not execute.
Can you manually open a CLI and execute the command?
/Users/leohxj/.platformio/penv/bin/python "/Users/leohxj/.platformio/packages/tool-esptoolpy/esptool.py" --chip esp8266 --port "/dev/cu.usbserial-0001" --baud 115200 --before default_reset --after hard_reset read_flash 0x300000 0xfa000 "/Users/leohxj/Documents/PlatformIO/Projects/access-point/downloaded_fs_0x300000_0xfa000.bin"
what does it output?
@maxgerhardt It works! and the output is:
/Users/leohxj/.platformio/penv/bin/python "/Users/leohxj/.platformio/packages/tool-esptoolpy/esptool.py" --chip esp8266 --port "/dev/cu.usbserial-0001" --baud 115200 --before default_reset --after hard_reset read_flash 0x300000 0xfa000 "/Users/leohxj/Documents/PlatformIO/Projects/access-point/downloaded_fs_0x300000_0xfa000.bin"
esptool.py v3.1
Serial port /dev/cu.usbserial-0001
Connecting....
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: 98:cd:ac:26:2a:2f
Uploading stub...
Running stub...
Stub running...
1024000 (100 %)
1024000 (100 %)
Read 1024000 bytes at 0x300000 in 91.5 seconds (89.5 kbit/s)...
Hard resetting via RTS pin...
Weird that it works when the command is executed in the commandline, if it's the same command it should work.
What is the full output now of the "Download Filesystem" task?
I have the same issue under linux (Manjaro). I could execute the cmds directly via shell, but I think the problem is already the download cmd, not only the extraction cmd.
Removing the quotes around the python-path doesn't help, neither in the mentioned get_extract_cmd
method nor in download_fs
.
But with changing the call to subprocess.call(cmd, shell=True)
fixed the issue with download and extraction (lines 297 & 274). Executing via shell is considered as a security issue because it could enable shell injection, but I see no problem in this case. It could be a problem for Windows users, don't know. Maybe there is a better option escaping the cmd correctly or use the arguments of subprocess.call
?
With the script working there is another issue: The extracted files are only a part of the file system. But perhaps I should open a new Issue because they don't seem related.
I'll double-check this on Linux today to see where / why it fails, but thanks for the hint on shell = True
. Sadly I won't have a Mac to test on, but maybe it equally resolves the issue with that.
Fixed per PR above
I’ve tried it on my own project by copy
download_fs.py
to my project and adding extra_scripts = download_fs.py as described in https://github.com/maxgerhardt/pio-esp32-esp8266-filesystem-downloader#using-in-a-different-project.I run custom -> Download Filesystem, but got below error:
Where is
downloaded_fs_0x300000_0xfa000.bin
file, or how to build or generate it??