esp-idf/examples/storage/partition_api/partition_mmap
2021-09-24 13:55:07 +08:00
..
main Whitespace: Automated whitespace fixes (large commit) 2020-11-11 07:36:35 +00:00
CMakeLists.txt examples: Add partition API examples 2018-10-26 15:46:53 +08:00
Makefile Whitespace: Automated whitespace fixes (large commit) 2020-11-11 07:36:35 +00:00
partition_mmap_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
README.md examples: Add partition API examples 2018-10-26 15:46:53 +08: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

Partition Memory Map Example

This example demonstrates how to use esp_partition_mmap to configure MMU and map a partition into memory address space for read operations.

Example Flow

The example uses a custom partition table, with a data partition storage used for demonstration. Before mapping this partition to memory, data is written to the partition used for verification.

The partition API function esp_partition_mmap is used to get a pointer to the mapped memory region and a handle to the mapping. The pointer is used to transparently read back the verification data written previously. Once the data written and read are verified to be the same, the function spi_flash_munmap is used to release the mapping.

Output

I (309) example: Written sample data to partition: ESP-IDF Partition Memory Map Example
I (309) example: Mapped partition to data memory address 0x3f410000
I (319) example: Read sample data from partition using mapped memory: ESP-IDF Partition Memory Map Example
I (329) example: Data matches
I (329) example: Unmapped partition from data memory
I (339) 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.