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.

Shared variable between 8 DSPs and 1 ARM?

Other Parts Discussed in Thread: SYSBIOS

Hi 

I am trying to use a shared data buffer in my program. This buffer will be updated by DSP0 and all others should be able to see its updates.

I am using EVMK2H with linux on ARM and sysbios on DSPs. I am using #pargam section to define shared buffer. In code I update the buffer in DSP0 and when I try to read the values of buffer on other DSPs i.e. DSP1 I don't see updated values. I am using mpmcl utitlity and run dsp1 after 3-5 seconds of DSP0.

in My CFG file I do like this

Program.sectMap[".myMSMC"] = "MSMCSRAM";

while In c file 

#pragma DATA_SECTION(buf, "myMSMC");
int buf[72*1024]; // I also defines it above the #pragma line but same results

int i=0;
	switch(coreID)
	{
	case 1:
		Cache_inv(buf, 72*4096, Cache_Type_ALL, TRUE );
		for(i = 0; i < 72*1024; i++)
		{

			buf[i]=72*1024-i;
			System_printf("%d,", buf[i]);
		}
		Cache_wbInv(buf, 72*4096, Cache_Type_ALL, TRUE );
		break;
	default:
		Cache_inv(buf, 72*4096, Cache_Type_ALL, TRUE );
		for(i = 0; i < 72*1024; i++)
		{

			System_printf("%d,", buf[i]);
		}
		Cache_wbInv(buf, 72*4096, Cache_Type_ALL, TRUE );

  • Hi Rao,

    I would recommend you to start from something which already works.

    For K2H,

    Case ( i )

    If it is shared memory between just the DSP cores, please refer to the example, "rmSharedK2HC66BiosTestProject" of pdk_k2hk_4_0_1.

    Case (ii)

    If you are looking for shared memory between DSP cores and ARM core, there are examples like ex44_compute, ex45_host and ex46_graph. All these are working examples of ipc_42_00_02 . You can refer the source code of these and compare the flow with your code.
  • As I mentioned in my earlier post
    e2e.ti.com/.../524541
    that I don't see memory_alloc() called on shared region any where in the code except in a function that is defined but never called. these examples are not as easy as you say. For a beginner it is very complex example. All I need a simple procedure/tutorial on how to use SharedRegion between all the DSPs and ARM.
  • Rao,

    Request you not to create multiple posts on the same topic.

    Ofcourse, the memory_alloc function is called in that example.

    For TCI6638, able to run the shared region example , "rmShared_evmc6678_C66BiosTestProject" which uses the "Osal_rmMalloc()" which in turn uses the "SharedRegion_getHeap" to allocate the heap memory which returns me the valid address as "0x0083C038" as shown in the debug window below.

    I would recommend you to compare the code flow of how this function is used in that example and with your own code. You may be able to narrow down.

    /* FUNCTION PURPOSE: Allocates memory

    ***********************************************************************

    * DESCRIPTION: The function is used to allocate a memory block of the

    *              specified size.

    */

    void *Osal_rmMalloc (uint32_t num_bytes)

    {

    Error_Block errorBlock;

       while ((CSL_semAcquireDirect (RM_MALLOC_FREE_SEM)) == 0);

       Osal_rmBeginMemAccess(rmMallocCounter, sizeof(rmMallocCounter));

       /* Increment the allocation counter. */

       rmMallocCounter[0]++;

       Osal_rmEndMemAccess(rmMallocCounter, sizeof(rmMallocCounter));

       CSL_semReleaseSemaphore (RM_MALLOC_FREE_SEM);

    /* Allocate memory. */

    return Memory_alloc(SharedRegion_getHeap(0), num_bytes, 0, &errorBlock);

    }