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.

Get use of a CE codec compiled into an existing GNUmake project...

Other Parts Discussed in Thread: OMAP3530

Based on your samples within EZSDK 5.01 it's a short time to get the first own test functions running within a codec driven by the CodecEngine. But at this state these functions are called by an application which also is based on your examples and, that's the main point, gets built by the XDC framework.

Now, before the actual work begins (implementing needed algorithms into the own codec, especially doing DSP optimization) I need to write a small wrapper which initializes the CodecEngine and provides some functions to access my codec. So far, so good. But I need this wrapper to be combinable with an existing, non-XDC project.

Currently I do this by using some library and compiler settings from your C6Accel project, it works, but it's no clean way. Okay, i might add our needed DSP functions to your C6Accel library. But it was so easy to add our (first test) functions into a codec, I don't need the comfort (and additional interface details) of C6Accel.

Now, there is the sample dualcpu_separateconfig, below apps/video_copy. The readme file there sounds very good, that is exactly what I need: make a codec by XDC framework, write a small wrapper around, build that by the XDC framework as well - and get an object file which can be linked to our GNUmake project.

BUT unfortunately exactly this part, the dualcpu_separateconfig/configured_CE_subsystem does not build - also not after renaming package.xdc.disabled into package.xdc and after repairing the error which leads to an access to config.build (instead of _config.bld) within the CE samples' root directory.

It was very nice, if somebody could give an helpful hint or statement concerning this dualcpu_separateconfig sample.

Thanks in advance,

Joern.

 

  • Joern,

    The dualcpu_separateconfig example is not yet in the latest version of Codec Engine that has been released.  It will be fixed in the GA version of Codec Engine, scheduled to be released in July or August.  However, with a few changes you should be able to get it to build and run.  I tried this out on OMAP 3530, and here are the steps I needed to do to get this example to build:

    - In dualcpu_separateconfig/configured_CE_subsystem:

        * Remove all references to TraceUtil in ceapp.c.  (TraceUtil is not supported in Codec Engine 3.x)

        * In ceapp.cfg, you need to change the DSP server from "video_copy" to "all_codecs".  This is what I have for OMAP3530:

    /*
     *  ======== ceapp.cfg ========
     */

    /* set "serverName" to point at the platform-specific server executable */
    var platform = Program.platformName;
    var platBinName = platform.replace(/\:/g, "_").replace(/\./g, "_");
    serverName = "bin/" + platBinName + "/all_DSP.x64P";

    print("serverName = " + serverName);

    xdc.useModule('ti.sdo.ce.global.Settings').profile = "debug";


    /* use and configure the osal. */
    var osalGlobal = xdc.useModule('ti.sdo.ce.osal.Global');
    osalGlobal.runtimeEnv = osalGlobal.DSPLINK_LINUX;

    /*
     *  ======== Engine Configuration ========
     */
    var Engine = xdc.useModule('ti.sdo.ce.Engine');
    var myEngine = Engine.createFromServer(
        "video_copy",        // Engine name (as referred to in the C app)
        // path to server exe, relative to its package dir
        serverName,
        "ti.sdo.ce.examples.servers.all_codecs" // server package
    );

        * In the makefile, I changed the XDCTARGET and XDCPLATFORM to the following:

    XDCTARGET = gnu.targets.arm.GCArmv5T
    XDCPLATFORM = ti.platforms.evm3530

         I also add the XDCARGS to the CONFIGURO command:

    CONFIGURO = XDCPATH="$(XDC_PATH)" XDCARGS="$(XDCARGS)" $(XDC_INSTALL_DIR)/xs xdc.tools.configuro

    - In the dualcpu_separateconfig/enduser_app makefile, you will need to add the -lrt and -ldl link options:

    app.out: app.o $(CONFIGURED_CE_SUBSYSTEM_OBJ)
        $(CC) -g -o $@ app.o $(CONFIGURED_CE_SUBSYSTEM_OBJ) -lpthread -lrt -ldl

    To build the configured_CE_subsystem and enduser_app, you should be able to just cd into that directory and run 'gmake'.

    Best regards,

        Janet

     

     

     

  • Joern,

    One thing I forgot to mention for building the "configured_CE_subsystem": In the makefile, you will also need to change the name of the config.bld.  The line in the makefile should be changed to the following:

    CONFIG_BLD := $(EXAMPLES_ROOTDIR)/_config.bld

    (Note the leading '_' has been added to the name.)

    Best regards,

        Janet

     

     

  • Janet,

    thanks for your hints, that helped me to get this sample built now (for ti.platforms.evmTI816X), as a base for a GNUmake interface to our own codec.

    The missing underscore in CONFIG_BLD I already had found myself, but I was happier if I would know the rules, the intentions behind this underscore... as I am very often missing an explained intention within the wood of configuration possibilities (all roads lead to rome - but why sometimes this, othertimes that way?) However, I don't need nothing but to get our codec compiled by that RTSC framework for our current platform and to get a simple interface to GMUmake projects. This now seems solveable for me, in a more clean way than before, thanks.

    One open point remains: the file linker.cmd, generated by the configuro tool, contains this line:

    INSERT BEFORE .gnu.attributes

    Currently I have to delete this line manually, otherwise the linkage of "configured_CE_subsystem" fails, with this error message:

    arm-none-linux-gnueabi-ld: .gnu.attributes not found for insert

    I assume, that somewhere an configuration entry should be done - maybe you've a hint for concerning this?

    Thanks in advance,

    Joern.

     

  • Joern,

    The reason for the naming "_config.bld", is in case you have another file named "config.bld" on your package path.  This way you will be sure to use the one from Codec Engine.

    I haven't seen the "INSERT BEFORE .gnu.attributes" in the generated linker.cmd file before, and I'm not sure what would be causing that.  My configuro generated linker.cmd didn't have that.  What version of the XDC tools are you using?

    Regards,

        Janet

  • Joern,
    which compiler and which version of it are you using? We need that line to be able to specify sections allocations in addition to the ones from the default linker script. The GNU compilers we tested always define the section .gnu.attributes, but we might have missed some that don't.

    There is no configuration parameter that would remove that line, but we can come up with some solution so you don't need to remove that line every time. You'll probably see some increase in the size of your executable image as a consequence of removing that line.

  • Sasha,

    I'm using the CodeSourcery G++ Lite, the compiler and linker versions are:

    arm-none-linux-gnueabi-gcc (Sourcery G++ Lite 2009q1-203) 4.3.3
    GNU ld (Sourcery G++ Lite 2009q1-203) 2.19.51.20090205

    The error message of arm-none-linux-gnueabi-ld seems to occur after one of the most recent EZSDK updates, Google deliveres some TI forum entries when looking for ".gnu.attributes not found for insert"...

    The application is built for ARM, so soft-float only is available - maybe this leads to the lack of the .gnu.attributes section? Maybe there is a gcc option missing? 

    Best regards,
    Joern.

     

    PS:

    Might the reason for the following error message be affecting the .gnu.attributes lack?

    ti.sdo.fc.ecpy.getLibs(): Can't find suffix for GCArmv5T target

    Thanks in advance,
    Joern.

  • Janet,

    I always prefer it to know the intention behind notations, so thank you very much for the explanation concerning "_config.bld". Maybe I would tend to choose a name being more talkatively, like CEmain_config.bld or CEroot_config.bld or ce_config.bld in this case, but however, to make a difference in naming is good for being sure to catch the right config file...

    Concerning "INSERT BEFORE .gnu.attributes" it might be a question of tools version, I am using the most current EZSDK 5.01 from June 1th. And maybe a question of platform target as well, as I found something concerning soft- and hard-float decision when lookin for the .gnu.attributes section...

  • Joern,
    can you post your linker command line? I think if the option '-Wl,-T,' is missing in front of linker.cmd, you would get such an error.

  • Joern,

    The Codec Engine examples _config.bld in general should not need to be modified, so I think that is the logic behind the leading '_'.

    Best regards,

        Janet

  • Sasha,

    thank you very much, you made my day, the option -T did it. But in detail:

    The original makefile from

    /somewhere/codec-engine_3_21_00_13_eng/examples/ti/sdo/ce/examples/apps/video_copy/dualcpu_separateconfig/configured_CE_subsystem/

    contained this:

    configured_CE_subsystem.o: ceapp.o $(LINKER_FILE)
        $(LD) -r -o $@ $^

    where LINKER_FILE contained the complete path of linker.cmd, and LD was containing in the end this:

    /somewhere/CodeSourcery/Sourcery_G++_Lite/bin/arm-none-linux-gnueabi-ld

    The latter makes that the option -Wl is not needed here; we call the linker directly. But '-T' actually is needed. In the beginning for a short time I thought of this direct use of the linker.cmd script at an object files position and was wondering about, but then I loosed the track of that.

    Now I changed the linker call within the makefile like this:

    configured_CE_subsystem.o: ceapp.o $(LINKER_FILE)
        $(LD) -T $(LINKER_FILE) -r -o $@ ceapp.o

    and all works fine for the moment, not to forget the changes above, suggested by Janet.

    Thanks again, Sasha!

    (Should be changed for the next EZSDK version, if possible!)

  • Janet,

    as a "keep hands off" rule it makes sense to me to spend those leading underscores, somewhat like "hidden" global variable names in C often got a leading '_' in the same manner. It's not perfect, but makes sense to me (the more if it was fixed as rule somewhere...) The somewhat increased safety (not to point to the wrong config.bld) I would see more as a side effect. Thanks for your explanation.

    Best regards,

    Joern.

  • Just as a late supplement, now regarding EZSDK 5.03 - just as some help for those starters which have discovered the dualcpu_separateconfig sample and so arrived at this thread:

    • All the hints by Jane from above seem to have been applicated now, within the delivered sample sources.
    • The above change, adding -T, yet is missing and must be done to get configured_CE_subsystem.o linked

    Currently I am building for DM8148 (instead of DM6467), so I had to change some other points below configured_CE_subsystem directory:

    • within ceapp.cfg:

    from
        serverName = "bin/" + platBinName + "/all_DSP.x64P";
    to
        serverName = "bin/" + platBinName + "/all_DSP.xe674";

    • within makefile I changed for consistency (don't know why the old value had been okay for DM6467):

    from
        XDCPLATFORM = ti.platforms.evm3530
    to
        XDCPLATFORM = ti.platforms.evmDM8148

    And as I had commented out all non-used codecs from the *.cfg files of the all_codecs server (and so VIDENC_copy and VIDDEC_copy, which I only needed now because of again checking around this sample here), so of course functions provided by these codecs had not been linked into configured_CE_subsystem.o and that lead to an linker error when building the enduser_app. Adding the missed codecs again to the all_codecs server removed this little self-made problem, too.

    Regards,
    Joern.

  • Thanks for the feedback, Joern.

    We're planning to review and clean up the CE examples in the next few months, so we'll take your feedback into account.

    Chris

  • Just another point which somewhat concerns this, to build a CE API into a single object file which may easily be combined with existing, GNUmake based projects...

    I've implemented such an API for a codec  server containing (until now) just one single codec, based on the universal_copy sample. I can access the codec functions (running on DSP side) from an ARM side application, by use of my little CE API.

    Now I added a library to my codec. FYI, it is a C wrapper around some C++ code (which is provided as a rtsc package then, for howto see here). I did this by using the API header of my small C wrapper and by adding a 'require' statement for theC wrapper package into package.xdc of the xDAIS codec package, where also I am calling the functions provided by this C wrapper.

    That works, the functionality implemented within C++, provided by the C wrapper, can be used within the now enhanced xDAIS codec, the ICodec package around and the codec server package are built without problems. If I acess the codec functions with my unchainged application, then I see the enhanced results from the enhanced xDAIS codec.

    The remaining problem is: if I want to link my little CE API concerning the new codec server, then the build process crys for an ARM version of my C wrapper library. Which I might build and provide, too, but there is actual no need, because in the end I never want to call the xDAIS codec's functions locally, always I want to call them remotely, from ARM side, but running on DSP side (and this obviously already is working). In this context I found, that there seems to be a linkage with the ARM version of my xDAIS codec, as well (wich might be the only reason for the cry for my C wrapper, but is obsolete, because I don't need nor use it on ARM side).

    It seems for me that within the configuration of the xDAIS / ICodec / codec server packages I have somehow to restrict the build to the DSP platform, so that the linkage with the codec engine stuff for the ARM side does no longer include the ARM side versions of the codec... But how? Or have I to provide a dummy ARM version of my C wrapper?

    Thanks in advance,
    Joern.

  • Okay, solved myself.

    The need was:

    See above, I have a codec, enhanced by a library which only shall be implemented for DSP at the moment. Leave this library out of being bound to my small, ARM side Codec Engine API for my codec.

    It was clear for me that I had to restrict concerning processor platforms, but where and how?

    Solution:

    First, for my small, external library for DSP side (provided to RTSC environment like described here) I changed the getLibs function in package.xs to return no library name for the ARM target, else (DSP in my case) the correct path and name to my externally built library.

    After some digging around I found how to get the current target name and now I do it this way:

    function getLibs(prog) {

      var targetname = prog.build.target.name;

      if ( targetname == "GCArmv5T" )
        return ("");
      else
        return ("./lib/cwrapper.lib");
    }

    Additionally, as now actually this library is missing for ARM builds, I had to prevent my xDAIS codec to be built for ARM, too. After some digging within the TI examples I found a solution which is working for me: for the package.bld for my xDAIS codec I had adapted that one from the TI xDAIS codec example universal_copy, and there for all possible targets concerning global settings for the whole platform library target definitions are constructed. Again I had to restrict this to DSP targets only:

    [...]
    for (var i = 0; i < Build.targets.length; i++) {

      var targ = Build.targets[i];

      if (targ.name == "GCArmv5T") {
        /* I don't want this on ARM side */
        continue;
      }
      else {
    [...]

    Where at both places a condition like targ.os == "Linux" would have been a more common solution, maybe.

    That's all - maybe it helps some other people or, at least, might be a sample for what background information seems not to be documented enough or at the right place...

    Regards,
    Joern.

  • You have a few options.

    The simplest is probably to enhance your '2nd' package to only return a library (from it's getlibs() fxn) when it has one (which wouldn't be when building for ARM).  This is described in this FAQ:

    http://processors.wiki.ti.com/index.php/Codec_Engine_FAQ#Why_does_my_GPP-side_application_try_.28and_fail.21.29_to_link_in_a_DSP-side_library

    If you don't have a library for the environment you're in, your getLibs() fxns shouldn't return one.  This option is probably A Good Thing To Do anyway.

    -------------------------

    Another approach is similar to what is discussed here

    http://e2e.ti.com/support/embedded/multimedia_software_codecs/f/356/t/109271.aspx

    Specifically, rather than unconditionally establishing a dependency between your codec and utility package (via 'requires' as you're doing) you could _conditionally_ establish the dependency.  Rather than 'requires', do a conditional loadPackage() in the codec's close() method in package.xs.

    The dependency could be made only when the "conditions are right".  Not sure what "right conditions" are in your case, but we could talk through it.

    Chris

  • Obviously our posts have crossed :-) - but nevertheless thanks a lot for throwing additional light upon this.

    Especially thanks for your hint concerning conditional loadPackage() - this way seems nicer for me than my solution, because condition and the library load are directly combined this way.

    Nevertheless, additionally I have to prevent the build of the codec for other platforms - like I did within package.bld. But maybe also this should better be done as well by not requiring the xDAIS codec within the ICodec package for all platforms, but by a conditional load within the package.xs there... I will try that out, thanks again.

    P.S.

    It works, now I have excluded all unwanted package loads from within package.xs, there close(). Helpful concerning this: xdc.IPackage. Especially note the notes there containing this:

    if (xdc.om.$name == "cfg") 
    {
    print(Program.build.target.name);
    }

    This value can be used for target-specific decisions concerning loading or not loading a package...

    Regards,
    Joern.

  • hi

    Joern

    can you give me the whole codes of  the "dualcpu_separateconfig",or anothe good examples.and tell me  how to build this.

    my email is lbm9527@126.com.

    Regards,
    LEE.