4.6. Migrating CLA Code

The TI C28x (cl2000) compiler also compiles for the Control Law Accelerator (CLA). This accelerator is not needed when using TI C29x devices because of their improved performance over TI C28x devices.

In TI C28x applications, files with a .cla file extension and files compiled using the --cla_default command-line option use the CLA compiler. The CLA compiler can be used only with C source files, not with C++ source files.

When migrating C code that was compiled with CLA compiler, examine your code to see if changes are needed. In general, the CLA compiler is more restrictive than the general cl2000 compiler. For this reason, few changes are needed to migrate code that was compiled with the CLA compiler.

Look for the following CLA-specific code and make changes as needed:

  • CLA intrinsics: See Table 10-2 in the TMS320C28x Optimizing C/C++ Compiler User’s Guide (Section 10.2.2) for a list of intrinsics that were recognized only by the CLA compiler. Find an equivalent c29clang intrisic or write C/C++ code to accomplish the desired behavior.

  • Int sizes: The int size for CLA is 32 bits, which is the same size used for c29clang, but different from the TI C28x int size of 16 bits.

  • Pointer sizes: Pointer sizes for CLA are 16 bits, but for c29clang are 32 bits.

  • Section names: Sections called .bss_cla and .const_cla are specific to the CLA compiler and should be changed to .bss and .const. The .scratchpad section was used in place of a system stack.

You may also want to simplify code that was written in a more compilcated way to work around CLA limitations. Some of the CLA compiler limitations, which are not present for the c29clang compiler, were as follows:

  • Global and static data were not supported.

  • CLA code could not call C28x functions.

  • Recursive function calls were not supported.

  • Function pointers were not supported.

  • C standard libraries were not supported.

  • There was no C system heap, because there was no support for the malloc() function.

  • Data shared between C28x and CLA compilers had to be defined in the C28x code.

  • CLA0 and CLA1 did not support background tasks.