Tools – Optimizing Firmware using DRT


RSS
Follow by Email
Facebook
Facebook
Google+
Google+
http://beningo.com/tools-optimizing-firmware-using-drt/
YouTube
LinkedIn

Embedded software development is usually performed under severe resource constraints not only from a business stand-point but from the microcontroller as well. Upgrading to a higher end processor may result in a project that is not financially feasible especially for high volume applications where every penny can make difference. I’ve recently been playing with a firmware optimizer for GCC known as DRT that has produced some very interesting optimization results.

When optimizing an embedded system, there are three main areas that a developer might want to optimize; code size, speed and energy usage. When optimizing there is generally a trade-off that must be performed such as larger code size for faster processing. What is interesting about DRT is that the tool optimizes in all three domains simultaneously to provide the best overall result.

The DRT tool optimizes the entire program and performs an optimization known as a resequencing optimization. A resequencing optimization is performed after the program has been compiled and acts as a specialized linker. The resequencer will optimize by doing the following:

  • Load-relative instruction to load relative address
  • Branch-target
  • Constant sharing
  • Data shuffle
  • Exit truncate
  • Function reordering
  • Instruction sizing
  • Remove redundant nops
  • Removes unused code / data sequences
  • Small constant loads

The improvement from the optimizer can be quite significant. For example, Somnium has published results on their website for an Atmel D21 ARM M0+ core running at 48 MHz. Using two different compiler versions for Atmel Studio, the optimization improvements can be seen below:

03-DRT
The resequencing optimizer can have a significant impact on code size, energy usage and processing speed. For applications that are just on the border between two different microcontroller sizes or parts selections, using just such an optimizer could be just enough to use a less expensive microcontroller.

The Somnium DRT tool does have a 30-day which can be fun to play around with and see how much extra performance can be squeezed out of an application. After the 30-day trial has ended, the cost for the tool is about the same as a high end debugger probe. Not terribly price inhibiting but probably outside the price range for most individual or small team developers. However, if an appropriate trade study is performed, the price savings in microcontroller costs may greatly outweigh the tool cost.

RSS
Follow by Email
Facebook
Facebook
Google+
Google+
http://beningo.com/tools-optimizing-firmware-using-drt/
YouTube
LinkedIn
Post Tagged with , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *