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 #755 background imageLoading...
Page #755 background image
Chapter 2. API Reference
Note: Application code should mostly use these esp_partition_* API functions instead of lower level
esp_flash_* API functions. Partition table API functions do bounds checking and calculate correct offsets in
flash, based on data stored in a partition table.
SPI Flash Encryption
It is possible to encrypt the contents of SPI flash and have it transparently decrypted by hardware.
Refer to the Flash Encryption documentation for more details.
Memory mapping API
ESP32-S2 features memory hardware which allows regions of flash memory to be mapped into instruction and data
address spaces. This mapping works only for read operations. It is not possible to modify contents of flash memory
by writing to a mapped memory region.
Mapping happens in 64 KB pages. Memory mapping hardware can map flash into the data address space and the
instruction address space. See the technical reference manual for more details and limitations about memory mapping
hardware.
Note that some pages are used to map the application itself into memory, so the actual number of available pages
may be less than the capability of the hardware.
Reading data from flash using a memory mapped region is the only way to decrypt contents of flash when flash
encryption is enabled. Decryption is performed at the hardware level.
Memory mapping API are declared in esp_spi_flash.h and esp_partition.h:
• spi_flash_mmap() maps a region of physical flash addresses into instruction space or data space of the
CPU.
• spi_flash_munmap() unmaps previously mapped region.
• esp_partition_mmap() maps part of a partition into the instruction space or data space of the CPU.
Differences between spi_flash_mmap() and esp_partition_mmap() are as follows:
• spi_flash_mmap() must be given a 64 KB aligned physical address.
• esp_partition_mmap() may be given any arbitrary offset within the partition, it will adjust the returned
pointer to mapped memory as necessary.
Note that since memory mapping happens in pages, it may be possible to read data outside of the partition provided
to esp_partition_mmap, regardless of the partition boundary.
Note: mmap is supported by cache, so it can only be used on main flash.
SPI Flash Implementation
The esp_flash_t structure holds chip data as well as three important parts of this API:
1. The host driver, which provides the hardware support to access the chip;
2. The chip driver, which provides compatibility service to different chips;
3. The OS functions, provides support of some OS functions (e.g. lock, delay) in different stages (1st/2st boot, or
the app).
Espressif Systems 744
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