EmbeddedRelated.com
Forums
Memfault Beyond the Launch

MISRA-C 2004 code checker

Started by djordj April 6, 2009
In message <743rmdF1253q3U1@mid.individual.net>, Not Really Me 
<scott@validatedQWERTYsoftware.XYZZY.com> writes
>Boudewijn Dijkstra wrote: >> Op Tue, 07 Apr 2009 16:26:04 +0200 schreef Not Really Me >> <scott@validatedqwertysoftware.xyzzy.com>: >>> Boudewijn Dijkstra wrote: >>>> Op Mon, 06 Apr 2009 23:47:50 +0200 schreef djordj >>>> <djordj@despammed.com>: >>>>> Hi, >>>>> I need a tool to check C code MISRA-C 2004 compliance: as I need it >>>>> for various embedded compiler (GNU-ARM, Freescale CodeWarrior and >>>>> AVRStudio), I thought about an external code checker (like PC-Lint >>>>> for example). >>>>> >>>>> What can I use? >>>> >>>> - LDRA TestBed >>>> >>>> - IAR Embedded Workbench >>> >>> Two excellent choices, but PC Lint is only a few hundred dollars. >> >> Only for the Windows version. > >Sorry, it's all I use. Can't believe I'm saying this, but I'm a bit of a >Windows snob. Just don't see the point of others. ... I know, someday I >should try a linix platform,
Why? I am not a fan of MS but XP works and all the tools I need run on it which they don't do natively on anything else.
>And to all the others that already posted, yes, I know Embedded Workbench is >a compiler not a static analyzer. It does do an acceptable job with MISRA
Maybe.
>though, certainly better than no solution.
But PC-lint is a hell of a lot better and costs little. If you are buying EWB then it is worth adding PC-lint at the same time.
>If you can afford LDRA, get it. If not, get PC Lint. If you think linting >your code is a waste of time, what are doing programming for a living? Get >a job you know something about.
A blast of sanity at last :-) -- \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ \/\/\/\/\ Chris Hills Staffs England /\/\/\/\/ \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
In message <op.ur15k7vry6p7a2@azrael.lan>, Boudewijn Dijkstra 
<boudewijn@indes.com> writes
>Op Tue, 07 Apr 2009 20:06:47 +0200 schreef Chris H <chris@phaedsys.org>: >> In message <op.ur0n8ea5y6p7a2@azrael.lan>, Boudewijn Dijkstra >><boudewijn@indes.com> writes >>> Op Mon, 06 Apr 2009 23:47:50 +0200 schreef djordj >>><djordj@despammed.com>: >>>> Hi, >>>> I need a tool to check C code MISRA-C 2004 compliance: as I need it >>>>for various embedded compiler (GNU-ARM, Freescale CodeWarrior and >>>>AVRStudio), I thought about an external code checker (like PC-Lint >>>>for example). >>>> >>>> What can I use? >>> >>> - LDRA TestBed >>> >>> - IAR Embedded Workbench >> >> I wouldn't use the IAR Workbench for this. It only checks for the >>MISRA -C rules whereas MISRA-C assumes that you are using a full >>static analyser that will pick up as many MISRA-C rules as possible. > >A full static analysis of a big codebase might not be something you are >willing to wait for, while IAR EW can quickly pick out a portion of the >mistakes beforehand.
I disagree and I think you are better off running PC_lint from within EWB and running it often. For serious or safety critical projects something a little stronger like QAC or LDRA is a good idea. The EWB MISRA-C checker on it's own is not a good idea. It is a tick box solution. -- \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ \/\/\/\/\ Chris Hills Staffs England /\/\/\/\/ \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
<SNIP>
  ... I know,
>> someday I should try a linix platform, > > Why? I am not a fan of MS but XP works and all the tools I need run on > it which they don't do natively on anything else. >
Just to make sure I'm not missing out on something. I'm not an MS fan, but like you, XP works. I haven't tried with anything new, like .net, but if you want a laugh, try linting a simple Visual C version 6 program with lib checking enabled. I made that mistake. The first line of my C file was over 17K lines into the output listing. I wonder if MS has discovered lint yet. Scott

Chris H wrote:

> More and more I keep hearing, "I can't afford free" > > You would say that wouldn't you :-) > Even if it is true.
My most recent direct quote is from PJ Plauger at last weeks WG14 meeting, he does not speak alone. There are a lot of good commercial tools out there. A lot of innovate products have commercial roots, software products that were developed to attract customers who see them worthwhile enough to pay money for them. That is a high bar. I know better than most that there are alternatives. 15 years after most C compilers could out optimize most hand written assembler based applications there is still the myth that you need assembler. Regards, -- Walter Banks Byte Craft Limited http://www.bytecraft.com

Chris H wrote:

> >Trade the cost and accompanying support against the diverted time > >and specialized knowledge needed for FOSS starts to make the > >choices clearer. > > What have you started? Get the asbestos coat. ....:-))))
Last few days have been mostly all nighters. When the balance between lack of sleep and caffeine gets out of whack one's inhibitors fail. Its a tradeoff, its always a tradeoff. Many commercial tools and accompanying support can be a very good investment. Coffee's ready.. Regards, -- Walter Banks Byte Craft Limited http://www.bytecraft.com
In article <MZwVQBCLtL3JFAHJ@phaedsys.demon.co.uk>, Chris H says...
> In message <op.ur15k7vry6p7a2@azrael.lan>, Boudewijn Dijkstra > <boudewijn@indes.com> writes > >A full static analysis of a big codebase might not be something you are > >willing to wait for, while IAR EW can quickly pick out a portion of the > >mistakes beforehand. > > I disagree and I think you are better off running PC_lint from within > EWB and running it often.
I agree, Lint first compile only when the source passes lint. It doesn't take appreciably longer (if at all) to lint then it does to compile in my experience so you don't save a lot of time by avoiding the step. Actually I expect you save time when you consider the avoided problems. Robert
Op Wed, 08 Apr 2009 17:41:23 +0200 schreef Not Really Me  
<scott@validatedqwertysoftware.xyzzy.com>:
> <SNIP> > ... I know, >>> someday I should try a linix platform, >> >> Why? I am not a fan of MS but XP works and all the tools I need run on >> it which they don't do natively on anything else. > > Just to make sure I'm not missing out on something. I'm not an MS fan, > but like you, XP works. > > I haven't tried with anything new, like .net, but if you want a laugh, > try linting a simple Visual C version 6 program with lib checking > enabled. I > made that mistake. The first line of my C file was over 17K lines into > the output listing. I wonder if MS has discovered lint yet.
Lint checks against ANSI/ISO C/C++ and Good(TM) programming practice, not Microsoft(R) C/C++ and Microsoft(R) programming practice. -- Gemaakt met Opera's revolutionaire e-mailprogramma: http://www.opera.com/mail/
In message <MPG.24471f8b2e4aaf8e98993b@free.teranews.com>, Robert Adsett 
<sub2@aeolusdevelopment.com> writes
>In article <MZwVQBCLtL3JFAHJ@phaedsys.demon.co.uk>, Chris H says... >> In message <op.ur15k7vry6p7a2@azrael.lan>, Boudewijn Dijkstra >> <boudewijn@indes.com> writes >> >A full static analysis of a big codebase might not be something you are >> >willing to wait for, while IAR EW can quickly pick out a portion of the >> >mistakes beforehand. >> >> I disagree and I think you are better off running PC_lint from within >> EWB and running it often. > >I agree, Lint first compile only when the source passes lint. It doesn't >take appreciably longer (if at all) to lint then it does to compile in >my experience so you don't save a lot of time by avoiding the step. >Actually I expect you save time when you consider the avoided problems. > >Robert
There is a lot of evidence to support that. -- \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ \/\/\/\/\ Chris Hills Staffs England /\/\/\/\/ \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
Boudewijn Dijkstra wrote:
> Op Wed, 08 Apr 2009 17:41:23 +0200 schreef Not Really Me > <scott@validatedqwertysoftware.xyzzy.com>: >> <SNIP> >> ... I know, >>>> someday I should try a linix platform, >>> >>> Why? I am not a fan of MS but XP works and all the tools I need run >>> on it which they don't do natively on anything else. >> >> Just to make sure I'm not missing out on something. I'm not an MS >> fan, but like you, XP works. >> >> I haven't tried with anything new, like .net, but if you want a >> laugh, try linting a simple Visual C version 6 program with lib >> checking enabled. I >> made that mistake. The first line of my C file was over 17K lines >> into the output listing. I wonder if MS has discovered lint yet. > > Lint checks against ANSI/ISO C/C++ and Good(TM) programming practice, > not Microsoft(R) C/C++ and Microsoft(R) programming practice.
:-)
Jujitsu Lizard wrote:
> "djordj" <djordj@despammed.com> wrote in message > news:aMuCl.297223$FR.598370@twister1.libero.it... >> Hi, >> I need a tool to check C code MISRA-C 2004 compliance: as I need it >> for various embedded compiler (GNU-ARM, Freescale CodeWarrior and >> AVRStudio), I thought about an external code checker (like PC-Lint >> for example). What can I use? >> Thank you > > QAC.
Seconded!

Memfault Beyond the Launch