Using a Expressif dev-board and standard micropython.bin I was able to create a littlefs2 partition, mount it and write data into a file:
# ESP8266 and ESP32
import os
os.umount('/')
os.VfsLfs2.mkfs(bdev)
os.mount(bdev, '/'))
with open("myfile.txt", "a") as f:
f.write("myData")
Once I have done this os.listdir() will show the myfile.txt file but I can't see a way to update my code on the ESP anymore.
I assume I need to get rid of the littlefs2 file system first but could not find an example for that.
The only way I found for changing my code was erasing all flash, load a new copy of micropython.bin and then flash my code modules again onto the chip - which is kind of a long process for every change in my code?
Any shorter/faster way to update my code files on the ESP?