|ARM Technical Support Knowledge Articles|
Applies to: C51 C Compiler
Information in this article applies to:
I have a large application that was written using the Keil C51 Compiler Version 6.10. I have upgraded to Version 6.23 and now, when I compile, my program no longer works.
I need the features in 6.23 to complete my application. I also need the code packing ability of the LX51 Linker to make my code fit into the memory space.
What's the best way to locate the problems porting from 6.10 to 6.23?
Porting a working application to a new or updated compiler can be a difficult task. If you are not the original software designer or if you have a poor understanding of the application, the tools, the hardware, the microcontroller, the system architecture, or the C programming language it will be much more difficult. In most cases, assumptions were made in the original design and development that are no longer true in the newer tools — it is your job to find and correct these problems.
C51 Versions 6.20 and later add a number of new compiler optimizations that shrink program size. Version 6.23 offers linker code packing which further reduces program size. These new optimizations may break existing applications because the code generated may execute faster or slower than previous versions and because the optimizer may even remove dead code entirely. Therefore, you must carefully migrate the source code, one file at a time if necessary, to the newer tools.
Fortunately, you can migrate the application in a methodical process that will help you locate and identify program modules that have problems with the new optimizations.
For this article, we'll refer to C51 Versions prior to 6.20 as OLDER and Versions 6.20 and later as NEWER.
The idea is to create a copy of your current project that allows you to migrate your source files from the OLDER compiler to the NEWER compiler. In the KEILC51BIN folder (which contains the NEWER tools), you must have copies of the C51.EXE file from the OLDER and from the NEWER tools. You must create a project that has groups for the OLDER files and for the NEWER files. Batch files must be created that copy the OLDER and NEWER compilers to C51.EXE so that uVision can build the proper OBJ files. Initially, all source files will be added to the OLDER group (which will compile using the OLDER compiler).
copy /b c:keilc51inc51_v610.exe c:keilc51inc51.exe
copy /b c:keilc51inc51_v623.exe c:keilc51inc51.exe
You should now be able to build your project (using the ORDER compiler and the NEWER linker). It should work exactly as it did before. If it does not, check the listing files for each C file to be sure that the OLDER compiler build the object file. The compiler version number is listed in the page header.
If you cannot get your program to work using the OLDER compiler and the NEWER linker, you may have a problem with the order of the files in the project.
Once you can build your project with the OLDER compiler and link it with the NEWER linker, you are ready to start migrating to the NEWER compiler.
Article last edited on: 2006-02-16 17:47:05
Did you find this article helpful? Yes No
How can we improve this article?