-
Dear community, following up the issue #11226, which I was able to solve, I now have the following problem: when I format the internal flash with FATFS (no problems with LittleFS) and create files under Pycom's ESP32 port (micropython sigfox 1.20.2r6), I am able to mount the filesystem, but filenames are all scrambled up and cannot be opened. The filenames have text from file content of one of the files, e.g. one file is named "-----BEG.IN", which is part of a certificate file placed in the flash. I can open a file with fileHandle = open("-----BEG.IN"), but on reading from the file, I get OSError: [Errno 2] ENOENT. So it seems to me that some kind of mapping in the internal filesystem tables is not correct. Which additional confguration should I look for, that may has influence on how the lib interprets and reads data from the flash? Could the flash driver maybe have something to do with it? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
What are you trying to achieve?. |
Beta Was this translation helpful? Give feedback.
-
Hi Josverl, thank you for your reply and sorry for my late one, I can only work part time on this project. Because both ports use the exact same oofatfs lib, I can only imagine that there must be some kind of different configuration that is not just in ff.h or ffconf.h, because they are now also configured identically. But its hard to find other differences, because VFS implementation already is quite different. If you have any suggestions for files where configurations regarding FATFS are defined and where I can check differences, I would be most grateful. |
Beta Was this translation helpful? Give feedback.
-
OK, I think I found it. Long story short: the diskio_ctl function returns a sector size, that is fixed and thus not necessarily the one configured in the file system, which was it in my case. The long story: buf = bytearray(bdev.ioctl(5, 0)) # 5 is SEC_SIZE
bdev.readblocks(0, buf) returned so many bytes. Today I checked the actual size of buf, which returned 4096. The block size for the FATFS in ffconf.h is configured to be 512. There is a When I call it like this Could someone maybe please clarify if this is intended behaviour, and am I supposed to provide the block_size by myself, or could this be done automatically by the partition object? Using a fixed block size on a file system that may has a different or varying block size seems unexpected to me, but maybe I am missing something here? In theory, the block size can be read from the flash, but admittedly the file system must be known in advance to know where the setting can be read from. Pycom's implementation also uses a fixed block size that is returned in the diskio_ctl function used by ff.c |
Beta Was this translation helpful? Give feedback.
OK, I think I found it. Long story short: the diskio_ctl function returns a sector size, that is fixed and thus not necessarily the one configured in the file system, which was it in my case.
The long story:
In the provided inisetup.py, there is series of function to check the fs integrity. I used this function to check differences between a fs created with Micropython and Pycom, and discovered the first configuration issue with the different block size, see #11226 . Now I tried to find other differences and compared the config bytes of the FATFS in the first block of the flash. At first, I didn't wonder why
return…