IEC Certification Kit: Polyspace Bug Finder Reference Workflow
IEC Certification Kit: Polyspace Bug Finder Reference Workflow
www.mathworks.com
www.mathworks.com/sales_and_services
User community:
www.mathworks.com/matlabcentral
Technical support:
www.mathworks.com/support/contact_us
Phone:
508-647-7000
Revision History
September 2013
March 2014
October 2014
March 2015
September 2015
Contents
1 Introduction ...................................................................................................................................... 1-1
1.1 Overview ................................................................................................................................. 1-2
2 Integration of Polyspace Bug Finder into the Software Life Cycle .................................................. 2-1
2.1 Workflow Overview ................................................................................................................ 2-2
2.2 Tool Use Cases ........................................................................................................................ 2-5
[PBF_UC1] Static analysis of C/C++ code to assess compliance with coding standards ............ 2-5
[PBF_UC2] Static analysis of C/C++ code to determine code size and complexity metrics ....... 2-5
[PBF_UC3] Determination of software quality metrics ............................................................... 2-5
[PBF_UC4] Static analysis of C/C++ code to assess interface between components .................. 2-6
[PBF_UC5] Static analysis of C/C++ code to detect systematic and potential software defects . 2-6
Applicable ISO 26262, IEC 61508, and EN 50128 Requirements............................................... 2-6
2.3 Error Prevention and Detection Measures ............................................................................... 2-8
[M1] Preceding or Subsequent Dynamic Verification (Testing) of the Software ........................ 2-8
[M2] Specified Procedure for Corrective Action on Failure of Source Code Analysis ............... 2-8
[M_MISC1] Revision Control and Configuration Management to Identify the Artifacts to be
Analyzed; Use of Checksums ...................................................................................................... 2-8
[M_MISC2] Competency of the Project Team ............................................................................ 2-8
[M_MISC3] Adherence to Installation Instructions; Integrity of Tool Installation ..................... 2-9
[M_MISC4] Analysis of Available Bug Report Information ....................................................... 2-9
3 Additional Considerations ................................................................................................................ 3-1
3.1 Options Impacting Verification ............................................................................................... 3-2
3.2 Configuration Management and Revision Control .................................................................. 3-3
3.3 Competency of the Project Team ............................................................................................ 3-4
3.4 Installation Integrity and Release Compatibility ..................................................................... 3-5
3.5 Bug Reporting ......................................................................................................................... 3-6
3.6 Deviation from the Reference Workflow ................................................................................ 3-7
3.7 Integration with the Software Safety Life Cycle ..................................................................... 3-8
4 Workflow Overview......................................................................................................................... 4-1
5 Conformance Demonstration Template ........................................................................................... 5-1
6 References ........................................................................................................................................ 6-1
vi
1 Introduction
1.1 Overview
Polyspace Bug Finder supports the detection of MISRA C:2004, MISRA C:2012, MISRA
C++:2008, and JSF++ coding standard violations in embedded software written in the C and
C++ programming languages.
The product also generates code size and complexity metrics and produces reports that you can
use to monitor and help improve code reliability and quality.
This document provides a reference workflow for Polyspace Bug Finder. In particular, it
describes how to:
Leverage the coding standard compliance analysis, code size and complexity metrics
determination, and software quality metrics determination capabilities of Polyspace
Bug Finder in the software life cycle
This workflow addresses handwritten, automatically generated, and mixed code. It is applicable
for developing code as well as for auditing code received from others.
Note If you are verifying only generated C or C++ code, see the Embedded Coder reference
workflow provided in IEC Certification Kit: Embedded Coder Reference Workflow before using
this document. Polyspace Bug Finder products provide added assurance to the reference
workflow for models and generated code.
The reference workflow presented in this document describes activities intended to comply with
applicable requirements of the overall software safety lifecycles defined by IEC 61508-3 [1],
ISO 26262 [2], and EN 50128 [3] respectively, as they relate to verification and analysis of
handwritten, generated, or mixed source code. The workflow addresses risk levels ASIL A ASIL D according to ISO 26262, SIL 1 - SIL 3 according to IEC 61508, and SIL 0 - SIL 4
according to EN 50128.
The document is organized as follows:
Chapter 2, Integration of Polyspace Bug Finder into the Software Life Cycle provides a
reference workflow for the Polyspace Bug Finder tool. It describes reference use cases and
measures to prevent or detect potential tool errors.
Chapter 3, Additional Considerations describes tool options that impact verification results,
and other considerations such as tailoring and bug reporting.
Chapter 4, Workflow Overview summarizes the workflow in a tabular way.
1-2
1-3
1-4
During the development of embedded application software, C or C++ code can be used to
implement the required functionality. The source code can be the result of manual
implementation (see upper part of Figure 1) or automatic code generation (see lower part of
Figure 1) or a combination of both. Handwritten source code and source code created using code
generation can be combined to create the application software for an embedded system.
2-2
Solid arrows in the figure indicate the succession of software development activities.
The model uses for production code generation can contain hand-written source code. For example: C code contained in user
S-functions. This mixed-code use case is indicated by the dashed arrow in the figure.
2-3
Figure 2: Integration of source code analysis into the software life cycle
Note The source code analysis capabilities of Polyspace Bug Finder can be augmented with
additional analysis and verification capabilities for source code provided by Polyspace Code
Prover. For additional information, refer to:
IEC Certification Kit: Polyspace Code Prover Reference Workflow, R2015b
Note For generated code, this workflow can also be used to provide added assurance to the one
described in
IEC Certification Kit: Embedded Coder Reference Workflow, R2015b
2-4
Coding standard compliance analysis can be applied to handwritten as well as generated source
code.
Size and complexity metrics can be determined for handwritten as well as generated source
code. For more information about determining size and complexity metrics, see the Polyspace
Bug Finder Users Guide, R2015b.
2-5
Note The analysis and verification results provided by Polyspace Bug Finder can be used to
assess the quality of the C or C++ source code with respect to defined software quality goals, for
example Software Quality Objectives SQO-1 to SQO-6 according to [4].
2-6
In these documents, for information on use cases, refer to items labeled with:
Polyspace Bug Finder MISRA-C checker for use cases [PBF_UC1], [PBF_UC4],
[PBF_UC5]
Polyspace Bug Finder Code metrics and Polyspace Code Prover Code metrics
for use cases [PBF_UC2], [PBF_UC3], [PBF_UC4]
2-7
Dynamically verify (test) the executable code corresponding to the C or C++ source
code.
Analyze the identified issues using a defined procedure for corrective action.
The procedure for corrective action includes manual analysis and review of the issues
uncovered.
2-8
2-9
2-10
3 Additional Considerations
When implementing this reference workflow, consider the following topics:
3-2
3-3
Those carrying out coding and verification activities shall be competent for the
activities undertaken.
Coding and verification activities should be conducted by independent roles.
The applicable safety standard may provide additional guidance on the required degree of
independence.
3-4
3-5
You can use the bug reports section of the MathWorks web site
Bug Finder.
Note You can use the IEC Certification Kit Model Advisor check Display bug reports for
Polyspace Bug Finder to display bug report information for this product.
The tool user shall validate modifications or additions to shipping product(s), if applicable.
3-6
3-7
3-8
4 Workflow Overview
Objective
Prerequisites
Coding standard
compliance analysis
Demonstrate compliance C source code (e.g. .c and .h Raw code analysis results
of C or C++ source code files) or C++ source (e.g. .cpp with coding standard
with coding standards
and .hpp files) code to be
violations (MISRA-Canalyzed
summary-report.xml,
MISRA-CPP-summary Polyspace configuration and
report.xml, JSFproject information (.cfg and
summary-report.xml)
.ppm files)
List of coding standard rules
to be checked
Procedures for corrective
action
Work Products
Software quality
Define, determine, and
metrics determination report quality metrics
for C or C++ source
code based on analysis
results provided by
Polyspace Bug Finder
4-2
5 Conformance Demonstration
Template
To justify that the requirements outlined in this document have been satisfied, you must provide
evidence for the activities that have been carried out.
The IEC Certification Kit product provides an editable Conformance Demonstration Template that can
be used to demonstrate conformance with the parts of ISO 26262-6, IEC 61508-3, or EN 50128
covered in this document.
To access the conformance demonstration template, on the MATLAB command line, type
certkitiec to open the Artifacts Explorer. The template is in Polyspace Bug Finder.
In the third column, state to what degree you applied the technique or measure for the
application under consideration by using one of the phrases Used, Used to a limited degree,
or Not used.
In the fourth column, state how you used the technique or measure in the application under
consideration. If the reference workflow includes alternative means for compliance, indicate
what variant you used. In addition, enter a reference to the document (for example, test
report or review documentation) that satisfies the requirement.
5-2
6 References
[1] IEC 61508-3:2010. International Standard IEC 61508 Functional safety of electrical / electronic /
programmable electronic safety-related systems Part 3: Software requirements. Second edition,
2010.
[2] ISO 26262-6:2011. Road vehicles Functional safety Part 6: Product development: software
level. International Standard, 2011.
[3] EN 50128:2011. Railway applications - Communication, signalling and processing systems Software for railway control and protection systems. International Standard 2011.
[4] The MathWorks. Software Quality Objectives for Source Code. Version 3.0, 2012.