esp — ESP32-specific Functions

The esp module contains functions specific to the ESP32 module.

Functions

esp.flash_size()

Returns the flash size.

esp.flash_user_start()

Returns the memory offset where the user flash space starts.

esp.flash_read(byte_offset, length_or_buffer)

Reads data of buf.len() length from the flash starting at address byte_offset and stores it in buf.

  • byte_offset: Flash offset address

  • buf: Receive data buffer, buffer length is len

import esp

buf = bytearray(100)
esp.flash_read(2097152, buf)
esp.flash_write(byte_offset, bytes)

Writes all data in buf to the flash area at address byte_offset.

  • byte_offset: Flash offset address

  • buf: Data buffer, buffer length is len

buf = bytearray(100)
esp.flash_write(2097152, buf)
esp.flash_erase(sector_no)

Erase a flash sector.

  • sector_no: The sector to erase

esp.flash_erase(512)
esp.osdebug()