EasyManua.ls Logo

Espressif ESP32-S2 - Page 769

Espressif ESP32-S2
1695 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Chapter 2. API Reference
Return
If partition not found, returns NULL.
If found, returns a pointer to the esp_partition_t structure in flash. This pointer is always valid for
the lifetime of the application.
Parameters
partition: Pointer to partition data to verify. Must be non-NULL. All elds of this structure
must match the partition table entry in flash for this function to return a successful match.
esp_err_t esp_partition_read(const esp_partition_t *partition, size_t src_oset, void *dst, size_t
size)
Read data from the partition.
Partitions marked with an encryption flag will automatically be be read and decrypted via a cache mapping.
Return ESP_OK, if data was read successfully; ESP_ERR_INVALID_ARG, if src_oset exceeds partition
size; ESP_ERR_INVALID_SIZE, if read would go out of bounds of the partition; or one of error codes
from lower-level flash driver.
Parameters
partition: Pointer to partition structure obtained using esp_partition_find_first or
esp_partition_get. Must be non-NULL.
dst: Pointer to the buffer where data should be stored. Pointer must be non-NULL and buffer must
be at least sizebytes long.
src_offset: Address of the data to be read, relative to the beginning of the partition.
size: Size of data to be read, in bytes.
esp_err_t esp_partition_write(const esp_partition_t *partition, size_t dst_oset, const void *src,
size_t size)
Write data to the partition.
Before writing data to flash, corresponding region of flash needs to be erased. This can be done using
esp_partition_erase_range function.
Partitions marked with an encryption flag will automatically be written via the spi_flash_write_encrypted()
function. If writing to an encrypted partition, all write offsets and lengths must be multiples of 16 bytes. See
the spi_flash_write_encrypted() function for more details. Unencrypted partitions do not have this restriction.
Note Prior to writing to flash memory, make sure it has been erased with esp_partition_erase_range call.
Return ESP_OK, if data was written successfully; ESP_ERR_INVALID_ARG, if dst_offset exceeds parti-
tion size; ESP_ERR_INVALID_SIZE, if write would go out of bounds of the partition; or one of error
codes from lower-level flash driver.
Parameters
partition: Pointer to partition structure obtained using esp_partition_find_first or
esp_partition_get. Must be non-NULL.
dst_offset: Address where the data should be written, relative to the beginning of the partition.
src: Pointer to the source buffer. Pointer must be non-NULL and buffer must be at least size
bytes long.
size: Size of data to be written, in bytes.
esp_err_t esp_partition_read_raw(const esp_partition_t *partition, size_t src_oset, void *dst,
size_t size)
Read data from the partition without any transformation/decryption.
Note This function is essentially the same as esp_partition_read() above. It just never decrypts data
but returns it as is.
Return ESP_OK, if data was read successfully; ESP_ERR_INVALID_ARG, if src_oset exceeds partition
size; ESP_ERR_INVALID_SIZE, if read would go out of bounds of the partition; or one of error codes
from lower-level flash driver.
Parameters
partition: Pointer to partition structure obtained using esp_partition_find_first or
esp_partition_get. Must be non-NULL.
dst: Pointer to the buffer where data should be stored. Pointer must be non-NULL and buffer must
be at least sizebytes long.
src_offset: Address of the data to be read, relative to the beginning of the partition.
Espressif Systems 758
Submit Document Feedback
Release v4.4

Table of Contents