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.

Why the .switch and .const section is divided into few parts?

Other Parts Discussed in Thread: SYSBIOS

Hello

I'm using a C674 dsp, the compiler version is 7.4.2. I can see below in the map file:

1080558c    1080558c    00000014   00000014    r--
  1080558c    1080558c    00000014   00000014    r-- .switch.1

1080894c    1080894c    00000014   00000014    r--
  1080894c    1080894c    00000014   00000014    r-- .switch.2

  1080c080    1080c080    000001b8   000001b8    r-- .switch.3

86f30bd8    86f30bd8    00000008   00000008    r--
  86f30bd8    86f30bd8    00000008   00000008    r-- .const.1

  86f70e60    86f70e60    00005a32   00005a32    r-- .const.2

Why the section is devided into few parts? Thanks!

 

Best regards

Vincent

  • The linker splits sections like that when you use the split operator (">>") in the linker command file.  If you don't want them to be split, use the non-split placement operator (">").

  • Hello

        the linker command file is automatically generated. I find in the cfg file as below:

            Program.sectMap[".cinit"]                   = "PRIVATE_DATA_CORE_DSP";

            Program.sectMap[".switch"]                  = "DSP_L2RAM";

    but in cmd files:

        .cinit: load > PRIVATE_DATA_CORE_DSP

        .switch: load >> DSP_L2RAM

    How to select split operator (">>") or non-split placement operator (">")?

    Thanks!

    Best regards

    Vincent

  • I'm sorry, I don't know.  The cfg file system is external to the compiler.  This is probably not the best forum to get an answer to that question.

  • Vincent,
    the linker command file is automatically generated by XDCtools. I am guessing you are using SYS/BIOS or TI-RTOS, so this thread belongs to the TI-RTOS forum.

    Probably the easiest way to work around the default split-placement settings is to add an additional linker command script to your project, where you can specify:
    SECTIONS
    {
        .cinit: >> PRIVATE_DATA_CORE_DSP
        .switch: > DSP_L2RAM
    }
    or something similar. Then, in your CFG script you have to exclude these sections from the automatic generation, using the configuration parameter Program.sectionsExclude.
    Program.sectionsExclude = ".cinit | .switch";

    Also, keep in mind that the linker does not allow splitting some of the compiler-generated sections. I can't remember which ones, but it's documented in the linker's user guide.

  • Sasha Slijepcevic said:
    Also, keep in mind that the linker does not allow splitting some of the compiler-generated sections. I can't remember which ones, but it's documented in the linker's user guide.

    It varies by target, but .cinit may not be split on any target.

  • Hello

        Thanks for your suggestion. I use SYSBIOS. I can modify the linker command file as work around. but if the project is rebuilt, the linker command file is regenerated and all the modification is lost, so it is not convenient for code maintenance.

        Another question: has this split section any negative affection to code performance?


    Best regards
    Vincent

  • Vincent,
    which version of XDCtools are you using? There could be a better solution.

    I can't comment on code performance, I hope there is someone from the compiler team still checking this thread. They should be able to answer that.

  • Hello Sasha

        I'm using xdctools_3_24_03_33

    Best regards

    Vincent

  • Vincent,
    first I want to mention that my workaround doesn't include modifying the generated linker command file. You would create an additional linker command file and that file wouldn't be regenerated when the project is rebuilt.

    As for an alternative solution, we added a config parameter 'splitMap' to TI targets in 3.25, which allows you to define which sections can't be split. You would have to create a new file config.bld. In CCS5.5, CCS will recognize that file as a RTSC file, and it will automatically add it in Project Properties->CCS Build->XDCtools->Advanced Options->Build configuration file. If not, you'll have to type it in. Then, here is the content of that file:

    var C674 = xdc.module('ti.targets.elf.C674');|
    C674.splitMap[".switch"] = false;