Please note as of Wednesday, August 15th, 2018 this wiki has been set to read only. If you are a TI Employee and require Edit ability please contact x0211426 from the company directory.

Rebuilding Codec Engine

From Texas Instruments Wiki
Jump to: navigation, search

Background

Rebuilding Codec Engine is typically not necessary. Source code and build scripts are provided with releases for educational and debugging purposes, but rebuilding CE should not be required. Historically, rebuilding it hasn't been officially supported.

However, for various reasons like porting to other OS's or toolchains, users are interested in rebuilding the CE libraries. This article serves as a guide for doing so.

Rebuilding Codec Engine

Codec Engine can be downloaded here. Since the goal here is to rebuild Codec Engine, let's assume you've downloaded the "full" Codec Engine release (the one with cetools subdirectory), which will make this much easier (note that the one in your SDK is referred to as 'lite' and the reasons why two versions exist is documented here).

There are a number of good reasons why you'd want to rebuild CE. Amongst them are things like "I'm using a different toolchain" or "I'm using some strange compiler options that don't jive with the default libs" and others. There are a number of other reasons like "I want to debug X, Y, Z" that may be better off being referred to something like this. Most folks are really fine using the prebuilt libs, so just because you can rebuild CE, doesn't mean you should. There are probably a number of fine alternatives to rebuilding that could help you solve your problem.

Note that the following does not rebuild the Codec Engine Examples. For detailed instructions on doing that, see codec_engine_x_xx/examples/build_instructions.html or wiki link.

Notes specific to environments that use DSP Link

1. Codec Engine consumes DSP Link as "XDC packages". As a result, when building DSP Link, you need to ensure you include the build steps to Enable XDC integration. If you forget, when you build CE you'll see something like the following Remark:

Remark: module 'dsplink.gpp.Global' not found, this package will not be built.

... and a small subset of the Codec Engine packages will not be rebuild.

2. Also, note that CE's ti/sdo/ce/ipc/dsplink/package.bld build script (almost certainly incorrectly for end users) presumes DSP Link has been built for all supported devices. If you're only building for one device (and you likely are!), you will need to manually edit that package.bld script and remove the platforms you haven't built DSP Link for. That file is javascript, so a common technique to disable a chunk of code is something like this:

if (false) {
    /* code you want to remove */
}

Notes specific to 2.24.01

  • Due to bug (IR 61534): create a symbolic link for gt_dais.h to cetools/packages/ti/sdo/fc/utils/gt_dais.h from cetools/packages/ti/sdo/fc/utils/gtinfra/gt_dais.h
  • Due to bug (IR 57990): Add "if(null==suffix){return;}" in cetools/packages/ti/sdo/fc/dman3/package.xs validate() function immediately after "var suffix =..." (line 42)
  • Note both of these bugs are fixed in FC 2.25

Create a config.bld

  • config.bld is explained in further detail here so we won't go into too many details on the following. Basically copy and paste this into your codec_engine_2_24_01 (or other version) directory.
  • Modify the paths to your compiler tools appropriately.
  • Modify the platforms (note that this builds for DM6446 and OMAP3530) if needed
/* ======== ti.targets.C64P ======== */
var C64P = xdc.useModule('ti.targets.C64P');
 
C64P.rootDir = "/library/ticgt/cg6x_6_0_16";               /* toolchain base directory */
C64P.ccOpts.prefix += " -pden -pds=195 ";                  /* extra compiler opts */
 
C64P.platforms = [
//   "ti.platforms.evmDM6446",                             /* DM6446 platform */
   "ti.platforms.evm3530"                                  /* OMAP3 platform */
];
 
/* remove a few unused profiles to speed up the build */
delete C64P.profiles["coverage"];
delete C64P.profiles["profile"];
delete C64P.profiles["whole_program"];
delete C64P.profiles["whole_program_debug"];
 
Build.targets.$add(C64P);
 
/* ======== gnu.targets.arm.GCArmv5T ======== */
var GCArmv5T = xdc.useModule('gnu.targets.arm.GCArmv5T');
 
GCArmv5T.rootDir = "/library/cs/arm-2007q3";               /* toolchain base directory */
GCArmv5T.LONGNAME = "bin/arm-none-linux-gnueabi-gcc";      /* gcc toolchain long name */
GCArmv5T.ccOpts.prefix += " -Wall -fno-strict-aliasing ";  /* extra compiler opts */
GCArmv5T.lnkOpts.suffix =                                  /* extra linker opts */
        GCArmv5T.lnkOpts.suffix.replace("-lstdc++", "");
GCArmv5T.lnkOpts.suffix += " -lpthread ";
 
GCArmv5T.platforms = [
//   "ti.platforms.evmDM6446",                             /* DM6446 platform */
   "ti.platforms.evm3530"                                  /* OMAP3 platform */
];
 
/* remove a few unused profiles to speed up the build */
delete GCArmv5T.profiles["coverage"];
delete GCArmv5T.profiles["profile"];
 
Build.targets.$add(GCArmv5T);
 
/*
 * Add this libvers.xdt template to each package being built to auto-generate
 * symbols used internally to determine compatibility between SW running on
 * different devices.
 */
Pkg.libTemplate = "ti/sdo/ce/utils/libvers.xdt";

Create a Makefile

  • Copy the following Makefile into your codec_engine_2_24_01 (or other) directory.
  • Modify the paths appropriately. Then type "make" and you should be off.
#
#  ======== Makefile ========
#
 
# Set location of various tools
CODEGEN_INSTALL_DIR = /library/ticgt/cg6x_6_0_16
CROSS_COMPILE = /library/cs/arm-2007q3/
BIOS_INSTALL_DIR = $(HOME)/tools/bios_5_33_05
XDC_INSTALL_DIR = $(HOME)/tools/xdctools_3_10_05_61
CE_INSTALL_DIR = $(HOME)/tools/codec_engine_2_24_01
LINK_INSTALL_DIR= $(HOME)/tools/OMAPL137_arm_1_00_00_10/dsplink-1_61_03-prebuilt
FC_INSTALL_DIR= $(CE_INSTALL_DIR)/cetools
XDAIS_INSTALL_DIR= $(CE_INSTALL_DIR)/cetools
CMEM_INSTALL_DIR = $(CE_INSTALL_DIR)/cetools
BIOSUTILS_INSTALL_DIR = $(CE_INSTALL_DIR)/cetools
LPM_INSTALL_DIR = $(CE_INSTALL_DIR)/cetools
 
# set the location for packages
PACKAGE_DIR1  = $(CE_INSTALL_DIR)/cetools/packages/
PACKAGE_DIR2  = $(CE_INSTALL_DIR)/packages/
 
# Set XDCPATH to contain necessary repositories.
XDCPATH = $(CURDIR);$(XDAIS_INSTALL_DIR)/packages;$(FC_INSTALL_DIR)/packages;$(BIOS_INSTALL_DIR)/packages;$(CMEM_INSTALL_DIR)/packages;$(LINK_INSTALL_DIR)/packages;$(CE_INSTALL_DIR)/packages;$(CE_INSTALL_DIR)/cetools/packages;$(BIOSUTILS_INSTALL_DIR)/packages;$(LPM_INSTALL_DIR)/packages
 
# Set your XDC executable command
# Note that XDCBUILDCFG must point at the config.bld file created above
XDC = $(XDC_INSTALL_DIR)/xdc XDCBUILDCFG=$(CE_INSTALL_DIR)/config.bld
 
# Conditionally, you can create verbose build output
XDCOPTIONS=v
 
export XDCOPTIONS
export XDCPATH
 
######################################################
## Shouldnt have to modify anything below this line ##
######################################################
 
all: .all-packages
 
# This recursively locates all packages in the PACKAGE_DIR# directory, builds
# and releases them
.all-packages:
	$(XDC) -PR $(PACKAGE_DIR1)
	$(XDC) -PR $(PACKAGE_DIR2)
 
# This recursively cleans all packages in the PACKAGE_DIR# directory
clean: clean-packages
 
clean-packages:
	$(XDC) clean -PR $(PACKAGE_DIR1)
	$(XDC) clean -PR $(PACKAGE_DIR2)