diff --git a/misra/check_misra_v1.86.sh b/misra/check_misra_v1.86.sh new file mode 100755 index 00000000..540c838f --- /dev/null +++ b/misra/check_misra_v1.86.sh @@ -0,0 +1,26 @@ +if [ -f ./results.txt ]; then + rm results.txt +fi + +cd speeduino/speeduino +#cppcheck --dump --inline-suppr --suppress=syntaxError:src/PID_v1/PID_v1.h --suppressions-list=../misra/suppressions.txt --include=./*.h -DCORE_AVR=1 -D__AVR_ATmega2560__ -U__STM32F1__ -USTM32F4 ./*.ino > /dev/null +cppcheck --dump --inline-suppr --suppress=syntaxError:src/PID_v1/PID_v1.h --suppressions-list=../misra/suppressions.txt --include=./*.h -DCORE_AVR=1 -D__AVR_ATmega2560__ -U__STM32F1__ -USTM32F4 -UCORE_STM32 -UCORE_TEENSY ./storage.ino > /dev/null +cd ../.. +mv speeduino/speeduino/*.dump ./ +rm ./utils.*.dump + +python cppcheck/addons/misra.py --rule-texts=speeduino/misra/misra_2012_text.txt *.dump 2> results.txt +#python cppcheck/addons/misra.py --rule-texts=speeduino/misra/misra_2012_text.txt board_avr2560.ino.dump 2> results.txt +#rm *.dump + +cat results.txt +# wc -l results.txt + +errors=`wc -l < results.txt | tr -d ' '` +echo $errors MISRA violations + +if [ $errors -gt 0 ]; then + exit 1 +else + exit 0 +fi diff --git a/misra/misra_2012_text.txt b/misra/misra_2012_text.txt index 1d49e1f3..fb58afd3 100644 --- a/misra/misra_2012_text.txt +++ b/misra/misra_2012_text.txt @@ -34,7 +34,7 @@ No text specified Rule 5.3 Mandatory - An identifier (variable) in an outer scope shall not be redfined within an inner scope Rule 5.4 -No text specified +Mandatory - Macro names must be unique Rule 5.5 No text specified Rule 5.6 @@ -116,9 +116,9 @@ No text specified Rule 11.3 No text specified Rule 11.4 -No text specified +Advisory - Object pointers should not be treated as or converted to integers Rule 11.5 -No text specified +Advisory - A void pointer should not be converted to an object pointer Rule 11.6 No text specified Rule 11.7 diff --git a/misra/suppressions.txt b/misra/suppressions.txt new file mode 100644 index 00000000..e78929fe --- /dev/null +++ b/misra/suppressions.txt @@ -0,0 +1,7 @@ +misra_12.1:board_avr2560.ino:7 +misra_14_4 +misra.5.2 +MISRA_16_4:misra-suppressions1-test.c +MISRA.16.6:misra-suppressions1-test.c +MISRA_4_1:misra-suppressions2-test.c +MISRA.19_2:misra-suppressions2-test.c \ No newline at end of file diff --git a/speeduino/comms.h b/speeduino/comms.h index aabee9ca..334e800b 100644 --- a/speeduino/comms.h +++ b/speeduino/comms.h @@ -43,12 +43,12 @@ const char pageTitles[] PROGMEM //This is being stored in the avr flash instead }; void command();//This is the heart of the Command Line Interpeter. All that needed to be done was to make it human readable. -void sendValues(uint16_t offset, uint16_t packetlength,byte cmd, byte portnum); -void receiveValue(int offset, byte newValue); +void sendValues(uint16_t, uint16_t,byte, byte); +void receiveValue(int, byte); void saveConfig(); -void sendPage(bool useChar); -void receiveCalibration(byte tableID); -void sendToothLog(bool useChar); +void sendPage(bool); +void receiveCalibration(byte); +void sendToothLog(bool); void testComm(); void commandButtons(); diff --git a/speeduino/table.h b/speeduino/table.h index 4a62dfd2..4b21ed32 100644 --- a/speeduino/table.h +++ b/speeduino/table.h @@ -31,7 +31,8 @@ struct table2D { byte cacheTime; //TRacks when the last cache value was set so it can expire after x seconds. A timeout is required to pickup when a tuning value is changed, otherwise the old cached value will continue to be returned as the X value isn't changing. }; -void table2D_setSize(struct table2D targetTable, byte newSize); +//void table2D_setSize(struct table2D targetTable, byte newSize); +void table2D_setSize(struct table2D, byte); struct table3D { @@ -49,7 +50,8 @@ struct table3D { byte lastYMax, lastYMin; }; -void table3D_setSize(struct table3D *targetTable, byte newSize); +//void table3D_setSize(struct table3D *targetTable, byte); +void table3D_setSize(table3D, byte); /* 3D Tables have an origin (0,0) in the top left hand corner. Vertical axis is expressed first.