1.1 在eclipse.org下载Eclipse IDE for Java EE Developers(目前最新版本helios,即v3.6),以及相应版本的CDT(目前最新版本7.0.0)。安装之后,通过eclipse的菜单“Window->Preferences”调出窗口后,在“General->Editors->File Associations”中,将*.bld/*.cfg/*.xdc等JavaScript文件与JavaScript Editor关联起来。
1.2 创建工程时应通过菜单“File->New->Makefile Project with Existing Code”来创建,当然你得先将目录创建好,源文件复制到位。最好直接在<CE_INSTALL_DIR>/examples中的例子的基础上修改出你需要的算法框架。
1.3 eclipse的工程使用绝对路径。复制已有workspace改名使用时,例如a_workspace复制并修改为b_workspace,最好删除并重新添加一遍工程,否则小心修改到原workspace目录下的文件。
2. 两个辅助工具
2.1 使用CCSv3.3 + Component Wizard for eXpressDSP(ti_xdais_v4.0d_setup.exe),可以快速搭建出你需要的CODEC算法框架。
2.2 RTSC Codec and Server Package Wizards,把一个.lib文件封装成RTSC Codec 包和RTSC DSP Server包,可惜需要Codec Engine1.20及以上版本,还没有机会使用。
3. 关于stack
3.1 在CODEC服务程序(例如<CE_INSTALL_DIR>/examples/servers下的程序)中的*.cfg中可以指定需要的stack size。其中Server.threadAttrs.stackSize为server stack指定大小,Server.algs中的stackSize为task stack指定大小,修改Server.algs中的stackMemId,可将task stack分配到片内存储器。
01./*
02. * ======== Server Configuration ========
03. */
04.var Server = xdc.useModule('ti.sdo.ce.Server');
05.Server.threadAttrs.stackSize = 2048;
06.Server.threadAttrs.priority = Server.MINPRI;
07.Server.autoGenScratchSizeArrays = true;
08.
09.Server.algs = [
10. {name: "scale", mod: SCALE, threadAttrs: {
11. stackSize: 16384, stackMemId: 0, priority: Server.MINPRI + 1}
12. },
13.];
3.2 Server.threadAttrs.stackSize和Server.algs中stackSize的区别
On the DSP server, every algorithm instance is run by an individual task. The Server.algs array specifies the stack size for the task running each algorithm. Hence this stack size must be greater than the worst-case stack usage by an algorithm's process() and control() functions (and by their skeletons, though typically stack usage is higher in the algorithm itself).
Server.threadAttrs.stackSize specifies the stack size of the server task used by CE to create algorithm instances on the DSP. The server task is also responsible for creating the task (with the stack size specified in the Server.algs array) that runs the created codec instance. Server.threadAttrs.stackSize must be larger than the stack size requirements of the basic IALG, IDMA3 and IRES functions implemented by each algorithm/codec, excluding the process() and control() functions.
3.3 在Arm端的TRACE文件(由CE_TRACEFILE指定)中可查看task stack的使用情况。
CE - Engine_deleteNode(0x25a48): algName = scale, algHandle = 0x8fa01190, stack size = 16384, stack used = 643(4%)
3.4 在Dsp端的TRACE文件(由TRACEUTIL_DSP0TRACEFILE指定)中可查看system stack的使用情况。
CR - RMS: stack size = 2048, stack used = 355(18%) … CR - RMS: stack size = 2048, stack used = 875(43%)
4. 关于DDR Segment
4.1 算法中的malloc()分配的内存在DDR段的heap中,全局和静态变量则在DDR段的非heap中。在CODEC服务程序(例如<CE_INSTALL_DIR>/examples/servers下的程序)中的*.tcf可以修改此设置。
01./* ===========================================================================
02. * Set all code and data sections to use DDR
03. * ===========================================================================
04. */
05.bios.setMemCodeSections (prog, bios.DDR);
06.bios.setMemDataNoHeapSections (prog, bios.DDR);
07.bios.setMemDataHeapSections (prog, bios.DDR);
08.
09./* ===========================================================================
10. * MEM : Global
11. * ===========================================================================
12. */
13.prog.module("MEM").BIOSOBJSEG = bios.DDR;
14.prog.module("MEM").MALLOCSEG = bios.DDR;
4.2 在CODEC服务程序(例如<CE_INSTALL_DIR>/examples/servers下的程序)中的*.tcf可以修改DDR段的heap size。
01./* ===========================================================================
02. * Create heaps in memory segments that are to have heap
03. * ===========================================================================
04. */
05.bios.DDR.createHeap = true;
06.bios.DDR.heapSize = 0x20000; // 512K
5. 关于CMEM Segment
5.1 使用Memory_contigAlloc分配内存到CMEM时,CMEM可能找不到合适的pool来分配,这时就需要修改CMEM的pool配置。
5.2 在loadmodules.sh文件中修改CMEM的pool配置。
# insert cmemk, tell it to occupy physical 120MB-128MB, create
# 20 4K buffers, 10 128K buffers and two 2MB buffers
insmod cmemk.ko phys_start=0x87800000 phys_end=0x88000000 pools=20x4096,10x131072,2x2097152