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.

SYS/BIOS XDCTOOLS locate sections

Hi,

We have recently moved a large existing code base to ccs5 and switched from COFF to ELF. We also use SYS/BIOS.

We now have to configure the linker using a .bld and .cfg file which is processed during the bios build phase. This produces bios_pe66_x.xdl which is to all intents and purposes a linker command file.

Where we used to end up with a single .const section - we now have 1139:

  82e9ace0    82e9ace0    00000001   00000001    r-- .const.1139

A similarly large number of .far and .fardata also.

 

Our sections configuration (via xdctools and the .cfg file) is:

  • Program.sectMap[".bss"]="DDR3";
  • Program.sectMap[".neardata"]="DDR3";
  • Program.sectMap[".rodata"]="DDR3";
  • Program.sectMap["xdc.meta"]="DDR3";
  • Program.sectMap[".text"]="DDR3";
  • Program.sectMap[".cio"]="DDR3";
  • Program.sectMap[".ti.decompress"]="DDR3";
  • Program.sectMap[".text"]="DDR3";
  • Program.sectMap[".far "]="DDR3";
  • Program.sectMap[".taskStackSection"]="DDR3";
  • Program.sectMap[".sysmem"]="DDR3";
  • Program.sectMap[".cinit"]="DDR3";
  • Program.sectMap[".init_array"]="DDR3";
  • Program.sectMap[".ti.handler_table"]="DDR3";
  • Program.sectMap[".args"]="DDR3";
  • Program.sectMap[".switch"]="DDR3";
  • Program.sectMap[".data"]="DDR3";
  • Program.sectMap[".stack"]="DDR3";
  • Program.sectMap[".vecs"]="DDR3";
  • Program.sectMap[".fardata"]="DDR3";
  • Program.sectMap[".const"]="DDR3";

...

How do I configure the .cfg section above to consolidate all the .const.* sections into a single output section? Same for far and fardata?

I would also like to place the .const at the start of DDR3 before the .data and .text
Any help would be gratefully received. I have studied http://www.ti.com/lit/ug/spru186v/spru186v.pdf and spru187t.pdf and spraa46a.pdf 
With all these documents - the xdctools layer on top makes things a little more opaque.
Ian

  • If I edit the created bios_pe66_x.xdl with the changes below I get the desired effect. single const, far and fardata where I want them.

    Obviously this is a machine generated file. How can I achieve the results below using xdctools Program.SectionSpec Program.sectMap?

     

    • SECTIONS
    • {
    • ...
    •     GROUP: load > 0x80000400
    •     {
    •         .const:
    •         .far:
    •         .fardata:
    •     }
    • ...

     

     

     

     

    (I need to find out how to avoid double spacing when pasting in code)

     

  • Ian,
    which version of XDCtools are you using? We added some functionality recently that would apply in your case, but you would have to use XDCtools 3.20.04 or newer for that.

    The first config parameter that you need is Program.sectionsExclude. It allows you to remove sections from automatic allocation. This is how you would specify that you don't want XDCtools to allocate .const, .far and .fardata automatically:
    Program.sectionsExclude = "^\.const|^\.far|^\.fardata";

    Then, you need to generate your allocation for these sections. The easiest way to do it is to use Program.sectionsTemplate. This config parameter specifies a template that replaces the automatically generated directive SECTIONS with your own content:
    Program.sectionsTemplate = "../mySections.xdt";

    If you start the path to the template file with "../", then you can keep the template in the same directory with your config script. I am assuming you work in CCS, where your working directory is one level below where your config script is. If your setup is different, and you get an error message that the template file cannot be found, you'll have to adjust that relative path.
    Finally, you need to create the template file. It uses XDCtools-specific template syntax, but your goal is simple enough that it requires only a couple of lines of code:

        GROUP: load > 0x80000400
        {
            .const:
            .far:
            .fardata:
        }
    `$args[1]`

    The first couple of lines contain your allocation for .const, .far and .fardata. The last line add the allocation for the rest of the sections. Check the linked docs for Program.sectionsTemplate for more detailed explanation how it works.

  • Hi Sasha,

    Perfect answer!

    xdctools is 3.20.08.88 Following your instructions works just fine.

    Many thanks for your prompt assistance.

    By the way - how do I avoid double space lines when copying into the forum? You can see I resorted to formatting as an unordered list in my original post.

    Ian

  • I use shift+enter to go to the next line to avoid double space lines. It doesn't help when copying, but you can always copy and then edit out double new lines and use shift+enter. I don't know any better way.