Page 1 of 1

Custom files in the self-compiled Micropython

Posted: Wed Apr 14, 2021 9:12 pm
by lutecki
Hi,
I need to upload Micropython with program files to a 30 piece of ESP32. To speed things up I would compile my own MP version already with the program files and images and libraries. In which folder should I put the files to be included in the compiled bin file?

Re: Custom files in the self-compiled Micropython

Posted: Thu Apr 15, 2021 9:30 am
by Roberthh
You van embed python scripts into the firmware by placing them into the modules directory. But that does not add them to the file system. A workaround may be to encapsulate other content into a python script and extract that on boot. But that works for short files only.

Re: Custom files in the self-compiled Micropython

Posted: Thu Apr 15, 2021 4:29 pm
by russ_h
Here is a link showing how I modified the VFAT file system image to add files for a ESP32 based MicroPython device using Centos 7 Linux. I have not tried modifying the littlefs file system but I suspect the process would be similar.

https://gist.github.com/russhughes/1300 ... vfat-image

Re: Custom files in the self-compiled Micropython

Posted: Fri Apr 16, 2021 7:33 am
by lutecki
OK, so you thinking it's not very simple. So maybe does esptool allow to upload files to littlefs? Then I would write a script to burn bootrom and copy the files.

Re: Custom files in the self-compiled Micropython

Posted: Fri Apr 16, 2021 9:06 am
by lutecki
Hi guys and thanks for reply,
So if you thinking it's not simple, does esptool allow to upload files to littlefs? Then I would create a script to burn bootrom and copy the files in second step.

Re: Custom files in the self-compiled Micropython

Posted: Fri Apr 16, 2021 9:18 am
by Roberthh
Esptool just copies data to the flash memory and does not care about the type of the data.

Re: Custom files in the self-compiled Micropython

Posted: Fri Apr 16, 2021 10:35 am
by Christian Walther
But you can use pyboard.py to copy files after you used esptool.py to install MicroPython. Works fine in a script if you put a sleep 5 or something between them to let MicroPython boot.

Re: Custom files in the self-compiled Micropython

Posted: Fri Apr 16, 2021 2:51 pm
by russ_h
Another option is to use mpfshell with a script to upload your files. I use this for uploading example programs to test new display driver code. See the upload.mpf file in https://github.com/russhughes/st7789_mp ... /T-DISPLAY for an example. It’s not very fast but it works.

To install mpfshell: pyrhon3 -m pip install mpfshell
To run script: mpfshell -s upload.mpf