Espressif ESP32-S2 Programming Manual page 778

Table of Contents

Advertisement

Chapter 2. API Reference
2. If you have an environment where a Python interpreter is not available, but a host compiler is available. Oth-
erwise, a pre-compiled mkspiffs binary can do the job. However, there is no build system integration for
mkspiffs and the user has to do the corresponding work: compiling mkspiffs during build (if a pre-
compiled binary is not used), creating build rules/targets for the output files, passing proper parameters to the
tool, etc.
See also
Partition Table documentation
Application Example
An example of using SPIFFS is provided in the
SPIFFS partition, then writes and reads data from it using POSIX and C library APIs. See the README.md file in
the example directory for more information.
High-level API Reference
Header File
components/spiffs/include/esp_spiffs.h
Functions
esp_err_t
esp_vfs_spiffs_register(const
Register and mount SPIFFS to VFS with given path prefix.
Return
• ESP_OK if success
• ESP_ERR_NO_MEM if objects could not be allocated
• ESP_ERR_INVALID_STATE if already mounted or partition is encrypted
• ESP_ERR_NOT_FOUND if partition for SPIFFS was not found
• ESP_FAIL if mount or format fails
Parameters
• conf: Pointer to
esp_err_t
esp_vfs_spiffs_unregister(const char *partition_label)
Unregister and unmount SPIFFS from VFS
Return
• ESP_OK if successful
• ESP_ERR_INVALID_STATE already unregistered
Parameters
• partition_label: Same label as passed to esp_vfs_spiffs_register.
bool esp_spiffs_mounted(const char *partition_label)
Check if SPIFFS is mounted
Return
• true if mounted
• false if not mounted
Parameters
• partition_label: Optional, label of the partition to check. If not specified, first partition with
subtype=spiffs is used.
esp_err_t
esp_spiffs_format(const char *partition_label)
Format the SPIFFS partition
Return
• ESP_OK if successful
• ESP_FAIL on error
Espressif Systems
storage/spiffs
esp_vfs_spiffs_conf_t
esp_vfs_spiffs_conf_t
configuration structure
767
Submit Document Feedback
directory. This example initializes and mounts a
*conf)
Release v4.4

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the ESP32-S2 and is the answer not in the manual?

Table of Contents

Save PDF