I want to use two fat partitions on my esp32. I have already created the two partitions with the partition table.
Until now I had only one partition, which I mounted with the FFat library very simple with FFat.begin().
Now I would like to create an instance for each partition. So for example FFat1 and FFat2.
Unfortunately it is not clear to me how I can achieve this or if there is another way to be able to read and write files on the two partitions separately.
Why would you use a filesystem to hold a single binary image file? Just write it directly to the FLASH partition, starting at offset 0 in the partition. The filesystem is just overhead that adds no value.
It's all a bit more coplicitous. The firmware file is encrypted and therefore cannot be written directly into flash. To ensure that I am always able to download and store a large encrypted firmware file, I want to reserve space for this purpose.
A file is a file. It's just a sequence of bytes of data. How does being encrypted affect anything at all? When you write a file to a FAT filesystem, it writes those bytes to FLASH without changing them in any way.
Sure, but I need to manipulate the file before writing the update to flash. The encrypted firmware image would not boot.
But that ist not the point.
I would like to know how to create mutiple instances of FFat.
The begin() function has a parameter to select the partition label to mount. But I dont know how to use both partitions because I have just one instance of FFat.
Please post a complete sketch that shows the use of the FFat library
I cant provide the full sketch. The sketch is way to big.
But there is not really more to it than including the library and mounting the partition with #include "FFat.h"
Each instance of the file system on the esp32 would be given the same memory area to use, as per post#10, not possible.
But,
If your ESP32 has PSRAM, you can write to multiple locations as separate entities but not using a file system. One would use the ESP32's API to use the HiMem. Also under the Arduino IDE the code can only access 4MB of PSRAM, if you want to access more, one would have to use the ESPRESSIF's IDF.
I think you are right. I have not been able to get it to work with multiple instances.
But it works for me to unmount the data partition and mount the update partition when I need to work on the update partition. This probably saves some resources on my esp32 as well.
Thanks to all of you for your input. The problem is now solved for me.