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.

How to replace sharedRegion BIOS code in syslink with my own application code

Guru* 95265 points


Dear all,

Under ti\syslink\samples\rtos\sharedRegion, there are several files:
- package.bld
- SharedRegionApp.c

Inside package.bld, the testArray defines what source codes used in compilation like below:
     {name: 'sharedregion_c6678_core1',
        sources: ['SharedRegionApp'], config: "./c6678/SharedRegion_c6678_core1",
        copts: " -DSYSLINK_PLATFORM_C667X ",
        buildTargets: ["C66","C66_big_endian"],
        buildPlatforms: ["ti.syslink.samples.rtos.platforms.evm6678.core1"],
    },

My application has multiple source flies/folders, I added them into sources array like ['./folder1/file1', './folder2/folder21/file2',]. Questions:
Q1. It looks they only search the header files under the same directory, how do I add include path for searching?
Q2. It assumes the filename extension .c, how do I add an assmbly source file (.asm) or a CPP file?
Q3. Where can I add the library I need to link for executable?

Thanks! Eric    

  • Eric,

    Q1) You can add " -IYOUR_INCLUDE_PATH_HERE"  to your copts string.

    Q2) If the source file name provided has no extension, ".c" is assumed. You can override this by explicitly providing the full .c or .asm file name (ie SharedRegion.asm).

    Q3) Just after the "copts: ..."  add a lopts: " -lYOUR_LIBRARY_HERE"

    Alan

  • Alan,

    Thanks very much! What is the syntax for putting multiple items in copts?

    If I wrote:  
       copts: " -I./folder3 ",
    It is OK. The header can be found.

    If I wrote   
    syntax A:   
       copts: [" -I./folder3 ", " -I./folder4 "],
       Then I got an error: could not open source file ","
    syntax B:  
       copts: " -I./folder3 ", " -I./folder4 ",
       Then I got an error: missing : after property id
      
    Regards, Eric

  • Just concatenate the strings into a single copts or lopts string.

    Alan

  • Alan,

    I found out the correct syntax already.

    Regards, Eric

  • Alan,

    Sorry I want to re-open this thread since I met problem in Q3. I added libraries in lopts, but the libraies are not picked up. In the automatically generated .xdl file, it lists all the libraries used to link. Those I added in lopts are not there.

    Are you familar with the syslink build process or how the xdl is generated?

    Regards, Eric

     

  • Eric,
    the content of the string you pass through the option 'lopts' is added to the command line, not to the generated linker command file. Can you post your complete linker command line, so we can verify that? You can get the verbose xdc command output by setting the enviornment variable XDCOPTIONS=v.

    Your build is probably failing because the libraries added using lopts show up on the command line too early. By default, the linker does not go back to look for symbols in the libraries that are already processed. You can change that behavior by adding '-x' option:
    lopts: "-x -lYOUR_LIBRARY"

    If you prefer not to use that option, there is another option, albeit a little bit more complicated. You can add the file package.xs alongside package.bld. In that file you can explicitly state which libraries should be added to the linker command file. I am guessing that you are not building any library in your app package, so the only library you would have to add is the one you were passing through 'lopts'.
    In that case your getLibs() function would be very simple:
    function getLibs() {
        return "YOUR_LIBRARY";

    This version of getLibs() assumes that you are building only for one target. Otherwise, you would have to check first if you are building for the target that can link with YOUR_LIBRARY. Here is a guide for writing getLibs() that covers different use cases. If you need more help with this, please let me know.