SW Development and WCET analysis for real-time applications • SW is mostly written in imperative programming Classifications of Code languages Annotations and Discussion of – Trend: graphical interfaces like state charts Compiler-Support for Worst-Case – Also domain-specific languages like data-flow languages (transformed to imperative Execution Time Analysis implementations.) • Today, only very small fractions of performance- Raimund Kirner critical code is written in assembly code. Peter Puschner • Precise and accurate WCET analysis wanted? � analysis of object code mandatory!! Real-Time Systems Group Vienna University of Technology Raimund Kirner Raimund Kirner, TU Wien 2 Why is it hard to analyse code Work around: Guide the analysis by semantics for WCET analysis? means of code annotations (1) • Platform-specific behavior (memory layout, • Annotations to find jump-targets [aiT]: ROM-areas, memory-mapped IO, …) instruction <addr> calls <target-list>; • Control-flow is well hidden within low-level instruction <addr> branches to <target-list>; constructs of object code (indirect jumps, …) • Labeling assembly-instructions with high-level • Formal limitations of computability (loop bounds, meaning [aiT]: correlation of code predicates, type-inference in object-oriented languages, …) instruction <addr> is a return; • etc. Raimund Kirner, TU Wien 3 Raimund Kirner, TU Wien 4 Work around: Guide the analysis by Work around: Guide the analysis by means of code annotations (2) means of code annotations (3) • Describing possible values of variables [aiT]: • Describe iteration bounds of loops [Bound-T]: condition <addr> is always <bool value>; subprogram “<fn-name>” snippedt <addr> is newer executed; loop that uses <var-name> instruction <addr> is entered with <state>; repeats <= 7 times; end loop; • Describe boundaries of memory access [aiT]: end “<fn-name>”; instruction <addr> accesses <addr-range>; (written in external code annotation file) 5 6 Raimund Kirner, TU Wien Raimund Kirner, TU Wien 1
Reflection on code annotations Classification of Code Annotations (1) • Code annotations may be erroneous • Platform Property Annotations (PPA) • Code annotations often have to be done at • CFG Reconstruction Annotations (CRA) object code level � update/check necessary • Program Semantics Annotations (PSA) when changing and re-compiling the code • Auxiliary Annotations (AA) • Manually annotating the code is labor-intensive (especially at the object-code level !!!) • Questions: Are there code annotations that can be avoided? Can the process of annotation be simplified? Raimund Kirner, TU Wien 7 Raimund Kirner, TU Wien 8 Classification of Code Annotations (2) Classification of Code Annotations (3) Platform Property Annotations (PPA) CFG Reconstruction Annotations (CRA) • Description of special semantics behind the • Help to build basic structures of code analysis: access of memory-mapped IO – control-flow graph (CFG) and call-graph (local annotations). • Allow to reverse-engineer the high-level code • Description of platform properties that influence structure from the low-level assembly the execution time (mostly global annotations). statements. • Examples: • Examples: description of memory layout, properties of list of targets for branch instr, type labeling of target hardware, … branch instr, … Raimund Kirner, TU Wien 9 Raimund Kirner, TU Wien 10 Classification of Code Annotations (4) Compiler-Support for WCET Analysis (1) Program Semantics Annotations (PSA) Information accessible by the compiler: • Local description of program behavior • Program representation at source and object code level. • Performed code transformations to obtain object code • Support for What a compiler can help: – path analysis • Describe CFG of object code (to avoid the need of CRA) – value analysis – etc. • Provide mapping of source-code annotations to object code (simplification by writing annotations at source • Examples: code level instead of object-code level) [PPA,PSA,AA] flow annotations like loop bounds, description of variable values, … 11 12 Raimund Kirner, TU Wien Raimund Kirner, TU Wien 2
Final remark on code annotations Compiler-Support for WCET Analysis (2) What a compiler can help (2): Not all code annotations are artificial: • Emit properties of a program’s execution behavior • application-context (operation mode) may be (reduce amount of code annotations) [PSA] specified to refine the analysis [PSA] – in general, some PSA may remain mandatory (e.g. range on initial variable values, CFG – but in practice almost no PSA is mandatory! restriction) • Improve predictability of code • mapping of target-specific properties to code – imitation of “WCET-oriented programming” may be mandatory [PPA] – e.g., single-path conversion can reduce the (e.g. memory-mapped IO) execution-time jitter of real-time programs – support of predictable HW mechanisms (e.g., prefetching, scratchpad memory, cache locking), Raimund Kirner, TU Wien 13 Raimund Kirner, TU Wien 14 3
Recommend
More recommend