Clear Filters
Clear Filters

Why is the limits.h header file included when there are fixed point data types in an AUTOSAR model?

13 views (last 30 days)
I have an AUTOSAR model that includes fixed point data types. When preprocessor directives for fixed point word size checks are enabled, in the generated file " modelName_private.h," I see the following line as part of the fixed point word size checks.
#include <limits.h>
In AUTOSAR, the data type definitions for the CRL are defined in "Mfx.h" header.
What is the difference between "limits.h" and "Mfx.h"? Why is the "limits.h" file included for AUTOSAR models with fixed point data types?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 20 Aug 2024
From section 5.1 of the AUTOSAR standard, the "header file Mfx.h provides all public function prototypes and types defined by the Mfx library specification."
The “limits.h” header file is unrelated to the CRL or AUTOSAR at all – it determines the limits (max and min values that can be represented) for variable types.
This header file is included when there are fixed point data types in the model and fixed-point word size checks are enabled. Please note that "limits.h" is not generated by MathWorks Coder products but rather is a C header file that determines the limits for different variable types. The limit for each type is the max and min values that can be represented by the type. 
The reason why we include this header file is to perform some checks on the target (e.g., because fixpoint slope/bias can cause overflow). These checks can be disabled with the setting

More Answers (0)

Categories

Find more on AUTOSAR Blockset in Help Center and File Exchange

Products


Release

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!