diff --git a/misra/check_misra.sh b/misra/check_misra.sh index 19ee894e..c04c54cb 100755 --- a/misra/check_misra.sh +++ b/misra/check_misra.sh @@ -4,12 +4,13 @@ fi for i in speeduino/speeduino/*.ino; do #cppcheck --xml --include=${i%.*}.h --include=speeduino/speeduino/globals.h $i > /dev/null - cppcheck --force --dump --suppress=syntaxError:speeduino/speeduino/src/PID_v1/PID_v1.h --include=${i%.*}.h --include=speeduino/speeduino/globals.h $i > /dev/null + #cppcheck --force --dump --suppress=syntaxError:speeduino/speeduino/src/PID_v1/PID_v1.h --include=${i%.*}.h --include=speeduino/speeduino/globals.h -DCORE_AVR=1 -USTM32F4 $i > /dev/null + cppcheck --dump --suppress=syntaxError:speeduino/speeduino/src/PID_v1/PID_v1.h --include=${i%.*}.h -DCORE_AVR=1 -D__AVR_ATmega2560__ $i > /dev/null done mv speeduino/speeduino/*.dump ./ rm ./utils.*.dump -python cppcheck/addons/misra.py *.dump 2> results.txt +python cppcheck/addons/misra.py --rule-texts=speeduino/misra/misra_2012_text.txt *.dump 2> results.txt rm *.dump cat results.txt diff --git a/misra/misra_2012_text.txt b/misra/misra_2012_text.txt new file mode 100644 index 00000000..17236edf --- /dev/null +++ b/misra/misra_2012_text.txt @@ -0,0 +1,285 @@ +Appendix A Summary of guidelines +Rule 1.1 +C Syntax violation +Rule 1.2 +txt rule 1.2 +Rule 1.3 +No text specified +Rule 2.1 +No text specified +Rule 2.2 +No text specified +Rule 2.3 +No text specified +Rule 2.4 +No text specified +Rule 2.5 +No text specified +Rule 2.6 +No text specified +Rule 2.7 +No text specified +Rule 3.1 +Mandatory - /* and // cannot used within a comment (ie No nested comments) +Rule 3.2 +No text specified +Rule 4.1 +No text specified +Rule 4.2 +No text specified +Rule 5.1 +No text specified +Rule 5.2 +No text specified +Rule 5.3 +No text specified +Rule 5.4 +No text specified +Rule 5.5 +No text specified +Rule 5.6 +No text specified +Rule 5.7 +No text specified +Rule 5.8 +No text specified +Rule 5.9 +No text specified +Rule 6.1 +No text specified +Rule 6.2 +No text specified +Rule 7.1 +No text specified +Rule 7.2 +No text specified +Rule 7.3 +No text specified +Rule 7.4 +No text specified +Rule 8.1 +No text specified +Rule 8.2 +No text specified +Rule 8.3 +No text specified +Rule 8.4 +No text specified +Rule 8.6 +No text specified +Rule 8.7 +No text specified +Rule 8.8 +No text specified +Rule 8.9 +No text specified +Rule 8.10 +No text specified +Rule 8.11 +No text specified +Rule 8.12 +No text specified +Rule 8.13 +No text specified +Rule 8.14 +No text specified +Rule 9.1 +No text specified +Rule 9.2 +No text specified +Rule 9.3 +No text specified +Rule 9.4 +No text specified +Rule 9.5 +No text specified +Rule 10.1 +No text specified +Rule 10.2 +No text specified +Rule 10.3 +No text specified +Rule 10.4 +No text specified +Rule 10.5 +No text specified +Rule 10.6 +No text Specified +Rule 10.7 +No text specified +Rule 10.8 +No text specified +Rule 11.1 +No text specified +Rule 11.2 +No text specified +Rule 11.3 +No text specified +Rule 11.4 +No text specified +Rule 11.5 +No text specified +Rule 11.6 +No text specified +Rule 11.7 +No text specified +Rule 11.8 +No text specified +Rule 11.9 +No text specified +Rule 12.1 +Advisory - Order of operations within an expression must be explicit. Multiple conditions in a logical operation should have brackets around them. +Rule 12.2 +No text specified +Rule 12.3 +Advisory - The comma operator is not permitted. +Rule 12.4 +No text specified +Rule 13.1 +No text specified +Rule 13.2 +No text specified +Rule 13.3 +No text specified +Rule 13.4 +Advisory - Assignment operation should not be used in an expression (Check for = when == should have been used) +Rule 13.5 +No text specified +Rule 13.6 +No text specified +Rule 14.1 +No text specified +Rule 14.2 +No text specified +Rule 14.3 +No text specified +Rule 14.4 +Mandatory - Non-Boolean type expression used in an if statement or the conditional iteration statement of a loop +Rule 15.1 +No text specified +Rule 15.2 +No text specified +Rule 15.3 +No text specified +Rule 15.4 +No text specified +Rule 15.5 +Advisory - A function should only have a single return point +Rule 15.6 +No text specified +Rule 15.7 +No text specified +Rule 16.1 +No text specified +Rule 16.2 +No text specified +Rule 16.3 +No text specified +Rule 16.4 +Mandatory - All switch statements must have a default case +Rule 16.5 +No text specified +Rule 16.6 +No text specified +Rule 16.7 +No text specified +Rule 17.1 +No text specified +Rule 17.2 +No text specified +Rule 17.3 +No text specified +Rule 17.4 +No text specified +Rule 17.5 +No text specified +Rule 17.6 +No text specified +Rule 17.7 +No text specified +Rule 17.8 +Advisory - An argument to a function should be treated as read-only +Rule 18.1 +No text specified +Rule 18.2 +No text specified +Rule 18.3 +No text specified +Rule 18.4 +No text specified +Rule 18.5 +No text specified +Rule 18.6 +No text specified +Rule 18.7 +No text specified +Rule 18.8 +No text specified +Rule 19.1 +No text specified +Rule 19.2 +No text specified +Rule 20.1 +No text specified +Rule 20.2 +No text specified +Rule 20.3 +No text specified +Rule 20.4 +No text specified +Rule 20.5 +Advisory - Use of #undef is not permitted +Rule 20.6 +No text specified +Rule 20.7 +No text specified +Rule 20.8 +No text specified +Rule 20.9 +No text specified +Rule 20.10 +No text specified +Rule 20.11 +No text specified +Rule 20.12 +No text specified +Rule 20.13 +No text specified +Rule 20.14 +No text specified +Rule 21.1 +No text specified +Rule 21.2 +No text specified +Rule 21.3 +No text specified +Rule 21.4 +No text specified +Rule 21.5 +No text specified +Rule 21.6 +No text specified +Rule 21.7 +No text specified +Rule 21.8 +No text specified +Rule 21.9 +No text specified +Rule 21.10 +No text specified +Rule 21.11 +No text specified +Rule 21.12 +No text specified +Rule 22.1 +No text specified +Rule 22.2 +No text specified +Rule 22.3 +No text specified +Rule 22.4 +No text specified +Rule 22.5 +No text specified +Rule 22.6 +No text specified \ No newline at end of file diff --git a/speeduino/decoders.h b/speeduino/decoders.h index a8625888..e0a737da 100644 --- a/speeduino/decoders.h +++ b/speeduino/decoders.h @@ -174,7 +174,7 @@ unsigned long triggerSecFilterTime; // The shortest time (in uS) that pulses wil unsigned int triggerSecFilterTime_duration; // The shortest valid time (in uS) pulse DURATION volatile uint16_t triggerToothAngle; //The number of crank degrees that elapse per tooth volatile bool triggerToothAngleIsCorrect = false; //Whether or not the triggerToothAngle variable is currently accurate. Some patterns have times when the triggerToothAngle variable cannot be accurately set. -bool secondDerivEnabled; //The use of the 2nd derivative calculation is limited to certain decoders. This is set to either true or false in each decoders setup routine +bool secondDerivEnabled = false; //The use of the 2nd derivative calculation is limited to certain decoders. This is set to either true or false in each decoders setup routine bool decoderIsSequential; //Whether or not the decoder supports sequential operation bool decoderIsLowRes = false; //Is set true, certain extra calculations are performed for better timing accuracy bool decoderHasFixedCrankingTiming = false; //Whether or not the decoder supports fixed cranking timing diff --git a/speeduino/decoders.ino b/speeduino/decoders.ino index be50ee71..c726ecb9 100644 --- a/speeduino/decoders.ino +++ b/speeduino/decoders.ino @@ -565,7 +565,7 @@ void triggerPri_BasicDistributor() if(configPage2.perToothIgn == true) { uint16_t crankAngle = ( (toothCurrentCount-1) * triggerToothAngle ) + configPage4.triggerAngle; - crankAngle = ignitionLimits(crankAngle); + crankAngle = ignitionLimits((crankAngle)); if(toothCurrentCount > (triggerActualTeeth/2) ) { checkPerToothTiming(crankAngle, (toothCurrentCount - (triggerActualTeeth/2))); } else { checkPerToothTiming(crankAngle, toothCurrentCount); } } @@ -621,10 +621,10 @@ void triggerSetEndTeeth_BasicDistributor() { int tempEndAngle = (ignition1EndAngle - configPage4.triggerAngle); - tempEndAngle = ignitionLimits(tempEndAngle); + tempEndAngle = ignitionLimits((tempEndAngle)); - if(tempEndAngle > 180 || tempEndAngle <= 0) + if( (tempEndAngle > 180) || (tempEndAngle <= 0) ) { ignition1EndTooth = 2; ignition2EndTooth = 1;