This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F28388D: Question about the call of CLA Math

Other Parts Discussed in Thread: SYSCONFIG, C2000WARE

I've encountered an unusual issue with CLA math. After enabling CLA math through Sysconfig, I began testing it with some IQ formulations. Initially, everything worked fine, as demonstrated in the screenshot:

However, the moment I added the line "flt_Pg = _IQtoF(_IQ(0.2));", an error appeared, indicating that "_IQ24toF is first referenced," as seen in the second screenshot.

I've been grappling with this problem for a week now and am at a loss about what could be wrong. Also, I've included the necessary .h, .lib, and .cmd files in my project. To clarify clearly, I re-imported an IQmath example (see attached fig below) from C2000ware which runs error-free. However, adding the line tempZ_flt = _IQtoF(_IQ(0.3)) triggers the previously mentioned error regarding _IQtoF, that it's first referenced. After incorporating the .lib file (see attached fig below) and recompiling, the error persisted. Modifying the .cmd file from 2838x_RAM_lnk_CProj_cpu1 to IQmath_2838x_fpu32 resolved the issue, albeit with a warning (see attached fig below). Given this, (1)why does this phenomenon happen? (2) how can I solve the remained warning, which is also relevant to the cmd setting? (3) how to integrate a complete IQmath into an existing project, mainly considering the need to adjust the original cmd file without replacing it with IQmath_2838x_fpu32?

  • Sorry for the typo, it should be IQmath instead of CLA Math

  • Hi Eric,

    What's different between 2838x_RAM_lnk_CProj_cpu1.cmd and IQmath_2838x_fpu32.cmd? Can you share these?

    The warning about the entry point is expected and can be ignored. The compiler by default expects c_int00 to be the entry point. In this case, a different label (code_start) is the entry point, so it's throwing a warning.

    The picture showing the lab_cla_cc_f2838x project doesn't explicitly show an IQMath library in the project view. I presume the desired library is specified in the C2000 linker field of the project properties. Also, please make sure that under Project properties - C2000 Compiler - Processor options, you have --float_support = fpu32 (and not softlib).

    It's not necessary to add IQmath_fpu32_eabi.lib to the project. Adding IQmath_fpu32.lib will suffice. This is the index library that will pick the necessary IQmath library (IQmath_fpu32_coff.lib or IQmath_fpu32_eabi.lib) depending on the chosen output format.

    Thanks,

    Sira

  • Hi Sira,

    (1)

    2838x_RAM_lnk_CProj_cpu1.cmd is from the TI C2000ware sample, as shown in the following figure and Appendix 1.  

    IQmath_2838x_fpu32.cmd is from the IQMath lib file in C2000ware, as shown in  Appendix 2.

    (2) 

    Based on your advice, I have modified the settings accordingly; however, the issue persists.

    BTW, one of the directories in the file search path is unavailable, and I am unsure of its impact.

    (3)

    Appendix 1: 2838x_RAM_lnk_CProj_cpu1.cmd:

    //###########################################################################
    //
    // FILE: 2838x_RAM_lnk_CProj_cpu1.cmd
    //
    // TITLE: Linker Command File For C IQmath examples that run out of RAM
    //
    //
    //###########################################################################
    //
    //
    // $Copyright: Copyright (C) 2014-2023 Texas Instruments Incorporated -
    // http://www.ti.com/ ALL RIGHTS RESERVED $
    //###########################################################################

    MEMORY
    {
    /* BEGIN is used for the "boot to SARAM" bootloader mode */
    BEGIN : origin = 0x000000, length = 0x000002
    BOOT_RSVD : origin = 0x000002, length = 0x0001AE /* Part of M0, BOOT rom will use this for stack */
    RAMM0 : origin = 0x0001B0, length = 0x000250
    RAMM1 : origin = 0x000400, length = 0x000400 /* on-chip RAM block M1 */
    RAMD0 : origin = 0x00C000, length = 0x000800
    RAMD1 : origin = 0x00C800, length = 0x000800
    RAMLS0 : origin = 0x008000, length = 0x000800
    RAMLS1 : origin = 0x008800, length = 0x000800
    RAMLS2 : origin = 0x009000, length = 0x000800
    RAMLS3 : origin = 0x009800, length = 0x000800
    RAMLS4 : origin = 0x00A000, length = 0x000800
    RAMLS5 : origin = 0x00A800, length = 0x000800
    RAMLS6 : origin = 0x00B000, length = 0x000800
    RAMLS7 : origin = 0x00B800, length = 0x000800
    RAMGS0 : origin = 0x00D000, length = 0x001000
    RAMGS1 : origin = 0x00E000, length = 0x001000
    RAMGS2 : origin = 0x00F000, length = 0x001000
    RAMGS3 : origin = 0x010000, length = 0x001000
    RAMGS4 : origin = 0x011000, length = 0x001000
    RAMGS5 : origin = 0x012000, length = 0x001000
    RAMGS6 : origin = 0x013000, length = 0x001000
    RAMGS7 : origin = 0x014000, length = 0x001000
    RAMGS8 : origin = 0x015000, length = 0x001000
    RAMGS9 : origin = 0x016000, length = 0x001000
    RAMGS10 : origin = 0x017000, length = 0x001000
    RAMGS11 : origin = 0x018000, length = 0x001000
    RAMGS12 : origin = 0x019000, length = 0x001000
    RAMGS13 : origin = 0x01A000, length = 0x001000
    RAMGS14 : origin = 0x01B000, length = 0x001000
    RAMGS15 : origin = 0x01C000, length = 0x001000

    /* Flash sectors */
    FLASH0 : origin = 0x080000, length = 0x002000 /* on-chip Flash */
    FLASH1 : origin = 0x082000, length = 0x002000 /* on-chip Flash */
    FLASH2 : origin = 0x084000, length = 0x002000 /* on-chip Flash */
    FLASH3 : origin = 0x086000, length = 0x002000 /* on-chip Flash */
    FLASH4 : origin = 0x088000, length = 0x008000 /* on-chip Flash */
    FLASH5 : origin = 0x090000, length = 0x008000 /* on-chip Flash */
    FLASH6 : origin = 0x098000, length = 0x008000 /* on-chip Flash */
    FLASH7 : origin = 0x0A0000, length = 0x008000 /* on-chip Flash */
    FLASH8 : origin = 0x0A8000, length = 0x008000 /* on-chip Flash */
    FLASH9 : origin = 0x0B0000, length = 0x008000 /* on-chip Flash */
    FLASH10 : origin = 0x0B8000, length = 0x002000 /* on-chip Flash */
    FLASH11 : origin = 0x0BA000, length = 0x002000 /* on-chip Flash */
    FLASH12 : origin = 0x0BC000, length = 0x002000 /* on-chip Flash */
    FLASH13 : origin = 0x0BE000, length = 0x002000 /* on-chip Flash */
    CPU1TOCPU2RAM : origin = 0x03A000, length = 0x000800
    CPU2TOCPU1RAM : origin = 0x03B000, length = 0x000800

    CPUTOCMRAM : origin = 0x039000, length = 0x000800
    CMTOCPURAM : origin = 0x038000, length = 0x000800

    CANA_MSG_RAM : origin = 0x049000, length = 0x000800
    CANB_MSG_RAM : origin = 0x04B000, length = 0x000800
    RESET : origin = 0x3FFFC0, length = 0x000002
    }


    SECTIONS
    {
    codestart : > BEGIN
    .text : >> RAMD0 | RAMD1 | RAMLS0 | RAMLS1 | RAMLS2 | RAMLS3
    .cinit : > RAMM0 | RAMM1
    .switch : > RAMM0
    .reset : > RESET, TYPE = DSECT /* not used, */

    .stack : > RAMM1
    #if defined(__TI_EABI__)
    .bss : > RAMLS5
    .bss:output : > RAMLS3
    .init_array : > RAMM0
    .const : > RAMLS5
    .data : > RAMLS5
    .sysmem : > RAMLS4
    #else
    .pinit : > RAMM0
    .ebss : >> RAMLS5 | RAMLS6
    .econst : > RAMLS5
    .esysmem : > RAMLS5
    #endif

    ramgs0 : > RAMGS0
    ramgs1 : > RAMGS1

    MSGRAM_CPU1_TO_CPU2 > CPU1TOCPU2RAM
    MSGRAM_CPU2_TO_CPU1 > CPU2TOCPU1RAM
    MSGRAM_CPU_TO_CM > CPUTOCMRAM
    MSGRAM_CM_TO_CPU > CMTOCPURAM

    /* The following section definition are for IQMATH */
    IQmath : > RAMGS15
    IQmathTables : > RAMGS15
    IQmathTablesRam : > RAMGS15

    /* The following section definition are for SDFM examples */
    Filter_RegsFile : > RAMGS0
    Filter1_RegsFile : > RAMGS1, fill=0x1111
    Filter2_RegsFile : > RAMGS2, fill=0x2222
    Filter3_RegsFile : > RAMGS3, fill=0x3333
    Filter4_RegsFile : > RAMGS4, fill=0x4444
    Difference_RegsFile : >RAMGS5, fill=0x3333

    #ifdef __TI_COMPILER_VERSION__
    #if __TI_COMPILER_VERSION__ >= 15009000
    .TI.ramfunc : {} > RAMM0
    #else
    ramfuncs : > RAMM0
    #endif
    #endif

    }

    /*
    //===========================================================================
    // End of file.
    //===========================================================================
    */

    IQmath_2838x_fpu32.cmd:

    /*
    // TI File $Revision: /main/6 $
    // Checkin $Date: July 9, 2008 14:12:48 $
    //###########################################################################
    //
    // FILE: 28235_IQmath_lnk.cmd
    //
    // TITLE: Linker Command File For IQmath examples that run out of RAM
    //
    // NOTE; The example project uses memory protected by the
    // Code Security Module (CSM). Make sure the CSM is
    // unlocked before you load the project. One quick way
    // to do this on an erased device is to open a memory
    // window to the CSM password locations. If these locations
    // read back 0xFFFF (or non-zero), then the CSM is unlocked:
    //
    // Device Password locations
    // 28235: 0x33FFF8 - 0x33FFFF
    //
    //###########################################################################
    //
    //
    // $Copyright: Copyright (C) 2014-2023 Texas Instruments Incorporated -
    // http://www.ti.com/ ALL RIGHTS RESERVED $
    //###########################################################################
    */

    MEMORY
    {
    PAGE 0 :

    BEGIN : origin = 0x000000, length = 0x000002 /* Boot to M0 will go here */
    BOOT_RSVD : origin = 0x000002, length = 0x00004E /* Part of M0, BOOT rom will use this for stack */
    RAMM0 : origin = 0x000050, length = 0x0003B0

    RAML0 : origin = 0x008000, length = 0x001000
    RAML1L2 : origin = 0x009000, length = 0x003000
    ZONE7A : origin = 0x200000, length = 0x00FC00 /* XINTF zone 7 - program space */
    CSM_RSVD : origin = 0x33FF80, length = 0x000076 /* Part of FLASHA. Program with all 0x0000 when CSM is in use. */
    CSM_PWL : origin = 0x33FFF8, length = 0x000008 /* Part of FLASHA. CSM password locations in FLASHA */
    ADC_CAL : origin = 0x380080, length = 0x000009
    RESET : origin = 0x3FFFC0, length = 0x000002

    /* IQTABLES and IQTABLES2 are part of the boot ROM.
    The boot ROM is available in both program or
    data space so this can be defined on page 0 or page 1
    */

    /*
    IQTABLES : origin = 0x3FE000, length = 0x000b50
    IQTABLES2 : origin = 0x3FEB50, length = 0x00008c */

    /* CHANGED FOR TENOR */
    IQTABLES : origin = 0x3E9402, length = 0x000b50
    IQTABLES2 : origin = 0x3E9F52, length = 0x00008c

    FPUTABLES : origin = 0x3FEBDC, length = 0x0006A0
    BOOTROM : origin = 0x3FF27C, length = 0x000D44


    PAGE 1 :
    RAMM1 : origin = 0x000400, length = 0x000400 /* on-chip RAM block M1 */
    RAML4 : origin = 0x00C000, length = 0x001000
    RAML5 : origin = 0x00D000, length = 0x001000
    RAML6 : origin = 0x00E000, length = 0x001000
    RAML7 : origin = 0x00F000, length = 0x001000
    ZONE7B : origin = 0x20FC00, length = 0x000400 /* XINTF zone 7 - data space */
    }


    SECTIONS
    {
    /* IQmath inclues the assembly routines in the IQmath library
    IQmathTables is used by division, IQsin, IQcos, IQatan, IQatan2
    this is in boot ROM so we make it NOLOAD. Using
    the ROM version saves space at the cost of 1 cycle
    per access (boot ROM is 1 wait).
    IQmathTablesRam is used by IQasin, IQacos, and IQexp
    on 2833x and 2823x the IQNexpTable is in ROM so it
    is placed in its own section. If IQexp or IQNexp is
    not called by the program, this will cause a linker
    warning.
    */

    IQmath : > RAML1L2, PAGE = 0
    IQmathTables : > IQTABLES, PAGE = 0, TYPE = NOLOAD
    IQmathTables2 : > IQTABLES2, PAGE = 0, TYPE = NOLOAD
    IQmathTablesRam : > RAML4, PAGE = 1


    codestart : > BEGIN, PAGE = 0
    ramfuncs : > RAML0, PAGE = 0
    .text : > RAML1L2, PAGE = 0
    .cinit : > RAML0, PAGE = 0
    .pinit : > RAML0, PAGE = 0
    .switch : > RAML0, PAGE = 0

    .cio : > RAML4, PAGE = 1
    .stack : > RAMM1, PAGE = 1
    .ebss : > RAML4, PAGE = 1
    .econst : > RAML5, PAGE = 1
    .sysmem : > RAML5, PAGE = 1
    .esysmem : > RAMM1 | RAML4, PAGE = 1

    ZONE7DATA : > ZONE7B, PAGE = 1

    .reset : > RESET, PAGE = 0, TYPE = DSECT /* not used */
    csm_rsvd : > CSM_RSVD PAGE = 0, TYPE = DSECT /* not used for SARAM examples */
    csmpasswds : > CSM_PWL PAGE = 0, TYPE = DSECT /* not used for SARAM examples */

    /* Allocate ADC_cal function (pre-programmed by factory into TI reserved memory) */
    .adc_cal : load = ADC_CAL, PAGE = 0, TYPE = NOLOAD

    }

    /*
    //===========================================================================
    // End of file.
    //===========================================================================
    */

  • Eric, please give me a day or so to review this in more detail and get back to you.

  • Sure. Thanks your prompt reponse

  • Eric,

    Here's what I did. I downloaded the latest C2000Ware (v5.02.00), imported the 2838x IQMath project into CCS. The default build configuration of this project is Debug_fpu32IQMATH_EABI. This configuration uses EABI and fpu32, the .lib is the index library IQmath_fpu32.lib, and the .cmd file is 2838x_RAM_lnk_CProj_cpu1.cmd .I built this project and it built OK.

    Then I went inside IQsample.c and added your flt_pg float variable and the _IQtoF(_IQ(0.2)) statement. Building this resulted in a linker error about insufficient memory in RAMGS15. I opened the .map and it was interesting - the size is 0x1000 and the used space was 0xFFF, unused was 0x1. So the addition of this new line was causing it to run out of memory. In the .cmd, RAMGS15 is assigned to the IQMath sections. So I changed RAMGS15 from 0x1000 to 0x2000. Then it built without errors. I didn't get any unresolved symbol errors.

    Thanks,

    Sira

  • Hi Sira,

    I followed your guidance and tried the latest C2000Ware (v5.02.00). It works well, and I only encountered one warning, as detailed below

    However, I did run into problems with an earlier version. When I tried importing an example project again from C2000Ware v5.01.00, it failed to compile this time. Could you advise on how to resolve this compilation issue?

    Additionally, I’ve noticed that any changes I make to the code in an imported project persist even after I reinstall C2000Ware. How can I completely reset C2000Ware to its original state, free from any modifications I’ve previously made?

    Thanks for your help,

    Eric

  • Eric,

    1. Good to hear it works on C2000Ware v5.02.00. I would advise you to use that SDK version. I did make updates to the IQmath library and examples for this version of the SDK.

    2. When you import a project, one of two things could be happening. It could import the project directly into CCS with the source files still tied to the SDK, OR it could be imported into a CCS workspace with the files copied there. If it is the former, then when you delete and reinstall the SDK your changes would be wiped clean. However, if it is the latter, then you may be importing the same old project again and again from the workspace even though you reinstalled and replaced the SDK.

    Thanks,

    Sira

  • Hi Sira,

    How can I switch to the first option to ensure the original file in C2000Ware remains unchanged? During the process of importing example projects, I haven't encountered any options that allow me to do that. Could you guide me through this?"

    Thanks,

    Eric

  • Eric,

    It all depends on how the example project was developed. If it was developed using a CCS projectspec, then more than likely the source files for the project will be copied into the workspace, and not linked to the original source files in the project. So if you make changes, you are only editing the workspace files - copies - not the original source files. However, if the project is a .project/.cproject, then it would likely be linked to the original source files, and you will run into the issue you are describing.

    Thanks,

    Sira

  • Thank you!