esp — ESP32-related functions

This esp module contains specific functions related to the ESP32 module.

Functions

esp.flash_size()

Return the size of the flash.

esp.flash_user_start()

Read the memory offset where the user flash space starts.

esp.flash_read(byte_offset, length_or_buffer)

Read buf.len() bytes of data from the flash starting at address byte_offset and place them into buf.

  • byte_offset: the flash offset address

  • buf: the receive data buffer; the buffer length is len

import esp

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

Write all the data in buf to the flash region at address byte_offset.

  • byte_offset: the flash offset address

  • buf: the data buffer; the buffer length is len

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

Erase a flash sector.

  • ector_no: the sector to erase

esp.flash_erase(512)
esp.osdebug()