import { IStub } from './ESPLoader' ; import ESP32ROM from './ESP32ROM' ; export default class ESP32S2ROM extends ESP32ROM { static CHIP_DETECT_MAGIC_VALUE = [ 0x000007c6 ] ; CHIP_NAME = 'ESP32-S2' ; EFUSE_BASE = 0x3f41A000 ; EFUSE_BLK0 = this . EFUSE_BASE + 0x030 ; EFUSE_BLK1 = this . EFUSE_BASE + 0x044 ; STUB_CLASS = ESP32S2StubLoader ; async load_stub ( ) { return await import ( './stubs/stub_flasher_32s2.elf' ) ; } async get_pkg_version ( ) { const word3 = await this . read_efuse ( this . EFUSE_BLK1 , 3 ) ; return ( word3 >> 21 ) & 0x0F ; } async get_chip_description ( ) { return { 0 : 'ESP32-S2' , 1 : 'ESP32-S2FH16' , 2 : 'ESP32-S2FH32' , } [ await this . get_pkg_version ( ) ] || 'unknown ESP32-S2' ; } } class ESP32S2StubLoader extends ESP32S2ROM { FLASH_WRITE_SIZE = 0x4000 ; STATUS_BYTES_LENGTH = 2 ; IS_STUB = true ; }