TI中文支持网
TI专业的中文技术问题搜集分享网站

cfg文件修改

各位专家好:

现在我手上有两个工程需要集成在一起(IPC, net), net接收数据后,启动计算线程8核通过sharedRegion 共同实现算法的计算。8核加载相同的程序镜像, 通过核号的判断实现不同核处理不同的运算和数据获取地址。

现在问题出现在cfg文件。需要修改cfg文件满足ipc 模块和net 模块。工程基于sys/bios。使用到了task, ipc, sharedRegion. 我修改了几个方案,ipc运行不正常,程序不是跑飞了,就是提示ipc注册事件错误等。

net工程的cfg文件如下:

/********************************************************************************************************************
* Specify all needed RTSC MOudles and ocnfigure them. *
********************************************************************************************************************/

var Memory = xdc.useModule('xdc.runtime.Memory');

var BIOS = xdc.useModule('ti.sysbios.BIOS');

var Task = xdc.useModule('ti.sysbios.knl.Task');

var HeapBuf = xdc.useModule('ti.sysbios.heaps.HeapBuf');

var Log = xdc.useModule('xdc.runtime.Log');

/*
** Allow storing of task names. By default if you name a task with a friendly display name it will not be saved
** to conserve RAM. This must be set to true to allow it. We use friendly names on the Task List display.
*/
//Defaults.common$.namedInstance = true;Task.common$.namedInstance = true;

var Clock = xdc.useModule ('ti.sysbios.knl.Clock');

/*** Interface with IPC. Depending on the version of BIOS you are using the** module name may have changed.
*/
/* Use this for pre BIOS 6.30 */
/* var Sem = xdc.useModule ('ti.sysbios.ipc.Semaphore'); */

/* Use this for BIOS 6.30 plus to get the IPC module */
var Sem = xdc.useModule ('ti.sysbios.knl.Semaphore');

var Hwi = xdc.useModule ('ti.sysbios.hal.Hwi');

var Ecm = xdc.useModule ('ti.sysbios.family.c64p.EventCombiner');

/*
** Configure this to turn on the CPU Load Module for BIOS.
**
*/
/*
var Load = xdc.useModule('ti.sysbios.utils.Load');
Load.common$.diags_USER4 = Diags.ALWAYS_ON;
*/

var Diags = xdc.useModule('xdc.runtime.Diags');

/* Load the CSL package */
var Csl = xdc.useModule('ti.csl.Settings');

/* Load the CPPI package */
var Cppi = xdc.loadPackage('ti.drv.cppi');

/* Load the QMSS package */
var Qmss = xdc.loadPackage('ti.drv.qmss');

/* Load the PA package */
var Pa = xdc.useModule('ti.drv.pa.Settings');

/* Load the Platform/NDK Transport packages */
//var PlatformLib = xdc.loadPackage('ti.platform.evmc6678l');
//var NdkTransport = xdc.loadPackage('ti.transport.ndk');

/*** Sets up the exception log so you can read it with ROV in CCS*/
var LoggerBuf = xdc.useModule('xdc.runtime.LoggerBuf');
var Exc = xdc.useModule('ti.sysbios.family.c64p.Exception');
Exc.common$.logger = LoggerBuf.create();
Exc.enablePrint = true; /* prints exception details to the CCS console */

/*
** Give the Load module it's own LoggerBuf to make sure the
** events are not overwritten.
*/
/* var loggerBufParams = new LoggerBuf.Params();
loggerBufParams.exitFlush = true;
loggerBufParams.numEntries = 64;
Load.common$.logger = LoggerBuf.create(loggerBufParams);*/

/*
** Use this load to configure NDK 2.2 and above using RTSC. In previous versions of
** the NDK RTSC configuration was not supported and you should comment this out.
*/
var Global = xdc.useModule('ti.ndk.config.Global');

/*** This allows the heart beat (poll function) to be created but does not generate the stack threads**
** Look in the cdoc (help files) to see what CfgAddEntry items can be configured. We tell it NOT
** to create any stack threads (services) as we configure those ourselves in our Main Task
** thread hpdspuaStart.
*/Global.enableCodeGeneration = false;

/* Define a variable to set the MAR mode for MSMCSRAM as all cacheable */
var Cache = xdc.useModule('ti.sysbios.family.c66.Cache');
//Cache.MAR224_255 = 0x0000000f;

var Startup = xdc.useModule('xdc.runtime.Startup');

var System = xdc.useModule('xdc.runtime.System');

/*
** Create a Heap.*/
var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
var heapMemParams = new HeapMem.Params();
heapMemParams.size = 0x300000;
heapMemParams.sectionName = "systemHeap";
Program.global.heap0 = HeapMem.create(heapMemParams);

/* This is the default memory heap. */
Memory.defaultHeapInstance = Program.global.heap0;
Program.sectMap["sharedL2"] = "DDR3";Program.sectMap["systemHeap"] = "DDR3";
Program.sectMap[".sysmem"] = "DDR3";
Program.sectMap[".args"] = "DDR3";
Program.sectMap[".cio"] = "DDR3";
Program.sectMap[".far"] = "DDR3";
Program.sectMap[".rodata"] = "DDR3";
Program.sectMap[".neardata"] = "DDR3";
//Program.sectMap[".cppi"] = "DDR3";
Program.sectMap[".cppi"] = "L2SRAM";
Program.sectMap[".init_array"] = "DDR3";
//Program.sectMap[".qmss"] = "DDR3";
Program.sectMap[".qmss"] = "L2SRAM";
Program.sectMap[".cinit"] = "DDR3";
Program.sectMap[".bss"] = "DDR3";
Program.sectMap[".const"] = "DDR3";
Program.sectMap[".text"] = "DDR3";
Program.sectMap[".code"] = "DDR3";
Program.sectMap[".switch"] = "DDR3";
Program.sectMap[".data"] = "DDR3";
Program.sectMap[".fardata"] = "DDR3";
Program.sectMap[".args"] = "DDR3";
Program.sectMap[".cio"] = "DDR3";
Program.sectMap[".vecs"] = "DDR3";
Program.sectMap["platform_lib"] = "DDR3";
Program.sectMap[".far:taskStackSection"] = "L2SRAM";
Program.sectMap[".stack"] = "L2SRAM";
Program.sectMap[".nimu_eth_ll2"] = "L2SRAM";
Program.sectMap[".resmgr_memregion"] = {loadSegment: "L2SRAM", loadAlign:128}; /* QMSS descriptors region */
Program.sectMap[".resmgr_handles"] = {loadSegment: "L2SRAM", loadAlign:16}; /* CPPI/QMSS/PA Handles */
Program.sectMap[".resmgr_pa"] = {loadSegment: "L2SRAM", loadAlign:8}; /* PA Memory */
Program.sectMap[".far:IMAGEDATA"] = {loadSegment: "L2SRAM", loadAlign: 8};
Program.sectMap[".far:NDK_OBJMEM"] = {loadSegment: "L2SRAM", loadAlign: 8};
Program.sectMap[".far:NDK_PACKETMEM"] = {loadSegment: "L2SRAM", loadAlign: 128};

/* Required if using System_printf to output on the console */
SysStd = xdc.useModule('xdc.runtime.SysStd');
System.SupportProxy = SysStd;

/*** Register an EVM Init handler with BIOS. This will initialize the hardware. BIOS calls before it starts.**
** If yuo are debugging with CCS, then this function will execute as CCS loads it if the option in your** Target Configuraiton file (.ccxml) has the option set to execute all code before Main. That is the** default.
*/
//

/*** Create the stack Thread Task for our application.
*/

var ndkTaskParams = new Task.Params();
ndkTaskParams.stackSize = 8192;
ndkTaskParams.priority = 0x5;
Task.create("&NetStartup", ndkTaskParams);

/*** Create a Periodic task to handle all NDK polling functions.** If you are using RTSC configuration with NDK 2.2 and above, this is done by default and** you do not need to do this.
*/

/*var prdNdkClkParams = new Clock.Params ();
prdNdkClkParams.period = 0x64;prdNdkClkParams.startFlag = true;
Program.global.clockInst1 = Clock.create("&llTimerTick", 5, prdNdkClkParams);
*/

/*** If you are using RTSC configuration with NDK 2.2 and above, this is done by default, else
** register hooks so that the stack can track all Task creationTask.common$.namedInstance = true;
Task.addHookSet ({ registerFxn: '&NDK_hookInit', createFxn: '&NDK_hookCreate', });

*/

/* Enable BIOS Task Scheduler */
BIOS.taskEnabled = true;

/*
* Enable Event Groups here and registering of ISR for specific GEM INTC is done
* using EventCombiner_dispatchPlug() and Hwi_eventMap() APIs
*/

Ecm.eventGroupHwiNum[0] = 7;
Ecm.eventGroupHwiNum[1] = 8;
Ecm.eventGroupHwiNum[2] = 9;
Ecm.eventGroupHwiNum[3] = 10;

//////////////////////////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////////////////////////

IPC sharedRegion工程的cfg文件如下 ;

var System = xdc.useModule('xdc.runtime.System');
var SysStd = xdc.useModule('xdc.runtime.SysStd');
System.SupportProxy = SysStd;

/* 存储空间分配 */
Program.sectMap["SystemHeap"] = "L2SRAM";
Program.sectMap[".const"] = "L2SRAM";
Program.sectMap[".switch"] = "L2SRAM";
Program.sectMap[".cinit"] = "L2SRAM";
Program.sectMap[".vecs"] = "L2SRAM";
Program.sectMap[".DDR3_0"] = "DDR3";

var BIOS = xdc.useModule('ti.sysbios.BIOS');
BIOS.heapSize = 0x8000;

/* 创建任务 */
var Task = xdc.useModule('ti.sysbios.knl.Task');
var tsk0 = Task.create('&tsk0_func');
tsk0.instance.name = "tsk0";

/* 创建信号量 */
var Semaphore = xdc.useModule('ti.sysbios.knl.Semaphore');
Program.global.semHandle = Semaphore.create(0);

/* 配置核心名 */
var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
var procNameAry = MultiProc.getDeviceProcNames();
//var procNameAry = [ "CORE0", "CORE1"];
MultiProc.setConfig(Program.global.procName, procNameAry);

/* IPC 配置 */
var Ipc = xdc.useModule('ti.sdo.ipc.Ipc');
var Notify = xdc.useModule('ti.sdo.ipc.Notify'); /* Notify */
var GateMP = xdc.useModule('ti.sdo.ipc.GateMP'); /* GateMP */
var SharedRegion = xdc.useModule('ti.sdo.ipc.SharedRegion'); /* shared region */
var MessageQ = xdc.useModule('ti.sdo.ipc.MessageQ'); /* MessageQ */
var HeapBufMP = xdc.useModule('ti.sdo.ipc.heaps.HeapBufMP');

Ipc.procSync = Ipc.ProcSync_ALL; /* Ipc_start 里同步所有核心*/
Ipc.sr0MemorySetup = true;

GateMP.maxRuntimeEntries = 4;
GateMP.RemoteCustom1Proxy = xdc.useModule('ti.sdo.ipc.gates.GateMPSupportNull');

/* 配置 SharedRegion #0 (IPC) */
var SHAREDMEM = 0x80000000;
var SHAREDMEMSIZE = 0x00100000;

SharedRegion.setEntryMeta(0,
{ base: SHAREDMEM, len: SHAREDMEMSIZE,
ownerProcId: 0,
isValid: true,
name: "DDR2_RAM",
});

for (var i = 0; i < MultiProc.numProcessors; i++) {
Ipc.setEntryMeta({
remoteProcId: i,
setupMessageQ: true,
});
}

var Startup = xdc.useModule('xdc.runtime.Startup');

还请高手看一下,怎么修改能使用程序正常运行?或给一些修改建议。我是新手,这部分内容以及某些规则还不是很熟悉。

谢谢啦

Shine:

合并之前,两个工程是否能单独运行?合并的时候,注意memory不要overlap,堆栈大小是否足够。

赞(0)
未经允许不得转载:TI中文支持网 » cfg文件修改
分享到: 更多 (0)