Fix ESP32 32MB program flash size

This commit is contained in:
Theo Arends 2023-10-30 15:29:01 +01:00
parent 8540ee37fc
commit 444f4fcd62
1 changed files with 5 additions and 4 deletions

View File

@ -659,8 +659,7 @@ uint32_t ESP_getFlashChipMagicSize(void) {
return ESP_magicFlashChipSize(fhdr.spi_size); return ESP_magicFlashChipSize(fhdr.spi_size);
} }
uint32_t ESP_magicFlashChipSize(uint8_t byte) uint32_t ESP_magicFlashChipSize(uint8_t byte) {
{
switch(byte & 0x0F) { switch(byte & 0x0F) {
case 0x0: // 8 MBit (1MB) case 0x0: // 8 MBit (1MB)
return 1048576; return 1048576;
@ -672,8 +671,10 @@ uint32_t ESP_magicFlashChipSize(uint8_t byte)
return 8388608; return 8388608;
case 0x4: // 128 MBit (16MB) case 0x4: // 128 MBit (16MB)
return 16777216; return 16777216;
default: // fail? case 0x5: // 256 MBit (32MB)
return 0; return 33554432;
default: // fail so return (1KB)
return 1024;
} }
} }