I have modified one of the examples included in the codec engine examples, and I am trying to link in dsplib to be able to run an fft.
What files do I have to modify to link in the library?
Thanks in advance.
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.
I have modified one of the examples included in the codec engine examples, and I am trying to link in dsplib to be able to run an fft.
What files do I have to modify to link in the library?
Thanks in advance.
Jared Locke said:What files do I have to modify to link in the library?
You can add to the 'attrs' parameter of the PackageContent.addExecutable method. In the server's directory is a file named package.bld, and in that file is a line similar to the following:
Pkg.addExecutable(name, targ, platform, {
copts: compileOpts,
profile: theProf,
cfgScript: cfg + ".cfg",
cfgArgs: "{ platform: \"" + platform + "\" }",
cfgArgs: "{ lld : " + lld + "}",
lopts: "-l link.cmd"
}).addObjects(srcs);
You can add to the 'lopts' line to link in a library:
lopts: "-l link.cmd -L <path to dsplib library> -l dsplib.<extension>"
where <extension> is whatever your library uses.
Regards,
- Rob
Don't I need it to build the codec, instead of the server? In the codec is where I am actually calling the functions.
Jared Locke said:Don't I need it to build the codec, instead of the server? In the codec is where I am actually calling the functions
Isn't your codec part of your server?
Only one program can be loaded on the slave processor, and this program can contain many codecs, all wrapped up in a codec server that arbitrates codec access.
Regards,
- Rob
Okay, I may have found where my problem lies. I think that when trying to compile the codec, it can't find header files.
I believe this was because I didn't have defines _TMS320C6740 and for __TI_COMPILER_VERSION__.
Where should these be set so that all the correct header files get included? What else do I need to do to be able to compile my codec that uses dsplib?
Jared Locke said:Okay, I may have found where my problem lies. I think that when trying to compile the codec, it can't find header files.
I believe this was because I didn't have defines _TMS320C6740 and for __TI_COMPILER_VERSION__.
Jared,
Those are compiler-generated symbols. With TI C6x CGT command 'cl6x' there needs to be an option of the form -mv<arch>, where <arch> can be 6740. However, that option should be automatically set for you by the RTSC tooling that is used to build SYS/BIOS programs, when you select a platform that uses the C674 RTSC package (or the C674elf package).
So I don't think that's your problem, given that you're building a Codec Engine example that has all the right plumbing prepackaged for you.
Have you set the DEVICE macro in the file <codecengine_install_dir>/examples/xdcpaths.mak correctly?
Regards,
- Rob
I've been stabbing in the dark and you've been making certain assumptions, so to move this along can you please show:
- the new dsplib-based code that you're adding
- why you thought that you needed to link in a dsplib library
- why you thought that header files were not being correctly included.
- anthing else you might think is pertinent to the issue.
Regards,
- Rob
So far, I haven't added any code, other than to include "inc/dsplib.h". I have also added the dsplib install path (and packages subdir) to XDC_PATH. I was just trying to get the codec to build before actually inserting any additional code.
I originally thought that I needed to link in the dsp library because when trying to build the codec, I was getting the error: #error invalid target when it was trying to include the header files. Since then, I went to the directory of one of the files indicated in the error, and discovered that the header file actually outputs the error "#error invalid target" when _TMS320C6740 is not defined (I have the c674 dsplib). After that, I added a define for _TMS320C6740 before I included dsplib.h and got the error that it couldn't find "C6xSimulator.h". I then traced that and found that it is only included when __TI_COMPILER_VERSION__ is not defined, which it says should only be done for a non TI compiler. Then I posted here asking about the defines because I figured that something else may be wrong if I have to define these.
If I do not include dsplib.h, then everything builds just fine, and runs on the OMAPL138.
Here are the versions that I am using:
dvsdk for omapl138 version 04_03_00_06 which includes codec engine version 2_26_02_11.
dsplib is version 3_1_1_1, downloaded for the c674
Thanks for all your help so far. I know it hasn't been very clear what the problem is.
I'm drawing a blank on this one...
Is it possible that you're *not* using a TI compiler?
I downloaded the dsplib 3_1_1_1 for the c674 and don't see any header files that look at __TI_COMPILER_VERSION nor check for _TMS320C6740.
What compiler are you using (and if a TI compiler, what version?)?
Regards,
- Rob
I have copied and modified an example from the codec engine (v2_26_02_11), so the make command includes xdcpaths.mak and then calls buildutils/xdcrules.mak. I'm not exactly sure how the xdc call builds everything, but I can only assume that it is using a TI compiler.
In xdcpaths.mak, CGTOOLS_V5T is set to an arm compiler that I downloaded (arm-2012.03), but I believe that only builds the arm side of the code. I also have CGTOOLS_C674 set to cgt6x_6_1_14 that is included in the dvsdk for the omapl138. I believe that is the compiler that is being called for building the codec.
In dsplib_3_1_1_1, in inc/dsplib.h, it includes a variety of different header files, the first being ti/dsplib/src/DSPF_blk_eswap16/DSPF_blk_eswap16.h. If I view that file (<dsplib_install_dir>/packages/ti/dsplib/src/DSPF_blk_eswap16/DSPF_blk_eswap16.h, it contains a ifdef as follows:
#if defined(_TMS320C6740)
#include <ti/dsplib/src/DSPF_blk_eswap16/c674/DSPF_blk_eswap16.h>
#else
#error invalid target
#endif
Then looking at the file included if _TMS320C6740 is defined, (ti/dsplib/src/DSPF_blk_eswap16/c674/DSPF_blk_eswap16.h), it contains the following ifndef:
#ifndef __TI_COMPILER_VERSION__ // for non TI compiler
#include "assert.h" // intrinsics prototypes
#include "C6xSimulator.h" // intrinsics prototypes
#include "C6xSimulator_type_modifiers.h" // define/undefine typing keywords
#endif
Jared,
Please accept my apology for the delay in responding. I have unfortunately been stricken with the flu. I'm just getting back into the swing of things and am catching up on forum support, so I will be looking into this today.
Nothing so far, although I would suggest that you also make a post to the TI Compiler forum (http://e2e.ti.com/support/development_tools/compiler/default.aspx). If you do so, I think it would help if you included a link to this forum thread.
Regards,
- Rob
Jared,
I went ahead and installed codec_engine_2_26_02_11 so I could try this out. I didn't use the dvsdk since that is much more involved, and since you're having difficulty building a CE codec. I also installed dsplib_3_1_1_1 and pointed XDC_PATH to its root, as well as the dsplib_3_1_1_1/packages subdir.
I don't know what codec file you're modifying with #include <inc/dsplib.h> so I just went ahead and picked main.c from the examples/servers/all_codecs directory. The build framework should be the same for all DSP-side content, so I thought it would suffice.
After adding
#include <inc/dsplib.h>
to that main.c, I was able to succesfully build the all_codecs server. Here is a snippet from the 'gmake' output for the compile command of main.c:
#
# cl674 main.c ...
/db/toolsrc/library/tools/vendors/ti/c6x/6.1.5/Linux/bin/cl6x -c -qq -pdsw225 -pden -pds=195 -mv6740 -eo.o674 -ea.s674 -Dxdc_cfg__header__='ti/sdo/ce/examples/servers/all_codecs/package/cfg/bin/ti_platforms_evmOMAPL138/all_x674.h' -Dxdc_target_name__=C674 -Dxdc_target_types__=ti/targets/std.h -Dxdc_bld__profile_release -Dxdc_bld__vers_1_0_6_1_5 -O2 -I. -I/db/atree/rt/codec_engine_2_26_02_11/examples/ti/sdo/ce/examples/servers/all_codecs/../../../../../.. -I/home/a0783933/ti/dsplib_3_1_1_1 -I/home/a0783933/ti/dsplib_3_1_1_1/packages -I/db/atree/rt/codec_engine_2_26_02_11/cetools/packages -I/db/atree/rt/codec_engine_2_26_02_11/packages -I/home/xlibrary/trees/sabios/sabios-m06/product/ccsv4/Linux/bios_5_41_00_06/packages -I/home/xlibrary/trees/link/link-l03/exports/dsplink-1_64-prebuilt/packages -I/db/rtree/library/trees/xdcprod/xdcprod-l18/product/Linux/xdctools_3_16_00_18/packages -I../../../../../.. -I/home/xlibrary/trees/sabios/sabios-m06/product/ccsv4/Linux/bios_5_41_00_06/packages/ti/bios/include -I/db/toolsrc/library/tools/vendors/ti/c6x/6.1.5/Linux/include -fs=./package/cfg/bin/ti_platforms_evmOMAPL138/all -fr=./package/cfg/bin/ti_platforms_evmOMAPL138/all -fc main.c
I have highlighted some key elements of the cl6x command in red above. Note the -mv6740 is present, and that the cl6x command comes from a TI CGT installation (I had to use 6.1.5 since we don't have 6.1.4 installed, but it should be close enough).
Since your build finds the necessary dsplib header files then you must have your -I options set correctly (since the error is coming from one of them).
Do you get the same sort of verbose output from the (failing) compilation of your .c file? I didn't do anything special to generate that, so please take a look at your echoed compile command of the file that you're modifying and ensure that you are indeed using the correct compiler and that the command line has -mv6740.
Regards,
- Rob
The dsplib.h is actually included from the codec c file, not the servers, but I have looked at the output from building the codec, and see a similar line. I'll just post from there until the errors:
When it builds for the dsp, it seems to be fine, but then there is a section "clv5T" where it seems to use the arm compiler, and runs into the problem. I'm really not sure what is going on here, as I don't fully understand how xdc decides how and what to build.
======== .libraries [/home/jlocke/Documents/Local-Projects/2385/Software/Linux/examples/ti/xdais/dm/examples/dsp_fft] ========
rm -f package/lib/lib/profile/dsp_fft/dsp_fft.o674
#
# cl674 dsp_fft.c ...
/home/jlocke/ti-dvsdk_omapl138-evm_04_03_00_06/cgt6x_7_4_2/bin/cl6x -c -qq -pdsw225 -pden -pds=195 -mv6740 -eo.o674 -ea.s674 -Dxdc_target_name__=C674 -Dxdc_target_types__=ti/targets/std.h -Dxdc_bld__profile_profile -Dxdc_bld__vers_1_0_7_4_2 --gen_profile_info -I. -I/home/jlocke/Documents/Local-Projects/2385/Software/Linux/examples/ti/sdo/ce/examples/codecs/dsp_fft/../../../../../.. -I/home/jlocke/ti-dvsdk_omapl138-evm_04_03_00_06/codec-engine_2_26_02_11/packages -I/home/jlocke/ti-dvsdk_omapl138-evm_04_03_00_06/xdais_6_26_01_03/packages -I/home/jlocke/ti-dvsdk_omapl138-evm_04_03_00_06/linuxutils_2_26_02_05/packages -I/home/jlocke/ti-dvsdk_omapl138-evm_04_03_00_06/framework-components_2_26_00_01/packages -I/home/jlocke/ti-dvsdk_omapl138-evm_04_03_00_06/biosutils_1_02_02/packages -I/home/jlocke/ti-dvsdk_omapl138-evm_04_03_00_06/edma3lld_01_11_02_05/packages -I/home/jlocke/ti-dvsdk_omapl138-evm_04_03_00_06/dsplib_3_1_1_1 -I/home/jlocke/ti-dvsdk_omapl138-evm_04_03_00_06/dsplib_3_1_1_1/packages -I/home/jlocke/ti-dvsdk_omapl138-evm_04_03_00_06/dspbios_5_41_03_17/packages -I/home/jlocke/ti-dvsdk_omapl138-evm_04_03_00_06/dsplink_1_65_01_05_eng -I/home/jlocke/ti-dvsdk_omapl138-evm_04_03_00_06/xdctools_3_16_03_36/packages -I../../../../.. -I/home/jlocke/ti-dvsdk_omapl138-evm_04_03_00_06/cgt6x_7_4_2/include -fs=./package/lib/lib/profile/dsp_fft -fr=./package/lib/lib/profile/dsp_fft -fc dsp_fft.c
"dsp_fft.c", line 339: warning #179-D: variable "j" was declared but never referenced
/home/jlocke/ti-dvsdk_omapl138-evm_04_03_00_06/xdctools_3_16_03_36/bin/mkdep -a package/lib/lib/profile/dsp_fft/dsp_fft.o674.dep -p package/lib/lib/profile/dsp_fft -s o674 dsp_fft.c -C -qq -pdsw225 -pden -pds=195 -mv6740 -eo.o674 -ea.s674 -Dxdc_target_name__=C674 -Dxdc_target_types__=ti/targets/std.h -Dxdc_bld__profile_profile -Dxdc_bld__vers_1_0_7_4_2 --gen_profile_info -I. -I/home/jlocke/Documents/Local-Projects/2385/Software/Linux/examples/ti/sdo/ce/examples/codecs/dsp_fft/../../../../../.. -I/home/jlocke/ti-dvsdk_omapl138-evm_04_03_00_06/codec-engine_2_26_02_11/packages -I/home/jlocke/ti-dvsdk_omapl138-evm_04_03_00_06/xdais_6_26_01_03/packages -I/home/jlocke/ti-dvsdk_omapl138-evm_04_03_00_06/linuxutils_2_26_02_05/packages -I/home/jlocke/ti-dvsdk_omapl138-evm_04_03_00_06/framework-components_2_26_00_01/packages -I/home/jlocke/ti-dvsdk_omapl138-evm_04_03_00_06/biosutils_1_02_02/packages -I/home/jlocke/ti-dvsdk_omapl138-evm_04_03_00_06/edma3lld_01_11_02_05/packages -I/home/jlocke/ti-dvsdk_omapl138-evm_04_03_00_06/dsplib_3_1_1_1 -I/home/jlocke/ti-dvsdk_omapl138-evm_04_03_00_06/dsplib_3_1_1_1/packages -I/home/jlocke/ti-dvsdk_omapl138-evm_04_03_00_06/dspbios_5_41_03_17/packages -I/home/jlocke/ti-dvsdk_omapl138-evm_04_03_00_06/dsplink_1_65_01_05_eng -I/home/jlocke/ti-dvsdk_omapl138-evm_04_03_00_06/xdctools_3_16_03_36/packages -I../../../../.. -I/home/jlocke/ti-dvsdk_omapl138-evm_04_03_00_06/cgt6x_7_4_2/include -fs=./package/lib/lib/profile/dsp_fft -fr=./package/lib/lib/profile/dsp_fft
rm -f package/lib/lib/profile/dsp_fft/package/package_ti.xdais.dm.examples.dsp_fft.o674
#
# cl674 package/package_ti.xdais.dm.examples.dsp_fft.c ...
/home/jlocke/ti-dvsdk_omapl138-evm_04_03_00_06/cgt6x_7_4_2/bin/cl6x -c -qq -pdsw225 -pden -pds=195 -mv6740 -eo.o674 -ea.s674 -Dxdc_target_name__=C674 -Dxdc_target_types__=ti/targets/std.h -Dxdc_bld__profile_profile -Dxdc_bld__vers_1_0_7_4_2 --gen_profile_info -I. -I/home/jlocke/Documents/Local-Projects/2385/Software/Linux/examples/ti/sdo/ce/examples/codecs/dsp_fft/../../../../../.. -I/home/jlocke/ti-dvsdk_omapl138-evm_04_03_00_06/codec-engine_2_26_02_11/packages -I/home/jlocke/ti-dvsdk_omapl138-evm_04_03_00_06/xdais_6_26_01_03/packages -I/home/jlocke/ti-dvsdk_omapl138-evm_04_03_00_06/linuxutils_2_26_02_05/packages -I/home/jlocke/ti-dvsdk_omapl138-evm_04_03_00_06/framework-components_2_26_00_01/packages -I/home/jlocke/ti-dvsdk_omapl138-evm_04_03_00_06/biosutils_1_02_02/packages -I/home/jlocke/ti-dvsdk_omapl138-evm_04_03_00_06/edma3lld_01_11_02_05/packages -I/home/jlocke/ti-dvsdk_omapl138-evm_04_03_00_06/dsplib_3_1_1_1 -I/home/jlocke/ti-dvsdk_omapl138-evm_04_03_00_06/dsplib_3_1_1_1/packages -I/home/jlocke/ti-dvsdk_omapl138-evm_04_03_00_06/dspbios_5_41_03_17/packages -I/home/jlocke/ti-dvsdk_omapl138-evm_04_03_00_06/dsplink_1_65_01_05_eng -I/home/jlocke/ti-dvsdk_omapl138-evm_04_03_00_06/xdctools_3_16_03_36/packages -I../../../../.. -I/home/jlocke/ti-dvsdk_omapl138-evm_04_03_00_06/cgt6x_7_4_2/include -fs=./package/lib/lib/profile/dsp_fft/package -fr=./package/lib/lib/profile/dsp_fft/package -fc package/package_ti.xdais.dm.examples.dsp_fft.c
/home/jlocke/ti-dvsdk_omapl138-evm_04_03_00_06/xdctools_3_16_03_36/bin/mkdep -a package/lib/lib/profile/dsp_fft/package/package_ti.xdais.dm.examples.dsp_fft.o674.dep -p package/lib/lib/profile/dsp_fft/package -s o674 package/package_ti.xdais.dm.examples.dsp_fft.c -C -qq -pdsw225 -pden -pds=195 -mv6740 -eo.o674 -ea.s674 -Dxdc_target_name__=C674 -Dxdc_target_types__=ti/targets/std.h -Dxdc_bld__profile_profile -Dxdc_bld__vers_1_0_7_4_2 --gen_profile_info -I. -I/home/jlocke/Documents/Local-Projects/2385/Software/Linux/examples/ti/sdo/ce/examples/codecs/dsp_fft/../../../../../.. -I/home/jlocke/ti-dvsdk_omapl138-evm_04_03_00_06/codec-engine_2_26_02_11/packages -I/home/jlocke/ti-dvsdk_omapl138-evm_04_03_00_06/xdais_6_26_01_03/packages -I/home/jlocke/ti-dvsdk_omapl138-evm_04_03_00_06/linuxutils_2_26_02_05/packages -I/home/jlocke/ti-dvsdk_omapl138-evm_04_03_00_06/framework-components_2_26_00_01/packages -I/home/jlocke/ti-dvsdk_omapl138-evm_04_03_00_06/biosutils_1_02_02/packages -I/home/jlocke/ti-dvsdk_omapl138-evm_04_03_00_06/edma3lld_01_11_02_05/packages -I/home/jlocke/ti-dvsdk_omapl138-evm_04_03_00_06/dsplib_3_1_1_1 -I/home/jlocke/ti-dvsdk_omapl138-evm_04_03_00_06/dsplib_3_1_1_1/packages -I/home/jlocke/ti-dvsdk_omapl138-evm_04_03_00_06/dspbios_5_41_03_17/packages -I/home/jlocke/ti-dvsdk_omapl138-evm_04_03_00_06/dsplink_1_65_01_05_eng -I/home/jlocke/ti-dvsdk_omapl138-evm_04_03_00_06/xdctools_3_16_03_36/packages -I../../../../.. -I/home/jlocke/ti-dvsdk_omapl138-evm_04_03_00_06/cgt6x_7_4_2/include -fs=./package/lib/lib/profile/dsp_fft/package -fr=./package/lib/lib/profile/dsp_fft/package
rm -f lib/profile/dsp_fft.a674
#
# archiving package/lib/lib/profile/dsp_fft/dsp_fft.o674 package/lib/lib/profile/dsp_fft/package/package_ti.xdais.dm.examples.dsp_fft.o674 into lib/profile/dsp_fft.a674 ...
/home/jlocke/ti-dvsdk_omapl138-evm_04_03_00_06/cgt6x_7_4_2/bin/ar6x rq lib/profile/dsp_fft.a674 package/lib/lib/profile/dsp_fft/dsp_fft.o674 package/lib/lib/profile/dsp_fft/package/package_ti.xdais.dm.examples.dsp_fft.o674
rm -f package/lib/lib/coverage/dsp_fft/dsp_fft.ov5T
#
# clv5T dsp_fft.c ...
/home/jlocke/arm-2012.03/bin/arm-none-linux-gnueabi-g++ -c -MD -MF package/lib/lib/coverage/dsp_fft/dsp_fft.ov5T.dep -x c -fPIC -Wunused -Wall -fno-strict-aliasing -march=armv5t -Dfar= -Dxdc_target_name__=GCArmv5T -Dxdc_target_types__=gnu/targets/arm/std.h -Dxdc_bld__profile_coverage -Dxdc_bld__vers_1_0_4_6_3 -fprofile-arcs -ftest-coverage -I. -I/home/jlocke/Documents/Local-Projects/2385/Software/Linux/examples/ti/sdo/ce/examples/codecs/dsp_fft/../../../../../.. -I/home/jlocke/ti-dvsdk_omapl138-evm_04_03_00_06/codec-engine_2_26_02_11/packages -I/home/jlocke/ti-dvsdk_omapl138-evm_04_03_00_06/xdais_6_26_01_03/packages -I/home/jlocke/ti-dvsdk_omapl138-evm_04_03_00_06/linuxutils_2_26_02_05/packages -I/home/jlocke/ti-dvsdk_omapl138-evm_04_03_00_06/framework-components_2_26_00_01/packages -I/home/jlocke/ti-dvsdk_omapl138-evm_04_03_00_06/biosutils_1_02_02/packages -I/home/jlocke/ti-dvsdk_omapl138-evm_04_03_00_06/edma3lld_01_11_02_05/packages -I/home/jlocke/ti-dvsdk_omapl138-evm_04_03_00_06/dsplib_3_1_1_1 -I/home/jlocke/ti-dvsdk_omapl138-evm_04_03_00_06/dsplib_3_1_1_1/packages -I/home/jlocke/ti-dvsdk_omapl138-evm_04_03_00_06/dspbios_5_41_03_17/packages -I/home/jlocke/ti-dvsdk_omapl138-evm_04_03_00_06/dsplink_1_65_01_05_eng -I/home/jlocke/ti-dvsdk_omapl138-evm_04_03_00_06/xdctools_3_16_03_36/packages -I../../../../.. -o package/lib/lib/coverage/dsp_fft/dsp_fft.ov5T dsp_fft.c
In file included from /home/jlocke/ti-dvsdk_omapl138-evm_04_03_00_06/dsplib_3_1_1_1/inc/dsplib.h:14:0,
from dsp_fft.c:70:
/home/jlocke/ti-dvsdk_omapl138-evm_04_03_00_06/dsplib_3_1_1_1/packages/ti/dsplib/src/DSPF_blk_eswap16/DSPF_blk_eswap16.h:46:2: error: #error invalid target
In file included from /home/jlocke/ti-dvsdk_omapl138-evm_04_03_00_06/dsplib_3_1_1_1/inc/dsplib.h:15:0,
from dsp_fft.c:70:
/home/jlocke/ti-dvsdk_omapl138-evm_04_03_00_06/dsplib_3_1_1_1/packages/ti/dsplib/src/DSPF_blk_eswap32/DSPF_blk_eswap32.h:46:2: error: #error invalid target
In file included from /home/jlocke/ti-dvsdk_omapl138-evm_04_03_00_06/dsplib_3_1_1_1/inc/dsplib.h:16:0,
from dsp_fft.c:70:
The errors continue like this.
I think I found the problem. In xdcpaths.mak, I had PROGRAMS set to "APP_CLIENT DSP_SERVER". When I set it to only DSP_SERVER when building the codec and server, it seems to build okay, and then put back APP_CLIENT for building the actual app. I didn't think I would have to change those, as when building the examples, it works fine with both left in there. I guess the error arises when using a target specific library.
I'm suspecting that you are trying to build a codec that has a package.bld file that doesn't filter out non-C674 targets.
I found a document that might help your situation. On this page http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/dvsdk/DVSDK_4_00/latest/index_FDS.html is a link to a PDF file named "OMAPL138_Software_Developers_Guide.pdf". On page 33 of that PDF file are instructions for the package.bld file:
Replace the content of
$(DVSDK)/codecs-omapl138_x_xx_xx_xx_test/packages/ti/sdo/codecs/mp3dec/ce/package.bld with the following
/*
* ======== package.bld ========
*/
Pkg.attrs.exportAll = true;
var SRCS = ["src/auddec1_skel.c", ];
for (var i = 0; i < Build.targets.length; i++) {
var targ = Build.targets[i];
if (targ.name == "C64P"||targ.name == "C674") {
Pkg.addLibrary("lib/mp3auddecskel", targ, {
}).addObjects(SRCS);
}
}
Please check if your package.bld in /home/jlocke/Documents/Local-Projects/2385/Software/Linux/examples/ti/xdais/dm/examples/dsp_fft contains content similar to above. This will ensure that the library is built for only the DSP.
Regards,
- Rob