Prepare FAT image and flash it to ESP32
Posted: Thu Sep 21, 2017 7:30 pm
Here is a tool to prepare FAT image on host and flash it to esp32.
https://github.com/jkearins/ESP32_mkfatfs
The tool is inspired by mkspiffs https://github.com/loboris/ESP32_spiffs_example tool created by loboris https://esp32.com/viewtopic.php?f=18&t=1901
Example of using FAT with ESP32
Features
Configure your esp32 build environment as for other esp-idf examples.
Clone the repository:
Execute menuconfig and configure your Serial flash config and other settings. Included sdkconfig.defaults sets some defaults to be used.
Make and flash the example:
Prepare FAT image
FAT image can be prepared on host and flashed to ESP32.
Tested and works under Windows. It is not tested under Linux and Mac OS yet but should work.
Copy the files to be included on FAT into components/fatfs_image/image/ directory. Subdirectories can also be added.
To create FAT image in build directory without flashing to ESP32 execute:
To create FAT image in build directory and flash it to ESP32 execute:
To flash previously prepared in build directory FAT image to ESP32 execute:
Example functions
To manage FATFS objects I used Kolban's cpp_utils from esp32-snippets project: https://github.com/nkolban/esp32-snippets.git.
Files for sample flash image have been gotten from another Kolban's project https://github.com/nkolban/ESP32_Explorer.git introduced there https://esp32.com/viewtopic.php?f=17&t=2977
https://github.com/jkearins/ESP32_mkfatfs
The tool is inspired by mkspiffs https://github.com/loboris/ESP32_spiffs_example tool created by loboris https://esp32.com/viewtopic.php?f=18&t=1901
Example of using FAT with ESP32
Features
- prepare of FAT image
- flash FAT image to ESP32
- example of FAT functions
Configure your esp32 build environment as for other esp-idf examples.
Clone the repository:
Code: Select all
git clone https://github.com/jkearins/ESP32_mkfatfs.git
Code: Select all
make menuconfig
Code: Select all
make all && make flash && make flashfatfs
FAT image can be prepared on host and flashed to ESP32.
Tested and works under Windows. It is not tested under Linux and Mac OS yet but should work.
Copy the files to be included on FAT into components/fatfs_image/image/ directory. Subdirectories can also be added.
To create FAT image in build directory without flashing to ESP32 execute:
Code: Select all
make makefatfs
Code: Select all
make flashfatfs
Code: Select all
make copyfatfs
- registers FAT as VFS file system; if the fs is not mounted the system will halt
- lists files in root directory
Code: Select all
I (399) cpu_start: Pro cpu up.
I (399) cpu_start: Starting app cpu, entry point is 0x40080e98
I (0) cpu_start: App cpu up.
I (402) heap_init: Initializing. RAM available for dynamic allocation:
I (417) heap_init: At 3FFAE2A0 len 00001D60 (7 KiB): DRAM
I (433) heap_init: At 3FFB3E60 len 0002C1A0 (176 KiB): DRAM
I (449) heap_init: At 3FFE0440 len 00003BC0 (14 KiB): D/IRAM
I (466) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (483) heap_init: At 40087D04 len 000182FC (96 KiB): IRAM
I (499) cpu_start: Pro cpu start user code
I (582) cpu_start: Starting scheduler on PRO CPU.
I (192) cpu_start: Starting scheduler on APP CPU.
I (192) FATFS: Mounting FAT partition...
I (195) FATFS: Done.
I (196) FATFS: ============= Begin of root contents
I (199) FATFS: ESP32Explorer.html 8332 bytes
I (202) FATFS: ESP32Explorer.js 11434 bytes
I (208) FATFS: <images>
I (210) FATFS: <jquery>
I (212) FATFS: <jQuery-File-Upload-9.18.0>
I (216) FATFS: <jqueryui>
I (218) FATFS: <jstree>
I (220) FATFS: ============= End of root contents
Files for sample flash image have been gotten from another Kolban's project https://github.com/nkolban/ESP32_Explorer.git introduced there https://esp32.com/viewtopic.php?f=17&t=2977