Introduction
The quality and finally safety (IEC61508 SIL3 certification) and
security development of Zephyr OS requires
- to follow a or several processes
- to have a tool environment installed to complete tasks and support the processes.
This RFC defines a rough concept how the safety committee intends to setup, both,
tools and processes to do safety development.
Serveral areas, in example requirements management, are not restricted
to safety and shall be setup at the best of our current knowledge to suite
for the full extend of the ecosystem.
Nevertheless, in order to be able to finish with the safety certifcation task,
it must be accepted that the focus of the safety committee and WG and therefore
this RFC is safety.
Please feel invited
- to suggest improvement
- to disclose gaps
- to ask questions when unclear
- to state your opinion
Problem description
An overall concept how to do safety is not (fully) defined, described and known to the safety WG
and TSC.
It is necessary to achieve a common understanding.
Proposed change
Create an overall concept by defining processes and a tool environment that allows
to get 'main' in a 'safety certifiable ready' state of which an auditable can
be branched with basically no gaps to reach certification.
Doing safety on auditable and forward merge all code changes, all tests, requirements etc.
has shown to not work.
We start with an rough concept and iteratively detail and implement the different areas.
Detailed RFC
Proposed change (Detailed)
Overview

Requirements Management
For safety (IEC61508) the following specifications need to be written:
Requirements specifications
- User Story (US) - not requested by 61508 but makes requirements more understandable
- Software Requirements Specification (SRS)
- Software Architecture & Interface Specification (SAIS)
- Software Module Design Specification (SMDS)
Requirements management(SRS, SAIS, STS) is done using
Storage location is zephyrproject-rtos/reqmgmt repo (https://github.com/zephyrproject-rtos/reqmgmt).
Test specifications
- Software Test Specification (STS)
- Software Integration Test Specification (SITS)
- Software Module Test Specification (SMTS)
Remark: possibly replace term 'module' as in 61508 by 'component' as in 50128 or 'unit' as in unit test for SMDS and SMTS, since easily confused with git (sub-)module.
Definition: Module as in 61508 is in most cases referred to as a implementation / header file pair in a C/C++ context (my_module.c/.h).
Test specifications are written as doxygen comments to the unit-, integration- and software tests into the zephyrproject-rtos/zephyr repo (https://github.com/zephyrproject-rtos/zephyr).
The linkage to a Doorstop requirements (SRS, SAIS, SMDS) is done by doxygen tag referencing the requirement by its ID.
Requirements process
Adding requirements or test specifications uses the same workflow as any code change does:
- Create a fork repo
- Create a branch where all changes are done
- Create a Github PR
- Review the PR
- Merge the PR
The standard github features (PR, diff, review) are used
- since Doorstop uses single yaml files per requirement (less merging than a single file approach as e.g. with StrictDoc, but would still work)
- the yaml file content is human readable
- users are acustomed to the github process (no major changes compared to source code)
Requirements wording
Requirememts shall be
and follow the 'Easy Approach to Requirements Syntax' (EARS) principle
Traceability
Traceability is created by a dediated 'tracedoc' tool.
The tool takes the
- requirements specification from Doorstop (or any other requirements tool) in a defined csv based format as input
(other formats would be feasible but for simplicity shall not be considered in the beginning)
- scans the zephyrproject-rtos/zephyr code base for dedicated doxygen comments with reference tags to the requirements
- checks for dead links and missing traceability (report at the end of or highlighted in traceability documentation)
- creates a doxygen / sphinx base requirements and traceability documentation
Remark: Intel has a prove-of-concept implemented.
By defining an open and simple input interface (csv) into tracedoc, requirements tools are not limited to Doorstop
and the requirements do not necessarily have to come from the same source (repo, system etc.)
Future: tracedoc could be extended to process multiple csv input files from different requirements tools and scan over multiple repos. We start with the simple 1:1 case.
Linkages
The following link roles will be used:
- refines (in the requirements management tool (Doorstop):
- software requirement <-- software architecture & interface requirement
- software architecture & interface requirement <-- software module design requirement
- implements (Doxygen tag - exact syntax tbd):
- software module design requirement <-- source code
- verifies (Doxygen tag - exact syntax tbd):
- software requirement <-- software test requirement
- software architecture & interface requirement <-- software integration test requirement
- software module design requirement <-- software module test requirement
Safety Scope
Why a safety scope? The Zephyr OS is by far too big, that we can achieve a safety certification of the full code base.
Hence we need to restrict it to a smaller scope and provide measures to distinguish non-safety from safety (for us and for a user).
The safety scope as defined will be marked using two mechanisms:
- The source files in the safety scope will carry an SPDX tag, similar to the SPDX license tag, indicating the safety relevance/scope
- In that way safety relevant code is clear identified and immediately visible to developers and maintainers
- Special (stricter) guidelines may apply to source code within the safety scope than to the rest of the code (e.g.: use of dynamic memory)
- The SPDX tool can be used to verify that a built binary only comprises of sources out of the safety scope and no other
(similar to that a binary only comprises of sources under a certain license model (e.g. no GPL)
- The maintainer.yml will define folders and file belonging to the safety scope
- In that manner PRs affecting the safety scope can be auto-assigned to dedicated safety maintainers
- Possibly to an include syntax also an exclude syntax need to be defined and implemented (/folder/A but not /folder/A/fileB.c)
Using both, SPDX and maintainer.yml, will be used to validate the safety scope against each other for plausibility / congruence (tool: scope validator, added to CI)
Coding Guidelines
The coding guidelines will be enforced as far as possible using a static code analyzer.
Guidelines which cannot be enforce by tooling, will be verified by code review prior to merging the github PR.
Static Code Analyzer (SCA)
- CI
- The project uses a commercial grade SCA (Parasoft cpptest is foreseen) in its CI, creating a violation report accessible via github PR for each development branch and main.
- The violation report will be differential for a development branch, between the development branch and the origin the development branch was branched from, only showing and enforcing the newly introduced violations.
- A full violation report should be available / visible but not be enforced to be cleaned up - in hope some feel motivated to fix low hanging violation fruits
(That could be skipped in CI and be left to the local SCA scans, where differential scans cannot be easily provided)
- Local
- Commercial SCAs typically have a rather high price tag for the community and the project providing floating license will be come expensive and requires an elaborated infrastructure (license server, access management, preventing from use outside of the project scope etc.)
- Different companies use different commercial SCAs, they will be able to integrate their SCA.
- The open source SCA "cppcheck" will be available and integrated into the build system to be used on a local machine. Even if the open source SCA does not have the same quality as a commercial grade solutions, it will be suitable to detect and this way fix 80 - 90% of the violations in a fast development cycle. The remaining 10 - 20% will have to be done using the CI integrate SCA with slower development cycles.
- The local scans will only provide a full scan of the source files, showing all existing violations (whom ever introduced them).
Testing
Testing will be done according to IEC61508 on the three levels:
- (full) software: verifying the software from a user perspective (black box testing)
- The software is approached from a user API perspective
- integration: verifying the interaction between dedicated modules (grey box testing)
- A number of modules are used in a test application. The modules under test will be approached via theirs API, external dependencies will be provided by faking (FFF) or using a device simulation.
- module: verifying single functions of a module including code coverage (white box testing)
- module API:
- Tests the module only via accessing the module API
- module unit:
- Takes the module-under-test as include into the test implementation file to allow access also to the local (static) functions
- Limitation: testing caller functions on all possible return values, where the callee is in the same module will not be possible
in all cases (see module stubbing).
- module stubbing:
- functions in the module that call static functions of the module might not be fully testable without stubbing or faking the called function
(example: the called function interacting with some hardware which does not fail during tests and therefore always returning 0 = OK) but the callers reaction needs to be tested on error codes. That caller's code would not be reachable.
- The function calls to module own functions need to be stubbed by suffixing the called function by "_stub" to allow to use fake function framework (FFF) to fake that called function (This will require a tool manipulating the source code file, suffixing the relevant function calls)
Testing folder structure
The /tests folder (as already existing) will resemble (except for the /tests folder itself) the repos folder structure and place the tests under dedicated sub-folders.
- /_s_test, for "software-test", will be used as sub-folder for the (full) software tests
- /_i_test, for "integration-test", will be used as sub-folder for the integration tests
- at the top most level, which includes all participating modules
- /_m_a_test, for "module-api-test", will be used as sub-folder for the module api tests
- It will be under the module names folder
- Which is, what we most have today
- /_m_u_test, for "module-unit-test", will be used as sub-folder for the module unit tests
- It will be under the module names folder
- /_m_s_test, for "module-stubbing-test", will be used as sub-folder for the module unit tests
- It will be under the module names folder
An example to depict the idea
(the shown existing tests might have been placed in the wrong category/location, creating the shown folder structure will
require a transition phase from the existing structure to the shown)
- /tests
- /_i_tests
/sched_subsys_xyz
- /_s_tests
- /queue
- /semaphore
- /sched
- /
- /kernel
- /_i_test
- /sched_mutex
- /sched_queue
- /queue
- /semaphore
- /sched
- /_m_a_test (former schedule_api test?)
- /_m_u_test
Dependencies
Introducing a system for quality to achieve a safety certification will introduce changes in various areas.
It has to be an iterative step by step process in which the direction very likely will have to be corrected
now and then.
Concerns and Unresolved Questions
Is part of this RFC's discussion to adjust the concept.
Alternatives
Is part of this RFC's discussion to adjust the concept.
Introduction
The quality and finally safety (IEC61508 SIL3 certification) and
security development of Zephyr OS requires
This RFC defines a rough concept how the safety committee intends to setup, both,
tools and processes to do safety development.
Serveral areas, in example requirements management, are not restricted
to safety and shall be setup at the best of our current knowledge to suite
for the full extend of the ecosystem.
Nevertheless, in order to be able to finish with the safety certifcation task,
it must be accepted that the focus of the safety committee and WG and therefore
this RFC is safety.
Please feel invited
Problem description
An overall concept how to do safety is not (fully) defined, described and known to the safety WG
and TSC.
It is necessary to achieve a common understanding.
Proposed change
Create an overall concept by defining processes and a tool environment that allows
to get 'main' in a 'safety certifiable ready' state of which an auditable can
be branched with basically no gaps to reach certification.
Doing safety on auditable and forward merge all code changes, all tests, requirements etc.
has shown to not work.
We start with an rough concept and iteratively detail and implement the different areas.
Detailed RFC
Proposed change (Detailed)
Overview
Requirements Management
For safety (IEC61508) the following specifications need to be written:
Requirements specifications
Requirements management(SRS, SAIS, STS) is done using
Storage location is zephyrproject-rtos/reqmgmt repo (https://github.com/zephyrproject-rtos/reqmgmt).
Test specifications
Remark: possibly replace term 'module' as in 61508 by 'component' as in 50128 or 'unit' as in unit test for SMDS and SMTS, since easily confused with git (sub-)module.
Definition: Module as in 61508 is in most cases referred to as a implementation / header file pair in a C/C++ context (my_module.c/.h).
Test specifications are written as doxygen comments to the unit-, integration- and software tests into the zephyrproject-rtos/zephyr repo (https://github.com/zephyrproject-rtos/zephyr).
The linkage to a Doorstop requirements (SRS, SAIS, SMDS) is done by doxygen tag referencing the requirement by its ID.
Requirements process
Adding requirements or test specifications uses the same workflow as any code change does:
The standard github features (PR, diff, review) are used
Requirements wording
Requirememts shall be
and follow the 'Easy Approach to Requirements Syntax' (EARS) principle
Traceability
Traceability is created by a dediated 'tracedoc' tool.
The tool takes the
(other formats would be feasible but for simplicity shall not be considered in the beginning)
Remark: Intel has a prove-of-concept implemented.
By defining an open and simple input interface (csv) into tracedoc, requirements tools are not limited to Doorstop
and the requirements do not necessarily have to come from the same source (repo, system etc.)
Future: tracedoc could be extended to process multiple csv input files from different requirements tools and scan over multiple repos. We start with the simple 1:1 case.
Linkages
The following link roles will be used:
Safety Scope
Why a safety scope? The Zephyr OS is by far too big, that we can achieve a safety certification of the full code base.
Hence we need to restrict it to a smaller scope and provide measures to distinguish non-safety from safety (for us and for a user).
The safety scope as defined will be marked using two mechanisms:
(similar to that a binary only comprises of sources under a certain license model (e.g. no GPL)
Using both, SPDX and maintainer.yml, will be used to validate the safety scope against each other for plausibility / congruence (tool: scope validator, added to CI)
Coding Guidelines
The coding guidelines will be enforced as far as possible using a static code analyzer.
Guidelines which cannot be enforce by tooling, will be verified by code review prior to merging the github PR.
Static Code Analyzer (SCA)
(That could be skipped in CI and be left to the local SCA scans, where differential scans cannot be easily provided)
Testing
Testing will be done according to IEC61508 on the three levels:
in all cases (see module stubbing).
(example: the called function interacting with some hardware which does not fail during tests and therefore always returning 0 = OK) but the callers reaction needs to be tested on error codes. That caller's code would not be reachable.
Testing folder structure
The /tests folder (as already existing) will resemble (except for the /tests folder itself) the repos folder structure and place the tests under dedicated sub-folders.
An example to depict the idea
(the shown existing tests might have been placed in the wrong category/location, creating the shown folder structure will
require a transition phase from the existing structure to the shown)
/sched_subsys_xyz
Dependencies
Introducing a system for quality to achieve a safety certification will introduce changes in various areas.
It has to be an iterative step by step process in which the direction very likely will have to be corrected
now and then.
Concerns and Unresolved Questions
Is part of this RFC's discussion to adjust the concept.
Alternatives
Is part of this RFC's discussion to adjust the concept.