EasyManuals Logo

Espressif ESP32-S2 User Manual

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
Page #770 background imageLoading...
Page #770 background image
Chapter 2. API Reference
size: Size of data to be read, in bytes.
esp_err_t esp_partition_write_raw(const esp_partition_t *partition, size_t dst_oset, const
void *src, size_t size)
Write data to the partition without any transformation/encryption.
Before writing data to flash, corresponding region of flash needs to be erased. This can be done using
esp_partition_erase_range function.
Note This function is essentially the same as esp_partition_write() above. It just never encrypts
data but writes it as is.
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 the
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_erase_range(const esp_partition_t *partition, size_t oset, size_t size)
Erase part of the partition.
Return ESP_OK, if the range was erased successfully; ESP_ERR_INVALID_ARG, if iterator or dst are
NULL; ESP_ERR_INVALID_SIZE, if erase 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.
offset: Offset from the beginning of partition where erase operation should start. Must be aligned
to 4 kilobytes.
size: Size of the range which should be erased, in bytes. Must be divisible by 4 kilobytes.
esp_err_t esp_partition_mmap(const esp_partition_t *partition, size_t oset, size_t size,
spi_flash_mmap_memory_t memory, const void **out_ptr,
spi_flash_mmap_handle_t *out_handle)
Configure MMU to map partition into data memory.
Unlike spi_flash_mmap function, which requires a 64kB aligned base address, this function doesnt impose
such a requirement. If offset results in a flash address which is not aligned to 64kB boundary, address will be
rounded to the lower 64kB boundary, so that mapped region includes requested range. Pointer returned via
out_ptr argument will be adjusted to point to the requested offset (not necessarily to the beginning of mmap-ed
region).
To release mapped memory, pass handle returned via out_handle argument to spi_flash_munmap function.
Return ESP_OK, if successful
Parameters
partition: Pointer to partition structure obtained using esp_partition_find_first or
esp_partition_get. Must be non-NULL.
offset: Offset from the beginning of partition where mapping should start.
size: Size of the area to be mapped.
memory: Memory space where the region should be mapped
out_ptr: Output, pointer to the mapped memory region
out_handle: Output, handle which should be used for spi_flash_munmap call
esp_err_t esp_partition_get_sha256(const esp_partition_t *partition, uint8_t *sha_256)
Get SHA-256 digest for required partition.
For apps with SHA-256 appended to the app image, the result is the appended SHA-256 value for the app
Espressif Systems 759
Submit Document Feedback
Release v4.4

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

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

Espressif ESP32-S2 Specifications

General IconGeneral
BrandEspressif
ModelESP32-S2
CategorySingle board computers
LanguageEnglish