Store error flags in error memory if they cause a panic event.

This commit is contained in:
Mario Hüttel 2021-01-02 02:37:59 +01:00
parent 7c6205d20a
commit bea8e2df74

View File

@ -43,7 +43,7 @@
#include <stm-periph/rcc-manager.h> #include <stm-periph/rcc-manager.h>
#define check_flag_persistent(flag) ((flag)->persistency && (flag)->persistency->persistency) #define check_flag_persistent(flag) ((flag)->persistency && (flag)->persistency->persistency)
#define get_flag_weight(flag) ((flag)->weight ? (flag->weight->weight) : SAFETY_FLAG_CONFIG_WEIGHT_NONE) #define get_flag_weight(flag) ((flag)->weight ? ((flag)->weight->weight) : SAFETY_FLAG_CONFIG_WEIGHT_NONE)
struct safety_weight { struct safety_weight {
uint32_t start_dummy; uint32_t start_dummy;
@ -388,7 +388,8 @@ static int report_error(enum safety_flag flag, uint32_t key, bool prevent_error_
flags[i].error_state_inv = !flags[i].error_state; flags[i].error_state_inv = !flags[i].error_state;
flags[i].key = key; flags[i].key = key;
if (check_flag_persistent(&flags[i]) && !old_state && !prevent_error_mem_enty) { if ((check_flag_persistent(&flags[i]) && !old_state && !prevent_error_mem_enty) ||
get_flag_weight(&flags[i]) == SAFETY_FLAG_CONFIG_WEIGHT_PANIC) {
err_mem_entry.counter = 1; err_mem_entry.counter = 1;
err_mem_entry.flag_num = flag_enum_to_flag_no(flags[i].flag); err_mem_entry.flag_num = flag_enum_to_flag_no(flags[i].flag);
err_mem_entry.type = SAFETY_MEMORY_ERR_ENTRY_FLAG; err_mem_entry.type = SAFETY_MEMORY_ERR_ENTRY_FLAG;