check MCU flash size at runtime fix #2648

This commit is contained in:
rusefillc 2021-05-07 17:04:54 -04:00
parent 4c7be3819f
commit f0a57fef63
1 changed files with 8 additions and 1 deletions

View File

@ -51,7 +51,14 @@ static void sayHello(void) {
int mcuRevision = DBGMCU->IDCODE & MCU_REVISION_MASK;
efiPrintf("rev=%x size=%d", mcuRevision, TM_ID_GetFlashSize());
#define MIN_FLASH_SIZE 1024
int flashSize = TM_ID_GetFlashSize();
if (flashSize < MIN_FLASH_SIZE) {
firmwareError(OBD_PCM_Processor_Fault, "rusEFI expected at least %dK of flash", MIN_FLASH_SIZE);
}
efiPrintf("rev=%x size=%d", mcuRevision, flashSize);
#endif