Porting GNU C Programs to Freescale's CodeWarrior C Compiler

If you are reading this, you are either seriously considering moving your software development work to Freescale’s CodeWarrior, or have just adopted the CodeWarrior tools (congratulations!). In both cases, you undoubtedly own a body of proven C programs that were written with a GNU C compiler. Now you are wondering how difficult it is going to be to migrate such code to the CodeWarrior compilers.

Nothing strikes fear into the hearts of seasoned programmers more than the oft-quoted vendor phrase of "a simple recompile is all it takes." Because each C/C++ compiler seems to implement its own dialect of the language, you must often modify the code so that it is palatable to the other compiler. In short, that "simple recompile" can sometimes become a major programming effort. Occasionally, the amount of work spent porting the code is large enough to make you wonder if it would have been easier writing the program from scratch.

Let’s be honest here—you will have to revise a GNU C program so that it works with the CodeWarrior C compiler. How much work this involves will depend upon many factors. This paper describes some of the differences between the two compilers in terms of conformance to the C language standard and library support. This information should help you determine the amount of effort required to port the source code to CodeWarrior.

There are two important facts to note before we proceed further. First, do not construe this information as a criticism of the GNU compilers. GNU C compilers have produced hundreds of industrial-strength programs and the GNU edition of CodeWarrior for Linux uses GNU compilers.

Second, the information in this paper is neither exhaustive nor complete. There are many versions of GNU C compilers and each version can run on several operating systems. CodeWarrior also supports a variety of processors and platforms and while Freescale strives to keep the implementations consistent, there can be minor differences among them. Because each compiler implementation and set of system libraries can affect the porting process in unique ways, a single paper cannot cover all of the possible variations. What this paper can do is provide some general guidelines that will serve as the starting point in the porting effort.

View Entire Paper | Previous Page | White Papers Search

If you found this page useful, bookmark and share it on: