| 27 | |
| 28 | #define FATAL_ERROR_MSG "\nA fatal error happened. System halted.\n" |
| 29 | static void panic_(const char* format, VA_LIST va) |
| 30 | { |
| 31 | if ( format ) { |
| 32 | vprintf(format, va); |
| 33 | #ifdef DEBUG_ON_SERIAL_PORT |
| 34 | char buf[500]; |
| 35 | vsnprintf(buf, sizeof(buf)-1, format, va); |
| 36 | SerialPortWrite((UINT8*)buf, strlen(buf)); |
| 37 | #endif |
| 38 | } |
| 39 | printf(FATAL_ERROR_MSG); |
| 40 | #ifdef DEBUG_ON_SERIAL_PORT |
| 41 | SerialPortWrite((UINT8*)FATAL_ERROR_MSG, strlen(FATAL_ERROR_MSG)); |
| 42 | #endif |
| 43 | while (1) { // this will avoid warning : Function declared 'noreturn' should not return |
| 44 | CpuDeadLoop(); |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | void panic(const char* format, ...) |
| 49 | { |
no test coverage detected