![]() |
TLE986x Device Family SDK
|
The SDK has been checked for MISRA 2012 compliancy, here further details are listed.
For checking the MISRA 2012 compliancy the tool PC-LINT V9.00L from Gimpel Software is used.
The following rules have been disabled:
-e19 //Suppressing MISRA 2012 Error 19: Useless Declaration
This rule is violated by the definition of the function pointers to the bootrom functions.
-e46 //Error 46: field type should be _Bool, unsigned int or signed int [MISRA 2012 Rule 6.1, required]
The device header file tle986x.h is autogenerated by the ARM tool SVDConv.exe. The definition of the bitfields seems not to be MISRA compliant.
Since the header file is generated by the ARM tool, the MISRA rule is disabled.
-e438 //Warning 438: Last value assigned to variable '...' (defined at line n) not used [MISRA 2012 Rule 2.2, required]
SCU_EnterSleepMode() and SCU_EnterStopMode() require the clearing of the wakeup reagisters. The wakeup registers are cleared by a read. The content of the registers is not of interest in this case.
-e451 //Warning 451: Header file 'core_cm3.h' repeatedly included but does not have a standard include guard [MISRA 2012 Directive 4.10, required]
The device header file tle986x.h includes core_cm3.h, MISRA complains about repetitive includes. The file core_cm3.h is distributed by ARM in the CMSIS pack and is not in scope of this PACK file.
-e506 //Warning 506: Constant value Boolean [MISRA Rule 52], [MISRA Rule 85]
Inside the SDK many Config Wizard inputs (macros) are used in preprocessor statements, for the MISRA checker these statement evaluations does not always make sense, as the checker assumes #defines to be constants.
But all these Config Wizard macros can be changed by the Config Wizard and therefore are not constant, so this MISRA rule is disabled.
-e537 //Warning 537: Repeated include file '...'
The include of header files in the source modules have been reduced to a minimum, still MISRA complains about some repeated includes.
-e621 //Warning 621: Identifier clash (symbol '...' with symbol '...' at line n) [MISRA 2012 Rule 5.1, required], [MISRA 2012 Rule 5.2, required], [MISRA 2012 Rule 5.4, required], [MISRA 2012 Rule 5.5, required]
This is caused by macro names which are very similar to others like in the autogenerated tle986x.h header file which holds position and mask macros for every bit in the hardware.
Certain macro names to access peripherie registers fall under the same category.
-e923 //Note 923: cast from pointer to unsigned int [MISRA 2012 Rule 11.1, required], [MISRA 2012 Rule 11.4, advisory], [MISRA 2012 Rule 11.6, required]
All SFR (special function register) accesses listed in the tle986x.h file are violating this rule.
-e929 //Note 929: cast from pointer to pointer [MISRA 2012 Rule 11.3, required], [MISRA 2012 Rule 11.5, advisory]
This rule is only violated in the function GetCustomerID(). Here the data read from the 100TP page is directly stored in the CustID struct.
-e950 //Note 950: Non-ANSI reserved word or construct: '_to_brackets' [MISRA 2012 Directive 2.1, required], [MISRA 2012 Rule 1.1, required], [MISRA 2012 Rule 1.2, advisory]
The NAC/NAD value as well as the the control structures for the DMA needs to be placed in memory to dedicated locations.
The attribute((at(...),used)) term is not understood by MISRA.
-e9029 //Mismatched essential type categories for binary operator [MISRA 2012 Rule 10.4, required]
Config Wizard 1 and Config Wizard 2 defines the output macros slightly differently, here is an example:
Config Wizard 1:
Config Wizard 2:
The evaluation of the macros inside the code violates this MISRA rule in the Config Wizard 2 way.
-e9018 //Note 9018: declaration of symbol '...' with union based type '...' [MISRA 2012 Rule 19.2, advisory]
Some data structs are stored in unions, TCustomerID and TADC1_ANON_U, these unions violate this rule.
-e9032 //Note 9032: Composite expression with smaller essential type than other operand [MISRA 2012 Rule 10.7, required]
Certain preprocessor statments in the isr.c for the CCU6 violate this rule, as CPU_NVIC_ISER0 and CCU6_INP are inputs from the Config Wizard but seen as constant for MISRA.
-e9050 //Note 9050: dependence placed on C/C++ operator precedence; operators '+' and '*' [MISRA 2012 Rule 12.1, advisory]
ARMCC v6 compatibility required some updates to the DMA module which led to a violation of this rule
-e9053 //Note 9053: the shift value is at least the precision of the essential type of the left hand side [MISRA 2012 Rule 12.2, required]
The dma.c and isr.c are using preprocessor statements, for better readability, which shifts a '1' to a specific bit position. If this shift exceeds eight bit then this rule is violated.
-e9058 //Note 9058: tag '...' (line ?, file ..., module ...) unused outside of typedefs [MISRA 2012 Rule 2.4, advisory]
There are certain types in dma.h and types.h defined which are not used.
-e9059 //Note 9059: C comment contains C++ comment [MISRA 2012 Rule 3.1, required]
This rule is violated by doxygen blocks only, here for certain functions an code example is provided, any code documentation inside the code example is using c-style comments
-e755 //Info 755: global macro '...' (line n, file ...) not referenced [MISRA 2012 Rule 2.5, advisory]
Various macros are defined, but not used, in future or under certain application circumstances they might be used. Therefore this rule is deactivated.
-e756 //Info 756: global typedef '...' (line n, file ...) not referenced [MISRA 2012 Rule 2.3, advisory]
Various types are defined, but not used, in future or under certain application circumstances they might be used. Therefore this rule is deactivated.
-e765 //Info 765: external '...' (line n, file ...) could be made static [MISRA 2012 Rule 8.7, advisory]
The SDK provides functions for various applications, but not all functions are needed for each application. If a function is declared as static then the linker complains as the functions is never referenced.
-e793 //Info 793: ANSI/ISO limit of 6 'significant characters in an external identifier, identifier names too long
Autogenerated macros in tle986x.h exceeds the maximum number of macros for MISRA which is 4095.
Further the length of the macros in tle986x.h exceeds the maximum length of a macro in some cases.
-e835 //Info 835: A zero has been given as right argument to operator
Inside the SDK many Config Wizard inputs (macros) are used in preprocessor statements, for the MISRA checker these statement evaluations does not always make sense, as '#define' might even become '0' and therefore certain statements do not make sense to MISRA.
Example:
-e845 //Info 845: The right argument to operator '+' is certain to be 0 [Reference: file ...]
ARMCC v6 compatibility required some updates to the DMA module which led to a violation of this rule
-e849 //Info 849: Symbol '...' has same enumerator value 'x' as enumerator '...' [MISRA 2012 Rule 8.12, required]
Inside the hardware various features (bitfields) do have a double meaning, in order to map this to the software, double defines inside strucs are required.
-e718 //Info 718: Symbol '...' undeclared, assumed to return int [MISRA Rule 20], [MISRA Rule 71]
In order to call ARM CMSIS compiler intrinsics this rule has to be disabled.
-e746 //Info 746: call to function '...' not made in the presence of a prototype [MISRA Rule 71]
In order to call ARM CMSIS compiler intrinsics this rule has to be disabled.
-e762 //Info 762: Redundantly declared symbol '...' previously declared at line xx [MISRA Rule 27]
This violation is not really a violation by the SDK code, but comes due to the simplified declaration of always the same interrupt callback "place_your_function_call_back_here(void)" for all interrupt service routines for the sake of the MISRA check.
Same applies to the redifinition of a variable "ui16" for MISRA checking the DMA functions.