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

ndk和ipc合并出现问题

各位工程师好,本人想把ndk和ipc工程合并,用的是helloworld_evmc6678l和shmIpcBenchmark_c6678l工程,合并步骤如下:

1.将shmIpcBenchmark工程的cfg配置文件拷贝到helloworld.cfg文件下;

2.改写helloworld.c文件,将ipc相关的头文件和函数加入其中;

3.编译可以通过,但是下载到core0.core1后有问题;显示:

[C66xx_0] timerFreq.lo = 1000000000. timerFreq.hi = 0

[C66xx_0] cpuFreq.lo = 1000000000. cpuFreq.hi = 0

[C66xx_0] Core ("CORE0") starting

[C66xx_1] Invalid CIO command (24) in the CIO buffer at address (0x80693380) was not recognized. Please check the device and program memory maps.

[C66xx_1] cpuFreq.lo = 1000000000. cpuFreq.hi = 0

[C66xx_1] Core ("CORE1") starting

发现程序一直停留在语句attachAll(numCores),无法进入下一语句。请问是怎么回事?望哪位工程师解答一下,谢谢。

cfg文件:

/*
 * 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.
 *
 */
 
 
 
 
 

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

 var BIOS    =   xdc.useModule('ti.sysbios.BIOS');
/********************************************************************************************************************
*  Specify all needed RTSC MOudles and ocnfigure them.                *
********************************************************************************************************************/

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

 

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');

 

 

/*
** Create a Heap.*/

var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
var heapMemParams = new HeapMem.Params();
heapMemParams.size = 0x600000;
heapMemParams.sectionName = "systemHeap";
Program.global.heap0 = HeapMem.create(heapMemParams);

 /* This is the default memory heap. */
  Memory.defaultHeapInstance  =   Program.global.heap0;

//=======================================================由DDR3改成MSMCSRAM———–开始
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";
//=======================================================由DDR3改成MSMCSRAM———–结束

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;

/********************************************************************************************************************
* 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 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;

 

 

 

var Task = xdc.useModule('ti.sysbios.knl.Task');var tskParams = new Task.Params;
tskParams.instance.name = "tsk0";
Program.global.task0 = Task.create('&tsk0', tskParams); /* Benchmark Task */

var Semaphore     = xdc.useModule('ti.sysbios.knl.Semaphore');
Semaphore.supportsEvents = false;

//var Agent = xdc.useModule('ti.sysbios.rta.Agent');
//Agent.transport = Agent.Transport_STOP_MODE_ONLY;
 
//var Load = xdc.useModule('ti.sysbios.utils.Load');
//Load.hwiEnabled = false;
//Load.swiEnabled = false;//Load.taskEnabled = false;

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

System.extendedFormats = "%f";

var BIOS = xdc.useModule('ti.sysbios.BIOS');
BIOS.clockEnabled = true;
BIOS.heapSize = 0x10000;

var Timestamp = xdc.useModule("xdc.runtime.Timestamp");

Program.sectMap[".msgQ_ptrs"] = new Program.SectionSpec();
Program.sectMap[".msgQ_ptrs"] = "L2SRAM";

Program.sectMap["platform_lib"] = new Program.SectionSpec();
Program.sectMap["platform_lib"] = "L2SRAM";

var PlatformLib = xdc.loadPackage('ti.platform.evmc6678l');

/*** Register an EVM Init handler with BIOS. This will initialize the hardware. BIOS calls before it starts.**
** If debugging with CCS, then this function will execute as CCS loads it if the option in your** Target Configuration file (.ccxml) has the option set to execute all code before Main. That is the** default.
*/
Startup.firstFxns.$add('&initPlatform');

var cslSettings = xdc.useModule ('ti.csl.Settings');

var cacheEnabled = true; var cacheLineSize = 128;
var procName = null;
var procNameList = [];

var Settings                = xdc.module('ti.sdo.ipc.family.Settings');
var Cache                = xdc.useModule('ti.sysbios.family.c66.Cache');
var MessageQ                = xdc.module('ti.sdo.ipc.MessageQ');
var Notify                  = xdc.module('ti.sdo.ipc.Notify');
var Ipc                     = xdc.useModule('ti.sdo.ipc.Ipc');
Notify.SetupProxy           = xdc.module(Settings.getNotifySetupDelegate());
MessageQ.SetupTransportProxy= xdc.module(Settings.getMessageQSetupDelegate());

/* Use shared memory IPC */
Notify.SetupProxy           = xdc.module('ti.sdo.ipc.family.c647x.NotifyCircSetup');
MessageQ.SetupTransportProxy = xdc.module('ti.sdo.ipc.transports.TransportShmNotifySetup');

/* Set to disable error printouts */
/* var Error = xdc.useModule('xdc.runtime.Error'); */
/* Error.raiseHook = null; */

Program.global.NOTIFYSETUP = Notify.SetupProxy.delegate$.$name;
Program.global.TRANSPORTSETUP = MessageQ.SetupTransportProxy.delegate$.$name;

switch (Program.platformName) {                                                                      case "ti.sdo.ipc.examples.platforms.evm6678.core0":
    case "ti.platforms.evm6678":           Program.global.USING_C6678 = 1;           procNameList = ["CORE0", "CORE1"];
        Program.global.shmBase = 0x0C000000;
        Program.global.shmSize =  0x00100000; /* Sized for greater than 8000 128 byte messageQ messages */
        break;
    case "ti.sdo.ipc.examples.platforms.evm6670.core0":
    case "ti.platforms.evm6670":           Program.global.USING_C6670 = 1;           procNameList = ["CORE0", "CORE1"];
        Program.global.shmBase = 0x0C000000;
        Program.global.shmSize = 0x00100000; /* Sized for greater than 8000 128 byte messageQ messages */
        break;
    default:
        throw("Unsupported platform: " + Program.platformName);
}
var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
MultiProc.setConfig(procName, procNameList);

Program.global.DEVICENAME = Program.cpu.deviceName;
Program.global.PROCNAMES = procNameList.join(",");
Program.global.BUILDPROFILE = Program.build.profile;

var SharedRegion = xdc.useModule('ti.sdo.ipc.SharedRegion');
SharedRegion.translate = false;
SharedRegion.setEntryMeta(0,
    { base: Program.global.shmBase,      len: Program.global.shmSize,
      ownerProcId: 0,
      isValid: true,
      cacheEnable: cacheEnabled,
      cacheLineSize: cacheLineSize,  /* Aligns allocated messages to a cache line */
      name: "internal_shared_mem",
    });

/* Optimization stuff */
Diags = xdc.useModule("xdc.runtime.Diags");
var Defaults = xdc.useModule('xdc.runtime.Defaults');

//Defaults.common$.diags_ASSERT = Diags.ALWAYS_OFF;
Defaults.common$.logger = null;

var Semaphore     = xdc.useModule('ti.sysbios.knl.Semaphore');
Semaphore.supportsEvents = false;

BIOS.libType = BIOS.LibType_Custom;

 

main函数:

int main()
{   char coreID = CSL_chipReadReg (CSL_CHIP_DNUM);

 Int status ;
 Task_Params taskPara;
 Task_Params taskParams;

 

#if 1
  Int32 result = 0;
  Types_Timestamp64 time64;
  UInt64 timeStamp = 0;

  Timestamp_getFreq(&timerFreq);
  System_printf("timerFreq.lo = %d. timerFreq.hi = %d\n", timerFreq.lo, timerFreq.hi);

  BIOS_getCpuFreq(&cpuFreq);
  System_printf("cpuFreq.lo = %d. cpuFreq.hi = %d\n", cpuFreq.lo, cpuFreq.hi);

  cpuTimerFreqRatio = (Float)cpuFreq.lo / (Float)timerFreq.lo;

  Timestamp_get64(&time64);
  timeStamp = TIMESTAMP64_TO_UINT64(time64.hi,time64.lo);
  timeAdj = TIMESTAMP64_TO_UINT64(time64.hi,time64.lo) – timeStamp;

  selfId = CSL_chipReadReg (CSL_CHIP_DNUM);

  System_printf("Core (\"%s\") starting\n", MultiProc_getName(selfId));

  if (numCores == 0) {
   numCores = MultiProc_getNumProcessors();
  }

  /* Attach all cores */
  attachAll(numCores);

  prevCoreId = (selfId – 1 + numCores) % numCores;

  System_sprintf(localQueueName, "CORE%d", selfId);
  System_sprintf(nextQueueName, "CORE%d",
   ((selfId + 1) % numCores));
  System_sprintf(prevQueueName, "CORE%d", prevCoreId);

  System_printf("localQueueName=%s. nextQueueName=%s. prevQueueName=%s\n",
      localQueueName,  nextQueueName, prevQueueName);

  /* Create a message queue. */
  messageQ = MessageQ_create(localQueueName, NULL);
  if (messageQ == NULL) {
   System_abort("MessageQ_create failed\n" );
  }

 

#endif
#if 1

     if(coreID == 0)
     {
   Task_Params_init(&taskParams);
   taskParams.priority = 1;
   taskParams.stackSize = 4096;
   tsk1 = Task_create (StackTest, &taskParams, NULL);
     }
#endif

 /* Start the BIOS 6 Scheduler */
 BIOS_start ();

}

eric long:

单步调试时候,发现core0能够运行attachAll(numCores)直到bios_start;但是core1一直跳不出attachAll(numCores)中的如下循环:

  if (MultiProc_self() != entry.ownerProcId) {        do {            status = Ipc_attach(entry.ownerProcId);        } while (status < 0);    }

status == -11,查了下,-11表示Operation was not ready,那么需要修改什么呢?

赞(0)
未经允许不得转载:TI中文支持网 » ndk和ipc合并出现问题
分享到: 更多 (0)