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 mem_alloc multiple heaps over multiple cores

Other Parts Discussed in Thread: SYSBIOS

Hi,

I am working with the c6678 multicore processor. I was using the c6414 processor and had a single heap in external memory for dynamically allocating buffers using MEM_alloc from the heap. I want to extend this to the c6678 with having 8 different heaps (one for each core) so they all are not competing for the same heap. Can I just go about defining 8 different heaps in the .cfg file connected to the project. My .cfg file is based on the PA multicore example that is provided as part of the PDK and within.

I had some general questions too. What is the difference between HeapBuf and HeapMem? In CCS, it talks of fixed sized buffer heap management as HepBuf - Does that mean each call to the MEM_alloc will return a fixed sized specified in the cfg file? While the HeapMem is used for variable sized heap management so all one needs to do is specify the total size of the heap. This would appear to be the same as the heap used in the c64. In the cfg file it also talks of the default Heap as being set but I want to have the default heap by any of 8 possible heaps, one for each core?

I want to have one "out file" to load on each core and not have separate out files.

Thanks, Aamir

  • Hi Aamir,

    Which version of BIOS are you using?  Which version of the MCSDK are you using?

    Aamir Husain said:
    dynamically allocating buffers using MEM_alloc from the heap

    Are you using SYS/BIOS legacy APIs (MEM_alloc) or did you mean to type Memory_alloc (or HeapBuf_alloc or HeapMem_alloc)?

    Aamir Husain said:
    What is the difference between HeapBuf and HeapMem?

    HeapBuf is fast and deterministic.  As you stated, it can only allocate blocks of a single size.

    HeapMem allows you allocate blocks of varying sizes.

    For more details please refer to the SYS/BIOS API guide, found under SYS/BIOS help in the CCS help menu.

    Steve

  • I believe it is bios 6.33.02.31 and mcsdk is 2.00.07.19.

    I guess I could use either the legacy APIs of the new one Memory_alloc. I have had a look at the sysbios application report spraas7g that talks of migrating aplications to sysbios6 and get the sense I can do what I want but I am not sure so some guidance from TI would be appreciated.

    Thanks, Aamir

  • Hi Aamir,

    Ok, I'm still trying to understand what you're trying to do completely.  So far I think that originally, you had an application that was based on BIOS 5.x running onthe C6414.  And now you will try to migrate this application to BIOS 6.x.  (Please correct me if I'm wrong...)

    If that's right, then you will certainly want to read through the SYS/BIOS Migration Guide (spraas7g.pdf).  We will be happy to help you with any questions or migration issues that you might have while getting your app moved from BIOS 5.x -> BIOS 6.x.  Just post your questions to the BIOS forum.

    Aamir Husain said:
    I want to extend this to the c6678 with having 8 different heaps (one for each core) so they all are not competing for the same heap. Can I just go about defining 8 different heaps in the .cfg file connected to the project

    I want to double check with my colleague on this.  I'm not sure that this will work like you think it will; you may have to use IPC to acheive this.  I'm thinking that if the image is identical between cores, then the memory range of the heap may be the same (and hence conflicting).  IPC has a solution for sharing heaps between cores.

    Steve

  • Aamir,

    HeapMem and HeapBuf are for single core BIOS.  These cannot be used across different cores, but sounds to me like you want to create 8 different heaps with each one used by just one core?  If that's what you want to do, that should be okay.  Create 8 heaps and then at runtime make sure each core uses a different heap.

    A possible alternative is Ipc has some multicore heap implementation called HeapBufMP and HeapMemMP which can be used across multiple cores but these are not statically supported.  They can only be created at runtime.

    Judah

  • Judah,Steve,

    Yes, I am interested in creating 8 different heaps one for each core and not to be shared amongst cores. Can I create it as an array of 8 heaps and then use the coreNum to access the appropriate heap when calling the MEM_alloc function.

    Can you also point me to some documentation on the ipc alternative HeapBufMP and HeapMemMP for my info sake.

    Thanks, Aamir

  • Aamir,

    IPC is its own product that's meant to work together with SYS/BIOS.  You can download the most current version at this link as well as access some documentation links:

    http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/ipc/1_25_01_09/index_FDS.html

    Steve

  • Judah,

    I have a followup question in regards to your statement that HeapMem are for single core BIOS and cannot be used across different cores. Is that really the case? Here is what I am doing.

    I am making use of the multicore example provided in the PDK as a starting point for my development. In the cppi_qmss_mgmt.c file that is part of the project there is a function called Setup_Rx(). In this function one sets up the Rx flow using the call to Cppi_configureRxFlow(). This in turn makes a call to the Memory_alloc function which is grabbing a buffer from the default heap set in the .cfg file as of size 8192x30. This malloc is also used in Cppi_txChannelOpen and Cppi_rxChannelOpen. The later two are only called by the first core. However, the Setup_Rx() core is called by all cores. In the original code provided by TI, all cores call this function so would that not mean that each core is using the same default heap or is it that all of the cores are using their own default heap? Another thing is that in the file multicore_osal.c that is under the multicoreExample directory that contains the Osal_cppiMalloc() function that actually calls the Memory_alloc() function there is a comment that says this API should allocate memory from shared memory if the test are to be run on multiple cores which is the case for the multicore example so does'nt that constitute use across different cores?

    Thanks, Aamir

  • Aamir,

    Yes, HeapMem cannot be shared across cores.  There is no protection and one core would not know what the other cores have done.

    It could be that all cores are using their own default heap.

    You need to find out where the Memory_alloc() is getting memory.

    Judah