How to only create flash file system if it is not already created, otherwise mount #16450
-
In boot.py the FAT file system is created. The problem that arises is that every time boot.py is run, the flash file system is erased. How can this be prevented. Is there a way to determine that the file system is already created? When the fs is already created it should only be mounted. This is the code in boot.py.
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
You can try to mount the file system first and only recreate it, if mountingb fails. A typical sequence from _boot.py of various ports is:
Note: For formatting code, either indent all code lines or enclose the code section into lines with three backticks ``` |
Beta Was this translation helpful? Give feedback.
-
There is no _boot.py in the STM32 port. But it uses the same logic in C code. So no, you do not have to create the on.board file system in your boot.py. The STM port will as well mount an SD card if present. |
Beta Was this translation helpful? Give feedback.
-
does work and shows that flash partition is there |
Beta Was this translation helpful? Give feedback.
That's because the file system is already mounted. I added an umount like in your sample code. But the whole code is not needed.