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)
305305 return esp_get_idf_version ();
306306}
307307
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+
308315uint32_t EspClass::getFlashChipSize (void )
309316{
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 );
315319}
316320
317321uint32_t EspClass::getFlashChipSpeed (void )
You can’t perform that action at this time.
0 commit comments