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 clock function linking problem

Other Parts Discussed in Thread: SYSBIOS

Hi all,

 

I am trying to set up a periodic function in SYSBIOS that just posts a semaphore.  The relevant (XDCscript) code is below:

var semParams = new Semaphore.Params();
Program.global.mySem = Semaphore.create(0, semParams);

var clockParams = new Clock.Params;
clockParams.period = 1000;
clockParams.arg = "&mySem";
Program.global.myClock = Clock.create("&Semaphore_post", 1000, clockParams);

The problem is that linking fails with unresolved symbol on Semaphore_post (a BIOS function).  What is the correct syntax to get this to link?

 

Many thanks,

Brady

  • Brady,

    I think you need to just need to add the following line to your .cfg file:

    xdc.useModule('ti.sysbios.knl.Semaphore');

    You need to do this for all modules you use in your C code.

     

  • You also need to be sure that you have the following in all .c files that use Semaphore module.

    #include <ti/sysbios/knl/Semaphore.h>

    Can you send full linker error?

    -Karl-

  • David and Karl,

    I have both the #include in the c code and the xdc.useModule line in the .cfg file.  Here is the full linker error:

     undefined       first referenced                                              
      symbol             in file                                                   
     ---------       ----------------                                              
     _Semaphore_post Z:/trunk/df/taskProj/Debug/configPkg/package/cfg/mutex.p64P.obj

    error: unresolved symbols remain
    error: errors encountered during linking; "taskProj.out" not built

    >> Compilation failure
    gmake: *** [taskProj.out] Error 1
    gmake: Target `all' not remade because of errors.

     

    So pretty much exactly as I said and nothing else.  I can call Semaphore_post from the c code just fine, I just cannot use Semaphore_post as the clkFxn argument to Clock.create in the .cfg file.  Further, if I set up the clock using the C api rather than in the cfg file (functional c code below), it works just fine.

        Clock_Params clkParams;
        Clock_Params_init(&clkParams);
        clkParams.period = 1000;
        clkParams.startFlag = TRUE;
        clkParams.arg = (UArg)testSem;
        Clock_create(Semaphore_post, 1000, &clkParams, NULL);

  • Edit by way of post:  disregard the difference in variable names between this and my first post; it is not real.

     

    double edit: I just noticed the edit button...

  • Brady,
    I think your problem arose because the symbol 'Semaphore_post' does not exist.   Semaphore_XXX APIs used in your application are actually mapped to symbols that reflect the fully qualified RTSC path to the module (see ti/sysbios/knl/Semaphore.h).  I.e. the correct symbol for Semaphore_post is actually something like ti_sysbios_knl_Semaphore_post__F.

    You can get around this by using the XDC identifier for this function instead of using the symbol name.  Try

    Program.global.myClock = Clock.create(Semaphore.post, 1000, clockParams);

    instead of

    Program.global.myClock = Clock.create("&Semaphore_post", 1000, clockParams);


    Regards,
    Shreyas

  • Shreyas,

     

    Unfortunately, that does not work either.  I get an XDC runtime error:

    XDC runtime error: ti.sysbios.knl.Semaphore: no property named 'post'

     

    -Brady

  • I have to look into why this isn't working.  In the mean time you can use the following:

    Program.global.myClock = Clock.create("&ti_sysbios_knl_Semaphore_post__E", 1000, clockParams);

  • Shreyas,

     

    Thanks for all the help with this.  Unfortunately, that also does not work, and fails with this error:

    "package/cfg/mutex_p64P.c", line 2245: error: declaration is incompatible with "void ti_sysbios_knl_Semaphore_post__E(ti_sysbios_knl_Semaphore_Handle)" (declared at line 347 of "C:/PROGRA~1/TEXASI~1/bios_6_31_02_23/packages/ti/sysbios/knl/Semaphore.h")
    1 error detected in the compilation of "package/cfg/mutex_p64P.c".

     

    The problem here is that the generated mutex_p64P.c file declares the Semaphore_post function as taking an xdc_UArg argument type, while the declaration in Semaphore.h says it takes one of type ti_sysbios_knl_Semaphore_Handle.

     

    -Brady

  • Brady,
    sorry for sending you in different directions, but the right way to point to a function declared in a module is

    Program.global.myClock = Clock.create($externModFxn("ti.sysbios.knl.Semaphore.post"), 1000, clockParams);

    The function $externModFxn is not properly documented, and there is a bug filed about it.
    https://bugs.eclipse.org/bugs/show_bug.cgi?id=317123

    The purpose of that function is to state that the function passed as a parameter is declared in a RTSC module and no additional declaration should be generated. 

  • Sasha,

     

    Thanks, this was helpful.  It compiled, but it was still not actually posting the semaphore.  I changed the clock function arg from this:

    clockParams.arg ="&mySem";

    to this:

    clockParams.arg = Program.global.mySem;

    and now it works as expected.  Again, thanks to everyone for the help.

    -Brady