AVR SD Safety Framework 1.0.0
Loading...
Searching...
No Matches
configuration_validator.c File Reference

Provides optional compile-time validation checks for all Framework configuration macros and constants. More...

#include <stddef.h>
#include <stdint.h>
#include <define_error_criticality.h>
#include <define_error_ids.h>
#include <define_error_inject_reset.h>
#include <define_tasks_configs.h>
#include <error_handler_config.h>
#include <midware_clock_manager.h>
#include <midware_error_manager.h>
#include <midware_memory_manager.h>
#include <midware_power_manager.h>
#include <midware_watchdog_manager.h>
#include <tasks_config.h>
#include <avr/interrupt.h>
#include <xc.h>

Macros

#define UINT24_MAX   0x00FFFFFFUL
 Defines max value for 24-bit registers used during validation.
#define INT_VECTOR_NUM_MAX   ((_VECTORS_SIZE / _VECTOR_SIZE) - 1U)
 Defines highest valid vector number used during validation.

Detailed Description

Provides optional compile-time validation checks for all Framework configuration macros and constants.

Version
1.0.0

This file can optionally be included during compilation to verify that configurations made are valid as an additional safety measure in addition to the input validation done in Middleware.

Note

This file uses compiler extensions that are not part of strict C99:

  • #warning is a preprocessor extension supported by GCC, Clang, and XC8, used here to emit compile-time diagnostics when a configuration value is outside its valid range.
  • static_assert is a C11 feature, and its use can be enabled here by defining ALLOW_STATIC_ASSERT or passing -DALLOW_STATIC_ASSERT to the compiler. It is required for checks whose bounds are enum values, since enum members are not visible to the C preprocessor and cannot be used in #if expressions.

Note

It is recommended to promote warnings to errors (-Werror) so that an invalid configuration prevents compilation entirely.