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.

how to use shared memory on c6657

Hello,

I have some questions about the usage of shared regions on c6657. On this device I use for both cores seperate .out files.
What I want to do: core 0 processes some data, then gives a QMessage to core 1 that does also some processing.

But how do I 'transfer' the data. The size of the data is approximately  512kByte.
I think I can create a message like:
typedef struct
{
    MessageQ_MsgHeader  header;       // The MessageQ header
    Uint8    Data[512000];          // Message data
} MyMsg;

But what is the maximum size of the data buffer? Does the message use MSM RAM (size is 1024KB)?
Is this the best way or transfering such an amount of data? What is the time delay?
Is the message actually transfered or is it a transfer of the pointer?

Or can I create a shared mem buffer in DDR3 ram? I think I can using the SharedRegion Module (SPRUGO6E page 32).
The thing that is not clear to me is how do I transfer the addres of the data buffer from core0 to core1.

I hope you can help.

Thanks Ralph

  • The MessageQ message can be passed as either a buffer pointer or the buffer itself.  The buffer can be allocated in various way, either by calling MessageQ_alloc, allocating it yourself, or by defining it statically as you have.  The buffer (or pointer) is typically from within a SharedRegion location that's known to both cores.  You can configure your SharedRegion in any valid memory space (DDR3, etc) from your application *.cfg file.

    CodeComposerStudio (CCS) provides a MessageQ IPC example that might help clarify some of this.  If you have CCS, create a new CCS project by selecting  "IPC and I/O Examples" from the Project templates.

  • Ok thanks, I have it running. The shared memory that is used is however MSM Ram.

    What are the steps in the .cfg file to create it in external memory? In the platform file,  I did add a memory region called DDR3_Shared.

  • Depending on with device you selected for the IPC example, you may already have MSM RAM defined.  In the examples below, you can see the generated application map file which defines MSMCSRAM, which is where the Message_multicore example set its SharedRegion to be.

  • Hey Arnie,

    As you say I have it working. The message is placed inside MSM Ram, but I want it to be placed inside SDRAM.

    Inside the cfg file I added the lines:
    Program.sectMap["mySect"] = new Program.SectionSpec();
    Program.sectMap["mySect"].loadSegment = "DDR3_Shared";

    At the moment I create the heap inside the.cpp file like this:
    HeapBufMP_Params_init(&heapBufParams);
    heapBufParams.regionId       = 0;
    heapBufParams.name           = HEAP_NAME;
    heapBufParams.numBlocks      = 1;
    heapBufParams.blockSize      = sizeof(ImageData_Msg);
    heapHandle = HeapBufMP_create(&heapBufParams);

    So can you point me into a direction so that the heap is placed inside SDRAM ("mysect").

    Thanks Ralph

  • If you open up your IPC example application's *.cfg file in a text view, you'll see something similar to the following:

    /* 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.setEntryMeta(0,
        { base: SHAREDMEM,
          len:  SHAREDMEMSIZE,
          ownerProcId: 0,
          isValid: true,
          name: "DDR2 RAM",
        });

    This configures SharedRegion0 (SR0) to be placed in the entire MSM (defined in the platform as base: 0x0c000000, length: 0x00200000) memory ranges defined by the platform you are using.  You can change SHAREDMEM and SHAREDMEMSIZE within the range of your DDR3 (defined in the platform as base: 0x8000000, length:0x20000000).  You can use a portion of it or the entire range.  It probably a good idea to place SRs either at the top or bottom of your memory range as to not create holes if not using the entire range.

    For example, you can set the following:

    var SHAREDMEM           = 0x80000000;
    var SHAREDMEMSIZE       = 0x00200000;

    var SharedRegion = xdc.useModule('ti.sdo.ipc.SharedRegion');
    SharedRegion.setEntryMeta(0,
        { base: SHAREDMEM,
          len:  SHAREDMEMSIZE,
          ownerProcId: 0,
          isValid: true,
          name: "DDR3 MEMORY",
        });


    The application will now allocate HeapMemMP buffers from DDR3 (SharedRegion 0 as set above in your heapBufParams.regionId)