esp-idf/examples/storage/partition_api/partition_ops
Roland Dobai 766aa57084 Build & config: Remove leftover files from the unsupported "make" build system 2021-11-11 15:32:36 +01:00
..
main Build & config: Remove leftover files from the unsupported "make" build system 2021-11-11 15:32:36 +01:00
CMakeLists.txt examples: Add partition API examples 2018-10-26 15:46:53 +08:00
README.md examples: Add partition API examples 2018-10-26 15:46:53 +08:00
partition_ops_example_test.py ci: run Example_GENERIC for C3 2021-03-15 10:27:07 +08:00
partitions_example.csv global: update note in the partition tables 2019-07-27 10:28:16 +02:00
sdkconfig.ci example_tests: Deletes usage esp32c3 ECO0 in CI (by default ECO3) 2021-09-24 13:55:07 +08:00
sdkconfig.defaults examples: remove non-existent options from sdkconfig.defaults 2019-07-29 04:57:38 +02:00

README.md

Partition Read, Write, Erase Example

This example demonstrates how to perform partition read, write and erase operations using API functions esp_partition_read, esp_partition_write and esp_partition_erase.

Example Flow

The example uses a custom partition table, 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.

The 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 and 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.

Output

I (588) example: Written data: ESP-IDF Partition Operations Example (Read, Erase, Write)
I (588) example: Read data: ESP-IDF Partition Operations Example (Read, Erase, Write)
I (638) example: Erased data
I (638) example: Example end

Others

Detailed functional description of partition API is provided in documentation.

See the README.md file in the upper level 'examples' directory for more information about examples.