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.

Redefining malloc in RTSC application

Other Parts Discussed in Thread: SYSBIOS

Hello,

We are implementing our own malloc() function in a DSP application which uses BIOS. The need for new malloc() is because we need to allocate from different heaps based on the requested allocation size using the standard malloc() call. 

My problem is that malloc(), free(), etc. are already defined in app_pe66.c configuration generated source file:

error #10056: symbol "malloc" redefined: first defined in "...Debug/configPkg/package/cfg/app_pe66.oe66"; redefined in "./malloc2.obj"

If I've understood correctly, the RTSC configuration can not be build as a library, even the configuration is in a separate CCS project? 
If I'm building my malloc in a library, the application compiles, but it uses the malloc() from  app_pe66.c.

Does anyone know how I can overwrite/ignore/rename some of the symbols in app_pe66.c? 

thanks,

Vesa

  • Vesa,


    Which versions of BIOS and XDC tools are you using?

    The first argument to Memory_alloc() is the Heap instance which the allocation should be drawn from. This allows the user to specify different heaps and heap managers for different purposes, all through a common API. Is this functionality not sufficient for your application?

    Alan

  • Hi Alan, others,

    Yes, that is what we are exactly using. My problem is that we need to implement malloc(), free(), memalign() in order to be compliant with other libraries that are used in the SW. No problem implementing these, the problem is the conflicting symbols from app_pe66.c. 


    Is there anyway to configure the application so that this section will not be included in the generated source code?

    /*
    * ======== ti.sysbios.rts.MemAlloc TEMPLATE ========
    */

    Vesa

  • Vesa,

    For BIOS 6.37 and older, If you add the following to your .cfg file, BIOS will not generate the conflicting APIs:

       var HeapStd = xdc.useModule('xdc.runtime.HeapStd');

    Starting with BIOS 6.40, you should instead add the following to suppress the generation of the conflicting APIs:

      var MemAlloc = xdc.useModule('ti.sysbios.rts.MemAlloc');

      MemAlloc.generateFunctions = false;

    Alan

  • Thanks a lot Alan! That's exactly what I was looking for.