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.

NDK command line build for C6657 - linker errors, unresolved symbols

Other Parts Discussed in Thread: SYSBIOS

Hello,

I am posting this based on advice from TI in my post here:

e2e.ti.com/.../537927

We want to do a command line build, using Linux, of a project which includes the NDK. I am attaching the very simple example I created to demonstrate the issue we are facing. In the single C file you will see one line of code with a comment next to it saying that this line causes the linker error. The linker error is in a comment above that line of code. The whole project is in the zip file.

The feedback I have had from TI is "In any case, based on this, it seems that the missing code is indeed in the PDK.  I think the problem is that your app just isn't linking all of the libraries that are required.  Note that the above library doesn't look to have those Osal_* symbols defined, either. I guess it's possible that the PDK requires you to build the nimu_osal*.c files into the application, but I'm not sure, as I'm not familiar with this product. I think the best option at this point is to ask the PDK team what libraries are needed to resolve these undefined symbols, and what are the best means of getting those libraries linked in (or, the best way to resolve these Osal* symbols)."

Please look at the linker.cmd file in the sysbios folder of the attached zip file to see that the OSAL library is indeed being linked. 

" -l"/opt/ivy-tools/ti/pdk_c665x_2_0_2/packages/ti/osal/lib/tirtos/c66/release/ti.osal.ae66" "

Thanks,

Geraldineexample3.zip

  • Hi Geraldine,

    I've forwarded this to the NDK expert. Feedback will be posted directly here.

    Best Regards,
    Yordan
  • Let me try build it and update.
    Thanks for your patience.
  • Can you please try to add the "test_osal.c" file in your code and rebuild it ?

    C:\ti\pdk_c665x_2_0_2\packages\ti\drv\emac\test\EmacLoopbackTest\test_osal.c

    I just created a SYSBIOS project in CCS and able to build it.

    Here is the log:

    **** Build of configuration Debug for project NDK_simple_C6657 ****

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

    'Building file: ../sysbios.cfg'

    'Invoking: XDCtools'

    "C:/ti/xdctools_3_32_00_06_core/xs" --xdcpath="C:/ti/ndk_2_24_01_18/packages;C:/ti/bios_6_45_00_19/packages;C:/ti/pdk_c665x_2_0_2/packages;C:/ti/ccsv6/ccs_base;" xdc.tools.configuro -o configPkg -t ti.targets.elf.C66 -p ti.platforms.evm6657 -r release -c "C:/ti/ccsv6/tools/compiler/ti-cgt-c6000_8.1.0" "../sysbios.cfg"

    making package.mak (because of package.bld) ...

    generating interfaces for package configPkg (because package/package.xdc.inc is older than package.xdc) ...

    configuring sysbios.xe66 from package/cfg/sysbios_pe66.cfg ...

    generating custom ti.sysbios library makefile ...

    Linking with library ti.transport.ndk.nimu:./lib/c6657/c66/release/ti.transport.ndk.nimu.ae66

    Linking with library ti.drv.emac:./lib/c6657/c66/ti.drv.emac.c6657.ae66

    Linking with library ti.drv.qmss:./lib/c66/ti.drv.qmss.ae66

    Linking with library ti.osal:./lib/tirtos/c66/release/ti.osal.ae66

    Linking with library ti.csl:./lib/c6657/c66/release/ti.csl.ae66;./lib/c6657/c66/release/ti.csl.intc.ae66

    Starting build of library sources ...

    making C:/Users/Titus/workspace_v6_1/NDK_simple_C6657/src/sysbios/sysbios.ae66 ...

    gmake[1]: Entering directory `C:/Users/Titus/workspace_v6_1/NDK_simple_C6657/src/sysbios'

    gmake[1]: Nothing to be done for `all'.

    gmake[1]: Leaving directory `C:/Users/Titus/workspace_v6_1/NDK_simple_C6657/src/sysbios'

    Build of libraries done.

    cle66 package/cfg/sysbios_pe66.c ...

    'Finished building: ../sysbios.cfg'

    ' '

    'Building file: ../ndkTest.c'

    'Invoking: C6000 Compiler'

    "C:/ti/ccsv6/tools/compiler/ti-cgt-c6000_8.1.0/bin/cl6x" -mv6600 --abi=eabi --include_path="C:/ti/ccsv6/tools/compiler/ti-cgt-c6000_8.1.0/include" -g --diag_warning=225 --diag_wrap=off --display_error_number --preproc_with_compile --preproc_dependency="ndkTest.pp" --cmd_file="configPkg/compiler.opt" "../ndkTest.c"

    'Finished building: ../ndkTest.c'

    ' '

    'Building target: NDK_simple_C6657.out'

    'Invoking: C6000 Linker'

    "C:/ti/ccsv6/tools/compiler/ti-cgt-c6000_8.1.0/bin/cl6x" -mv6600 --abi=eabi -g --diag_warning=225 --diag_wrap=off --display_error_number -z -m"NDK_simple_C6657.map" -i"C:/ti/ccsv6/tools/compiler/ti-cgt-c6000_8.1.0/lib" -i"C:/ti/ccsv6/tools/compiler/ti-cgt-c6000_8.1.0/include" --reread_libs --diag_wrap=off --display_error_number --warn_sections --xml_link_info="NDK_simple_C6657_linkInfo.xml" --rom_model -o "NDK_simple_C6657.out" "./ndkTest.obj" -l"configPkg/linker.cmd" -l"libc.a"

    <Linking>

    'Finished building target: NDK_simple_C6657.out'

    ' '

    **** Build Finished ****

    From this log, I found that, we also need to link the OSAL library.

    C:\ti\pdk_c665x_2_0_2\packages\ti\osal\lib\tirtos\c66\release\ti.osal.ae66

     


    Typicaly, in SYSBIOS code, we don't use the linker command file instead it would create automatically.

    So here is the linker command file generated using yours CCS based NDK example.

    Refer this file for your reference.

    linker.cmd

    /*
     * Do not modify this file; it is automatically generated from the template
     * linkcmd.xdt in the ti.targets.elf package and will be overwritten.
     */

    /*
     * put '"'s around paths because, without this, the linker
     * considers '-' as minus operator, not a file name character.
     */


    -l"C:\Users\Titus\workspace_v6_1\NDK_simple_C6657\Debug\configPkg\package\cfg\sysbios_pe66.oe66"
    -l"C:\ti\ndk_2_24_01_18\packages\ti\ndk\hal\timer_bios\lib\hal_timer_bios.ae66"
    -l"C:\ti\ndk_2_24_01_18\packages\ti\ndk\os\lib\os.ae66"
    -l"C:\ti\ndk_2_24_01_18\packages\ti\ndk\hal\userled_stub\lib\hal_userled_stub.ae66"
    -l"C:\ti\ndk_2_24_01_18\packages\ti\ndk\hal\eth_stub\lib\hal_eth_stub.ae66"
    -l"C:\ti\ndk_2_24_01_18\packages\ti\ndk\tools\cgi\lib\cgi.ae66"
    -l"C:\ti\ndk_2_24_01_18\packages\ti\ndk\tools\hdlc\lib\hdlc.ae66"
    -l"C:\ti\ndk_2_24_01_18\packages\ti\ndk\tools\console\lib\console_min.ae66"
    -l"C:\ti\ndk_2_24_01_18\packages\ti\ndk\netctrl\lib\netctrl.ae66"
    -l"C:\ti\ndk_2_24_01_18\packages\ti\ndk\nettools\lib\nettool.ae66"
    -l"C:\ti\ndk_2_24_01_18\packages\ti\ndk\hal\ser_stub\lib\hal_ser_stub.ae66"
    -l"C:\ti\ndk_2_24_01_18\packages\ti\ndk\tools\servers\lib\servers_min.ae66"
    -l"C:\ti\ndk_2_24_01_18\packages\ti\ndk\stack\lib\stk6_ppp_pppoe.ae66"
    -l"C:\Users\Titus\workspace_v6_1\NDK_simple_C6657\src\sysbios\sysbios.ae66"
    -l"C:\ti\pdk_c665x_2_0_2\packages\ti\transport\ndk\nimu\lib\c6657\c66\release\ti.transport.ndk.nimu.ae66"
    -l"C:\ti\pdk_c665x_2_0_2\packages\ti\drv\emac\lib\c6657\c66\ti.drv.emac.c6657.ae66"
    -l"C:\ti\pdk_c665x_2_0_2\packages\ti\drv\qmss\lib\c66\ti.drv.qmss.ae66"
    -l"C:\ti\pdk_c665x_2_0_2\packages\ti\osal\lib\tirtos\c66\release\ti.osal.ae66"
    -l"C:\ti\pdk_c665x_2_0_2\packages\ti\csl\lib\c6657\c66\release\ti.csl.ae66"
    -l"C:\ti\pdk_c665x_2_0_2\packages\ti\csl\lib\c6657\c66\release\ti.csl.intc.ae66"
    -l"C:\ti\bios_6_45_00_19\packages\ti\targets\rts6000\lib\ti.targets.rts6000.ae66"
    -l"C:\ti\bios_6_45_00_19\packages\ti\targets\rts6000\lib\boot.ae66"

    --retain="*(xdc.meta)"


    --args 0x0
    -heap  0x0
    -stack 0x1000

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

    /*
     * Linker command file contributions from all loaded packages:
     */

    /* Content from xdc.services.global (null): */

    /* Content from xdc (null): */

    /* Content from xdc.corevers (null): */

    /* Content from xdc.shelf (null): */

    /* Content from xdc.services.spec (null): */

    /* Content from xdc.services.intern.xsr (null): */

    /* Content from xdc.services.intern.gen (null): */

    /* Content from xdc.services.intern.cmd (null): */

    /* Content from xdc.bld (null): */

    /* Content from ti.targets (null): */

    /* Content from ti.targets.elf (null): */

    /* Content from xdc.rov (null): */

    /* Content from xdc.runtime (null): */

    /* Content from ti.targets.rts6000 (null): */

    /* Content from ti.sysbios.interfaces (null): */

    /* Content from ti.sysbios.family (null): */

    /* Content from xdc.services.getset (null): */

    /* Content from ti.csl (null): */

    /* Content from ti.osal (null): */

    /* Content from ti.drv.qmss (null): */

    /* Content from ti.drv.emac (null): */

    /* Content from ti.transport.ndk.nimu (null): */

    /* Content from ti.ndk.rov (null): */

    /* Content from ti.sysbios.rts (ti/sysbios/rts/linkcmd.xdt): */

    /* Content from xdc.runtime.knl (null): */

    /* Content from ti.sysbios.family.c62 (null): */

    /* Content from ti.ndk (null): */

    /* Content from ti.ndk.hal.timer_bios (null): */

    /* Content from ti.ndk.os (null): */

    /* Content from ti.ndk.hal.userled_stub (null): */

    /* Content from ti.ndk.hal.eth_stub (null): */

    /* Content from ti.ndk.tools.cgi (null): */

    /* Content from ti.ndk.tools.hdlc (null): */

    /* Content from ti.ndk.stack (null): */

    /* Content from ti.ndk.tools.console (null): */

    /* Content from ti.ndk.netctrl (null): */

    /* Content from ti.ndk.nettools (null): */

    /* Content from ti.ndk.hal.ser_stub (null): */

    /* Content from ti.ndk.tools.servers (null): */

    /* Content from ti.sysbios.family.c64p.tci6488 (null): */

    /* Content from ti.catalog.c6000 (null): */

    /* Content from ti.catalog (null): */

    /* Content from ti.catalog.peripherals.hdvicp2 (null): */

    /* Content from xdc.platform (null): */

    /* Content from xdc.cfg (null): */

    /* Content from ti.platforms.evm6657 (null): */

    /* Content from ti.sysbios (null): */

    /* Content from ti.sysbios.hal (null): */

    /* Content from ti.sysbios.knl (null): */

    /* Content from ti.sysbios.timers.timer64 (null): */

    /* Content from ti.sysbios.family.c64p (ti/sysbios/family/c64p/linkcmd.xdt): */

    /* Content from ti.sysbios.family.c66 (ti/sysbios/family/c66/linkcmd.xdt): */

    /* Content from ti.ndk.config (null): */

    /* Content from ti.sysbios.gates (null): */

    /* Content from ti.sysbios.heaps (null): */

    /* Content from ti.sysbios.xdcruntime (null): */

    /* Content from ti.sysbios.utils (null): */

    /* Content from configPkg (null): */

    /* Content from xdc.services.io (null): */


    /*
     * symbolic aliases for static instance objects
     */
    xdc_runtime_Startup__EXECFXN__C = 1;
    xdc_runtime_Startup__RESETFXN__C = 1;

    SECTIONS
    {
        .text: load >> MSMCSRAM
        .ti.decompress: load > L2SRAM
        .stack: load > L2SRAM
        GROUP: load > MSMCSRAM
        {
            .bss:
            .neardata:
            .rodata:
        }
        .cinit: load > MSMCSRAM
        .pinit: load >> L2SRAM
        .init_array: load > MSMCSRAM
        .const: load >> MSMCSRAM
        .data: load >> MSMCSRAM
        .fardata: load >> MSMCSRAM
        .switch: load >> MSMCSRAM
        .sysmem: load > MSMCSRAM
        .far: load >> MSMCSRAM
        .args: load > MSMCSRAM align = 0x4, fill = 0 {_argsize = 0x0; }
        .cio: load >> MSMCSRAM
        .ti.handler_table: load > L2SRAM
        .c6xabi.exidx: load > L2SRAM
        .c6xabi.extab: load >> L2SRAM
        sharedL2: load > MSMCSRAM
        systemHeap: load > MSMCSRAM
        .cppi: load > MSMCSRAM
        .qmss: load > MSMCSRAM
        .code: load > MSMCSRAM
        .vecs: load > MSMCSRAM
        emacComm: load > L2SRAM
        .far:taskStackSection: load > L2SRAM
        .far:IMAGEDATA: load > L2SRAM align = 0x8
        .far:NDK_OBJMEM: load > L2SRAM align = 0x8
        .far:NDK_PACKETMEM: load > L2SRAM align = 0x80
        xdc.meta: load > MSMCSRAM, type = COPY

    }

  • Hello Titus,

    I should have copied the text below from the original post. It seems like you have found the same workaround that we found. We added the file nimu_osal_c6657.c, and you have added the file test_osal.c. My question is why is this file needed?

    The generated linker.cmd file in the zip file I attached previously does include the line 

    -l"/opt/ivy-tools/ti/pdk_c665x_2_0_2/packages/ti/osal/lib/tirtos/c66/release/ti.osal.ae66"

    Why doesn't this library provide the symbols which show as being unresolved?

    Text from original post:

    In the meantime we found a workaround but it seems unwieldy, and if this is the only way to resolve things we'd like to understand why. The unresolved symbols are all defined as functions in the file 

    pdk_c665x_2_0_2/packages/ti/transport/ndk/nimu/example/helloWorld/src/nimu_osal_c6657.c

    If we include that file in our project, the build finishes without any errors. Many of the functions in this file look like stubs. Why would they be needed if the project is including the OSAL library? The generated linker.cmd file includes this line:

    -l"/opt/ivy-tools/ti/pdk_c665x_2_0_2/packages/ti/osal/lib/tirtos/c66/release/ti.osal.ae66"

    Thanks,
    Geraldine

  • Hello - is there any update on this?


  • I should have copied the text below from the original post. It seems like you have found the same workaround that we found. We added the file nimu_osal_c6657.c, and you have added the file test_osal.c. My question is why is this file needed?


    C:\ti\pdk_c665x_2_0_1\packages\MyExampleProjects\NIMU_emacExample_EVMC6657C66BiosExampleProject

    C6657 NIMU example (NDK hello world) code has "nimu_osal_c6657.c" source file in that project, so it seems your workaround is good.



    Also,
    Can you please try to use the linker command file which I have given in my previous post ?
    As I said, SYSBIOS code will generate the linker command file based on the .cfg and platform file.

  • Hello Titus,

    We will keep using our workaround then.

    Regards,

    Geraldine