Microcontroller Code Coverage Tracking via Dominator Tree Instrumentation
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing methods for code coverage tracking on microcontrollers are inefficient, requiring significant resources and time, especially when dealing with large codebases or long test runs, and often introduce performance impacts or environmental variability.
Innovation Solution
The system and method for in-situ code coverage tracking instrument the program code with a reduced number of instrumentation points using dominator trees and profile arcs, employing single bit-set instructions or NOP phase change traps to record execution information, allowing for efficient and precise tracking without external connections.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Measurement precision
If traditional code coverage tracking methods are used to track every instruction execution, then code coverage accuracy is improved, but resource consumption and execution time increase significantly
Solution Approach 1:
The patent segments the code into basic blocks and identifies only the entry points of these blocks as instrumentation points. This segmentation approach reduces the number of tracking locations from every instruction to just the entry points of basic blocks, thereby maintaining code coverage accuracy while significantly reducing resource consumption and execution time.
Solution Approach 2:
The patent applies partial action by instrumenting only the necessary points (basic block entry points) rather than every instruction. This selective instrumentation provides sufficient code coverage information without the excessive overhead of tracking every single instruction execution.
2Measurement precision
If instruction trace mechanism is used to capture trace stream, then code coverage tracking capability is improved, but hardware cost and data processing time increase
Solution Approach 1:
The patent extracts the essential code coverage tracking function from complex hardware instruction trace mechanisms. By identifying and instrumenting only basic block entry points, the system removes the need for expensive high-speed hardware trace capture while maintaining adequate code coverage tracking capability.
Solution Approach 2:
The patent replaces expensive, complex hardware trace mechanisms with simpler, lighter-weight instrumentation at basic block entry points. This substitution uses cheaper resources (minimal instrumentation code and memory) to achieve the same tracking objective without requiring sophisticated hardware infrastructure.
3Loss of information
If basic block instrumentation with serial communication is used, then code coverage data collection is improved, but program performance and timing characteristics deteriorate
Solution Approach 1:
The patent extracts only the essential tracking function from bulky basic block instrumentation routines. By using compact instrumentation code at basic block entry points without serial communication overhead, it collects code coverage data while eliminating the performance penalty of traditional instrumentation methods.
Solution Approach 2:
The patent uses a lightweight copy or representation of the basic block entry point information stored in memory, rather than executing heavy instrumentation routines. This copying approach allows efficient tracking of code coverage without disrupting program execution performance.
Data Source
AI summary
A microcontroller may include a processor and at least one memory device storing (a) program code of a program defining a plurality of dominator arcs based on logical relationships among basic blocks (instructions) in the program code; and (b) a set of instrumentation points consisting of a subset of the program code basic blocks that correspond with the plurality of dominator arcs, each instrumentation point being located in a respective dominator arc. A code coverage implementation program (e.g., IDE or compiler) may be configured to instrument each instrumentation point in the program code with execution tracking instruction(s) to store or generate execution recording information. A testing tool may be used to execute the program on the microcontroller, wherein execution of each respective instrumentation point in the program code causes the respective execution tracking instruction to store or generate execution recording information indicating that the dominator arc corresponding with that instrumentation point has been executed by the testing tool.


