We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7f7f304 commit 37cbaecCopy full SHA for 37cbaec
cores/esp32/Esp.cpp
@@ -305,13 +305,17 @@ const char * EspClass::getSdkVersion(void)
305
return esp_get_idf_version();
306
}
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
+
315
uint32_t EspClass::getFlashChipSize(void)
316
{
- esp_image_header_t fhdr;
- if(flashRead(ESP_FLASH_IMAGE_BASE, (uint32_t*)&fhdr, sizeof(esp_image_header_t)) && fhdr.magic != ESP_IMAGE_HEADER_MAGIC) {
- return 0;
- }
- return magicFlashChipSize(fhdr.spi_size);
317
+ uint32_t id = (ESP_getFlashChipId() >> 16) & 0xFF;
318
+ return 2 << (id - 1);
319
320
321
uint32_t EspClass::getFlashChipSpeed(void)
0 commit comments