Getting started with OTAWA Eclipse plugin

Content

3 Exploring the WCET

This second step show how to use the OTAWA plug-in to explore the binary structure of the program and to understand how a compiled program is organized. This will be useful to help OTAWA computing WCET in the next step.

3.1 Switching to the OTAWA perspective

In the last step, you have produced an program executable for an ARM embedded machine that is put in the directory Debug, named crc. To open the OTAWA perspective, you have to select it and righ-click to get the contextual menu and click on Compute WCET. This will open the OTAWA perspective as below:

3.2 Using the CFG graphic view

The top-left pane Workspaces contains the description of the program in term of a collection of executable files and as a logic views on the subprograms, cfg. You may expand this items to retrieve back the sub-programs. They includes you own sub-programs (or function) like main, icrc or icrc1 and other sub-programs coming from the standard C library like _exit for example.

These sub-program are represented as Control Flow Graphs (CFG) where the assembly is grouped in basic block (piece of code where control flow enters at the first instruction and leaves only at the last one) and the control is represented as edges between basic block. OTAWA provides a graphical representation of these graphs. Select, for example, icrc1, right-click and on the contextual menu, select Open Graph. This will open, in the editor part, a graphical representation of the graph.

To navigate in the display graph, you can:

The basic block display is organized in three boxes. The top one gives the number of the basic block and the address of its first instruction. The box just below contains the disassembled code and the last contains OTAWA annotation linked to this block. The edge may have a taken label showing that the edge control flow is the result of branch. Edges without label are simple sequential control flow while slashed one represents sub-program calls or return. Finally, the big dot represents the entry of the CFG while the circled dot represents the exit.

<p>You may retrieve in the CFG the structure of icrc1 function that contains a loop and a conditional. The assembly code may matches exactly or not the structure of the original C program. It depends on the assembly generation algorithm and on the activated optimizations.

You can also control the display of the graph using buttons in the toolbar. They allows, respectively, to:

You may also click on basic block or on edges, a blue aura will surround the selected item, to get and edit the annotations in the pane below:

3.3 Using the disassembly view

OTAWA provides also a disassembly view the program. To get it, you must expand the file entry of the top-left pane to get the list of segments composing the program. The segments are logical division that are usually differentiated by the properties (executable, readable, writable) of the memory where they are installed. Double click on a segment, .text for example, to get the disassembled segment in the editor part. The obtained frame is read only.

To find the disassembled code of a sub-program, you may also select its CFG, right-click and select the menu item Show source > Show assembly source. It works the like to get back the source matching a sub-program: right-click and select Show source > Show C source.

This page have shown how to navigate in the processed program code and sources. This is used in the next page where the WCET computation is explained.