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.

c6678 Heap problem


C6678 development board, now I met, multiple cores by IPC run at the same time, using the malloc function allocates space at the same time, the basic

can go wrong, many in the operation of the core will not allocated memory, I because in the e2e should be assigned the same heap, I learned to create

multiple heap and give each nuclear to specify different heap can solve, my BIOS version is 6.35.4.50. I define heap is as follows in my cfg:

Var heapMem0Params = new HeapMem. Params ();

HeapMem0Params. Instance. Name = "H1";

HeapMem0Params. Size = 104857600/3;

HeapMem0Params. The align = 8;

HeapMem0Params. SectionName = "myHeap1";

The Program. The global. Task0Heap = HeapMem. Create (heapMem0Params);

"MyHeap1" Program. SectMap [] = "DDR3";

/ / Program. Global. INTMEM_HEAP = HeapMem. Create (heapMem0Params);

The Memory. DefaultHeapInstance = Program. Global. Task0Heap;

/ / Memory. DefaultHeapInstance = Program. Global. INTMEM_HEAP;

Error phenomenon: when multicore run error by the ROV view to heapmem available memory to zero, but in fact, the memory allocated is enough, don't know what reason to swallowed up

How do I give each nuclear specified heap

To the point, I'd like To know how do I define in the CFG file heapbuf assigned To specific nuclear

  • Hi he jay,

    I would recommend you to have a look at the C6678 cfg files for Master and slave code of Image processing demo. It might be of good help to create your own.

    Those CFG files will have appropriate Heap configurations for IPC communication.

    Attached here too for reference.image_processing_evmc6678l_master.cfg

    image_processing_evmc6678l_slave.cfg

  • Thank you very much for your prompt reply, I carefully read your two CFG file, each file defines a heapmem. Only I want such a mechanism, a CFG file defined in the multiple heapmem, then they are assigned to each nuclear, generate only a out file. Excuse me, is that ok?

  • I created a multi-core project in a c6678. Generate an executable file. Eight core at the same time to run the. Out file, run the process found very

    strange phenomenon, after a series of tests found is a memory conflict. Because I used a lot of dynamic memory application code and eight core at the

    same time from a heapmem dynamic application memory will conflict, so I created the eight core heapmem, I think to the eight heapmem were distributed

    to eight cores in, ask how to achieve?

    var heapMem0Params = new HeapMem.Params();
    heapMem0Params.instance.name = "H0";
    heapMem0Params.size = 0x2000000//204857600*3/2;
    heapMem0Params.align = 8;
    heapMem0Params.sectionName = "myHeap0";
    Program.global.task0Heap = HeapMem.create(heapMem0Params);
    Program.sectMap["myHeap0"] = "DDR2";
    //Program.global.INTMEM_HEAP = HeapMem.create(heapMem0Params);
    Memory.defaultHeapInstance = Program.global.task0Heap;
    //Memory.defaultHeapInstance = Program.global.INTMEM_HEAP;

    var heapMem1Params = new HeapMem.Params();
    heapMem1Params.instance.name = "H1";
    heapMem1Params.size = 0x2000000//204857600*3/2;
    heapMem1Params.align = 8;
    heapMem1Params.sectionName = "myHeap1";
    Program.global.task1Heap = HeapMem.create(heapMem1Params);
    Program.sectMap["myHeap1"] = "DDR3";
    //Program.global.INTMEM_HEAP = HeapMem.create(heapMem0Params);
    Memory.defaultHeapInstance = Program.global.task1Heap;
    //Memory.defaultHeapInstance = Program.global.INTMEM_HEAP;

    For example, the above I create the two heapmem, how were they are assigned to the first nuclear and a second nuclear.




    In short, also is in a single image, a cfg file created eight core heapmem. To this single image download to 0-7 cores, how to each core dynamic

    application to locate a heapmen.
  • If you are looking for allocating memory for each core, refer below the code snippet (mcip_process.c) in which memory is allocated for each core and created as one slave.out file. 

    For more info on the memory allocation and distribution, please refer to this thread:

     e2e.ti.com/.../1452126

    i

    nt mc_process_init (int number_of_cores)
    
    {
    
        int i;
    
     
    
        p_queue_msg = (process_message_t **) calloc(number_of_cores, sizeof(process_message_t *));
    
        if (!p_queue_msg) {
    
            printf("alloc_queue_message: Can't allocate memory for queue message\n");
    
            return -1;
    
        }
    
     
    
        for (i = 0; i < number_of_cores; i++) {
    
            p_queue_msg[i] =  (process_message_t *) MessageQ_alloc(IMAGE_PROCESSING_HEAPID, sizeof(process_message_t));
    
            if (!p_queue_msg[i]) {
    
                printf("alloc_queue_message: Can't allocate memory for queue message %d\n", i);
    
                return -1;           
    
            }
    
            memset(p_queue_msg[i]->info.scratch_buf_len, 0, NUMBER_OF_SCRATCH_BUF * sizeof(uint32_t));
    
            memset(p_queue_msg[i]->info.scratch_buf, 0, NUMBER_OF_SCRATCH_BUF * sizeof(uint8_t *));
    
        }
    
     
    
        max_core = number_of_cores;
    
     
    
        memset(slave_queue_name, 0, MAX_SLICES*16);
    
        for (i = 0; i < MAX_SLICES; i++) {
    
            GET_SLAVE_QUEUE_NAME(slave_queue_name[i], i);
    
        }
    
        return 0;
    
    }