Davinci 开发心得点滴

1. 用eclipse辅助开发,可节省不少开发时间。

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分配到片内存储器。

/*
 *  ======== Server Configuration ========
 */
var Server = xdc.useModule('ti.sdo.ce.Server');
Server.threadAttrs.stackSize = 2048;
Server.threadAttrs.priority = Server.MINPRI;
Server.autoGenScratchSizeArrays = true;

Server.algs = [
    {name: "scale", mod: SCALE, threadAttrs: {
        stackSize: 16384, stackMemId: 0, priority: Server.MINPRI + 1}
    },
];

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'sprocess() andcontrol() 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 theServer.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 theprocess() andcontrol() 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可以修改此设置。

/*  ===========================================================================
 *  Set all code and data sections to use DDR
 *  ===========================================================================
 */
bios.setMemCodeSections (prog, bios.DDR);
bios.setMemDataNoHeapSections (prog, bios.DDR);
bios.setMemDataHeapSections (prog, bios.DDR);

/*  ===========================================================================
 *  MEM : Global
 *  ===========================================================================
 */
prog.module("MEM").BIOSOBJSEG = bios.DDR;
prog.module("MEM").MALLOCSEG  = bios.DDR;

4.2 在CODEC服务程序(例如<CE_INSTALL_DIR>/examples/servers下的程序)中的*.tcf可以修改DDR段的heap size。

/*  ===========================================================================
 *  Create heaps in memory segments that are to have heap
 *  ===========================================================================
 */
bios.DDR.createHeap = true;
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

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值