Skip to content

Commit 63630dd

Browse files
committed
rm hard coded image id in 8266
1 parent 494c635 commit 63630dd

File tree

4 files changed

+4
-8
lines changed

4 files changed

+4
-8
lines changed

src/esploader.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -692,10 +692,7 @@ export class ESPLoader {
692692
try {
693693
this.info("Detecting chip type... ");
694694
const chipID = await this.getChipId();
695-
const filteredROMList = ROM_LIST.filter(
696-
(n) => n.CHIP_NAME !== "ESP8266" && n.CHIP_NAME !== "ESP32" && n.CHIP_NAME !== "ESP32-S2",
697-
);
698-
for (const cls of filteredROMList) {
695+
for (const cls of ROM_LIST) {
699696
if (chipID === cls.IMAGE_CHIP_ID) {
700697
this.chip = cls;
701698
break;

src/image/esp32.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ export class ESP32FirmwareImage extends BaseFirmwareImage {
301301
[this.hdDrv, this.wpDrv] = this.splitByte(hdConfig);
302302

303303
this.chipId = view.getUint8(4);
304-
if (this.chipId !== this.ROM_LOADER.IMAGE_CHIP_ID) {
304+
if (this.ROM_LOADER.IMAGE_CHIP_ID !== undefined && this.chipId !== this.ROM_LOADER.IMAGE_CHIP_ID) {
305305
console.warn(
306306
`Unexpected chip id in image. Expected ${this.ROM_LOADER.IMAGE_CHIP_ID} but value was ${this.chipId}. ` +
307307
"Is this image for a different chip model?",
@@ -330,7 +330,7 @@ export class ESP32FirmwareImage extends BaseFirmwareImage {
330330
view.setUint8(2, this.joinByte(this.dDrv, this.csDrv));
331331
view.setUint8(3, this.joinByte(this.hdDrv, this.wpDrv));
332332

333-
view.setUint8(4, this.ROM_LOADER.IMAGE_CHIP_ID);
333+
view.setUint8(4, this.ROM_LOADER.IMAGE_CHIP_ID ?? 0);
334334
view.setUint8(5, this.minRev);
335335
view.setUint16(6, this.minRevFull, true);
336336
view.setUint16(8, this.maxRevFull, true);

src/targets/esp8266.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ export class ESP8266ROM extends ROM {
5050
public SPI_USR2_OFFS = 0x24;
5151
public SPI_MOSI_DLEN_OFFS = 0; // not in esp8266
5252
public SPI_MISO_DLEN_OFFS = 0; // not in esp8266
53-
public IMAGE_CHIP_ID = 9999; // not in esp8266
5453
public SPI_W0_OFFS = 0x40;
5554

5655
public async readEfuse(loader: ESPLoader, offset: number): Promise<number> {

src/targets/rom.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ export abstract class ROM {
101101
// abstract EFUSE_RD_REG_BASE: number; //esp32
102102

103103
abstract FLASH_WRITE_SIZE: number;
104-
abstract IMAGE_CHIP_ID: number; // not in esp8266
104+
IMAGE_CHIP_ID?: number; // not in esp8266, optional for other chips
105105
abstract SPI_MOSI_DLEN_OFFS: number; // not in esp8266
106106
abstract SPI_MISO_DLEN_OFFS: number; // not in esp8266
107107
abstract SPI_REG_BASE: number;

0 commit comments

Comments
 (0)