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.

DSP/BIOS to SYS/BIOS migration linking problems with undefined memory sections

Hi,

I am migrating a DSP/BIOS project to legacy SYS/BIOS and I am facing problems with the final linking of the legacy out file.

The initial DSP/BIOS project builds with Makefile (no CCS) and uses the following tools-packages:

DSP/BIOS 05.41.04.18, CGT 06.1.22

For the migration to legacy SYS/BIOS, I am using the following tools:

CGT 7.4.8, bios_6_34_05_24, xdctools_3_24_07_73


The initial .tcf configuration file for DSP/BIOS had some memory sections defined, like the one:

LOGRAM = MEM.create("LOGRAM");
LOGRAM.heapSize = 0x00E01F00
LOGRAM.len = 0x00E01F00
LOGRAM.base = 0xC91FE100

First, I used the conversion tool to create the cfg file for the legacy project.

The definition of the memory section is the same, in the new "legacy" .cfg file, as expected I suppose.

Then. I used the configuro tool to build the compiler.opt and linker.cmd files that I need to build with SYS/BIOS. The linker.cmd includes the memory sections in the MEMORY struct definition:

MEMORY
{

//some other memory sections

    LOGRAM : org = 0xc91fe100, len = 0xe01f00

//some other memory sections...

}

When I build my final project, I get "undefined symbols" errors referring to these memory sections, although I include the linker.cmd in the linking command. Also, I see these memory sections created in my projects .map file.

My questions are:

1) Should I expect any other files generated by the conversion of the tcf->cfg file to include this memory sections? I need to confirm that the conversion is done OK, I have seen various problems in the past.

2) Should I use any other files generated by the conversion or build (configuro) of the cfg file, in the build process of the whole project? I only use the compiler.opt and linker.cmd. Should I use the platform generated in the conversion step?

In simple words: I cannot figure out how my linking process can discover these memory sections (although I see them created in the map file)

Any help would be appreciated.

  • Nasos,
    your SYS/BIOS installation contains the directory docs, and in it you can find Bios Legacy App Note. You may want to read carefully Sections 2. Converting Your Configuration and 5. Migrating Memory Configurations. In short, the conversion tool generates a platform package that you need to use in your project. You may have done it already if linker.cmd contains LOGRAM.
    Also, check this guide: http://rtsc.eclipse.org/docs-tip/Consuming_Configurable_Content/makefiles.

    For 1), you'll get a CFG script, an optional header file and a platform package. Whichever of these is generated, you'll need to use them.

    For 2), yes you need to use whatever is generated by the conversion tool, and then only linker.cmd and compiler.opt from the configuro output. More details are given in that makefile guide I linked above. The conversion tool generates the platform, which specifies LOGRAM. configuro uses that platform and generates linker.cmd with LOGRAM. Since you already have that, please post the complete console output with the error message. You may have some different unrelated problem in your build.

  • Hi Sasha,


    thanks for your respond.

    Indeed, my migration steps are according the spraas7 guide that you mention. I am also aware of the rtsc page regarding makefiles.

    However, I still cannot find out what is the problem. The steps, I followed:

    Step 1

    I did the conversion of the project6746_legacy.tcf to project6746_legacy.cfg with this command:

    >C:\ti\xdctools_3_24_07_73\xs.exe --xp "c:\ti\bios_6_34_05_24\packages" ti.bios.conversion --pr ".\myrepository" --pn project6746_legacy -i project6746_legacy.tcf

    and indeed, the project6746_legacy package was created. I also see the definition of the memory segments in the platform.xdc file inside .\myrepository\project6746_legacy\ directory.

    Also, I got the project6746_legacycfg.h header file, which had only one line

    #include <xdc/cfg/global.h>

    Step 2

    I built the new project6746_legacy.cfg with the configuro tool with the following command:

    >c:\ti\xdctools_3_24_07_73\xs.exe --xdcpath="c:/ti/xdctools_3_24_07_73/packages;c:/ti/bios_6_34_05_24/packages;c:/ti/ipc_1_25_03_15/packages;c:/ti/uia_1_03_00_02/packages;c:/ti/xdais_7_21_01_07/packages;C:/ti/bios_6_34_05_24/packages/ti/bios/include;./myRepository" xdc.tools.configuro  -t ti.targets.C674 -p udp6746_legacy -c "c:\ti\ccsv6\tools\compiler\c6000_7.4.8" project6746_legacy.cfg

    And I got a folder with the output files including compiler.opt and linker.cmd among others.

    In the linker.cmd, I see the Memory structure containing the right sections, e.g.:

    MEMORY
    {
    ...

       LOGRAM : org = 0xc91fe100, len = 0xe01f00
    ....
    }

    Note: I noticed that the linker.cmd was missing an -l statement of a library .o674 generated from this step. When I added it manually, I got many legacy sys/bios symbols resolved.

    Step 3

    I built my project using the generated compiler.opt and the final linking is made using the linker.cmd file.

    However, I get error like this:

    undefined                                 first referenced
     symbol                                       in file

    _LOGRAM                                   ctrace.rel
    _LOGRAM_base                         fm.rel

    My questions are: the platform package is used only for the build of the cfg file?

    Are only the compiler.opt and linker.cmd useful for the build and linking of the final project?

    Should the project6746_legacycfg.h also include anything regarding those memory sections?

  • The symbols _LOGRAM and _LOGRAM_base are not automatically created by the linker or SYS/BIOS. You are probably referencing these symbols trying to get a heap handle and allocate memory. In DSP/BIOS 5, each heap had its own section and there were symbols assigned to the beginning of each section. In SYS/BIOS, heaps are managed differently, and it's possible to have multiple in one section.

    I am still trying to see if there is something that the conversion tool should have done, but it didn't. In the meantime, can you check your source code and let me know which API you are using when referencing _LOGRAM and _LOGRAM_base?

  • I also noticed that you linker.cmd does not contain a section for a heap in LOGRAM. I tried a simple test project and I could see a section generated for each heap. Also, it's not expected that you have to edit the generated linker.cmd. Can you send me your makefile too? There could be something else going wrong other than a missing heap handle.

  • The memory sections are defined in a single project header file like this:

    extern far const Uns LOGRAM;

    Then they are referred to from the source, mainly in alloc/free BIOS API command, e.g.:

    MEM_free(LOGRAM, buf, ctrace.traceSize);

    or

    MEM_alloc(LOGRAM, ....);

    or

    MEM_stat(LOGRAM, &statbuf)

    The makefiles environment has been set and tested with mailbox examples as mentions in spraas7, I have built the examples for DSP/BIOS, Legacy BIOS and SYS/BIOS so I believe there is not an error there. The conversion and configuro commands have run separately prior make and then I continued with makefiles for the build.

  • I can replicate now the issues you are seeing. The first problem with the missing -l option in the linker command file is caused by two different packages having the same name. Your platform is named 'udp6746_legacy' and your CFG script is called udp6746_legacy.cfg, which causes an automatically generated package 'udp6746_legacy' to be created. The name of that package is derived from the name of the CFG script.
    Try running configuro again, but this time either rename your CFG script to udp6746.cfg for example, or add the option -o configPkg:
    c:\ti\xdctools_3_24_07_73\xs.exe --xdcpath="c:/ti/bios_6_34_05_24/packages;./myRepository" xdc.tools.configuro  -t ti.targets.C674 -p udp6746_legacy -c "c:\ti\ccsv6\tools\compiler\c6000_7.4.8" -o configPkg udp6746_legacy.cfg
    Also notice that I removed all other components from the package path except for bios and myRepository. Your CFG script does not reference any package from other products, so no need to add them to the package path.

    I haven't found the cause for the second problem - missing LOGRAM symbols, but now when I can replicate it, I think I should be able to have more info quickly.

  • In your original TCF script, there is no statement that enables a heap in LOGRAM. You would have to have something like this:
    LOGRAM.createHeap = true;
    Without that, DSP/BIOS wouldn't create a section for the heap, and there wouldn't be a symbol _LOGRAM_base. So, try adding that line to the CFG script, right after the definition of LOGRAM. Then, also add a statement that will define a symbol that you can use in C:
    LOGRAM.enableHeapLabel = 1;
    LOGRAM.heapLabel = "LOGRAM";
    Now you can reference LOGRAM in C code. For _LOGRAM_base, you would have to do some editing in linker.cmd, but I am not sure if you still need that symbol. If yes, you should edit the line that defines _LOGRAM$heap section in SECTIONS directive to:
    _LOGRAM$heap: RUN_START(_LOGRAM_base) > LOGRAM

  • Hi Sasha,


    indeed the two solutions you suggested solved the two problems:

    1. the different name for package + config spec solved the missing -l statement in linker.cmd

    2. the two commands

    createHeap = true;/enableHeapLabel = 1;  in the original tcf

    in addition with

    _LOGRAM$heap: RUN_START(_LOGRAM_base) > LOGRAM in the linker.cmd

    solved the linking problems I was facing.

    Thank you for your contribution.