Espressif Systems ESP Faq page 126

Table of Contents

Advertisement

Chapter 4. Software framework
4.7.26 After enabling Secure Boot or flash encryption, what should I pay attention to
during OTA (Over-The-Air) updates?
• After enabling Secure Boot, you must sign the new firmware to be used for OTA updates. Otherwise, the new
firmware cannot be applied to the device.
• After enabling flash encryption, when generating a new firmware, please ensure that the flash encryption option
is enabled.
4.8 Storage
4.8.1 FAT Filesystem
How to improve the damage to FatFs file system caused by accidental power loss?
Since FatFs is designed to not support write transactions, the accidental power loss may cause error to
partitions, which cannot be restored by simply modifying FatFs. For now, it is recommended to resolve
this problem in application level by creating two identical FatFs partitions to do backups, or you can also
choose a more secure file system instead, such as
How to make and flash the image of a FatFs file system?
Here we will use a third-party tool, since there is no such tool provided in ESP-IDF now. The entire
process shows as below:
• Step 1: use the
image named fat_img.bin in the file_image folder.
./mkfatfs -c file_image -s 1048576 ./fat_img.bin
• Step 2: flash the image to address 0x110000:
esptool.py -p /dev/ttyUSB1 -b 460800 --before default_reset --after hard_
reset write_flash --flash_mode dio --flash_size detect --flash_freq
0x110000 ~/Desktop/fat_img.bin;
• Step 3: mount the image in program:
static
void
initialize_filesystem() {
static
wl_handle_t
wl_handle
=
WL_INVALID_HANDLE;
const
esp_vfs_fat_mount_config_t
mount_config
ESP_LOGI(TAG,
esp_err_t err
mount_config, &wl_handle);
if
(err
!=
ESP_OK) {
ESP_LOGE(TAG,
return;
}
}
Espressif Systems
mkfatfs
tool to create image in a specified folder. Here we create a 1048576-byte
=
{ .max_files
=
10, };
"Mounting
FATfilesystem");
=
esp_vfs_fat_spiflash_mount("/spiflash", "storage",
"Failed to mount FATFS
Submit Document Feedback
LittleFS
and
SafeFAT
(charged).
(%s)", esp_err_to_name(err));
109
80m␣
&
Release master

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the ESP and is the answer not in the manual?

This manual is also suitable for:

Esp32Esp8266Esp32-s2Esp32-c3Esp32-s3

Table of Contents