Code Design and Coding Standard Compliance Checkinghttps://repo.valu3s.eu/method/code-design-and-coding-standard-compliance-checkinghttps://repo.valu3s.eu/@@site-logo/logo_valu3s_green_transparent.png
Code Design and Coding Standard Compliance Checking
To facilitate verifiability of the produced code.
Coding standards can be used to facilitate verifiability of the produced code. If employed they tend to exclude dynamic variables or objects such as unwanted or undetected overlay of memory, and bottlenecks of resources during (safety-related) runtime. The software development shall involve the limitation of the use of interrupts, in order to keep the software verifiable and testable, as well as the use of pointers, which shall be strictly defined, in order to avoid the problems caused by uncontrolled accessing data and recursion, to avoid unverifiable and untestable use of subroutine calls.
Detailed rules shall be fully agreed upon before coding. These typically require specific actions and patterns in the design of each software component, such as modularization guidelines, inheritance depth, etc. Other points covered:
Dynamic variables use and checking: using dynamic variables cannot be checked by the compiler or other off-line tools, if they are to be used, their disposition must be handled;
If interrupts are used, then parts not able to be interrupted shall have a specified maximum computation time, so that the maximum time for which an interrupt is inhibited can be calculated.
Interrupt usage and inhibiting shall be thoroughly documented;
Pointer arithmetic shall be used at source code level only if the pointer data and value range are checked;
The use of recursion shall be documented in terms of depth of recursion
These rules enable ease of software component testing, verification, assessment and maintenance.
Uniforms code creation enhancing component testing, verification and assessment;
Development is more solid and maintenance is less time consuming
Could not be applied easily to model-based designs
Method compliance hard to verify
Limited tool support for fully coverage
Bagnara R., Bagnara A., Hill P.M. (2018) The MISRA C Coding Standard and its Role in the Development and Analysis of Safety- and Security-Critical Embedded Software. In: Podelski A. (eds) Static Analysis. SAS 2018. Lecture Notes in Computer Science, vol 11002. Springer, Cham. https://doi.org/10.1007/978-3-319-99725-4_2
G. J. Holzmann, "The power of 10: rules for developing safety-critical code," in Computer, vol. 39, no. 6, pp. 95-99, June 2006, doi: 10.1109/MC.2006.212.