File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -305,13 +305,17 @@ const char * EspClass::getSdkVersion(void)
305
305
return esp_get_idf_version ();
306
306
}
307
307
308
+ uint32_t ESP_getFlashChipId (void )
309
+ {
310
+ uint32_t id = g_rom_flashchip.device_id ;
311
+ id = ((id & 0xff ) << 16 ) | ((id >> 16 ) & 0xff ) | (id & 0xff00 );
312
+ return id;
313
+ }
314
+
308
315
uint32_t EspClass::getFlashChipSize (void )
309
316
{
310
- esp_image_header_t fhdr;
311
- if (flashRead (ESP_FLASH_IMAGE_BASE, (uint32_t *)&fhdr, sizeof (esp_image_header_t )) && fhdr.magic != ESP_IMAGE_HEADER_MAGIC) {
312
- return 0 ;
313
- }
314
- return magicFlashChipSize (fhdr.spi_size );
317
+ uint32_t id = (ESP_getFlashChipId () >> 16 ) & 0xFF ;
318
+ return 2 << (id - 1 );
315
319
}
316
320
317
321
uint32_t EspClass::getFlashChipSpeed (void )
You can’t perform that action at this time.
0 commit comments