A structured approach to embedded software source control
New standards such as ISO26262 and IEC61508 continue to emerge to bring more standardization in the embedded system development. There is a pressing need to follow a disciplined software development approach to adhere to these standards -- and help improve software quality. Effective usage of a source control system can support this cause and this article highlights some best practices for deployment with GIT source control.
Some of the best practices that we employ in our embedded software development include the following:
- Modularized GIT commit comments
- GIT ignore feature to avoid unnecessary/debug/test data in release package
- ‘Inline patch review’ for quicker code-review process without needing a separate tool
Git is a distributed version control system with good speed. It supports distributed non-linear workflows. It is one of the most widely adopted version control systems used for software development. You can refer to Getting-Started-Git-Basics to get a basic understanding of the GIT version control system.
Modularized GIT commit comments
When working with legacy code containing many MISRA-C violations, tracking code changes made to fix them becomes difficult especially when there are multiple contributors. Furthermore, it can become more unmanageable due to added factors including:
- Different contributors may use different tools for static code analysis like Klocwork, LDRA etc. Reports from various tools may be inconsistent at times on account of being evolved independently i.e. one MISRAC violation under LDRA may not come from Klocwork and vice-versa.
- Multiple contributors may work on same modules addressing the same MISRA-C violations independent of each other, leading to a cumbersome integration.
Here we show some simple examples using GIT commands and structured GIT commit messages which we have used to easily manage MISRA-C fixes in our products. Some of these approaches have been incorporated as guidelines in our configuration management.
The figure below shows our recommended GIT commit message format that can be used for the git code commits related to MISRA-C fixes.
Using such commit messages for every code commit made for fixing the MISRA-C violations enables effective tracking of the code changes. Once every developer starts adapting such methodology it reduces confusion and enables developers to effectively manage and fix the MISRA errors.