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.

TMS320C6674: Setting cache size in makefile project

Part Number: TMS320C6674
Other Parts Discussed in Thread: SYSBIOS

I am working on a project that uses TMS320C6674. It is a makefile project based on the example code in ipc_3_50_04_08\examples\C6678_bios_elf\ex11_ping (although it has been modified and expanded a lot).

Now I need to know, how can I enable L2 cache and choose the size for it?

'TMS320C66x DSP Cache User Guide' only says that if SYS/BIOS is used, it enables the cache.

'TI-RTOS Kernel (SYS/BIOS) User's Guide' says that in order to select cache size, one must create a custom platform.
I created a platform using the Platform Wizard. It generated several files (.zip, .bld, .mak, .xdc, .xs etc.). But how I can use these in a makefile project?

For testing, I created a CCS project, selecting 'Empty RTSC project'. The wizard required me to choose one of the platforms that came with the pdk. There was no option to choose a custom platform.
I did not find a way to change the platform from project options. So I created a new platform, checked 'Add Repository to Project Package Path' and selected by test project.
The path was included in project settings, but when I built the test project, CCS was not using the new platform.
In Project Properties dialog, Build > XDCtools > Basic Options, there is a field Platform, but it can not be modified.

So the questions are:
 1. How to select custom platform in CCS?
 2. How to select custom platform in makefile project?

  • Hi Pauli Lindgren,

     1. How to select custom platform in CCS?
     2. How to select custom platform in makefile project?

    After importing the project, Select the project and right-click, on the drop-down menu select "Build settings".

    In the dialog box, Select "General" on right and "Variant" on left. PFA

    Thanks

  • This only selects product variant. However, I noticed that in the Products tab on this dialog box, there is a field Platform, where I could select the custom platform I had made. I tested that, and it was working. The L2CFG register did have 03000004, which indicates that 256k L2 cache is in use.

    However, that did not solve the main problem: How to select stack size in a makefile project. Should I write somethin in the makefile, in the .cfg file, or what?

  • Hi Pauli,

     1. How to select custom platform in CCS?
     2. How to select custom platform in makefile project?

    Before creating the project, kindly create a platform using the steps mentioned on Page 144 of the TI-RTOS user guide spruex3v.pdf

    How to select stack size in a makefile project

    I will post my response ASAP.

    Thanks

  • Hi Pauli Lindgren,

    How to select stack size in a makefile project.

    The stack size can be set in the "Linker.cmd" file in every project. 

    I have attached the URL for Definitions in "Linker.cmd" https://software-dl.ti.com/ccs/esd/documents/sdto_cgt_Linker-Command-File-Primer.html

    https://software-dl.ti.com/codegen/docs/tiarmclang/compiler_tools_user_guide/compiler_manual/linker_description/05_linker_command_files/linker-command-files-stdz0751521.html

    Please refer to the above links and also refer to the example projects in PDK for "linker.cmd" usage.

    Thanks

  • The problem is that linker.cmd is created automatically by the build process, so it can not be modified. For cache setting, it contains the following lines:

    /* Content from ti.sysbios.family.c66 (ti/sysbios/family/c66/linkcmd.xdt): */
    ti_sysbios_family_c66_Cache_l1dSize = 32768;
    ti_sysbios_family_c66_Cache_l1pSize = 32768;
    ti_sysbios_family_c66_Cache_l2Size = 0;

    However, we are already using a secondary linker command file for adding more memory sections. So I added the following line in that file:

    ti_sysbios_family_c66_Cache_l2Size = 65536;

    That seems to work. When I checked the value of 'L2 Configuration Register' (address 0x01840000), it now contained value 03000002 as expected. However the .map file shows that the size of L2SRAM section is still the maximum, 00080000. So there was no space reserved for cache.
    Then I added the following line in the MEMORY section of my secondary linker file:

    L2DATA (RW) : org = 0x00800000, len = 0x40000

    But when building the project, the following error messages were displayed:

    <Linking>
    "bin/debug/configuro/linker.cmd", line 212: error: L2SRAM memory range has already been specified
    "bin/debug/configuro/linker.cmd", line 212: error: L2SRAM memory range overlaps existing memory range L2SRAM
    "bin/debug/configuro/linker.cmd", line 208: warning: absolute symbol
    "ti_sysbios_family_c66_Cache_l2Size" being redefined
    error: errors encountered during linking; "bin/debug/project_xxx.xe66" not built

    So, it seems that it is not possible to define stack size using secondary linker command file.

  • Hi Pauli,

    Please set the value in the "linker.cmd" and it is not auto-generated. And, we can only define the memory ranges here. You can select them from the following folder "C:\ti\ccs930\ccs\ccs_base\c6000\include\"

    Since the "L2SRAM" is configured in the ".cfg" file, It contradicts the memory map in the "linker.cmd".

    You can set the value of "65536" like the below example.

    MEMORY
    {
        L2SRAM (RWX) : org = 0x800000, len = 0x100000
        MSMCSRAM (RWX) : org = 0xc000000, len = 0x100000
        DDR3 : org = 0x80000000, len = 0x20000000
    }

    change the origin address (here it is org = 0x800000) and length as 0x10000 (equals 65536 ). Make sure it does not overlap the other memory parts, Here it is 0xc0000000 and 0x20000000

    Thanks,

  • The linker.cmd is located in folder bin/debug/configuro. Make clean deletes the whole bin folder, so it is not possible to keep the modified linker.cmd there.

    So, I copied the generated linker.cmd into another folder and edited it there. Then I added in makefile a command to copy the edited linker.cmd to the configuro folder.

    This works, but now one must remember to manually edit linker.cmd if any changes to configuration is made.

  • I was too fast to report this as solved. It did work on my Windows computer. But when I tried to build the project in Linux server, it failed.

    The reason was that linker.cmd contains absolute paths. In Windows, a path is for example:

      -l"C:\ti\ipc_3_50_04_08\packages\ti\sdo\utils\lib\utils\instrumented\utils.ae66"

    But in Linux it is:

      -l"/opt/ti3/ipc_3_50_04_08/packages/ti/sdo/ipc/lib/ipc/nonInstrumented/ipc.ae66"

    That resulted in dozens of linker errors.

  • Hi Pauli,

    We have the following queries,

    1. Could you post the detailed error log and the source?
    2. How have you been compiling IPC, which of the toolset have you been using
      1. C66x
      2. ARM

    Tools and Libraries differ for Windows and Ubuntu.

    Thanks

  • I am using C66x toolset. (TMS320C6674 does not have ARM cores.)

    The automatically generated linker.cmd file (for release version) contains the following absolute pathnames:

    -l"C:\Users\User\Documents\work\foo\dsp\bin\release\configuro\package\cfg\app_pe66.oe66"
    -l"C:\ti\ipc_3_50_04_08\packages\ti\sdo\ipc\lib\ipc\nonInstrumented\ipc.ae66"
    -l"C:\ti\ipc_3_50_04_08\packages\ti\sdo\utils\lib\utils\nonInstrumented\utils.ae66"
    -l"C:\Users\User\Documents\work\foo\dsp\bin\release\configuro\package\cfg\app_pe66.src\sysbios\sysbios.ae66"
    -l"C:\ti\pdk_c667x_2_0_16\packages\ti\drv\tsip\lib\c6678\c66\ti.drv.tsip.ae66"
    -l"C:\ti\pdk_c667x_2_0_16\packages\ti\csl\lib\c6678\c66\release\ti.csl.ae66"
    -l"C:\ti\bios_6_76_03_01\packages\ti\targets\rts6000\lib\ti.targets.rts6000.ae66"
    -l"C:\ti\bios_6_76_03_01\packages\ti\targets\rts6000\lib\boot.ae66"

    (Debug version have somewhat different pathnames.)

    If I only modify the settings for L2SRAM and ti_sysbios_family_c66_Cache_l2Size, the build works fine on Windows and cache
    size is correct.

    But when I compile it in Linux server, there are lots of errors "cannot find file" and undefined symbols. That is expected, since
    both the source code and libraries are in different folders.

    I don't know if the separator '\' causes problems on Linux. But I changed those to '/', and that works in Windows, too.
    Then I changed absolute paths of the generated library files into relative path, so the location of the source files should
    no more be a problem.

    -l"bin/release/configuro/package/cfg/app_pe66.oe66"
    -l"C:/ti/ipc_3_50_04_08/packages/ti/sdo/ipc/lib/ipc/nonInstrumented/ipc.ae66"
    -l"C:/ti/ipc_3_50_04_08/packages/ti/sdo/utils/lib/utils/nonInstrumented/utils.ae66"
    -l"bin/release/configuro/package/cfg/app_pe66.src/sysbios/sysbios.ae66"
    -l"C:/ti/pdk_c667x_2_0_16/packages/ti/drv/tsip/lib/c6678/c66/ti.drv.tsip.ae66"
    -l"C:/ti/pdk_c667x_2_0_16/packages/ti/csl/lib/c6678/c66/release/ti.csl.ae66"
    -l"C:/ti/bios_6_76_03_01/packages/ti/targets/rts6000/lib/ti.targets.rts6000.ae66"
    -l"C:/ti/bios_6_76_03_01/packages/ti/targets/rts6000/lib/boot.ae66"

    This still works on Windows. But in Linux, there are tons of errors.
    The linker does not find any of the library files. Not even those with relative path.
    Then I added ./ at the begin of the relative paths, but that didn't help in Linux, and it caused build to fail in Windows, too.

    I tried moving the library definitions to makefile, where I can use variables such as $(IPC_INSTALL_DIR) instead of C:
    /ti/ipc_3_50_04_08, but that caused build to fail even in Windows.

    Is there a way to upload a file here? Error log has so many errors that it is not convenient to include it here in the message.

  • Hi Paul,

    This still works on Windows. But in Linux, there are tons of errors.

    I appreciate your efforts for trying out this in Linux. But, we recommend our customers to work only on Windows especially for TI-RTOS SDK. As you have mentioned, problems arises in 

    • File Path and permissions.
    • Compiled binary in windows and Linux were totally different (Non-compatible, because of OS architecture).

    I tried moving the library definitions to makefile, where I can use variables such as $(IPC_INSTALL_DIR) instead of C:
    /ti/ipc_3_50_04_08, but that caused build to fail even in Windows.

    Is there a way to upload a file here? Error log has so many errors that it is not convenient to include it here in the message.

    Yes, you can attach the file using "Insert -> Image / Video/ File " option available below the post (Menu bar at the bottom).

    Thanks,

    Rajarajan U

  • We are using Linux in our Continuous Integration server. It compiles the SW and runs some tests. Only if everything is OK, the commit is integrated to Git master branch. So Linux is needed. If the automatically generated linker.cmd is used, everything works just fine.

    Here is the error log when build is done in Linux with the manually edited linker.cmd file:

    error_log1.txt
    <Linking>
    error: cannot find file "dsp/bin/release/configuro/package/cfg/app_pe66.oe66"
    error: cannot find file
       "C:/ti/ipc_3_50_04_08/packages/ti/sdo/ipc/lib/ipc/nonInstrumented/ipc.ae66"
    error: cannot find file
       "C:/ti/ipc_3_50_04_08/packages/ti/sdo/utils/lib/utils/nonInstrumented/utils.
       ae66"
    error: cannot find file
       "dsp/bin/release/configuro/package/cfg/app_pe66.src/sysbios/sysbios.ae66"
    error: cannot find file
       "C:/ti/pdk_c667x_2_0_16/packages/ti/drv/tsip/lib/c6678/c66/ti.drv.tsip.ae66"
    error: cannot find file
       "C:/ti/pdk_c667x_2_0_16/packages/ti/csl/lib/c6678/c66/release/ti.csl.ae66"
    error: cannot find file
       "C:/ti/bios_6_76_03_01/packages/ti/targets/rts6000/lib/ti.targets.rts6000.ae
       66"
    error: cannot find file
       "C:/ti/bios_6_76_03_01/packages/ti/targets/rts6000/lib/boot.ae66"
    
     undefined                                                  first referenced
      symbol                                                        in file
     ---------                                                  ----------------
     GateMP_Params_init                                         bin/release/obj/app/host_comm/host_comm_rx.oe66
     GateMP_create                                              bin/release/obj/app/host_comm/host_comm_rx.oe66
     GateMP_enter                                               bin/release/obj/app/host_comm/host_comm_rx.oe66
     GateMP_leave                                               bin/release/obj/app/host_comm/host_comm_rx.oe66
     GateMP_open                                                bin/release/obj/app/gem2/gem2.oe66
     Ipc_start                                                  bin/release/obj/app/main.oe66
     MessageQ_Params_init__S                                    bin/release/obj/app/host_comm/host_comm_rx.oe66
     MessageQ_alloc                                             bin/release/obj/app/host_comm/host_comm_rx.oe66
     MessageQ_create                                            bin/release/obj/app/host_comm/host_comm_rx.oe66
     MessageQ_free                                              bin/release/obj/app/host_comm/host_comm_tx.oe66
     MessageQ_get                                               bin/release/obj/app/host_comm/host_comm_tx.oe66
     MessageQ_open                                              bin/release/obj/app/host_comm/host_comm_rx.oe66
     MessageQ_put                                               bin/release/obj/app/host_comm/host_comm_rx.oe66
     MessageQ_registerHeap                                      bin/release/obj/app/main.oe66
     MessageQ_setReplyQueue                                     bin/release/obj/app/host_comm/host_comm_rx.oe66
     SharedRegion_getHeap                                       bin/release/obj/app/main.oe66
     ti_sysbios_BIOS_start__E                                   bin/release/obj/app/main.oe66
     ti_sysbios_family_c64p_EventCombiner_dispatchPlug__E       bin/release/obj/app/e1/e1drv.oe66
     ti_sysbios_family_c64p_EventCombiner_enableEvent__E        bin/release/obj/app/e1/e1drv.oe66
     ti_sysbios_family_c64p_Hwi_Params__init__S                 bin/release/obj/app/e1/e1drv.oe66
     ti_sysbios_family_c64p_Hwi_clearInterrupt__E               bin/release/obj/app/e1/e1drv.oe66
     ti_sysbios_family_c64p_Hwi_create                          bin/release/obj/app/e1/e1drv.oe66
     ti_sysbios_family_c64p_Hwi_disableInterrupt__E             bin/release/obj/app/e1/e1_task.oe66
     ti_sysbios_family_c64p_Hwi_enableInterrupt__E              bin/release/obj/app/e1/e1drv.oe66
     ti_sysbios_family_c64p_Hwi_eventMap__E                     bin/release/obj/app/e1/e1drv.oe66
     ti_sysbios_family_c66_tci66xx_CpIntc_clearSysInt__E        bin/release/obj/midware/host_mailbox/host_mailbox.oe66
     ti_sysbios_family_c66_tci66xx_CpIntc_disableHostInt__E     bin/release/obj/midware/host_mailbox/host_mailbox.oe66
     ti_sysbios_family_c66_tci66xx_CpIntc_enableAllHostInts__E  bin/release/obj/midware/host_mailbox/host_mailbox.oe66
     ti_sysbios_family_c66_tci66xx_CpIntc_enableHostInt__E      bin/release/obj/midware/host_mailbox/host_mailbox.oe66
     ti_sysbios_family_c66_tci66xx_CpIntc_enableSysInt__E       bin/release/obj/midware/host_mailbox/host_mailbox.oe66
     ti_sysbios_family_c66_tci66xx_CpIntc_getEventId__E         bin/release/obj/midware/host_mailbox/host_mailbox.oe66
     ti_sysbios_family_c66_tci66xx_CpIntc_mapSysIntToHostInt__E bin/release/obj/midware/host_mailbox/host_mailbox.oe66
     ti_sysbios_hal_Hwi_Params__init__S                         bin/release/obj/midware/fpga/fpga.oe66
     ti_sysbios_hal_Hwi_clearInterrupt__E                       bin/release/obj/midware/fpga/fpga.oe66
     ti_sysbios_hal_Hwi_create                                  bin/release/obj/midware/fpga/fpga.oe66
     ti_sysbios_knl_Clock_getTicks__E                           bin/release/obj/app/e1/e1app.oe66
     ti_sysbios_knl_Event_create                                bin/release/obj/app/e1/e1test.oe66
     ti_sysbios_knl_Event_delete                                bin/release/obj/app/e1/e1test.oe66
     ti_sysbios_knl_Event_pend__E                               bin/release/obj/app/e1/e1test.oe66
     ti_sysbios_knl_Event_post__E                               bin/release/obj/app/e1/e1test.oe66
     ti_sysbios_knl_Semaphore_Params__init__S                   bin/release/obj/app/gem2/gem2.oe66
     ti_sysbios_knl_Semaphore_create                            bin/release/obj/app/gem2/gem2.oe66
     ti_sysbios_knl_Semaphore_pend__E                           bin/release/obj/app/gem2/gem2.oe66
     ti_sysbios_knl_Semaphore_post__E                           bin/release/obj/app/gem2/gem2.oe66
     ti_sysbios_knl_Task_Params__init__S                        bin/release/obj/app/main.oe66
     ti_sysbios_knl_Task_create                                 bin/release/obj/app/main.oe66
     ti_sysbios_knl_Task_getEnv__E                              bin/release/obj/midware/logprint/logprint.oe66
     ti_sysbios_knl_Task_self__E                                bin/release/obj/app/host_comm/host_comm_rx.oe66
     ti_sysbios_knl_Task_setEnv__E                              bin/release/obj/app/host_comm/host_comm_rx.oe66
     ti_sysbios_knl_Task_sleep__E                               bin/release/obj/app/host_comm/host_comm_rx.oe66
     xdc_runtime_Error_check__E                                 bin/release/obj/app/main.oe66
     xdc_runtime_Error_getData__E                               bin/release/obj/app/main.oe66
     xdc_runtime_Error_getMsg__E                                bin/release/obj/app/main.oe66
     xdc_runtime_Error_init__E                                  bin/release/obj/app/main.oe66
     xdc_runtime_System_abort__E                                bin/release/obj/app/main.oe66
    
    error: unresolved symbols remain
    error: errors encountered during linking; "bin/release/foo_app.xe66" not
       built
    

    Br.  Pauli

  • Hi Paul,

    Can you able o try the changes in linker.cmd,

    Replace this line : C:/ti/ipc_3_50_04_08/packages/ti/sdo/ipc/lib/ipc/nonInstrumented/ipc.ae66"
    with this line        : "/home/${USER}/ti/ipc_3_50_04_08/packages/ti/sdo/ipc/lib/ipc/nonInstrumented/ipc.ae66"

    Replace this line : "C:/ti/ipc_3_50_04_08/packages/ti/sdo/utils/lib/utils/nonInstrumented/utils.ae66"
    with this line        : "/home/${USER}/ti/ipc_3_50_04_08/packages/ti/sdo/utils/lib/utils/nonInstrumented/utils.ae66"

    Replace this line : "dsp/bin/release/configuro/package/cfg/app_pe66.src/sysbios/sysbios.ae66"
    with this line        : /home/${USER}/ti/ctoolslib_2_2_0_0/packages/ti/aet/examples/interrupt_on_stall/src/sysbios/sysbios.ae66

    Replace this line : "C:/ti/pdk_c667x_2_0_16/packages/ti/drv/tsip/lib/c6678/c66/ti.drv.tsip.ae66"
    with this line        : "/home/${USER}/ti/pdk_c667x_2_0_16/packages/ti/drv/tsip/lib/c6678/c66/ti.drv.tsip.ae66"

    Replace this line : "C:/ti/pdk_c667x_2_0_16/packages/ti/csl/lib/c6678/c66/release/ti.csl.ae66"
    with this line        : "/home/${USER}/ti/pdk_c665x_2_0_16/packages/ti/csl/lib/c6657/c66/release/ti.csl.ae66"

    Replace this line : "C:/ti/bios_6_76_03_01/packages/ti/targets/rts6000/lib/ti.targets.rts6000.ae66"
    with this line        : "/home/${USER}/ti/bios_6_76_03_01/packages/ti/targets/rts6000/lib/ti.targets.rts6000.ae66"

    PS: Replace "${USER}" with with your user name.

    If this doen't work out, you need to install CCS 9.3.0 (Version which comes with SDK) and on first start it will add / Import SDK components. Then Import the project and try to compile, The autogenerated "linker.cmd" may identify the missing packages.

    Thanks & Regards,

    Rajarajan U

  • That doesn't work since I don't even know what is the username used in the CI server. In addition, the location and versions of the libraries may be different from what I am using.

    So it looks like the cache can not be configured this way.

    Maybe I should just use the automatically generated linker.cmd file and configure the cache using functions defined in ti.sysbios.hal.Cache.

    I added the following in main.c:

    Cache_Size cache_sizes =
    {
    Cache_L1Size_32K, // l1pSize;
    Cache_L1Size_32K, // l1dSize;
    Cache_L2Size_256K // l2Size;
    };

    // At the begin of main function:

    /* Configure cache sizes */
    Cache_setSize(&cache_sizes);

    /* Non-cacheable memory areas */
    Cache_setMar((Ptr)0x8F000000, 0x8000, 0); // DDR3_MAILBOX_RESERVED

    This compiles OK, but I don't know if it actually works. And then, of course, one must ensure that the linker will not load anything at the cache area.

    By the way, the TMS320C66x DSP Cache User Guide mentions functions like CACHE_L2SetSize(). Such functions can not be found in bios_6_76_03_01.

  • Hi Paul,

    Maybe I should just use the automatically generated linker.cmd file and configure the cache using functions defined in ti.sysbios.hal.Cache.

    Yes, It is the recommended way.

    This compiles OK, but I don't know if it actually works. And then, of course, one must ensure that the linker will not load anything at the cache area.

    By the way, the TMS320C66x DSP Cache User Guide mentions functions like CACHE_L2SetSize(). Such functions can not be found in bios_6_76_03_01.

    You can also set those values in "Linker.cmd". Please refer to this documentation for "Linker.cmd" usage.

    Linker.cmd Documentation

    Linker.cmd SDK Documentation

    Thanks

    Rajarajan