EmbeddedRelated.com
Forums

MISRA-C 2004 code checker

Started by djordj April 6, 2009
In message <PSMCl.297642$FR.599112@twister1.libero.it>, djordj 
<djordj@despammed.com> writes
>Sembra che Boudewijn Dijkstra abbia detto : >> Op Mon, 06 Apr 2009 23:47:50 +0200 schreef djordj <djordj@despammed.com>: >> - LDRA TestBed >I've seen it, but it's really expensive for my budget. >> >> - IAR Embedded Workbench >Uhm... looks like a compiler...
A good one but a compiler not a static analyser.
>I've been using Splint some times ago, but it doesn't cover MISRA... >it's a pity...
Apparently the splint project has not been worked on for a couple of years? -- \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ \/\/\/\/\ Chris Hills Staffs England /\/\/\/\/ \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/

Chris H wrote:

> In message <7415vhF11742rU1@mid.individual.net>, Not Really Me > <scott@validatedQWERTYsoftware.XYZZY.com> writes > >> Boudewijn Dijkstra wrote: >> >>> Op Mon, 06 Apr 2009 23:47:50 +0200 schreef djordj >>> <djordj@despammed.com>: >>> >>>> 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, > > > I disagree one is a (very good) compiler not a static analyser.
Isn't MISRA rules checker included in any modern embedded compiler? It seems like many commertial packages have it. BTW, some of the IAR Workbench compilers are very good (like AVR, for example), the others are junk (like 68HC12). Vladimir Vassilevsky DSP and Mixed Signal Design Consultant http://www.abvolt.com
Chris H wrote:
> In message <op.ur0tgqacy6p7a2@azrael.lan>, Boudewijn Dijkstra > <boudewijn@indes.com> writes >> 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. > > The OP mentioned PC-Lint. Also LDRA and the IAR tools are Windows based. > What does AVR Studio run on? >
AVR Studio runs on windows (or Linux with Wine). But the OP seems to be slightly confused there, since AVR Studio is a debugger, simulator, and IDE - not a compiler. It's likely he meant AVR Studio with avr-gcc as the compiler, since this is a common combination (and if he were using IAR or ImageCraft, he'd probably have mentioned them by name). avr-gcc is, like "GNU-ARM" (i.e., gcc for the ARM) and CodeWarrior, a cross-platform tool. But the assumption from PC Lint and AVR Studio is that he is running on Windows.
In message <NrOCl.28613$ZP4.8528@nlpi067.nbdc.sbc.com>, Vladimir 
Vassilevsky <antispam_bogus@hotmail.com> writes
> > >Chris H wrote: > >> In message <7415vhF11742rU1@mid.individual.net>, Not Really Me >><scott@validatedQWERTYsoftware.XYZZY.com> writes >> >>> Boudewijn Dijkstra wrote: >>> >>>> Op Mon, 06 Apr 2009 23:47:50 +0200 schreef djordj >>>> <djordj@despammed.com>: >>>> >>>>> 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, >> I disagree one is a (very good) compiler not a static analyser. > >Isn't MISRA rules checker included in any modern embedded compiler?
No.
>It seems like many commertial packages have it.
Not that many AFAIK -- \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ \/\/\/\/\ Chris Hills Staffs England /\/\/\/\/ \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
Op Tue, 07 Apr 2009 20:10:26 +0200 schreef Chris H <chris@phaedsys.org>:
> In message <op.ur0tgqacy6p7a2@azrael.lan>, Boudewijn Dijkstra > <boudewijn@indes.com> writes >> 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. >>> LDRA is over $10K and IAR around $4K, with huge increases in >>> capability though. >> >> I'm just throwing options to consider. And don't forget that every >> penny spent on a tool might be worth its weight in some more valuable >> metal, > > Such as?
YMMV. Too many variables to consider naming a metal. But IIRC, 10%-30% productivity increases are not uncommon for high-end tools. -- Gemaakt met Opera's revolutionaire e-mailprogramma: http://www.opera.com/mail/
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. -- Gemaakt met Opera's revolutionaire e-mailprogramma: http://www.opera.com/mail/

Boudewijn Dijkstra wrote:

> >>> Two excellent choices, but PC Lint is only a few hundred dollars. > >>> LDRA is over $10K and IAR around $4K, with huge increases in > >>> capability though. > >> > >> I'm just throwing options to consider. And don't forget that every > >> penny spent on a tool might be worth its weight in some more valuable > >> metal, > > > > Such as? > > YMMV. Too many variables to consider naming a metal. But IIRC, 10%-30% > productivity increases are not uncommon for high-end tools.
Tools cost is typically equal to a few man days loaded costs. If they save more than that much they are worth it. More and more I keep hearing, "I can't afford free" Trade the cost and accompanying support against the diverted time and specialized knowledge needed for FOSS starts to make the choices clearer. Regards, -- Walter Banks Byte Craft Limited http://www.bytecraft.com
Walter Banks wrote:
> > Boudewijn Dijkstra wrote: > >>>>> Two excellent choices, but PC Lint is only a few hundred dollars. >>>>> LDRA is over $10K and IAR around $4K, with huge increases in >>>>> capability though. >>>> I'm just throwing options to consider. And don't forget that every >>>> penny spent on a tool might be worth its weight in some more valuable >>>> metal, >>> Such as? >> YMMV. Too many variables to consider naming a metal. But IIRC, 10%-30% >> productivity increases are not uncommon for high-end tools. > > Tools cost is typically equal to a few man days loaded costs. If they > save more than that much they are worth it. More and more I keep > hearing, "I can't afford free" > > Trade the cost and accompanying support against the diverted time > and specialized knowledge needed for FOSS starts to make the > choices clearer. >
Of course, the same applies the other way - I've seen commercial development tools with worse support than equivalent FOSS tools, or that are poorer quality than the FOSS tools, or that require more "specialised knowledge". It all depends on the tools in question, and who is using them. For someone who is used to gcc, makefiles, and a nice text editor, the gui, IDE, and project management system of CodeWorrier or Green Hills is "specialised knowledge" that can take days to figure out properly. For someone who is used to installing their tools with "./configure && make && make install" or "apt-get install", it is a hard jump to wait a week for delivery of a CD and dongle, then spend another two weeks fighting with the supplier over dongle or licensing problems. I certainly have at least two targets for which I have a fully licensed top-range commercial development toolchain worth many thousands of dollars, yet I choose to use gcc for my development because it is more effective for my uses. The point is not that FOSS is better than commercial, or vice versa - but that the best tool for the job depends on the job and who is doing it. Sweeping generalisations one way or the other are almost certainly going to be wrong. The "cost" of picking a tool has to include the time it takes to get productive, and the "worth" of the tool has to include the time it saves during use - but that applies equally to commercial software as well as FOSS, and to the middle ground of commercially-supported open source software.
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, but it isn't today. BTW, (to other posters), please don't fill this thread with long explanations on the merits of the others. If you really feel the need to educate me, start a new thread on the endless pros & cons of Linix and Windows. I am actually interested. 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 though, certainly better than no solution. 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. -- Scott Validated Software Lafayette, CO
In message <49DC9C19.E1AD1760@bytecraft.com>, Walter Banks 
<walter@bytecraft.com> writes
> > >Boudewijn Dijkstra wrote: > >> >>> Two excellent choices, but PC Lint is only a few hundred dollars. >> >>> LDRA is over $10K and IAR around $4K, with huge increases in >> >>> capability though. >> >> >> >> I'm just throwing options to consider. And don't forget that every >> >> penny spent on a tool might be worth its weight in some more valuable >> >> metal, >> > >> > Such as? >> >> YMMV. Too many variables to consider naming a metal. But IIRC, 10%-30% >> productivity increases are not uncommon for high-end tools. > >Tools cost is typically equal to a few man days loaded costs. If they >save more than that much they are worth it. More and more I keep >hearing, "I can't afford free"
You would say that wouldn't you :-) Even if it is true.
>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. ....:-)))) -- \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ \/\/\/\/\ Chris Hills Staffs England /\/\/\/\/ \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/