Issue #20: Add stack checking based on protection area between stack and heap

This commit is contained in:
2020-09-07 21:52:53 +02:00
parent 452abfdd5c
commit dd0ee47d86
3 changed files with 40 additions and 10 deletions

View File

@@ -347,6 +347,8 @@ void safety_controller_init()
/* This is usually done by the safety memory already. But, since this module also uses the CRC... */
crc_unit_init();
stack_check_init_corruption_detect_area();
init_safety_flag_weight_table_from_default();
if (found_memory_state == SAFETY_MEMORY_INIT_CORRUPTED)
@@ -374,6 +376,10 @@ static void safety_controller_check_stack()
free_stack = stack_check_get_free();
if (free_stack < SAFETY_MIN_STACK_FREE)
safety_controller_report_error(ERR_FLAG_STACK);
if (stack_check_corruption_detect_area()) {
safety_controller_report_error(ERR_FLAG_STACK);
}
}
static void safety_controller_handle_safety_adc()
@@ -430,7 +436,7 @@ static int safety_controller_handle_memory_checks(void)
enum safety_memory_state found_state;
int panic_request = 0;
if (systick_ticks_have_passed(ts, 1000)) {
if (systick_ticks_have_passed(ts, 250)) {
ts = systick_get_global_tick();
/* Check the safety memory */