Warning

This document is not updated for ESP32C61 yet, so some of the content may not be correct.

This warning was automatically inserted due to the source file being in the add_warnings_pages list.

# Storage API

[中文]

This section contains reference of the high-level storage APIs. They are based on low-level drivers such as SPI flash, SD/MMC.

- Partitions API allow block based access to SPI flash according to the Partition Tables.

- Non-Volatile Storage library (NVS) implements a fault-tolerant wear-levelled key-value storage in SPI NOR flash.

- Virtual File System (VFS) library provides an interface for registration of file system drivers. SPIFFS, FAT and various other file system libraries are based on the VFS.

- SPIFFS is a wear-levelled file system optimized for SPI NOR flash, well suited for small partition sizes and low throughput

- FAT is a standard file system which can be used in SPI flash or on SD/MMC cards

- Wear Levelling library implements a flash translation layer (FTL) suitable for SPI NOR flash. It is used as a container for FAT partitions in flash.

For information about storage security, please refer to Storage Security.

Note

It is suggested to use high-level APIs (`esp_partition` or file system) instead of low-level driver APIs to access the SPI NOR flash.

Due to the restriction of NOR flash and ESP hardware, accessing the main flash will affect the performance of the whole system. See SPI Flash API to learn more about the limitations.

- FAT Filesystem Support
- Generating and Parsing FATFS on Host
- Manufacturing Utility
- Non-Volatile Storage Library
- NVS Bootloader
- NVS Encryption
- NVS Partition Generator Utility
- NVS Partition Parser Utility
- SD/SDIO/MMC Driver
- Partitions API
- SPIFFS Filesystem
- Virtual Filesystem Component
- Wear Levelling API
- Storage Security

## Examples

NVS API examples
Code Example | Description
nvs_rw_blob | Shows the use of the C-style API to read and write blob data types in NVS flash.
nvs_rw_value | Shows the use of the C-style API to read and write integer data types in NVS flash.
nvs_rw_value_cxx | Shows the use of the C++-style API to read and write integer data types in NVS flash.
nvs_bootloader | Shows the use of the API available to the bootloader code to read NVS data.
nvsgen | Demonstrates how to use the Python-based NVS image generation tool to create an NVS partition image from the contents of a CSV file.

Common Filesystem API
Code Example | Description
fatfs/getting_started | Demonstrates basic common file API (stdio.h) usage over internal flash using FATFS.
fatfs/fs_operations | Demonstrates POSIX API for filesystem manipulation, such as moving, removing and renaming files.

FATFS API examples
Code Example | Description
fatfsgen | Demonstrates the capabilities of Python-based tooling for FATFS images available on host computers.
ext_flash_fatfs | Demonstrates using FATFS over wear leveling on external flash.
wear_leveling | Demonstrates using FATFS over wear leveling on internal flash.

SPIFFS API examples
Code Example | Description
spiffs | Shows the use of the SPIFFS API to initialize the filesystem and work with files using POSIX functions.
spiffsgen | Demonstrates the capabilities of Python-based tooling for SPIFFS images available on host computers.

Partition API examples
Code Example | Description
partition_api | Provides an overview of API functions to look up particular partitions, perform basic I/O operations, and use partitions via CPU memory mapping.
parttool | Demonstrates the capabilities of Python-based tooling for partition images available on host computers.

VFS related examples
Code Example | Description
littlefs | Shows the use of the LittleFS component to initialize the filesystem and work with a file using POSIX functions.
semihost_vfs | Demonstrates the use of the VFS API to let an ESP-based device access a file on a JTAG-connected host using POSIX functions.

Was this page helpful?

- Thank you! We received your feedback.
- If you have any comments, fill in Espressif Documentation Feedback Form.

- We value your feedback.
- Let us know how we can improve this page by filling in Espressif Documentation Feedback Form.