Embedded Apps Need Code And Requirements Coverage

Oct. 5, 2010
Reliable programs need to be tested and checked before problems occur. Static and dynamic analysis should be in every embedded developer's toolbox.

Dynamic code coverage

Code coverage report

Many developers employ code coverage tools but handle requirements coverage in an ad hoc fashion. This often parallels their system design approach, which often follows informal methodologies, if any. At the other end of the spectrum are developers delivering DO-178B certified applications where process and artifacts are as important as the implementation.

I’ve written about the need for code analysis and other tools to improve the software development process before (see “CGM And Static Code Analysis Provide Safer Applications” at www.electronicdesign.com). The cost to fix a bug grows exponentially over the development process.

Compared to trying to fix things in the field, even when the issue doesn’t cause an additional major liability, it’s always better to find problems during the requirements phase, at design time, or even when the application is coded.

From a developer’s perspective, many tools are easy to understand and use, and they have easily identifiable advantages. For example, static analysis tools like Grammatech’s Code Sonar (see “GrammaTech Code Sonar” at www.electronicdesign.com) and Klocwork’s Insight (see “Klocwork Source Code Analysis”) ensure that developers are following the rules when they’re writing source code.

There are many well established standards such as MISRA C and C++. Most of the MISRA rules can be implemented using static analysis tools, but some rules require manual checking by another developer. There also are many other rule-based standards such as Netrino’s Embedded C Coding Standard, which was developed by practicing embedded developers for embedded developers.

Another useful tool tracks code coverage. This is a runtime technology that typically requires instrumented code, though it is possible to track execution using hardware trace facilities as well as virtual memory access. Most approaches incur execution overhead, but hardware trace does not. Code coverage testing is usually matched with unit or application testing software since developers need to know what code has actually been run successfully.

Code Coverage Just The Start
As noted earlier, meeting design requirements is critical, but testing whether software meets the design requirements can be a challenge. Tools like IBM’s Rational Doors or UML-based design tools help with the creation, management, and traceability of requirements. These tools are often used for projects other than software applications.

LDRA’s TBmanager is another tool in this realm that targets embedded development. It includes LDRA Testbed for static and dynamic analysis engine and coding standards, TBrun for unit testing, and TBreq for requirements traceability.

The tool utilizes static and dynamic code analysis, providing developers feedback like the flow graph that highlights conditions that must be met to provide code coverage during testing (Fig. 1). Of course, the tool provides extensive code coverage reports (Fig. 2) as well.

The static analysis support also makes it easier for LDRA to automatically generate test vectors. I like how LDRA’s tools link requirements, testing, and source code together, making it easy for developers to navigate between these artifacts.

So you aren’t using tools to improve your application development process? Get some soon, or let me know why you aren’t.

LDRA
MISRA
netrino

Sponsored Recommendations

What are the Important Considerations when Assessing Cobot Safety?

April 16, 2024
A review of the requirements of ISO/TS 15066 and how they fit in with ISO 10218-1 and 10218-2 a consideration the complexities of collaboration.

Wire & Cable Cutting Digi-Spool® Service

April 16, 2024
Explore DigiKey’s Digi-Spool® professional cutting service for efficient and precise wire and cable management. Custom-cut to your exact specifications for a variety of cable ...

DigiKey Factory Tomorrow Season 3: Sustainable Manufacturing

April 16, 2024
Industry 4.0 is helping manufacturers develop and integrate technologies such as AI, edge computing and connectivity for the factories of tomorrow. Learn more at DigiKey today...

Connectivity – The Backbone of Sustainable Automation

April 16, 2024
Advanced interfaces for signals, data, and electrical power are essential. They help save resources and costs when networking production equipment.

Comments

To join the conversation, and become an exclusive member of Electronic Design, create an account today!