Is it possible to compile the firmware with custom files already included in the filesystem, and how? By default only the boot.py gets created but I would like to include several other files aswell, so that they are already present in the filesystem when I flash the firmware.
I'm using the ESP32 in case it matters.
Flashing with custom files in default filesystem possible?
Re: Flashing with custom files in default filesystem possible?
You can create a file system image with files and flash that to the device. https://penfold.owt.com/turtleplotbot/s ... vfat-image
Re: Flashing with custom files in default filesystem possible?
There was some discussion of this in this thread: viewtopic.php?f=16&t=6677
The basic idea is that on flash the filesystem follows the firmware, so if you add your own filesystem image to the end of the firmware (such that it ends up at the expected location) then it works.
If your goal is to add Python code or file resources to the firmware, then freezing may be a better option, (and for non-Python files, Peter's solution described here: https://github.com/micropython/micropyt ... -562918657 might be of interest)
The basic idea is that on flash the filesystem follows the firmware, so if you add your own filesystem image to the end of the firmware (such that it ends up at the expected location) then it works.
If your goal is to add Python code or file resources to the firmware, then freezing may be a better option, (and for non-Python files, Peter's solution described here: https://github.com/micropython/micropyt ... -562918657 might be of interest)
Re: Flashing with custom files in default filesystem possible?
Thanks, I followed the steps and it's working flawlessly! Exactly what I needed .russ_h wrote: ↑Tue Jan 28, 2020 5:08 amYou can create a file system image with files and flash that to the device. https://penfold.owt.com/turtleplotbot/s ... vfat-image
@jimmo thanks for the other tips, the data_to_py utility looks particularly useful. But the problem is that I want to upload a 1MB webpage to the module, together with its file hierarchy, and make it working with MicroWebSrv2 which searches within the filesystem directory. Maybe there's a way to make it working with the frozen code but if everything was a .py file instead of .html or .js I would have to carefully reroute literally everything, and I don't really mind the 1MB wasted space as I'm not going to use it for anything else.