For ESP32, Can Micropython(script) and C modules share(access) the same FAT filesystem? (C modules are the extension modules for Micropython)
If yes:
- Do they (Micropython and C modules) need do mounting seperately?
- Will it cause any access competition issue? for example, both Micropython task and C module task try to write the same directory.
I guess if the backend of MicroPython's FAT support relies on ESP32 C API, then there should be no issue with the cases above.
Can Micropython and C modules share the same FAT filesystem?
-
- Posts: 6
- Joined: Mon Mar 21, 2022 10:55 am
Re: Can Micropython and C modules share the same FAT filesystem?
The C code can use the same filesystem but it needs to use use the python functions to read/write/open/close the file and not use the c runtime library (I.e. fread/fwrite/fopen/fclose).
An example of how to do this can be found in the mpfile.c file from this commit: https://github.com/dhylands/micropython ... e1e0f0c21b (which was never merged into the mainline).
An example of how to do this can be found in the mpfile.c file from this commit: https://github.com/dhylands/micropython ... e1e0f0c21b (which was never merged into the mainline).
-
- Posts: 6
- Joined: Mon Mar 21, 2022 10:55 am
Re: Can Micropython and C modules share the same FAT filesystem?
Thank you! After read more code, I also realized it is not easy to share the same FS.
Both ESP-IDF and MicroPython ship their own FATFS implementation (although they are from the same upstream). This makes FS sharing not easy. And it looks like the FATFS for MicroPython does not recognize Wearing Level feature.
It would be great if the proposed C API can be magered to mainstream. Otherwise, we have to make C app and MicroPython script use seperate FS.
Both ESP-IDF and MicroPython ship their own FATFS implementation (although they are from the same upstream). This makes FS sharing not easy. And it looks like the FATFS for MicroPython does not recognize Wearing Level feature.
It would be great if the proposed C API can be magered to mainstream. Otherwise, we have to make C app and MicroPython script use seperate FS.