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.

TMS320F280025C: IQmath code not running with flash linker command file.

Part Number: TMS320F280025C
Other Parts Discussed in Thread: C2000WARE

I have a project that uses functions in the IQmath library. The project runs without issues when I use RAM configurations. I used the "28002x_IQmath_lnk_CProj.cmd" from the C2000Ware directory. I understand that this linker file maps the code for RAM execution. As a next step I replaced the linker file with  "28002x_launchxl_demo_flash_lnk.cmd" that also comes from C2000Ware directory. Please note that I am using the LAUNCH-F280025C board as a hardware. The project builds and compile successfully. If I comment the code section that uses IQmath library then the codes executes without any issue. However if I upload the code again with IQmath code included then the CPU goes into some trap. I think that there is some issue in the  "28002x_launchxl_demo_flash_lnk.cmd" file relating to IQmath sections that is causing the processor trap. Please guide in fixing this issue. If any one can share flash link command file for F280025C that successfully executes IQmath library functions then it will be very helpful.

  • Asad,

    Can you put IQMath sections in flash and then try?

    in the 28002x_launchxl_demo_flash_lnk.cmd file, 

    /* Allocate IQ math areas: */
    //IQmath : > RAMLS4567
    //IQmathTables : > RAMLS4567

    /* Allocate IQ math areas: */
    IQmath : > FLASH_BANK0_SEC1, PAGE = 0, ALIGN(4) /* Math Code */
    IQmathTables : > FLASH_BANK0_SEC2, PAGE = 0, ALIGN(4)

  • Thanks a lot for the prompt reply.  This resolves the issue.

  • There might be one issue.  In the linker file the .text is  FLASH_BANK0_SEC1 & FLASH_BANK0_SEC2 are already assigned to other pointers such as .text and .cinit . Can we assign the same section for IQmathTables?. 

  • Asad, 

    If the flash sector has space, you can assign. If it does not have enough space, the linker will throw error. So if you do not see any linker error, it should be fine.

  • I am getting errors for .text section as below: 
    error #10099-D: program will not fit into available memory, or the section contains a call site that requires a trampoline that can't be generated for this section. placement with alignment/blocking fails for section ".text" size 0x3938page 0. Available memory ranges:
    FLASH_BANK0_SEC2 size: 0x1000 unused: 0x0 max hole: 0x0
    FLASH_BANK0_SEC3 size: 0x1000 unused: 0x0 max hole: 0x0
    FLASH_BANK0_SEC4 size: 0x1000 unused: 0x176 max hole: 0x176
    FLASH_BANK0_SEC5 size: 0x1000 unused: 0x1000 max hole: 0x1000 
    Please guide how can I extend the .text section to accommodate my code. I see that FLASH_BANK0_SEC6_7 is assigned to .const. I have tried appending FLASH_BANK0_SEC8 & FLASH_BANK0_SEC9 to .text section but the error remains the same. Sorry I am not well versed with the linker file concepts. Kindly suggest a way forward to resolving it.

  • Asad,

    Please take a look at this link which goes through Linker Command file details:

    You can refer to section "Split an Output Section Across Multiple Memory Range". It illustrates how to split a section across various sectors.

  • Santosh,

        Allocating the IQmath and IQmathTables to flash has fixed the issue of controller trap. However I have noticed a significant increase in my code execution time. While running the code from RAM it was taking 7 u-seconds. After shifting the IQmath sections to flash, the program execution time has increased to 12 u-seconds. May be there is some way to keep the IQmath sections in the RAM for faster code execution. Any ideas?.

  • Asad,

    IQMathTables is available in ROM, so we can use that.

    Can you try like this in your linker cmd file

    In MEMORY area, add following in page0

    /* IQTABLES is 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 = 0x3F1402, length = 0x0166D

    In SECTIONS area:
    IQmath : > FLASH_BANK0_SEC1, PAGE = 0, ALIGN(4) /* Math Code */

    IQmathTables : > IQTABLES, PAGE = 0, TYPE = NOLOAD

  • Dear Santosh,

    I will definitely try with your suggestions and update you about the results. Before doing this I want you to clarify one thing relating to linker command file. The example linker script file allocates only five sectors for code i.e. 
    ".text            : >> FLASH_BANK0_SEC2 | FLASH_BANK0_SEC3 | FLASH_BANK0_SEC4 | FLASH_BANK0_SEC5"

    I was facing issues as my code was not fitting into the above allocation. The solution that worked for me was to combine two flash sectors as one large unit. The following modification allows my project to compile and link successfully:

     .text            : >> FLASH_BANK0_SEC3 | FLASH_BANK0_SEC4 | FLASH_BANK0_SEC5_6 | FLASH_BANK0_SEC7

    where FLASH_BANK0SEC5_6 is defines as   : origin = 0x085000, length = 0x002000

    So I have a very basic question: Is it Okay if I combine all the available flash sectors into a single unit and allocate it to .text?.
    Is there any performance compromise while doing this?. 

  • Asad,

    Yes, it is ok to combine the flash sectors without any issue.