11.07.2015 Views

Imagecraft c compiler and development environment for the atmel avr

Imagecraft c compiler and development environment for the atmel avr

Imagecraft c compiler and development environment for the atmel avr

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

TOOL REFERENCESMISRA / Lint Code CheckingMISRA C is a coding st<strong>and</strong>ard <strong>for</strong> <strong>the</strong> C programming language developed by MISRA(Motor Industry Software Reliability Association, http://www.misra.org.uk). Initiallyaimed to improve a program’s safety <strong>and</strong> portability in <strong>the</strong> automotive industry, with<strong>the</strong> ever-rising popularity of embedded devices, MISRA C guidelines are now beingadopted by many organizations in <strong>the</strong> embedded space outside of <strong>the</strong> auto industry.(Think MISRA C as a superset of Lint, if you are familiar with that tool.)We are currently only implementing a subset of <strong>the</strong> guidelines; more will be added insubsequent releases. More importantly, while a goal of MISRA C is to increaseportability, we have identified a number of MISRA C guidelines that are never going tobe an issue in any 2’s-complement machine, <strong>and</strong> ra<strong>the</strong>r than overloading <strong>the</strong> user wi<strong>the</strong>ven more warning messages, some of those guidelines will not be implemented. Thisdecision fits into our philosophy of increased usability while not being so pedantic thatit goes against being pragmatic.There are also checks that are difficult to implement from a technological st<strong>and</strong>point;mainly ones that involve whole-program behavior checking or dynamic checks. Wewill consider those as resources permit.It is typical to encounter hundreds <strong>and</strong> sometimes even thous<strong>and</strong>s of MISRA Cwarnings when you first run your project through it. However, sometimes <strong>the</strong> pain ofsloughing through <strong>the</strong> messages is worthwhile, as one of our users writes:"Thanks to <strong>the</strong>se MISRA warnings, I found a bug that hasbeen going through unnoticed <strong>for</strong> a few years”MISRA checking is available in <strong>the</strong> ADVANCED <strong>and</strong> PROFESSIONAL versions of ourtools, although <strong>the</strong>re are a few warnings that possibly reflect errors so <strong>the</strong>y areenabled all <strong>the</strong> time. Under <strong>the</strong> Code::Blocks IDE, invoke Project->BuildOptions->Compiler->Enable MISRA Checks to enable this option. Thiscorresponds to <strong>the</strong> -MISRA_CHECK <strong>compiler</strong> flag.MISRA Usage RecommendationWe recommend that you enable <strong>the</strong> MISRA checks occasionally to weed out anyobvious errors in your code. There are some MISRA rules that may or may not makesense <strong>for</strong> you or your organization; <strong>for</strong> example, use of break <strong>and</strong> continuestatements are discouraged. If you need to, you can disable individual MISRA checkwarning by putting <strong>the</strong> warning numbers in <strong>the</strong> file

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!