SOMNIUM DRT Object Analyser

[A blog post originally published on the SOMNIUM website]

SOMNIUM DRT is a C/C++ IDE for ARM Cortex-M based devices such as the Atmel SMART family, the STM32 family from ST Microelectronics, and the Kinetis and LPC families from NXP.

DRT is fully compatible with industry-standard tools such as the GNU toolchain and Eclipse IDE. Unlike the “vanilla” tools used in other free of charge and commercial products, SOMNIUM’s patented techniques generate smaller, faster, more energy efficient code. DRT also includes some advanced debugging tools, including live memory viewing, fault analysis and trace.

The latest releases of DRT include an extra tool called the Object File Analyser. This can be used to compare two object files and display details of differences in code and data sizes. This is currently provided as a stand-alone tool, rather than integrated with the DRT IDE, to allow more flexibility in usage.

The DRT Object File Analyser displays the symbols present in the files and compares their sizes. You could get some of this information using command line tools such as objdump. The value of the Object File Analyser is that it automates the process of matching up the data from two object files. It also allows the data to be interactively sorted, filtered and searched in various ways. This is another example of DRT improving productivity by extracting high-level information and presenting it to the developer in an easy-to-use form.

You could use the Object File Analyser to compare two files compiled with the DRT toolchain with different optimization options, for example. Or you could use it to compare the DRT tools with an alternative toolchain. The displayed data can be easily sorted and filtered to highlight the code size reductions made by DRT.

When you run the Object File Analyser it initially displays the Summary page. You can use the Browse buttons to select files to analyse and compare. When a file is opened summary data for that file will be displayed, as shown below:

Summary view of Object Analyser
Summary view

You can switch to the Symbol Table page to see a list of all the symbols in the file. This shows the name, section and size of each symbol. If you open two files, then the symbols from the two files are listed side by side, with a final column (Delta) showing the difference in size between them:

Symbols view of Object Analyser

The list of symbols can be sorted by clicking any of the column headers (clicking again will reverse the sort order.)

Tip: clicking on the Delta column is a quick way of seeing the symbols that make the largest contribution to the overall size difference.

There are various filtering options to control which symbols are displayed. You can choose the level of differences to display: all symbols, only those that differ between the files, or only those that appear in one or other file. You can choose to display only the symbols from specific sections (for example, to focus on code size you could choose to only display the .text section). And finally, you can use the search function to find all functions with particular names (this uses regular expressions and so allows pretty sophisticated searches).

You can select one or more rows. When you do this, the status bar lists: the number of rows selected, the total sizes of those symbols and the size difference.

More details about any of the symbols can be displayed by right-clicking and selecting More information from the context menu. In addition to the information already shown, this will display the address of the symbol, its type, any linker flags associated with it, and the source file where the symbols was defined.

Finally, the data can be exported to a file for further analysis, or to keep a log of results for different tools or build options.

We have found the Object File Analyser to be a really valuable tool for understanding where code savings can be made. We hope you find it useful too.