Fatfsgen.py fails to create bin partition
Posted: Sat Jun 07, 2025 3:21 pm
I have a fatfs partition in my controller. If the partition is initialized and written by the controller it works really well.
Now i want write this partition with esptool. Before, i need to create the binary fatfs partition, using fatfsgen: i create a folder with the file i need and launch this command.
It correctly generate a file myfatfs.bin, with size 576KB.
I can also check this file with fatfsparse.py:
It generates a folder "Espressif" with my files inside.
Well, I write the partition inside my controller:
And it works. I can check the partition with esptool: the partition is correctly written, no difference in binary comparison between the binary written and the binary read.
But microcontroller can't mount this partition: it shows error 13. After that, i wrote the files by wi-fi upload, so it stores the files correctly in the fatfs partition, and all works.
So, i tried to read the partition with esptool, due to compare the binary files. The broken binary generated by fatfsgen and the correct binary dumped from the controller are very similar, with small differences if i compare the files with a hex editor.
From location 0 to 0x1000 there's no difference.
At location 0x1000, in the fatfsgen's generated file i can find:
and at the same location, in the working controller's binary i can find:
There's no other difference between the files, but it's enough for the mounting partition error.
What is the problem?
Now i want write this partition with esptool. Before, i need to create the binary fatfs partition, using fatfsgen: i create a folder with the file i need and launch this command.
Code: Select all
python fatfs\fatfsgen.py --output_file myfatfs.bin --partition_size 0x90000 --sector_size 4096 --use_default_datetime fatfs_tempI can also check this file with fatfsparse.py:
Code: Select all
python fatfs\fatfsparse.py myfatfs.binWell, I write the partition inside my controller:
Code: Select all
esptool --chip esp32s3 -b 460800 --before default_reset --after hard_reset write_flash --flash_mode dio --flash_freq 40m 0xEE2000 myfatfs.binBut microcontroller can't mount this partition: it shows error 13. After that, i wrote the files by wi-fi upload, so it stores the files correctly in the fatfs partition, and all works.
So, i tried to read the partition with esptool, due to compare the binary files. The broken binary generated by fatfsgen and the correct binary dumped from the controller are very similar, with small differences if i compare the files with a hex editor.
From location 0 to 0x1000 there's no difference.
At location 0x1000, in the fatfsgen's generated file i can find:
Code: Select all
f8 ff ff ff ff ff ff 0f 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20Code: Select all
eb fe 90 4d 53 44 4f 53 35 2e 30 20 10 01 01 20 01 20 02 8c 20 f8 01 20 3f 20 ff 20 20 20 20 20 20 20 20 20 80 20 29 f7 85 99 58 4e 4f 20 4e 41 4d 45 20 20 20 20 46 41 54 20 20 20 20 20What is the problem?