Recognise some new flash size codes.
This at least recognises the 2MB-c1, 4MB-c1, 8MB, and 16MB flash size codes.
This commit is contained in:
parent
782eaabb97
commit
46559496c6
1 changed files with 15 additions and 8 deletions
|
@ -174,25 +174,32 @@ void IRAM sdk_user_start(void) {
|
||||||
}
|
}
|
||||||
switch (buf8[3] >> 4) {
|
switch (buf8[3] >> 4) {
|
||||||
case 0x0: // 4 Mbit (512 KByte)
|
case 0x0: // 4 Mbit (512 KByte)
|
||||||
flash_sectors = 128;
|
flash_size = 524288;
|
||||||
break;
|
break;
|
||||||
case 0x1: // 2 Mbit (256 Kbyte)
|
case 0x1: // 2 Mbit (256 Kbyte)
|
||||||
flash_sectors = 64;
|
flash_size = 262144;
|
||||||
break;
|
break;
|
||||||
case 0x2: // 8 Mbit (1 Mbyte)
|
case 0x2: // 8 Mbit (1 Mbyte)
|
||||||
flash_sectors = 256;
|
flash_size = 1048576;
|
||||||
break;
|
break;
|
||||||
case 0x3: // 16 Mbit (2 Mbyte)
|
case 0x3: // 16 Mbit (2 Mbyte)
|
||||||
flash_sectors = 512;
|
case 0x5: // 16 Mbit (2 Mbyte)
|
||||||
|
flash_size = 2097152;
|
||||||
break;
|
break;
|
||||||
case 0x4: // 32 Mbit (4 Mbyte)
|
case 0x4: // 32 Mbit (4 Mbyte)
|
||||||
flash_sectors = 1024;
|
case 0x6: // 32 Mbit (4 Mbyte)
|
||||||
|
flash_size = 4194304;
|
||||||
|
break;
|
||||||
|
case 0x8: // 64 Mbit (8 Mbyte)
|
||||||
|
flash_size = 8388608;
|
||||||
|
break;
|
||||||
|
case 0x9: // 128 Mbit (16 Mbyte)
|
||||||
|
flash_size = 16777216;
|
||||||
break;
|
break;
|
||||||
default: // Invalid -- Assume 4 Mbit (512 KByte)
|
default: // Invalid -- Assume 4 Mbit (512 KByte)
|
||||||
flash_sectors = 128;
|
flash_size = 524288;
|
||||||
}
|
}
|
||||||
//FIXME: we should probably calculate flash_sectors by starting with flash_size and dividing by sdk_flashchip.sector_size instead of vice-versa.
|
flash_sectors = flash_size / sdk_flashchip.sector_size;
|
||||||
flash_size = flash_sectors * 4096;
|
|
||||||
sdk_flashchip.chip_size = flash_size;
|
sdk_flashchip.chip_size = flash_size;
|
||||||
set_spi0_divisor(flash_speed_divisor);
|
set_spi0_divisor(flash_speed_divisor);
|
||||||
sdk_SPIRead(flash_size - 4096, buf32, BOOT_INFO_SIZE);
|
sdk_SPIRead(flash_size - 4096, buf32, BOOT_INFO_SIZE);
|
||||||
|
|
Loading…
Reference in a new issue