1# Partition Read, Write, Erase Example
2
3This example demonstrates how to perform partition read, write and erase operations using API functions `esp_partition_read`, `esp_partition_write` and `esp_partition_erase`.
4
5# Example Flow
6
7The example uses a [custom partition table](./partitions_example.csv), with a data partition `storage` used as the demo partition. For the most part the example code is well-commented so users should be able to follow along the code easily. Nevertheless, this section provides an overview of the code flow.
8
9The partition table is searched for the `storage` partition. Once found, the entire partition is erased using `esp_partition_erase_range`. Sample data is written using `esp_partition_write`
10and read back using `esp_partition_read`, verifying the read and written data match. The partition is erased once again using `esp_partition_erase_range`, limited to the sector the sample data was written to.
11
12### Output
13
14```
15I (588) example: Written data: ESP-IDF Partition Operations Example (Read, Erase, Write)
16I (588) example: Read data: ESP-IDF Partition Operations Example (Read, Erase, Write)
17I (638) example: Erased data
18I (638) example: Example end
19```
20
21# Others
22
23Detailed functional description of partition API is provided in [documentation](https://docs.espressif.com/projects/esp-idf/en/latest/api-reference/storage/spi_flash.html).
24
25See the README.md file in the upper level 'examples' directory for more information about examples.
26