The care and feeding of compilers - Embedded.com

The care and feeding of compilers

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

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

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

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

And with the larger word lengths, increased direct memory access, and largermemory 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 optimizationchallenges 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 aspectof compiler use in embedded software code development over a broad rangeof processor platforms and applications.

At one end of the spectrum are back-to-the-basics articles by authorssuch as Jakob Engblom on writingcompiler friendly C code, and usingC-compilers to reduce code size, Wayne Wolff on basicMCU compilation techniques, and Greg Davis on the details of programmingwith modern compilers.

At the other end are articles for experiencedprogrammers on such topics as using compilers to effectively allocate memory,the use of wholeprogram code compilation on 32-bit MCUs, architecture-oriented Ccompiler code optimization, compiler optimization for DSP and compiler supportfor 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 traditionalper module, “compiland” approach typical of the GCCcompiler, the broader range of applications in which embedded systemsare being used is dictating developers take a closer look at such approachesas wholeprogram compilation by companies such as IAR Systems and MicrochipTechnology. Also getting some attention is LLVM and dynamiccompilation techniques being considered by companies such as Apple thatare aimed at replacing – or at least complementing – the traditional GNUcompiler. 

As you explore these new alternatives – or find new waysto use old compiler techniques – I look forward to hearing from you aboutcommunicating your experiences and ideas with the broader embedded developercommunity.

Embedded.com Site Editor Bernard Cole is also editor of thetwice-a-week Embedded.comnewsletters as well as a partner in the TechRite Associates editorialservices consultancy. He welcomes your feedback. Send an email to , or call928-525-9087.

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

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.