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.

Compiler/TMS320F28377S: Linker issue with .const_cla section

Part Number: TMS320F28377S
Other Parts Discussed in Thread: C2000WARE

Tool/software: TI C/C++ Compiler

Hi,

I use C:\ti\c2000\C2000Ware_1_00_03_00\device_support\f2837xs\common\cmd\2837xS_FLASH_CLA_lnk_cpu1.cmd

and it compiles fine with e.g. the cla_iir2.2z_cpu01 example.

If I copy or link 2837xS_FLASH_CLA_lnk_cpu1.cmd to my own project, I get the errors

"J:/workspace/firmware/duc/device_support/f2837xs/common/cmd/2837xS_FLASH_CLA_lnk_cpu1.cmd", line 165: warning #10097:
   memory range not found: FLASHB on page 1
"J:/workspace/firmware/duc/device_support/f2837xs/common/cmd/2837xS_FLASH_CLA_lnk_cpu1.cmd", line 165: error #10265:
   no valid memory range(NULL) available for placement of ".const_cla"
"J:/workspace/firmware/duc/device_support/f2837xs/common/cmd/2837xS_FLASH_CLA_lnk_cpu1.cmd", line 165: error #10099-D:
   program will not fit into available memory.  load placement with
   alignment/blocking fails for section ".const_cla" size 0x2 page 1

As a workaround, in my own linker command file, I placed all to PAGE = 0 and all seems OK:

MEMORY
{
PAGE 0 :

    RAM4CLADATA     : origin = 0x008000, length = 0x000800  /* LS0 */

    FLASHE2J        : origin = 0x088000, length = 0x030000  /* firmware */

}


SECTIONS
{

    .scratchpad     : > RAM4CLADATA,    PAGE = 0
    .bss_cla        : > RAM4CLADATA,    PAGE = 0
    /* linker error if PAGE = 1, so RAM4CLADATA moved to PAGE = 0 */
    .const_cla      : LOAD = FLASHE2J,
                      RUN = RAM4CLADATA,
                      RUN_START(_cla_cons_run_start),
                      LOAD_START(_cla_cons_load_start),
                      LOAD_SIZE(_cla_cons_load_size),
                      PAGE = 0

}

This is similar to the suggestion in

Why does 2837xS_FLASH_CLA_lnk_cpu1.cmd not work in any case?

Are there problems when PAGE 0 is used?

Thanks,

Frank

  • Hi Frank,

    Are you using another linker command file in your project? Or only 2837xS_FLASH_CLA_lnk_cpu1.cmd?

    If you are using 2837xS_FLASH_CLA_lnk_cpu1.cmd, you should make sure that CLA_C=1 is predefined in your linker settings like the example shows.

    There is no problem with PAGE 0 being used. I think this is just a minor error with the linker file in your project.

    Hope this helps.

    Regards,

    sal

  • Hi Sal,

    thanks for your fast reply. I first tried my own linker file (derived from your examles) and then tried the example file 2837xS_FLASH_CLA_lnk_cpu1.cmd to verify the error I got. And YES, I get the error noted above with CLA_C=1 defined. Without CLA_C=1 I get

    warning #10247-D: creating output section ".bss_cla" without a SECTIONS
    specification
    warning #10247-D: creating output section ".const_cla" without a SECTIONS
    specification
    warning #10247-D: creating output section ".scratchpad" without a SECTIONS
    specification

    As said, my file works with PAGE = 0, however, it would be nice to know the reason why 2837xS_FLASH_CLA_lnk_cpu1.cmd does not.

    Thanks & regards
    Frank
  • I think the issue may be that where the memory is loaded to and where it is running from needs to be on the same page.

    Both either need to be page 0 or both page 1.

    sal
  • Hi Sal,

    sorry for the delayed response.

    Sal Pezzino said:
    I think the issue may be that where the memory is loaded to and where it is running from needs to be on the same page.

    Both either need to be page 0 or both page 1.

    sal

    This does not explain why 2837xS_FLASH_CLA_lnk_cpu1.cmd works with the cla_iir2p2z_cpu01 example: Here, the CLA LOAD (FLASHB, Page 0) and RUN (RAMLS1, Page 1) sections are on different sections.

    Is this a feature that is allowed to be used by TI employees only? ;-)

    Regards,

    Frank

  • Hi Frank,

    I apologize for the confusion. I was mistaken. The PAGE must only be consistent with where the code is RUNning from. So the original linker is fine.

    I am not sure what is causing the issue with linking your project.

    Can you provide me with more information, please? The exact linker command you are using. And the exact error message from the console.

    Thanks,
    sal
  • 5554.epwm_up_aq_cpu01.zipHi Sal,

    the problem can be reproduced as follows:

    - import e.g. epwm_up_aq_cpu1 example to ccs, copy to workspace option on

    - edit project options for CPU1_FLASH build:

     - replace 2837xS_Generic_FLASH_lnk.cmd with

       2837xS_FLASH_CLA_lnk_cpu1.cmd

     - predefine CLA_C=1 in linker

     - add cla support = cla1 in the compiler options

     - add a *.cla that populates .cla_const, .cla_bss

    - try to build CPU1_FLASH configuration

    This yields the error messages below. In the file enclosed you can find the modified project and also my own linker command file, that succeeds with PAGE=0 and produces the same error for PAGE=1. (By the way, I see no advantage to use the CLA_C #define, so I did not.)

    Regards,

    Frank

    **** Build of configuration CPU1_FLASH for project epwm_up_aq_cpu01 ****

    "C:\\ti\\ccsv7\\utils\\bin\\gmake" -k all

    'Building target: epwm_up_aq_cpu01.out'

    'Invoking: C2000 Linker'

    "C:/ti/ccsv7/tools/compiler/ti-cgt-c2000_16.9.1.LTS/bin/cl2000" -v28 -ml -mt --cla_support=cla1 --float_support=fpu32 -g --define=CPU1 --define=_FLASH --display_error_number --diag_warning=225 --diag_suppress=10063 -z -m"epwm_up_aq_cpu01.map" --stack_size=0x100 --warn_sections -i"C:/ti/ccsv7/tools/compiler/ti-cgt-c2000_16.9.1.LTS/lib" -i"C:/ti/ccsv7/tools/compiler/ti-cgt-c2000_16.9.1.LTS/include" -i"C:/ti/c2000/C2000Ware_1_00_03_00/device_support/f2837xs/common/cmd" -i"C:/ti/c2000/C2000Ware_1_00_03_00/device_support/f2837xs/headers/cmd" --reread_libs --define=CLA_C=1 --display_error_number --xml_link_info="epwm_up_aq_cpu01_linkInfo.xml" --entry_point=code_start --rom_model -o "epwm_up_aq_cpu01.out" "./F2837xS_CodeStartBranch.obj" "./F2837xS_DefaultISR.obj" "./F2837xS_EPwm.obj" "./F2837xS_GlobalVariableDefs.obj" "./F2837xS_Gpio.obj" "./F2837xS_PieCtrl.obj" "./F2837xS_PieVect.obj" "./F2837xS_SysCtrl.obj" "./F2837xS_usDelay.obj" "./cla.obj" "./epwm_up_aq_cpu01.obj"  -lrts2800_fpu32.lib -l2837xS_FLASH_CLA_lnk_cpu1.cmd -lF2837xS_Headers_nonBIOS.cmd -llibc.a

    <Linking>

    "C:/ti/c2000/C2000Ware_1_00_03_00/device_support/f2837xs/common/cmd/2837xS_FLASH_CLA_lnk_cpu1.cmd", line 165: warning #10097:

      memory range not found: FLASHB on page 1

    "C:/ti/c2000/C2000Ware_1_00_03_00/device_support/f2837xs/common/cmd/2837xS_FLASH_CLA_lnk_cpu1.cmd", line 165: error #10265:

      no valid memory range(NULL) available for placement of ".const_cla"

    "C:/ti/c2000/C2000Ware_1_00_03_00/device_support/f2837xs/common/cmd/2837xS_FLASH_CLA_lnk_cpu1.cmd", line 165: error #10099-D:

      program will not fit into available memory.  load placement with

      alignment/blocking fails for section ".const_cla" size 0x2 page 1

    error #10010: errors encountered during linking; "epwm_up_aq_cpu01.out" not

      built

    >> Compilation failure

    makefile:146: recipe for target 'epwm_up_aq_cpu01.out' failed

    gmake: *** [epwm_up_aq_cpu01.out] Error 1

    gmake: Target 'all' not remade because of errors.

    **** Build Finished ****

  • Frank,

    I have reproduced your problem following by your instruction and I will look for the reason and reply to you next Monday.

    Best Regards,
    Emma
  • Hi Frank,

    We have reproduced your issue with your example. Thank you.

    The issue is as Sal stated firstly, the memory in which a section is loaded to and run from, both need to be on the same PAGE. That means, that there is an issue with the linker command file in C2000Ware. We will fix this.

    The reason that the CLA examples do not demonstrate this issue, is that there are no CLA constants in the .cla files. So, the issue was not seen because nothing was being linked to the .const_cla memory section.

    Best Regards,
    Emma