SPRUIY8 October   2024 F29H850TU , F29H859TU-Q1 , TMS320C28341 , TMS320C28342 , TMS320C28343 , TMS320C28343-Q1 , TMS320C28344 , TMS320C28345 , TMS320C28346 , TMS320C28346-Q1

 

  1.   1
  2.   Abstract
  3.   Trademarks
  4. 1Introduction
  5. 2C28 to C29 CPU Migration
    1. 2.1 Use Cases
    2. 2.2 Key Differences
    3. 2.3 Source Code Migration
      1. 2.3.1 C/C++ Source Code
        1. 2.3.1.1 Pragmas and Attributes
        2. 2.3.1.2 Macros
        3. 2.3.1.3 Intrinsics
        4. 2.3.1.4 Inline assembly
        5. 2.3.1.5 Keywords
        6. 2.3.1.6 Data Type Differences
        7. 2.3.1.7 Tooling support for Migration
      2. 2.3.2 Assembly Language Source Code
    4. 2.4 Toolchain Migration
      1. 2.4.1 Compiler
      2. 2.4.2 Linker
      3. 2.4.3 CCS Project Migration
  6. 3CLA to C29 CPU Migration
    1. 3.1 Use Cases
    2. 3.2 Key Differences
    3. 3.3 Source Code Migration
      1. 3.3.1 C/C++ Source Code
        1. 3.3.1.1 Data Type Differences
        2. 3.3.1.2 Migrating CLAmath.h Functions and Intrinsics
        3. 3.3.1.3 Migrating C28 and CLA to the Same C29 CPU
        4. 3.3.1.4 Migrating C28 and CLA to Different C29 CPUs
      2. 3.3.2 Assembly Language Source Code
    4. 3.4 Toolchain Migration
  7. 4References

Migrating CLAmath.h Functions and Intrinsics

  1. The CLA compiler does not support math.h. A separate file CLAmath.h is used, which contains external references to functions/variables in the C2000Ware CLAmath library. These are hand optimized CLA assembly routines for specific operations (trig, div, sqrt, isqrt, exp, log). It also contains function redefinitions/mappings for code portability from C28 to CLA, such as:
    1. Mapping specific math.h functions and TMU intrinsics to CLA math library functions mentioned above. For example, if C28 code contains __cos (corresponding to the TMU instruction) or cosf, it will migrate without any updates to CLA because CLAmath.h maps __cos and cosf to CLAcos (in the CLAMath library) or CLAcos_inline (in CLAmath.h).
      1. So if user CLA code contains __cos, migrating to C29 will be similar to migrating C28 intrinsics to C29, as discussed in the C28-C29 source code migration section.
        1. The C29 compiler has a tool called c29clang-tidy which checks for use of C28 intrinsics and suggest alternatives if available, which is discussed here (under c29migration-c28-builtins). It is applicable here as well.
      2. If it contains cosf, migrating to C29 does not require any changes.
      3. However, if it contains CLAcos or CLAcos_inline, then the user needs to change all these calls to cosf. A mapping header file to assist in migration of CLAMath functions is planned.
    2. Mapping specific math.h functions and C28+FPU intrinsics to CLA intrinsics. For example, if C28 code contains __fmax (corresponding to the FPU instruction) or fmaxf, it will migrate without any updates to CLA because CLAmath.h maps __fmax and fmaxf to __mmaxf32 (the CLA intrinsic).
      1. So if user CLA code contains __fmax, migrating to C29 will be similar to migrating C28 intrinsics to C29, as discussed in the C28-C29 source code migration section.
        1. The C29 compiler has a tool called c29clang-tidy which checks for use of C28 intrinsics and suggest alternatives if available, which is discussed here (under c29migration-c28-builtins). It is applicable here as well.
      2. If it contains fmaxf, migrating to C29 does not require any changes.
      3. However, if it contains __mmaxf32, then the user needs to change all these calls to fmaxf. c29clang-tidy extension to check for CLA intrinsics is planned.
    3. If user code contains CLA intrinsics that do not map to a corresponding C28 intrinsic (for example, __mgeq, __mgequ, __mgt, __mgtu, __mleq, __mlequ, __mlt, __mltu, __mdebugstop), user code needs to be manually updated to fix them. c29clang-tidy extension to check for CLA intrinsics is planned.