diff --git a/firmware/config/stm32f4ems/chconf.h b/firmware/config/stm32f4ems/chconf.h index d576d694c5..ee663f45c9 100644 --- a/firmware/config/stm32f4ems/chconf.h +++ b/firmware/config/stm32f4ems/chconf.h @@ -34,6 +34,10 @@ #define _CHIBIOS_RT_CONF_ #define _CHIBIOS_RT_CONF_VER_5_1_ +#if !defined(_FROM_ASM_) +#include "obd_error_codes.h" +#endif /* _FROM_ASM_ */ + /* * __process_stack_size__ and __process_stack_size__ defaults are each hard-coded as 0x400 in ChibiOS rules.mk files * rusEfi do not override these defaults. @@ -58,12 +62,12 @@ #define EFI_CLOCK_LOCKS FALSE #endif /* EFI_CLOCK_LOCKS */ - #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #ifndef __ASSEMBLER__ + void firmwareError(obd_code_e code, const char *fmt, ...); #if EFI_CLOCK_LOCKS void irqEnterHook(void); void irqExitHook(void); @@ -806,10 +810,11 @@ void chDbgPanic3(const char *msg, const char * file, int line); #endif -#define chDbgAssert(c, remark) do { \ +#define chDbgAssert(c, remark) do { \ if (CH_DBG_ENABLE_ASSERTS != FALSE) { \ if (!(c)) { \ /*lint -restore*/ \ + firmwareError(OBD_PCM_Processor_Fault, "chDbg %s", remark); \ chSysHalt(remark); \ } \ } \ diff --git a/firmware/controllers/algo/obd_error_codes.h b/firmware/controllers/algo/obd_error_codes.h index 02fd317814..95e26c4fc8 100644 --- a/firmware/controllers/algo/obd_error_codes.h +++ b/firmware/controllers/algo/obd_error_codes.h @@ -11,12 +11,16 @@ #ifndef OBD_ERROR_CODES_H_ #define OBD_ERROR_CODES_H_ +// this header should not depend on anything - actually chconf.h usually depends on this header + #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ -#include "rusefi_enums.h" +// for now I want most enums to be 32 bit integers. At some point maybe we will make the one-byte +// this is about offsets and sizes in TunerStudio +#define ENUM_32_BITS 2000000000 typedef enum { //P0001 Fuel Volume Regulator Control Circuit/Open diff --git a/firmware/controllers/algo/rusefi_enums.h b/firmware/controllers/algo/rusefi_enums.h index 447958f0fd..4120f85d7b 100644 --- a/firmware/controllers/algo/rusefi_enums.h +++ b/firmware/controllers/algo/rusefi_enums.h @@ -12,10 +12,7 @@ #define RUSEFI_ENUMS_H_ #include "efifeatures.h" - -// for now I want most enums to be 32 bit integers. At some point maybe we will make the one-byte -// this is about offsets and sizes in TunerStudio -#define ENUM_32_BITS 2000000000 +#include "obd_error_codes.h" #define HIP_NAME "HIP" #define TACH_NAME "tach"