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.

"Memory_alloc" is undefined

Other Parts Discussed in Thread: SYSBIOS

I'm migrating from DSP/BIOS to SYS/BIOS (CCSv5.2.2, BIOS 6.33.05.46, XDC Tools  3.23.03.53)  and am seeing the following error in the Problems Window:

Description    Resource    Path    Location    Type
#20 identifier "Memory_alloc" is undefined    DecimationFilter.cpp    /Vibration Monitor/SignalProcessing    line 228    C/C++ Problem

In those files where I'm seeing the above error, I have:

#include <xdc/runtime/Memory.h>
#include <xdc/runtime/System.h>
#include <ti/sysbios/BIOS.h>
#include <xdc/cfg/global.h>

The errors are referring to the following lines in each file where I'm seeing the error:

        //mpPolyphaseFilters[i] = reinterpret_cast<float*>(MEM_alloc(FAST_HEAP, (mPolyphaseLength + mPolyphaseLength%2)*sizeof(float), 8));
        mpPolyphaseFilters[i] = reinterpret_cast<float*>(Memory_alloc(FAST_HEAP, (mPolyphaseLength + mPolyphaseLength%2)*sizeof(float), 8, NULL));

The first line is my DSP/BIOS implementation. The second is the SYS/BIOS implementation.

For the heap handle, I have this in my .cfg file (attached - 3386.VibrationMonitor.cfg):

var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
var heapMem0Params = new HeapMem.Params();
heapMem0Params.instance.name = "DDR_HEAP";
heapMem0Params.align = 8;
heapMem0Params.size = 0x00100000;
heapMem0Params.sectionName = "DDR";
//Program.global.DDR_HEAP = HeapMem.create(heapMem0Params);
var heapMem1Params = new HeapMem.Params();
heapMem1Params.instance.name = "FAST_HEAP";
heapMem1Params.align = 8;
heapMem1Params.size = 0x00010000;
heapMem1Params.sectionName = "IRAM";
//Program.global.FAST_HEAP = HeapMem.create(heapMem1Params);

What am I missing?

  • Hello Mark,

    Not sure if this will help but to get it working in my case I had to include an extra header file. This is my macro definition from a header file:

        /*-------------------
            Include Files
        -------------------*/
        #include <Memory.h>
        #include <IHeap.h>
        #include <global.h>

        /*-------------
            Defines
        -------------*/
        #define MALLOC(x) Memory_alloc(NULL, (x), 0, NULL)

    Regards,
    Annie

  • Mark,
    do you call other Memory functions, Memory_free for example? Does the compiler complain about those calls?

    You can also try the following:
    - click on Project->Properties->CCS Build->C6000 Compiler->Parser Preprocessing Options.
    - set Mode to "manual" and turn on the last option "Preprocess only; maintain line directives", and clean and rebuild your project
    - the build for your project will now fail, but it will generate the file DecimationFilter.pp somewhere in the Debug directory of your project
    - Please post that file, or if you can't post it publicly you can add me as a friend on the forum and send me the file through the private message. You can add me as a friend if you click on my name, and then Add as a friend on the next page

  • Yes, in fact, I should have posted the other similar errors:

    Description    Resource    Path    Location    Type
    #20 identifier "Memory_calloc" is undefined    McbspDriver.cpp    /Vibration Monitor/Common/Drivers/Module    line 451    C/C++ Problem

    Description    Resource    Path    Location    Type
    #20 identifier "Memory_free" is undefined    DecimationFilter.cpp    /Vibration Monitor/SignalProcessing    line 77    C/C++ Problem

    Also, after setting the Properties as you describe above, when I clean my project, I get this error:

    Description    Resource    Path    Location    Type
    Cannot set property "ENABLE" of undefined to "1"    VibrationMonitor.cfg    /Vibration Monitor    Configuration Validation    XDCTools Configuration Marker

    I can't send the file you ask for...any ideas why the errors?

  • Hi Sasha,

    Any luck on my Memory_alloc, _calloc, and _free errors? I appreciate you looking. Thanks.

  • I got this to work...just included <Memory.h> in a base file which gets included in nearly all files and I've got no errors now.