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.

Using ndk example with slave cores

Other Parts Discussed in Thread: SYSBIOS

Hi,

I am trying to add IPC messageQ capabilities to helloworld
evmc6678l NDK example and I am experimenting troubles in get this implementation.


I have added the follow header files in hellowrold.c file:

/*  ----------------------------------- IPC module Headers           */
#include <ti/ipc/Ipc.h>
#include <ti/ipc/MessageQ.h>
#include <ti/ipc/HeapBufMP.h>
#include <ti/ipc/MultiProc.h>


I just trying to define two new  functions, one
for master and one for slaves and that execute TaskTest just in core0.

In main function  I added

    int status;
    Task_Params      params;

    Task_Params_init(&params);
    params.stackSize = 0x6000;
    if (MultiProc_self() == 0) {
        Task_create(StackTest, &params, NULL);
        Task_create(core0_master, &params,NULL);
    }
    else{
        Task_create(cores_slave, &params,NULL);
    }

    System_printf(core1QueueName,"%s", MultiProc_getName(1));
    System_printf(core2QueueName,"%s", MultiProc_getName(2));
    System_printf(core3QueueName,"%s", MultiProc_getName(3));
    System_printf(core4QueueName,"%s", MultiProc_getName(4));
    System_printf(core5QueueName,"%s", MultiProc_getName(5));
    System_printf(core6QueueName,"%s", MultiProc_getName(6));
    System_printf(core7QueueName,"%s", MultiProc_getName(7));
    Ipc_start();
    if (status < 0) {
        System_abort("Ipc_start failed\n");
    }

This is the code of two function added:

void core0_master() {
    System_printf("En master core\n");
}

void cores_slave() {
    System_printf("En Slave core\n");

}



When I run 8 cores I get next result in console window:

[C66xx_0] A0=0x1 A1=0x80fd8c20
A2=0x0 A3=0x0
A4=0x0 A5=0x80fd8548
A6=0xe9 A7=0x0
A8=0x0 A9=0x2
A10=0x0 A11=0x1
A12=0x81443b04 A13=0x7fb8fbcf
A14=0xec01001c A15=0x5f3bc93c
A16=0x814ac56c A17=0x0
A18=0x814ac53c A19=0x20
A20=0x6c A21=0x4c
A22=0xcfff9b5d A23=0xbef9b9fd
A24=0xcfbef57f A25=0x1502650d
A26=0x8f386391 A27=0xffbff67b
A28=0xdfefdfdd A29=0x0
A30=0x80fd7e78 A31=0x0
B0=0x0 B1=0x0
B2=0x1 B3=0x4000
B4=0x2 B5=0x0
B6=0x0 B7=0x8144dc80
B8=0x80fd638c B9=0x0
B10=0x8 B11=0x0
B12=0xbff1e7a6 B13=0xbefffee5
B14=0x814ace00 B15=0x814ac5e0
B16=0xfa00000 B17=0x0
B18=0xeffffeef B19=0xefdd57f7
B20=0x69 B21=0xfef1ffd7
B22=0xa76bde51 B23=0xedaf546f
B24=0x7052e649 B25=0xfae39fb7
B26=0x75d9a74f B27=0x7ba65f9f
B28=0xff02fbff B29=0x7f7f8f7f
B30=0xffffffff B31=0x0
NTSR=0x1000c
ITSR=0x0
IRP=0x0
SSR=0x0
AMR=0x0
RILC=0x0
ILC=0x0
Exception at 0x4000
EFR=0x2 NRP=0x4000
Internal exception: IERR=0x1
Instruction fetch exception
ti.sysbios.family.c64p.Exception: line 248: E_exceptionMin: pc = 0x00004000, sp = 0x814ac5e0.
To see more exception detail, use ROV or set 'ti.sysbios.family.c64p.Exception.enablePrint = true;'
xdc.runtime.Error.raise: terminating execution



If I try to execute just core 0 nothing appears in console.


What is missing to do this example to work with 7 cores as slaves?




Julian





  • The last function that was executing would appear to have overwritten B3 (used as a return pointer) it could be a stack corruption if B3 was needed and pushed to the stack and popped off later, especially if the stack overflowed into data space that then got overwritten.

    Anyway the 0x4000 in the NRP says it tried to execute code at 0x4000, which isn't a valid memory space.  And B3 being 0x4000 would imply it try to return from a function to that location which isn't valid, something corrupted it.

    Look at the SP, where it's allocated and how much is allocated - is this still in the valid (or close to the edge) of the valid stack?

    Best Regards,

    Chad

  • Chad,

    I did some modifications to my project and the console output has changed.

    I was getting  Invalid CIO command  message a few times:

    [C66xx_6] t.i.ssysioo..hehaass.HeHaepaMemm:  lliinnee  ti.sysbios.heaps.HeapMem: line 329: assertion failure: A_invalidFree: Invalid free
    xdc.runtime.Error.raise: terminating execution
    [C66xx_3] Invalid CIO command (47) in the CIO buffer at address (0x890abd00) was not recognized. Please check the device and program memory maps.
    [C66xx_4] Invalid CIO command (47) in the CIO buffer at address (0x890abd00) was not recognized. Please check the device and program memory maps.
    xdc.runtime.Error.raise: terminating execution
    [C66xx_3] ti.sysbios.heaps.HeapMem: line 329: assertion failure: A_invalidFree: Invalid free
    xdc.runtime.Error.raise: terminating execution
    [C66xx_7] Invalid CIO command (47) in the CIO buffer at address (0x890abd00) was not recognized. Please check the device and program memory maps.
    xdc.runtime.Error.raise: terminating execution

    But know I am getting nothing in my console.

    I was reading in other post that it is possible that  exist a problem of

     cache coherence but I dont understand why if I only have added two functions

    to the ndk helloworld example for c6678 and the only thing those functions do is

    print in console a simple string.

    I attach a minimal project that can be used to  replicate the problem., 7652.helloWorld_case2_7slaves.zip

    Regards.

  • I'm going to ask a colleague who's more familiar with the NDK code base to comment on this.  Looks like the heap may be being corrupted based on this.

    Best Regards,
    Chad 

  • I looked at you code, in your stackTest(), do you really use anything for the code starting from: rc = NC_SystemOpen( NC_PRIORITY_LOW, NC_OPMODE_INTERRUPT );

    Is that correct understanding you just want to use the NDK hello world as an skeleton to write a simple multi-core application (system_printf) with IPC? And the code has nothing with NDK stack?

    Regards, Eric

  • Eric,

    I want to use  the ndk hello world for receive data and then process it using the 8 cores.

    That project I posted is for see what is the problem I have just added messageq implementation to ndk helloworld.,

     

    My idea is get this information using ndk example in core 0 and being the master core distribute

    the information to cores 1 to 7 in order to process that data.

    I was working  with nkd hello world example for my application and it works well using one core.

    I have used messsageq for another part of the application and it works fine.

    Now I need to use ndk with messageq. 

    Regards.

  • You run the NDK helloworld on one core (core 0) or you want to run NDK on all 8 cores simulatously? From the http://e2e.ti.com/support/dsp/c6000_multi-core_dsps/f/639/p/167588/834417.aspx. You can't do 8 cores NDK.

    Regards, Eric

  • I just need to run it in one core, other cores just are going to process arriving  information.

    Regards

  • Hi,

    I was running some tests and I realize the program works well if I load the image  in all cores and run core by core. Core 0 runs ndk well.

    The problem is when I tried to group the cores, no message appears in console window.

    I checked image processing demo and it seems to use a similar  implementation to what I need. The only difference I have found until now is that  demo use one image for core 0, as master, and  one image for the others cores, as slaves.

    So the question is:

    Is it possible to get ndk helloworld example works with messageq capabilities using one image, if yes what I need to modified in my code, or I need to generate other image for slave cores?

    Regards

  • I have  tried adding a  udp connection to  image_processing_evmc6678 demo and it works If I define a task for the DaemonNew function it receives the data well and the demo with the image filter still work with the 8 cores.

    So I want to understand what is the extra code that let that demo work with ndk and messageq.

    So if someone could have some idea what is needed to do a ndk helloworld to work with messageq that would help me a lot.

    Any comments and suggestions are welcome.

    Regards.

  • Hi, for me works using image processing demo and adding ndk daemon.

    regards

  • Hi JGarcia!

            I am working on 6678 now and I want to add messageq module to the helloworld example  ?have u solved this problem ?could u give me some information or helps ? thanks a lot!