Opened 8 months ago

Closed 8 months ago

Last modified 6 weeks ago

#20 closed enhancement (fixed)

Check MISRA C:2012 rules

Reported by: dsl Owned by: dsl
Priority: major Milestone: MCUSim-0.2
Component: avr Keywords: planned-in-0.2.0
Cc:

Description

There isn't any external requirement for MCUSim code to be compliant with the MISRA C:2012 rules, obviously. However, it's generally a good idea to apply additional checks to the simulator in order to mitigate any problems or mistakes.

I was able to find only one open source static code analyzer which supports MISRA C:2012 at least partially. It's cppcheck since version 1.83:

https://sourceforge.net/p/cppcheck/news/2018/04/cppcheck-183/
http://cppcheck.net/misra.php
http://cppcheck.net/manual.html#idm415

I'd want to modify MCUSim build configuration to let everyone run the analyzer against all of the files with source code and get a report (using, say, make misra). Only numbers of the rules will be printed. Everyone who's interested in a full description will have to buy a PDF from MISRA, convert it into a text and store in misra/MISRA_C_2012.txt to let the build configuration print detailed information about violated rule.

Attachments (2)

0001-patch-0.1.78-Check-MISRA-C-2012-rules-against-the-si.patch (120.2 KB) - added by dsl 8 months ago.
misra-report-0.1.83.txt (184.8 KB) - added by dsl 8 months ago.

Download all attachments as: .zip

Change History (12)

comment:1 Changed 8 months ago by dsl

Milestone: 0.2.0Work in Progress

comment:2 Changed 8 months ago by dsl

Status: assignedaccepted

comment:3 Changed 8 months ago by dsl

I'll be keeping this issue open until all of the MISRA violations to be worked out. I'd also want to update README.md and wiki to give user an idea how MISRA rules can be checked.

comment:4 Changed 8 months ago by dsl

There are patches between 0.1.79 and 0.1.83 which were intended to fix some MISRA C violations. Report for 0.1.83 is attached to the issue. There is still a plenty of them, but all of the sim*.c files with code for specific microcontollers were fixed. I consider this issue ready from now on and will be improving code during the upcoming patches.

Changed 8 months ago by dsl

Attachment: misra-report-0.1.83.txt added

comment:5 Changed 8 months ago by dsl

Milestone: Work in Progress0.2.0
Resolution: fixed
Status: acceptedclosed

comment:6 Changed 5 months ago by dsl

Milestone: 0.2.00.2

Milestone renamed

comment:7 Changed 5 months ago by dsl

Milestone: 0.2MCUSim-0.2

Milestone renamed

comment:8 Changed 3 months ago by dsl

Milestone: MCUSim-0.2MCUSim 0.2

Milestone renamed

comment:9 Changed 3 months ago by dsl

Milestone: MCUSim 0.2mcusim 0.2

Milestone renamed

comment:10 Changed 6 weeks ago by dsl

Milestone: mcusim 0.2MCUSim-0.2

Milestone renamed

Note: See TracTickets for help on using tickets.