SlideShare a Scribd company logo
1 of 37
© Programming Research
www.programmingresearch.com
An Introduction to MISRA C:2012
Paul Burden
Webinar will start shortly
© Programming Research
2
Welcome
• A warm welcome to all our visitors
• The Webinar will last for approx 50 minutes
• We will take 10 minutes of questions at the end
© Programming Research
3
GoToWebinar Attendee Interface
© Programming Research
4
Paul Burden
• Technical Consultant working for
PRQA
• Expert in coding standards
enforcement
• Product Manager for PRQA’s
leading static analysis tool QA·C
• Prominent member of the MISRA C
Working Group since its formation
more than 10 years ago.
© Programming Research
5
Agenda
1. An Introduction to MISRA C
2. The Changes in MISRA C:2012
3. Guideline Classification
4. MISRA C Compliance
© Programming Research
6
MISRA C
MISRA C:1998
• Derived from PRQA standards developed for Ford and Rover
• Developed in UK for automotive applications
MISRA C:2004
• Amended and extended
• Supplemented with an Exemplar suite
MISRA C:2012
• A committee of 10 representing many years of experience
• 4 years of effort
• Released 18th March 2013
• A further step forward …
© Programming Research
7
Coding standard adoption
VDC Research
White Paper* April 2011:
“Re-evaluation of Development and Testing Practices April 2011”
Available at:
www.programmingresearch.com/whitepapers
Data obtained from 600 respondents
in Embedded and Enterprise/IT
software and systems development.
0.0%
10.0%
20.0%
30.0%
40.0%
Coding Standard Adoption
by % of Respondents
© Programming Research
8
MISRA C
• Automotive
• Aerospace
• Defence
• Medical
• Nuclear power
• Railways
• Consumer electronics
• Process control
• etc.
MISRA C is now the most widely used coding
standard for the C language - worldwide
© Programming Research
9
Agenda
1. An Introduction to MISRA C
2. The Changes in MISRA C:2012
3. Guideline Classification
4. MISRA C Compliance
© Programming Research
10
The Changes in MISRA C:2012
MISRA C:2012 compared to MISRA C:2004
• It's bigger
– a few more rules (159 instead of 142 )
– and the content is better
• Many guidelines are unchanged
– they may be reworded and better specified
– guideline/rule numbering has changed
• Legacy code may not be compliant
– there are new requirements – not many
– but some restrictions have been removed
© Programming Research
11
C language support
ISO:C90
• Well supported by compilers and tools
• The dangers are well understood
• Limitations – e.g. absence of Boolean type
ISO:C99
• More features, e.g. _Bool and inline functions
• More dangers, e.g. additional undefined behaviour
• Most compilers do not support all features of C99
ISO:C11
• Still relatively new
• Very limited tool support
MISRA C:1998
MISRA C:2004
MISRA C:2012
MISRA C:2012
© Programming Research
12
Guideline specification
An expanded
explanation of the
requirement
Why the guideline
is necessary
More extensive
code examples
Headline text
clarification
Exceptions
© Programming Research
13
Terminology
MISRA terminology has changed
These terms were
loosely defined and
have been replaced
The new terms are fully
defined and used to
describe expressions
of any arithmetic type
MISRA C:2004 MISRA C:2012
underlying type essential type
complex expression composite expression
effectively Boolean essentially Boolean
© Programming Research
14
Agenda
1. An Introduction to MISRA C
2. The Changes in MISRA C:2012
3. Guideline Classification
4. MISRA C Compliance
© Programming Research
15
Guideline classification
Category
• Advisory
• Required
• Mandatory Decidability
• Decidable
• Undecidable
Language
• C90
• C99
• C90, C99
Guideline Type
• Directive
• Rule Analysis Scope
• Single Translation Unit
• System
© Programming Research
16
Rules and Directives
Rules
– Have well defined requirements
– Are statically enforceable (subject to certain limitations)
Directives
– May be loosely defined – allowing alternative interpretations
– May address "process" or "documentation" requirements
There are now 2 types of guideline:
© Programming Research
17
Rules and Directives - examples
Rules
Rule 8.5 An external object or function shall be declared once in
one and only one file
Rule 11.3 A cast shall not be performed between a pointer to object
type and a different pointer to object type
Dir 3.1 All code shall be traceable to documented requirements
Dir 4.3 Assembly language shall be encapsulated and isolated
Directives
© Programming Research
18
Guideline categories
• Advisory guidelines
– These are recommendations
– Non-compliance is permitted at the user's discretion
– Non-compliance should be documented
– Formal deviations are not required
• Required guidelines
– Non-compliance must be supported by a formal "deviation"
• Mandatory guidelines
– Must always be obeyed
– Compliance is always required
Mandatory guidelines
were not a feature of
previous versions of
MISRA C
There are now 3 guideline categories:
© Programming Research
19
Rule decidability
A rule is decidable if it is always possible, in any program,
for a tool to determine whether code is compliant. Otherwise
the rule is undecidable
Rules are either "decidable" or "undecidable"
Rule 12.4 Evaluation of constant expressions should not lead to
unsigned integer wrap-around
Decidable …
Undecidable …
Rule 13.5 The right hand operand of a logical && or || operator shall not
contain persistent side effects
© Programming Research
20
Analysis scope
There are 2 types of "analysis scope"
Single Translation Unit Rules
System Rules
Rule 8.2 Function types shall be in prototype form with named parameters
Rule 16.4 Every switch statement shall have a default label
Rule 8.7 Functions and objects should not be defined with external
linkage if they are referenced in only one translation unit
Rule 13.5 The right hand operand of a logical && or || operator shall not
contain persistent side efects
© Programming Research
21
Guideline Classification Summary
CLASSIFICATION SUMMARY
DIRECTIVES
(16)
RULES
(143)
CATEGORY Advisory 7 32
Required 9 101
Mandatory 0 10
LANGUAGE C90 0 2
C99 0 11
C90 or C99 16 130
DECIDABILITY Decidable - 117
Undecidable - 26
ANALYSIS SCOPE Single Translation Unit - 104
System - 39
Some rules are now classified
as "mandatory"
Some rules are only relevant
for a specific language version
Some rules cannot be statically
enforced with certainty
Rules that can be enforced
within a single translation unit
are decidable
© Programming Research
22
Agenda
1. An Introduction to MISRA C
2. The Changes in MISRA C:2012
3. Guideline Classification
4. MISRA C Compliance
© Programming Research
23
MISRA C Compliance
• Enforceability
• Decidability
• Deviations
What do we mean by "MISRA Compliant Code" ?
© Programming Research
24
Enforceability
143
16
"The vision for the third edition of MISRA C is therefore to:
…
Increase the number of guidelines that can be processed by static analysis tools"
…
MISRA C:2012 Chapter 1 – The Vision
Rules - can be
automatically
enforced
Directives – tools can
sometimes assist with
enforcement
© Programming Research
25
Enforceability
Independent Research performed by
TERA-Labs, a new research division of
the Karel de Grote university college in
Antwerp, Belgium.
• Test code was written for 11 key rules
in MISRA C:2004 - selected by a panel
of industrial partners
• The test code was analysed using a
number of analysis tools claiming to
enforce compliancy with MISRA C
• Two tool attributes were examined
– Effectiveness in identifying rule violations
– Incidence of false positive messages
No False
Positives
Many False
Positives
All
violations
reported
No
violations
reported
GOOD
BAD
"The ability to detect the maximum number of violations possible, while minimizing the number of
false positive messages, is therefore an important factor in choosing a tool."
MISRA C:2012 Chapter 3.2 Analysis Tools
© Programming Research
26
Tool Enforcement
Tool
XYZ
The author of the TERA-Labs
report observed:
“On paper all the selected tools
claimed to provide comprehensive
MISRA C compliance checking
– but the reality was different.”
www.programmingresearch.com/resources/white-papers
© Programming Research
27
MISRA C Compliance
• Enforceability
• Decidability
• Deviations
© Programming Research
28
Decidability
"In order to use MISRA C, it is necessary to develop and document …
• A compliance matrix, showing how compliance with each MISRA C guideline will be checked"
MISRA C:2012 Chapter 5.2.1 – Process activities required by MISRA C
"Where a guideline cannot be completely checked by a tool, then a manual review will be required."
MISRA C:2012 Chapter 5.3 – Compliance
117
26
16
MISRA C:2012 Guidelines
Decidable Rules
Undecidable Rules
Directives
© Programming Research
29
MISRA C Compliance
• Enforceability
• Decidability
• Deviations
What do we mean by "MISRA Compliant Code" ?
© Programming Research
30
Deviations
"In order to use MISRA C, it is necessary to develop and document …
• A deviation process by which justifiable non-compliances can be authorized and recorded "
MISRA C:2012 Chapter 5.2.1 – Process activities required by MISRA C
" It is important that such deviations are properly recorded and authorized."
MISRA C:2012 Chapter 5.4 – Deviation procedure
Deviations are often necessary …
… but the process can also be abused
MISRA C ADC: Approved deviation compliance for MISRA C:2004
ISBN 978-906400-09-5 (PDF), February 2013.
Freely downloadable from www.misra.org.uk
© Programming Research
31
Deviation Management
• Deviation support
• Documentation
• Collaborative code review
• Baselining
© Programming Research
32
Agenda
In Conclusion …
© Programming Research
33
In conclusion …
• Effective, accurate, automatic enforcement
MISRA C
2012
QA
C
• Disciplined compliance and deviation management
• Enforceable, decidable, well-specified coding rules
© Programming Research
34
Do you have any questions?
© Programming Research
35
MISRA C:2012 microsite
www.programmingresearch.com/mc3
• Download our MISRA C:2012 whitepaper
• Share our 1-page MISRA C:2012 summary
• Watch our videos about coding standards
• Access the MISRA webstore
© Programming Research
36
Do you have any questions?
© Programming Research
37
Thank you
Thank you for tuning in and giving an hour of your valuable time !
We will email the video link of this presentation and a summary of
the Q&A shortly.
Email us to ask any questions or for any follow-up points of interest.
Paul Burden
paul_burden@programmingresearch.com
Please don’t forget to fill in our short survey to tell us how we did !

More Related Content

What's hot

Autosar software component
Autosar software componentAutosar software component
Autosar software componentFarzad Sadeghi
 
Autosar fundamental
Autosar fundamentalAutosar fundamental
Autosar fundamentalOmkar Rane
 
ISO 26262 Approval of Automotive Software Components
ISO 26262 Approval of Automotive Software ComponentsISO 26262 Approval of Automotive Software Components
ISO 26262 Approval of Automotive Software ComponentsReal-Time Innovations (RTI)
 
ISO 26262 introduction
ISO 26262 introductionISO 26262 introduction
ISO 26262 introductionKoenLeekens
 
What is AUTOSAR MCAL? Learn about the software module architecture and device...
What is AUTOSAR MCAL? Learn about the software module architecture and device...What is AUTOSAR MCAL? Learn about the software module architecture and device...
What is AUTOSAR MCAL? Learn about the software module architecture and device...Embitel Technologies (I) PVT LTD
 
UDS: Vehicle Diagnostics in AUTOSAR Software Architecture
UDS: Vehicle Diagnostics in AUTOSAR Software Architecture UDS: Vehicle Diagnostics in AUTOSAR Software Architecture
UDS: Vehicle Diagnostics in AUTOSAR Software Architecture Embitel Technologies (I) PVT LTD
 
Automotive embedded systems part8 v1
Automotive embedded systems part8 v1Automotive embedded systems part8 v1
Automotive embedded systems part8 v1Keroles karam khalil
 
Introduction to DO-178B - Software Considerations in Airborne Systems and Equ...
Introduction to DO-178B - Software Considerations in Airborne Systems and Equ...Introduction to DO-178B - Software Considerations in Airborne Systems and Equ...
Introduction to DO-178B - Software Considerations in Airborne Systems and Equ...Swamy Shettru
 
Multicore and AUTOSAR
Multicore and AUTOSARMulticore and AUTOSAR
Multicore and AUTOSARHansang Lee
 
CAN (Controller Area Network) Bus Protocol
CAN (Controller Area Network) Bus ProtocolCAN (Controller Area Network) Bus Protocol
CAN (Controller Area Network) Bus ProtocolAbhinaw Tiwari
 
Automotive functional safety iso 26262 training bootcamp 2019
Automotive functional safety iso 26262 training bootcamp 2019Automotive functional safety iso 26262 training bootcamp 2019
Automotive functional safety iso 26262 training bootcamp 2019Tonex
 

What's hot (20)

Iso26262 component reuse_webinar
Iso26262 component reuse_webinarIso26262 component reuse_webinar
Iso26262 component reuse_webinar
 
Autosar software component
Autosar software componentAutosar software component
Autosar software component
 
Autosar fundamental
Autosar fundamentalAutosar fundamental
Autosar fundamental
 
Introduction to ASPICE
Introduction to ASPICEIntroduction to ASPICE
Introduction to ASPICE
 
Autosar MCAL (Microcontroller Abstraction Layer)
Autosar MCAL (Microcontroller Abstraction Layer)Autosar MCAL (Microcontroller Abstraction Layer)
Autosar MCAL (Microcontroller Abstraction Layer)
 
ISO 26262 Approval of Automotive Software Components
ISO 26262 Approval of Automotive Software ComponentsISO 26262 Approval of Automotive Software Components
ISO 26262 Approval of Automotive Software Components
 
ISO 26262: Automotive Functional Safety
ISO 26262: Automotive Functional SafetyISO 26262: Automotive Functional Safety
ISO 26262: Automotive Functional Safety
 
ISO 26262 introduction
ISO 26262 introductionISO 26262 introduction
ISO 26262 introduction
 
What is AUTOSAR MCAL? Learn about the software module architecture and device...
What is AUTOSAR MCAL? Learn about the software module architecture and device...What is AUTOSAR MCAL? Learn about the software module architecture and device...
What is AUTOSAR MCAL? Learn about the software module architecture and device...
 
AUToSAR introduction
AUToSAR introductionAUToSAR introduction
AUToSAR introduction
 
UDS: Vehicle Diagnostics in AUTOSAR Software Architecture
UDS: Vehicle Diagnostics in AUTOSAR Software Architecture UDS: Vehicle Diagnostics in AUTOSAR Software Architecture
UDS: Vehicle Diagnostics in AUTOSAR Software Architecture
 
13090016_vectorcast.ppt
13090016_vectorcast.ppt13090016_vectorcast.ppt
13090016_vectorcast.ppt
 
Automotive embedded systems part8 v1
Automotive embedded systems part8 v1Automotive embedded systems part8 v1
Automotive embedded systems part8 v1
 
Introduction to DO-178B - Software Considerations in Airborne Systems and Equ...
Introduction to DO-178B - Software Considerations in Airborne Systems and Equ...Introduction to DO-178B - Software Considerations in Airborne Systems and Equ...
Introduction to DO-178B - Software Considerations in Airborne Systems and Equ...
 
Multicore and AUTOSAR
Multicore and AUTOSARMulticore and AUTOSAR
Multicore and AUTOSAR
 
Advanced C
Advanced C Advanced C
Advanced C
 
Thesis Presentation
Thesis PresentationThesis Presentation
Thesis Presentation
 
CAN (Controller Area Network) Bus Protocol
CAN (Controller Area Network) Bus ProtocolCAN (Controller Area Network) Bus Protocol
CAN (Controller Area Network) Bus Protocol
 
Automotive functional safety iso 26262 training bootcamp 2019
Automotive functional safety iso 26262 training bootcamp 2019Automotive functional safety iso 26262 training bootcamp 2019
Automotive functional safety iso 26262 training bootcamp 2019
 
Microcontroller part 1
Microcontroller part 1Microcontroller part 1
Microcontroller part 1
 

Viewers also liked

MISRA Safety Case Guidelines -
MISRA Safety Case Guidelines - MISRA Safety Case Guidelines -
MISRA Safety Case Guidelines - Automotive IQ
 
Misra c-2004
Misra c-2004Misra c-2004
Misra c-2004sand390
 
MISRA C Chairman - Device Developer Conference 2016
MISRA C Chairman - Device Developer Conference 2016MISRA C Chairman - Device Developer Conference 2016
MISRA C Chairman - Device Developer Conference 2016Andrew Banks
 
HIS Conf 2014: An Insight into MISRA-C
HIS Conf 2014: An Insight into MISRA-CHIS Conf 2014: An Insight into MISRA-C
HIS Conf 2014: An Insight into MISRA-CAdaCore
 
Development of Safety Case for the Wolsong LILW disposal facility in Korea
Development of Safety Case for the Wolsong LILW disposal facility in KoreaDevelopment of Safety Case for the Wolsong LILW disposal facility in Korea
Development of Safety Case for the Wolsong LILW disposal facility in KoreaJin Beak Park
 
Misra cpp, cert cpp 2016 and RTL design style guide with HAZOP
Misra cpp, cert cpp 2016 and RTL design style guide with HAZOPMisra cpp, cert cpp 2016 and RTL design style guide with HAZOP
Misra cpp, cert cpp 2016 and RTL design style guide with HAZOPKiyoshi Ogawa
 
Multi-Core (MC) Processor Qualification for Safety Critical Systems
Multi-Core (MC) Processor Qualification for Safety Critical SystemsMulti-Core (MC) Processor Qualification for Safety Critical Systems
Multi-Core (MC) Processor Qualification for Safety Critical SystemsAdaCore
 
GNAT Pro for ARM processors
GNAT Pro for ARM processorsGNAT Pro for ARM processors
GNAT Pro for ARM processorsAdaCore
 
Achieve iso 26262 certification
Achieve iso 26262 certificationAchieve iso 26262 certification
Achieve iso 26262 certificationPRQA
 
2015 Upload Campaigns Calendar - SlideShare
2015 Upload Campaigns Calendar - SlideShare2015 Upload Campaigns Calendar - SlideShare
2015 Upload Campaigns Calendar - SlideShareSlideShare
 
What to Upload to SlideShare
What to Upload to SlideShareWhat to Upload to SlideShare
What to Upload to SlideShareSlideShare
 
Getting Started With SlideShare
Getting Started With SlideShareGetting Started With SlideShare
Getting Started With SlideShareSlideShare
 

Viewers also liked (12)

MISRA Safety Case Guidelines -
MISRA Safety Case Guidelines - MISRA Safety Case Guidelines -
MISRA Safety Case Guidelines -
 
Misra c-2004
Misra c-2004Misra c-2004
Misra c-2004
 
MISRA C Chairman - Device Developer Conference 2016
MISRA C Chairman - Device Developer Conference 2016MISRA C Chairman - Device Developer Conference 2016
MISRA C Chairman - Device Developer Conference 2016
 
HIS Conf 2014: An Insight into MISRA-C
HIS Conf 2014: An Insight into MISRA-CHIS Conf 2014: An Insight into MISRA-C
HIS Conf 2014: An Insight into MISRA-C
 
Development of Safety Case for the Wolsong LILW disposal facility in Korea
Development of Safety Case for the Wolsong LILW disposal facility in KoreaDevelopment of Safety Case for the Wolsong LILW disposal facility in Korea
Development of Safety Case for the Wolsong LILW disposal facility in Korea
 
Misra cpp, cert cpp 2016 and RTL design style guide with HAZOP
Misra cpp, cert cpp 2016 and RTL design style guide with HAZOPMisra cpp, cert cpp 2016 and RTL design style guide with HAZOP
Misra cpp, cert cpp 2016 and RTL design style guide with HAZOP
 
Multi-Core (MC) Processor Qualification for Safety Critical Systems
Multi-Core (MC) Processor Qualification for Safety Critical SystemsMulti-Core (MC) Processor Qualification for Safety Critical Systems
Multi-Core (MC) Processor Qualification for Safety Critical Systems
 
GNAT Pro for ARM processors
GNAT Pro for ARM processorsGNAT Pro for ARM processors
GNAT Pro for ARM processors
 
Achieve iso 26262 certification
Achieve iso 26262 certificationAchieve iso 26262 certification
Achieve iso 26262 certification
 
2015 Upload Campaigns Calendar - SlideShare
2015 Upload Campaigns Calendar - SlideShare2015 Upload Campaigns Calendar - SlideShare
2015 Upload Campaigns Calendar - SlideShare
 
What to Upload to SlideShare
What to Upload to SlideShareWhat to Upload to SlideShare
What to Upload to SlideShare
 
Getting Started With SlideShare
Getting Started With SlideShareGetting Started With SlideShare
Getting Started With SlideShare
 

Similar to An Introduction to MISRA C:2012

Safety on the Max: How to Write Reliable C/C++ Code for Embedded Systems
Safety on the Max: How to Write Reliable C/C++ Code for Embedded SystemsSafety on the Max: How to Write Reliable C/C++ Code for Embedded Systems
Safety on the Max: How to Write Reliable C/C++ Code for Embedded SystemsAndrey Karpov
 
VDA 2015 Presentation - Full
VDA 2015 Presentation - FullVDA 2015 Presentation - Full
VDA 2015 Presentation - FullAndrew Banks
 
Traceability Beyond Source Code: An Elusive Target?
Traceability Beyond Source Code: An Elusive Target?Traceability Beyond Source Code: An Elusive Target?
Traceability Beyond Source Code: An Elusive Target?Lionel Briand
 
Analyzing Natural-Language Requirements: The Not-too-sexy and Yet Curiously D...
Analyzing Natural-Language Requirements: The Not-too-sexy and Yet Curiously D...Analyzing Natural-Language Requirements: The Not-too-sexy and Yet Curiously D...
Analyzing Natural-Language Requirements: The Not-too-sexy and Yet Curiously D...Lionel Briand
 
Misracompliant20162020
Misracompliant20162020Misracompliant20162020
Misracompliant20162020Kiyoshi Ogawa
 
Software Quality Assurance class 1
Software Quality Assurance  class 1Software Quality Assurance  class 1
Software Quality Assurance class 1Santhiya Grace
 
Lecture 02 - Development Methodologies.pptx
Lecture 02 - Development Methodologies.pptxLecture 02 - Development Methodologies.pptx
Lecture 02 - Development Methodologies.pptxelham706227
 
Accelerating MISRA and CERT coding standards compliance with dedicated report...
Accelerating MISRA and CERT coding standards compliance with dedicated report...Accelerating MISRA and CERT coding standards compliance with dedicated report...
Accelerating MISRA and CERT coding standards compliance with dedicated report...ChantalWauters
 
software requirement specifcation.pptx
software requirement specifcation.pptxsoftware requirement specifcation.pptx
software requirement specifcation.pptxSACHINMAURYA57
 
Navigating the jungle of Secure Coding Standards
Navigating the jungle of Secure Coding StandardsNavigating the jungle of Secure Coding Standards
Navigating the jungle of Secure Coding StandardsChantalWauters
 
Model-Based Systems Requirements
Model-Based Systems RequirementsModel-Based Systems Requirements
Model-Based Systems RequirementsJean-Michel Bruel
 
Transforming the Central Office: Implementing CORD
Transforming the Central Office:  Implementing CORDTransforming the Central Office:  Implementing CORD
Transforming the Central Office: Implementing CORDRadisys Corporation
 
Quality Management and Quality Standard
Quality Management and Quality StandardQuality Management and Quality Standard
Quality Management and Quality StandardMurageppa-QA
 
Software Requirements and Specifications
Software Requirements and SpecificationsSoftware Requirements and Specifications
Software Requirements and Specificationsvustudent1
 
Documented Requirements are not Useless After All!
Documented Requirements are not Useless After All!Documented Requirements are not Useless After All!
Documented Requirements are not Useless After All!Lionel Briand
 
Embedded Internship review
Embedded Internship reviewEmbedded Internship review
Embedded Internship reviewHadiRazak4
 
Component based development | what, why and how
Component based development | what, why and howComponent based development | what, why and how
Component based development | what, why and howRakesh Kumar Jha
 
MISRA-Compliance-2020
MISRA-Compliance-2020MISRA-Compliance-2020
MISRA-Compliance-2020Massimo Talia
 
Software product quality
Software product qualitySoftware product quality
Software product qualitytumetr1
 
MISRA-Compliance-2020.pdf
MISRA-Compliance-2020.pdfMISRA-Compliance-2020.pdf
MISRA-Compliance-2020.pdfTamilKumaran31
 

Similar to An Introduction to MISRA C:2012 (20)

Safety on the Max: How to Write Reliable C/C++ Code for Embedded Systems
Safety on the Max: How to Write Reliable C/C++ Code for Embedded SystemsSafety on the Max: How to Write Reliable C/C++ Code for Embedded Systems
Safety on the Max: How to Write Reliable C/C++ Code for Embedded Systems
 
VDA 2015 Presentation - Full
VDA 2015 Presentation - FullVDA 2015 Presentation - Full
VDA 2015 Presentation - Full
 
Traceability Beyond Source Code: An Elusive Target?
Traceability Beyond Source Code: An Elusive Target?Traceability Beyond Source Code: An Elusive Target?
Traceability Beyond Source Code: An Elusive Target?
 
Analyzing Natural-Language Requirements: The Not-too-sexy and Yet Curiously D...
Analyzing Natural-Language Requirements: The Not-too-sexy and Yet Curiously D...Analyzing Natural-Language Requirements: The Not-too-sexy and Yet Curiously D...
Analyzing Natural-Language Requirements: The Not-too-sexy and Yet Curiously D...
 
Misracompliant20162020
Misracompliant20162020Misracompliant20162020
Misracompliant20162020
 
Software Quality Assurance class 1
Software Quality Assurance  class 1Software Quality Assurance  class 1
Software Quality Assurance class 1
 
Lecture 02 - Development Methodologies.pptx
Lecture 02 - Development Methodologies.pptxLecture 02 - Development Methodologies.pptx
Lecture 02 - Development Methodologies.pptx
 
Accelerating MISRA and CERT coding standards compliance with dedicated report...
Accelerating MISRA and CERT coding standards compliance with dedicated report...Accelerating MISRA and CERT coding standards compliance with dedicated report...
Accelerating MISRA and CERT coding standards compliance with dedicated report...
 
software requirement specifcation.pptx
software requirement specifcation.pptxsoftware requirement specifcation.pptx
software requirement specifcation.pptx
 
Navigating the jungle of Secure Coding Standards
Navigating the jungle of Secure Coding StandardsNavigating the jungle of Secure Coding Standards
Navigating the jungle of Secure Coding Standards
 
Model-Based Systems Requirements
Model-Based Systems RequirementsModel-Based Systems Requirements
Model-Based Systems Requirements
 
Transforming the Central Office: Implementing CORD
Transforming the Central Office:  Implementing CORDTransforming the Central Office:  Implementing CORD
Transforming the Central Office: Implementing CORD
 
Quality Management and Quality Standard
Quality Management and Quality StandardQuality Management and Quality Standard
Quality Management and Quality Standard
 
Software Requirements and Specifications
Software Requirements and SpecificationsSoftware Requirements and Specifications
Software Requirements and Specifications
 
Documented Requirements are not Useless After All!
Documented Requirements are not Useless After All!Documented Requirements are not Useless After All!
Documented Requirements are not Useless After All!
 
Embedded Internship review
Embedded Internship reviewEmbedded Internship review
Embedded Internship review
 
Component based development | what, why and how
Component based development | what, why and howComponent based development | what, why and how
Component based development | what, why and how
 
MISRA-Compliance-2020
MISRA-Compliance-2020MISRA-Compliance-2020
MISRA-Compliance-2020
 
Software product quality
Software product qualitySoftware product quality
Software product quality
 
MISRA-Compliance-2020.pdf
MISRA-Compliance-2020.pdfMISRA-Compliance-2020.pdf
MISRA-Compliance-2020.pdf
 

Recently uploaded

Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 

Recently uploaded (20)

Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 

An Introduction to MISRA C:2012

  • 1. © Programming Research www.programmingresearch.com An Introduction to MISRA C:2012 Paul Burden Webinar will start shortly
  • 2. © Programming Research 2 Welcome • A warm welcome to all our visitors • The Webinar will last for approx 50 minutes • We will take 10 minutes of questions at the end
  • 4. © Programming Research 4 Paul Burden • Technical Consultant working for PRQA • Expert in coding standards enforcement • Product Manager for PRQA’s leading static analysis tool QA·C • Prominent member of the MISRA C Working Group since its formation more than 10 years ago.
  • 5. © Programming Research 5 Agenda 1. An Introduction to MISRA C 2. The Changes in MISRA C:2012 3. Guideline Classification 4. MISRA C Compliance
  • 6. © Programming Research 6 MISRA C MISRA C:1998 • Derived from PRQA standards developed for Ford and Rover • Developed in UK for automotive applications MISRA C:2004 • Amended and extended • Supplemented with an Exemplar suite MISRA C:2012 • A committee of 10 representing many years of experience • 4 years of effort • Released 18th March 2013 • A further step forward …
  • 7. © Programming Research 7 Coding standard adoption VDC Research White Paper* April 2011: “Re-evaluation of Development and Testing Practices April 2011” Available at: www.programmingresearch.com/whitepapers Data obtained from 600 respondents in Embedded and Enterprise/IT software and systems development. 0.0% 10.0% 20.0% 30.0% 40.0% Coding Standard Adoption by % of Respondents
  • 8. © Programming Research 8 MISRA C • Automotive • Aerospace • Defence • Medical • Nuclear power • Railways • Consumer electronics • Process control • etc. MISRA C is now the most widely used coding standard for the C language - worldwide
  • 9. © Programming Research 9 Agenda 1. An Introduction to MISRA C 2. The Changes in MISRA C:2012 3. Guideline Classification 4. MISRA C Compliance
  • 10. © Programming Research 10 The Changes in MISRA C:2012 MISRA C:2012 compared to MISRA C:2004 • It's bigger – a few more rules (159 instead of 142 ) – and the content is better • Many guidelines are unchanged – they may be reworded and better specified – guideline/rule numbering has changed • Legacy code may not be compliant – there are new requirements – not many – but some restrictions have been removed
  • 11. © Programming Research 11 C language support ISO:C90 • Well supported by compilers and tools • The dangers are well understood • Limitations – e.g. absence of Boolean type ISO:C99 • More features, e.g. _Bool and inline functions • More dangers, e.g. additional undefined behaviour • Most compilers do not support all features of C99 ISO:C11 • Still relatively new • Very limited tool support MISRA C:1998 MISRA C:2004 MISRA C:2012 MISRA C:2012
  • 12. © Programming Research 12 Guideline specification An expanded explanation of the requirement Why the guideline is necessary More extensive code examples Headline text clarification Exceptions
  • 13. © Programming Research 13 Terminology MISRA terminology has changed These terms were loosely defined and have been replaced The new terms are fully defined and used to describe expressions of any arithmetic type MISRA C:2004 MISRA C:2012 underlying type essential type complex expression composite expression effectively Boolean essentially Boolean
  • 14. © Programming Research 14 Agenda 1. An Introduction to MISRA C 2. The Changes in MISRA C:2012 3. Guideline Classification 4. MISRA C Compliance
  • 15. © Programming Research 15 Guideline classification Category • Advisory • Required • Mandatory Decidability • Decidable • Undecidable Language • C90 • C99 • C90, C99 Guideline Type • Directive • Rule Analysis Scope • Single Translation Unit • System
  • 16. © Programming Research 16 Rules and Directives Rules – Have well defined requirements – Are statically enforceable (subject to certain limitations) Directives – May be loosely defined – allowing alternative interpretations – May address "process" or "documentation" requirements There are now 2 types of guideline:
  • 17. © Programming Research 17 Rules and Directives - examples Rules Rule 8.5 An external object or function shall be declared once in one and only one file Rule 11.3 A cast shall not be performed between a pointer to object type and a different pointer to object type Dir 3.1 All code shall be traceable to documented requirements Dir 4.3 Assembly language shall be encapsulated and isolated Directives
  • 18. © Programming Research 18 Guideline categories • Advisory guidelines – These are recommendations – Non-compliance is permitted at the user's discretion – Non-compliance should be documented – Formal deviations are not required • Required guidelines – Non-compliance must be supported by a formal "deviation" • Mandatory guidelines – Must always be obeyed – Compliance is always required Mandatory guidelines were not a feature of previous versions of MISRA C There are now 3 guideline categories:
  • 19. © Programming Research 19 Rule decidability A rule is decidable if it is always possible, in any program, for a tool to determine whether code is compliant. Otherwise the rule is undecidable Rules are either "decidable" or "undecidable" Rule 12.4 Evaluation of constant expressions should not lead to unsigned integer wrap-around Decidable … Undecidable … Rule 13.5 The right hand operand of a logical && or || operator shall not contain persistent side effects
  • 20. © Programming Research 20 Analysis scope There are 2 types of "analysis scope" Single Translation Unit Rules System Rules Rule 8.2 Function types shall be in prototype form with named parameters Rule 16.4 Every switch statement shall have a default label Rule 8.7 Functions and objects should not be defined with external linkage if they are referenced in only one translation unit Rule 13.5 The right hand operand of a logical && or || operator shall not contain persistent side efects
  • 21. © Programming Research 21 Guideline Classification Summary CLASSIFICATION SUMMARY DIRECTIVES (16) RULES (143) CATEGORY Advisory 7 32 Required 9 101 Mandatory 0 10 LANGUAGE C90 0 2 C99 0 11 C90 or C99 16 130 DECIDABILITY Decidable - 117 Undecidable - 26 ANALYSIS SCOPE Single Translation Unit - 104 System - 39 Some rules are now classified as "mandatory" Some rules are only relevant for a specific language version Some rules cannot be statically enforced with certainty Rules that can be enforced within a single translation unit are decidable
  • 22. © Programming Research 22 Agenda 1. An Introduction to MISRA C 2. The Changes in MISRA C:2012 3. Guideline Classification 4. MISRA C Compliance
  • 23. © Programming Research 23 MISRA C Compliance • Enforceability • Decidability • Deviations What do we mean by "MISRA Compliant Code" ?
  • 24. © Programming Research 24 Enforceability 143 16 "The vision for the third edition of MISRA C is therefore to: … Increase the number of guidelines that can be processed by static analysis tools" … MISRA C:2012 Chapter 1 – The Vision Rules - can be automatically enforced Directives – tools can sometimes assist with enforcement
  • 25. © Programming Research 25 Enforceability Independent Research performed by TERA-Labs, a new research division of the Karel de Grote university college in Antwerp, Belgium. • Test code was written for 11 key rules in MISRA C:2004 - selected by a panel of industrial partners • The test code was analysed using a number of analysis tools claiming to enforce compliancy with MISRA C • Two tool attributes were examined – Effectiveness in identifying rule violations – Incidence of false positive messages No False Positives Many False Positives All violations reported No violations reported GOOD BAD "The ability to detect the maximum number of violations possible, while minimizing the number of false positive messages, is therefore an important factor in choosing a tool." MISRA C:2012 Chapter 3.2 Analysis Tools
  • 26. © Programming Research 26 Tool Enforcement Tool XYZ The author of the TERA-Labs report observed: “On paper all the selected tools claimed to provide comprehensive MISRA C compliance checking – but the reality was different.” www.programmingresearch.com/resources/white-papers
  • 27. © Programming Research 27 MISRA C Compliance • Enforceability • Decidability • Deviations
  • 28. © Programming Research 28 Decidability "In order to use MISRA C, it is necessary to develop and document … • A compliance matrix, showing how compliance with each MISRA C guideline will be checked" MISRA C:2012 Chapter 5.2.1 – Process activities required by MISRA C "Where a guideline cannot be completely checked by a tool, then a manual review will be required." MISRA C:2012 Chapter 5.3 – Compliance 117 26 16 MISRA C:2012 Guidelines Decidable Rules Undecidable Rules Directives
  • 29. © Programming Research 29 MISRA C Compliance • Enforceability • Decidability • Deviations What do we mean by "MISRA Compliant Code" ?
  • 30. © Programming Research 30 Deviations "In order to use MISRA C, it is necessary to develop and document … • A deviation process by which justifiable non-compliances can be authorized and recorded " MISRA C:2012 Chapter 5.2.1 – Process activities required by MISRA C " It is important that such deviations are properly recorded and authorized." MISRA C:2012 Chapter 5.4 – Deviation procedure Deviations are often necessary … … but the process can also be abused MISRA C ADC: Approved deviation compliance for MISRA C:2004 ISBN 978-906400-09-5 (PDF), February 2013. Freely downloadable from www.misra.org.uk
  • 31. © Programming Research 31 Deviation Management • Deviation support • Documentation • Collaborative code review • Baselining
  • 33. © Programming Research 33 In conclusion … • Effective, accurate, automatic enforcement MISRA C 2012 QA C • Disciplined compliance and deviation management • Enforceable, decidable, well-specified coding rules
  • 34. © Programming Research 34 Do you have any questions?
  • 35. © Programming Research 35 MISRA C:2012 microsite www.programmingresearch.com/mc3 • Download our MISRA C:2012 whitepaper • Share our 1-page MISRA C:2012 summary • Watch our videos about coding standards • Access the MISRA webstore
  • 36. © Programming Research 36 Do you have any questions?
  • 37. © Programming Research 37 Thank you Thank you for tuning in and giving an hour of your valuable time ! We will email the video link of this presentation and a summary of the Q&A shortly. Email us to ask any questions or for any follow-up points of interest. Paul Burden paul_burden@programmingresearch.com Please don’t forget to fill in our short survey to tell us how we did !

Editor's Notes

  1. NOTES The GoToMeeting attendee interface is made up of two parts. The Viewer Window is where attendees see the presenter’s screen. The Viewer Window can be resized by clicking and dragging the lower right corner. The Control Panel is where attendees can interact with organizers. Click 1, 2 and 3: Clicking the arrows on the Grab Tab opens and closes the Control Panel. Click 4: Audio pane provides audio information. If the organizer has given attendees a choice, there are two options. Attendees joined via VoIP (Use Mic & Speakers) need speakers to hear. Click 5 and 6: Attendees can also joined via telephone. Click 6: Attendees can communicate with organizers and other attendees through the Chat box (if enabled by the organizer). Click 7: In the View menu, uncheck “Auto-Hide the Control Panel” if attendees want their Control Panel to remain open.