The care and feeding of compilers

May 12, 2013

Bernard Cole-May 12, 2013

A critical component in every embedded system developer's repertoire of firmware and software tools is the compiler. It transforms source code, generally written in a language such as C or C++, into a machine or object code form that a target microprocessor or microcontroller can understand and execute.

As simple as this sounds, the process is fraught with complexity, for the compiler must perform a range of operations - lexical analysis, preprocessing, parsing, semantic analysis, code generation and optimization - to be sure that what goes in is what comes out.

Because of the critical importance of this process, a lot of effort is spent on Embedded.com getting good how-to articles on the effective use of compilers. An early (2000) design article on Embedded.com was “Embeddeding with GNU: the compiler and linker,” which focused on the importance of good compiler practices in then leading edge 8 and 16 bit microcontrollers. 

As noted in the collection of recent design articles, webinars, white papers and Insight blogs in this week’s Tech Focus newsletter on “Firmware compiler optimization strategies,” 32-bit processors and multicore designs are becoming more common, though 8 and 16 bit MCUs have definitely not disappeared.

And with the larger word lengths, increased direct memory access, and larger memory sizes, program code lengths of a million lines or so are not uncommon. This represents at least an order of magnitude increase in the firmware optimization challenges facing programmers – and their compilers.

In addition to the recent articles included in this week’s newsletter, Embedded.com is the repository of extensive design resources on every aspect of compiler use in embedded software code development over a broad range of processor platforms and applications.

At one end of the spectrum are back-to-the-basics articles by authors such as Jakob Engblom on writing compiler friendly C code, and using C-compilers to reduce code size, Wayne Wolff on basic MCU compilation techniques, and Greg Davis on the details of programming with modern compilers.

At the other end are articles for experienced programmers on such topics as using compilers to effectively allocate memory, the use of whole program code compilation on 32-bit MCUs, architecture-oriented C compiler code optimization, compiler optimization for DSP and compiler support for multiprocessor SoC designs. Below are my Editor’s Top Picks

Tuning C/C++ compilers for optimal parallel performance in multicore apps
Compiler optimization for smaller, faster embedded application code
Providing memory system and compiler support for MPSoc designs
Optimizing compilers and embedded DSP software 

Although most embedded developers feel most comfortable using the traditional per module, "compiland" approach typical of the GCC compiler, the broader range of applications in which embedded systems are being used is dictating developers take a closer look at such approaches as whole program compilation by companies such as IAR Systems and Microchip Technology. Also getting some attention is LLVM and dynamic compilation techniques being considered by companies such as Apple that are aimed at replacing - or at least complementing - the traditional GNU compiler. 

As you explore these new alternatives - or find new ways to use old compiler techniques - I look forward to hearing from you about communicating your experiences and ideas with the broader embedded developer community.

Embedded.com Site Editor Bernard Cole is also editor of the twice-a-week Embedded.com newsletters as well as a partner in the TechRite Associates editorial services consultancy. He welcomes your feedback. Send an email to bccole@acm.org, or call 928-525-9087.

See more articles and column like this one on Embedded.com. Sign up for the Embedded.com newsletters. Copyright © 2013 UBM--All rights reserved.

Loading comments...

Parts Search Datasheets.com

KNOWLEDGE CENTER