将ti安装目录下的C:\ti\mcsdk_2_01_02_05\examples\ndk\helloWorld
与C:\ti\ipc_1_24_03_32\packages\ti\sdo\ipc\examples\multicore\evm667x下的
notify_multicore.c合并的问题
在helloWorld 工程下将notify_multicore.c的代码加入到helloWorld.c中,并将notify_multicore.cfg文件
也合并到helloWorld.cfg中,形成cfg文件源码如下:
在cfg文件配置中将MultiProc的numProcessors数量改为1
同时在cfg中setConfig如下:
MultiProc.setConfig(null, ["CORE0"]);
/*
* helloWorld.cfg
*
* Memory Map and Program intiializations for the helloWorld example Utility
*
* Copyright (C) 2010-2011 Texas Instruments Incorporated - http://www.ti.com/
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
*
* Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
/*
* @file helloWorld.cfg
*
* @brief
* Memory Map and Program intiializations for the HPDSP Utility.
*
*/
/********************************************************************************************************************
* 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');
var Ipc = xdc.useModule('ti.sdo.ipc.Ipc');
var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
var Notify = xdc.useModule('ti.sdo.ipc.Notify');
var SharedRegion = xdc.useModule('ti.sdo.ipc.SharedRegion');
var NameServer = xdc.useModule('ti.sdo.utils.NameServer');
MultiProc.setConfig(null, ["CORE0"]);
/*
** 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[".init_array"] = "DDR3";
Program.sectMap[".qmss"] = "DDR3";
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"] = "DDR3";
Program.sectMap[".stack"] = "DDR3";
Program.sectMap[".nimu_eth_ll2"] = "DDR3";
Program.sectMap[".resmgr_memregion"] = {loadSegment: "DDR3", loadAlign:128}; /* QMSS descriptors region */
Program.sectMap[".resmgr_handles"] = {loadSegment: "DDR3", loadAlign:16}; /* CPPI/QMSS/PA Handles */
Program.sectMap[".resmgr_pa"] = {loadSegment: "DDR3", loadAlign:8}; /* PA Memory */
Program.sectMap[".far:IMAGEDATA"] = {loadSegment: "DDR3", loadAlign: 8};
Program.sectMap[".far:NDK_OBJMEM"] = {loadSegment: "DDR3", loadAlign: 8};
Program.sectMap[".far:NDK_PACKETMEM"] = {loadSegment: "DDR3", loadAlign: 128};
/* Required if using System_printf to output on the console */
SysStd = xdc.useModule('xdc.runtime.SysStd');
System.SupportProxy = SysStd;
/********************************************************************************************************************
* Define hooks and static tasks that will always be running. *
********************************************************************************************************************/
/*
** 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.
*/
Startup.lastFxns.$add('&EVM_init');
/*
** Create the stack Thread Task for our application.
*/
var tskNdkStackTest = Task.create("&StackTest");
tskNdkStackTest.stackSize = 0x1400;
tskNdkStackTest.priority = 0x5;
/*
** 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 creation
Task.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.procSync = Ipc.ProcSync_ALL;
/* Shared Memory base address and length */
var SHAREDMEM = 0x0C000000;
var SHAREDMEMSIZE = 0x00200000;
/*
* Need to define the shared region. The IPC modules use this
* to make portable pointers. All processors need to add this
* call with their base address of the shared memory region.
* If the processor cannot access the memory, do not add it.
*/
var SharedRegion = xdc.useModule('ti.sdo.ipc.SharedRegion');
SharedRegion.setEntryzeta(0,
{ base: SHAREDMEM,
len: SHAREDMEMSIZE,
ownerProcId: 0,
isValid: true,
name: "DDR2_RAM",
});
var sem0Params = new Sem.Params();
sem0Params.instance.name = "semHandle";
Program.global.semHandle = Sem.create(null, sem0Params);
var task1Params = new Task.Params();
task1Params.instance.name = "task1";
Program.global.task1 = Task.create("&tsk0_func", task1Params);
MultiProc.numProcessors = 4;
合并后的程序在在一个核上CORE0上跑的时候可以得到正确的结果,结果如下:
[C66xx_0] main: MultiProc id = 0
[C66xx_0] main: MultiProc name = CORE0
[C66xx_0] QMSS successfully initialized
[C66xx_0] CPPI successfully initialized
[C66xx_0] PA successfully initialized
[C66xx_0]
[C66xx_0] TCP/IP Stack 'Hello World!' Application
[C66xx_0]
[C66xx_0]
[C66xx_0] TCP/IP Stack 'Hello World!' Application
[C66xx_0]
[C66xx_0] PASS successfully initialized
[C66xx_0] Ethernet subsystem successfully initialized
[C66xx_0] Ethernet eventId : 48 and vectId (Interrupt) : 7
[C66xx_0] Registration of the EMAC Successful, waiting for link up ..
[C66xx_0] Network Added: If-1:192.168.2.100
[C66xx_0] tsk1_func: Sent request #1 to CORE0
[C66xx_0] tsk1_func: Received request #1 from CORE0
[C66xx_0] tsk1_func: Sent request #2 to CORE0
[C66xx_0] tsk1_func: Received request #2 from CORE0
[C66xx_0] tsk1_func: Sent request #3 to CORE0
[C66xx_0] tsk1_func: Received request #3 from CORE0
[C66xx_0] tsk1_func: Sent request #4 to CORE0
[C66xx_0] tsk1_func: Received request #4 from CORE0
[C66xx_0] tsk1_func: Sent request #5 to CORE0
[C66xx_0] tsk1_func: Received request #5 from CORE0
[C66xx_0] tsk1_func: Sent request #6 to CORE0
[C66xx_0] tsk1_func: Received request #6 from CORE0
[C66xx_0] tsk1_func: Sent request #7 to CORE0
[C66xx_0] tsk1_func: Received request #7 from CORE0
[C66xx_0] tsk1_func: Sent request #8 to CORE0
[C66xx_0] tsk1_func: Received request #8 from CORE0
[C66xx_0] tsk1_func: Sent request #9 to CORE0
[C66xx_0] tsk1_func: Received request #9 from CORE0
[C66xx_0] tsk1_func: Sent request #10 to CORE0
[C66xx_0] tsk1_func: Received request #10 from CORE0
[C66xx_0] Test completed
将在cfg文件配置中将MultiProc的numProcessors数量改为4
同时在cfg中setConfig如下:
MultiProc.setConfig(null, ["CORE0","CORE1","CORE2","CORE3"]);
在CORE0、CORE1、CORE2、CORE3中跑上述程序,老报如下错误:
[C66xx_2] main: MultiProc id = 2
[C66xx_2] main: MultiProc name = CORE2
[C66xx_3] Invalid CIO command (29) in the CIO buffer at address (0x803efaf0) was not recognized. Please check the device and program memory maps.
[C66xx_3] main: MultiProc name = CORE3
[C66xx_0] Invalid CIO command (29) in the CIO buffer at address (0x803efaf0) was not recognized. Please check the device and program memory maps.
[C66xx_1] Invalid CIO command (29) in the CIO buffer at address (0x803efaf0) was not recognized. Please check the device and program memory maps.
[C66xx_0] main: MultiProc name = CORE1
[C66xx_1] main: MultiProc name = CORE1
[C66xx_0] A0=0x80 A1=0x0
[C66xx_0] A2=0x0 A3=0x803e9c7c
[C66xx_0] A4=0x80000408 A5=0x1
[C66xx_0] A6=0x80 A7=0x0
[C66xx_0] A8=0x1844018 A9=0x1
[C66xx_0] A10=0x300 A11=0x80000408
[C66xx_0] A12=0x80000408 A13=0x803ee624
[C66xx_0] A14=0x0 A15=0x803e95d0
[C66xx_0] A16=0xc002c80 A17=0x10
[C66xx_0] A18=0x80000c20 A19=0x0
[C66xx_0] A20=0x6c A21=0x4c
[C66xx_0] A22=0x0 A23=0x0
[C66xx_0] A24=0x0 A25=0x0
[C66xx_0] A26=0x0 A27=0x2005000
[C66xx_0] A28=0x0 A29=0x803de1c8
[C66xx_0] A30=0x1000 A31=0x0
[C66xx_0] B0=0x80000408 B1=0x0
[C66xx_0] B2=0x1 B3=0x8036f924
[C66xx_0] B4=0x300 B5=0x1
[C66xx_0] B6=0x803ee624 B7=0xffff
[C66xx_0] B8=0x1000 B9=0x80
[C66xx_0] B10=0x80000408 B11=0x803e95d4
[C66xx_0] B12=0x2 B13=0x300
[C66xx_0] B14=0x803ef880 B15=0x803ee5b8
[C66xx_0] B16=0x0 B17=0x803dddb0
[C66xx_0] B18=0xff B19=0x20
[C66xx_0] B20=0x20 B21=0x2e2
[C66xx_0] B22=0x2e20000 B23=0x0
[C66xx_0] B24=0x0 B25=0x3000
[C66xx_0] B26=0x3000 B27=0x0
[C66xx_0] B28=0x0 B29=0x3
[C66xx_0] B30=0xc002d80 B31=0x8b
[C66xx_0] NTSR=0x1000c
[C66xx_0] ITSR=0x0
[C66xx_0] IRP=0x0
[C66xx_0] SSR=0x0
[C66xx_0] AMR=0x0
[C66xx_0] RILC=0x0
[C66xx_0] ILC=0x0
[C66xx_0] Exception at 0x0
[C66xx_0] EFR=0x2 NRP=0x0
[C66xx_0] Internal exception: IERR=0x1
[C66xx_0] Instruction fetch exception
[C66xx_0] ti.sysbios.family.c64p.Exception: line 248: E_exceptionMin: pc = 0x00000000, sp = 0x803ee5b8.
[C66xx_0] To see more exception detail, use ROV or set 'ti.sysbios.family.c64p.Exception.enablePrint = true;'
[C66xx_0] xdc.runtime.Error.raise: terminating execution
附件里为整个工程包
求TI专家给分析一下原因!着急要使用网络跟多核调度!