conditional compilation around getBackupSram
This commit is contained in:
parent
cc4175f428
commit
e63b753b71
|
@ -355,6 +355,8 @@
|
||||||
#define RAM_UNUSED_SIZE 1
|
#define RAM_UNUSED_SIZE 1
|
||||||
#define CCM_UNUSED_SIZE 1
|
#define CCM_UNUSED_SIZE 1
|
||||||
|
|
||||||
|
#define EFI_BACKUP_SRAM FALSE
|
||||||
|
|
||||||
#define EFI_PRINT_ERRORS_AS_WARNINGS TRUE
|
#define EFI_PRINT_ERRORS_AS_WARNINGS TRUE
|
||||||
//#define EFI_PRINT_MESSAGES_TO_TERMINAL TRUE
|
//#define EFI_PRINT_MESSAGES_TO_TERMINAL TRUE
|
||||||
|
|
||||||
|
|
|
@ -336,6 +336,8 @@
|
||||||
#define RAM_UNUSED_SIZE 1
|
#define RAM_UNUSED_SIZE 1
|
||||||
#define CCM_UNUSED_SIZE 1
|
#define CCM_UNUSED_SIZE 1
|
||||||
|
|
||||||
|
#define EFI_BACKUP_SRAM FALSE
|
||||||
|
|
||||||
#define EFI_PRINT_ERRORS_AS_WARNINGS TRUE
|
#define EFI_PRINT_ERRORS_AS_WARNINGS TRUE
|
||||||
// #define EFI_PRINT_MESSAGES_TO_TERMINAL TRUE
|
// #define EFI_PRINT_MESSAGES_TO_TERMINAL TRUE
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,10 @@
|
||||||
#define EFI_ANTILAG_SYSTEM TRUE
|
#define EFI_ANTILAG_SYSTEM TRUE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef EFI_BACKUP_SRAM
|
||||||
|
#define EFI_BACKUP_SRAM TRUE
|
||||||
|
#endif
|
||||||
|
|
||||||
#define EFI_DYNO_VIEW TRUE
|
#define EFI_DYNO_VIEW TRUE
|
||||||
|
|
||||||
#ifndef EFI_CDM_INTEGRATION
|
#ifndef EFI_CDM_INTEGRATION
|
||||||
|
|
|
@ -25,6 +25,7 @@ const char* getCriticalErrorMessage(void) {
|
||||||
|
|
||||||
#if EFI_PROD_CODE
|
#if EFI_PROD_CODE
|
||||||
void checkLastBootError() {
|
void checkLastBootError() {
|
||||||
|
#if EFI_BACKUP_SRAM
|
||||||
auto sramState = getBackupSram();
|
auto sramState = getBackupSram();
|
||||||
|
|
||||||
switch (sramState->Cookie) {
|
switch (sramState->Cookie) {
|
||||||
|
@ -57,15 +58,18 @@ void checkLastBootError() {
|
||||||
|
|
||||||
efiPrintf("Power cycle count: %d", sramState->BootCount);
|
efiPrintf("Power cycle count: %d", sramState->BootCount);
|
||||||
sramState->BootCount++;
|
sramState->BootCount++;
|
||||||
|
#endif // EFI_BACKUP_SRAM
|
||||||
}
|
}
|
||||||
|
|
||||||
void logHardFault(uint32_t type, uintptr_t faultAddress, port_extctx* ctx, uint32_t csfr) {
|
void logHardFault(uint32_t type, uintptr_t faultAddress, port_extctx* ctx, uint32_t csfr) {
|
||||||
|
#if EFI_BACKUP_SRAM
|
||||||
auto sramState = getBackupSram();
|
auto sramState = getBackupSram();
|
||||||
sramState->Cookie = ErrorCookie::HardFault;
|
sramState->Cookie = ErrorCookie::HardFault;
|
||||||
sramState->FaultType = type;
|
sramState->FaultType = type;
|
||||||
sramState->FaultAddress = faultAddress;
|
sramState->FaultAddress = faultAddress;
|
||||||
sramState->Csfr = csfr;
|
sramState->Csfr = csfr;
|
||||||
memcpy(&sramState->FaultCtx, ctx, sizeof(port_extctx));
|
memcpy(&sramState->FaultCtx, ctx, sizeof(port_extctx));
|
||||||
|
#endif // EFI_BACKUP_SRAM
|
||||||
}
|
}
|
||||||
|
|
||||||
extern ioportid_t criticalErrorLedPort;
|
extern ioportid_t criticalErrorLedPort;
|
||||||
|
@ -258,11 +262,13 @@ void firmwareError(ObdCode code, const char *fmt, ...) {
|
||||||
strcpy((char*)(criticalErrorMessageBuffer) + errorMessageSize, versionBuffer);
|
strcpy((char*)(criticalErrorMessageBuffer) + errorMessageSize, versionBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if EFI_BACKUP_SRAM
|
||||||
auto sramState = getBackupSram();
|
auto sramState = getBackupSram();
|
||||||
if (sramState != nullptr) {
|
if (sramState != nullptr) {
|
||||||
strncpy(sramState->ErrorString, criticalErrorMessageBuffer, efi::size(sramState->ErrorString));
|
strncpy(sramState->ErrorString, criticalErrorMessageBuffer, efi::size(sramState->ErrorString));
|
||||||
sramState->Cookie = ErrorCookie::FirmwareError;
|
sramState->Cookie = ErrorCookie::FirmwareError;
|
||||||
}
|
}
|
||||||
|
#endif // EFI_BACKUP_SRAM
|
||||||
#else
|
#else
|
||||||
|
|
||||||
char errorBuffer[200];
|
char errorBuffer[200];
|
||||||
|
|
Loading…
Reference in New Issue