This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMDXIDK57X-LCD: IPC error

Part Number: TMDXIDK57X-LCD
Other Parts Discussed in Thread: AM5728

Hello every one,

I'm trying to use messageQ module between Cortex A15 core1 and C66x DSP1 , But I'm stuck in IPC initializations, I'm using AM5728 IDK, here is my main.c for cortex a15:

#include <xdc/std.h>
#include <xdc/runtime/Error.h>
#include <xdc/runtime/System.h>
#include <ti/sysbios/BIOS.h>
#include <ti/sysbios/knl/Task.h>



#include <ti/ipc/Ipc.h>
#include <ti/ipc/MessageQ.h>
#include <ti/ipc/MultiProc.h>
#include <ti/sdo/ipc/interfaces/ITransport.h>
#include <ti/sdo/ipc/interfaces/IMessageQTransport.h>

#define SERVER "DSP1"


Void taskFxn(UArg a0, UArg a1)
{
    Int     status;
    UInt16  remoteProcId;


    /*
     *  initialize the ipc layer
     */
    status = Ipc_start();
    System_printf("Ipc_start: %d", status);
    System_flush();
    if (status < 0) {
        System_abort("Ipc_start failed\n");
    }

    remoteProcId = MultiProc_getId(SERVER);
    System_printf("remoteProcId: %d", remoteProcId);
    System_flush();
    if (remoteProcId == MultiProc_INVALIDID) {
        System_abort("Improper MultiProc ID\n");
    }
    do {
        status = Ipc_attach(remoteProcId);

    } while ((status < 0) && (status == Ipc_E_NOTREADY));
    System_printf("Ipc_attach: %d", status);
    System_flush();

}

/*
 *  ======== main ========
 */
Int main()
{ 
    Task_Handle task;
    Error_Block eb;

    System_printf("enter main()\n");

    Error_init(&eb);
    task = Task_create(taskFxn, NULL, &eb);
    if (task == NULL) {
        System_printf("Task_create() failed!\n");
        BIOS_exit(0);
    }

    BIOS_start();    /* does not return */
    return(0);
}

and this is *.cfg file:

var Defaults = xdc.useModule('xdc.runtime.Defaults');
var Diags = xdc.useModule('xdc.runtime.Diags');
var Error = xdc.useModule('xdc.runtime.Error');
var Log = xdc.useModule('xdc.runtime.Log');
var LoggerBuf = xdc.useModule('xdc.runtime.LoggerBuf');
var Main = xdc.useModule('xdc.runtime.Main');
var Memory = xdc.useModule('xdc.runtime.Memory')
var SysMin = xdc.useModule('xdc.runtime.SysMin');
var System = xdc.useModule('xdc.runtime.System');
var Text = xdc.useModule('xdc.runtime.Text');
System.extendedFormats = '%$L%$S%$F%f';
var BIOS = xdc.useModule('ti.sysbios.BIOS');
var Clock = xdc.useModule('ti.sysbios.knl.Clock');
var Swi = xdc.useModule('ti.sysbios.knl.Swi');
var Task = xdc.useModule('ti.sysbios.knl.Task');
var Semaphore = xdc.useModule('ti.sysbios.knl.Semaphore');
var Hwi = xdc.useModule('ti.sysbios.hal.Hwi');

System.maxAtexitHandlers = 4;       

BIOS.heapSize = 0x1000;

/*
 * Build a custom SYS/BIOS library from sources.
 */
BIOS.libType = BIOS.LibType_Custom;

/* System stack size (used by ISRs and Swis) */
Program.stack = 0x2000;

/* Circular buffer size for System_printf() */
SysMin.bufSize = 0x200;

/* 
 * Create and install logger for the whole system
 */
var loggerBufParams = new LoggerBuf.Params();
loggerBufParams.numEntries = 16;
var logger0 = LoggerBuf.create(loggerBufParams);
Defaults.common$.logger = logger0;
Main.common$.diags_INFO = Diags.ALWAYS_ON;

System.SupportProxy = SysMin;
var SemiHostSupport = xdc.useModule('ti.sysbios.rts.gnu.SemiHostSupport');




/*========================   IPC  =======================*/

xdc.useModule('ti.sdo.ipc.Ipc');
xdc.useModule('ti.sdo.ipc.MessageQ');
xdc.useModule('ti.sdo.ipc.SharedRegion');
xdc.useModule('ti.sdo.utils.MultiProc');
xdc.useModule('ti.sysbios.heaps.HeapBuf');




/* configure processor names */
var procNameAry = ["DSP1","DSP2","IPU1","IPU2",
        "HOST"];
var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
MultiProc.setConfig("HOST", procNameAry);

/* ipc configuration */
var Ipc = xdc.useModule('ti.sdo.ipc.Ipc');
Ipc.procSync = Ipc.ProcSync_PAIR;
Ipc.sr0MemorySetup = true;

/* shared region configuration */
var SharedRegion = xdc.useModule('ti.sdo.ipc.SharedRegion');

/* configure SharedRegion #0 (IPC) */
var SHAREDMEM      = 0x8E000000;
var SHAREDMEMSIZE  = 0x1000000;


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





/* create a default heap */
var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
var heapMemParams = new HeapMem.Params();
heapMemParams.size = 0x8000;

var Memory = xdc.useModule('xdc.runtime.Memory');
Memory.defaultHeapInstance = HeapMem.create(heapMemParams);

and this is my project folder:

IPCTestProject.zip

I debugged both cores and they both stick in while loop and Ipc_attach returns -11, I think there is something wrong with the sharedRegion but I can't figure it out, I searched the forum, similar resolved questions didn't help so much.

I'm using ti-RTOS on both cores and these are my SW/tools versions;

bios_6_75_02_00,

ccs910,

ipc_3_50_03_05,

xdctools_3_51_01_18,

processor_sdk_rtos_am57xx_6_00_00_07,

B.R,

Alex.

  • Hello Alex,

    Please take a look at the IPC examples for reference. They are located at ipc_3_50_03_05/examples. The ex02_messageQ example looks similar to what you are trying to do here. 

    It may be good to try running one of the examples as a sanity check as well. They can be built by following the steps in the section titled "Build IPC RTOS examples" in the IPC quick start guide:

    http://software-dl.ti.com/processor-sdk-linux/esd/docs/latest/linux/Foundational_Components_IPC.html#ipc-quick-start-guide

    If you have any questions please let me know.

    Regards,
    Sahin

  • Hi Sahin,

    Thank you for your response. In fact, I need to use IPC in one of my projects, I started to read ti documents and then I run ti example "ex02_messageQ" which seems to work successfully (below is a screenshot of it) and I have read its source code too (although I didn't understand some parts).

    but, running ti's prebuilt examples wouldn't help me so much in my project, so I decided to start a new project and focus on implementing IPC,  connecting cores and messageQ, so that I can fully understand IPC and then use it in my main project. But still I'm stuck in Ipc_attach which returns -11, I tried to play with some configurations in .cfg files, but my problem still exists. (I attached my last version of code)

    1348.IPCTestProject.zip


    B.R,

    Alex.

  • I know my sharedregion setup is incomplete, it seems like ti has completed its setup in *.bld file which I can't fully understand, besides, as far as I know, I am supposed to define my memory regions in a linker.cmd file which can't be found in my configPkg directory. 

  • Hi Alex,

    It looks like you got the IPC example working in this thread here: https://e2e.ti.com/support/processors/f/791/t/833018

    Can we close this thread?

  • Dear Sahin,

    Even before I open this issue, I was able to run ti's example successfully, the point is, I can't use IPC in my own projects until I fully understand the procedure of adding it in a new project, and I think that's not rational to start all of my projects from ti's example. sorry if my question was not so clear, now I will ask my question more clearly:

    there is a config.bld file in ti's example that is linked into the project, in this file, ti has configured some memories, is there any other solution for doing this memory configuration? because that doesn't seem reasonable to add an external file in XDCTools=> advanced options, can I do that in my *.cfg file? if yes, how can I do that? where is this procedure documented?

  • Hi Alex,

    The config.bld allows for making memory map changes at the application level, but it is not required. You can configure your memory map by modifying your RTSC platform. Please see http://rtsc.eclipse.org/docs-tip/Demo_of_the_RTSC_Platform_Wizard_in_CCSv4 for a demonstration on how to do this. 

    It is also possible to do some memory map modifications in your *.cfg file using the Program.sectMap API. For example:

    Program.sectMap[".text"] = new Program.SectionSpec();
    Program.sectMap[".text"].loadSegment = "DDR2";

    Please see http://rtsc.eclipse.org/cdoc-tip/xdc/cfg/Program.html#sect.Map for more information on this.

    I hope this helps. If you have any questions please let me know.