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.

Why do I get an error when constructing a statically allocated event in the main function?

Hello,

When I call the function below:

/* Event init */
Event_construct(&Evt, &params.ep);

It jumps directly to an error function that seems to be implying that it cannot allocate memory for this instance as if this is not being statically allocated:

/* construct */
void ti_sysbios_knl_Event_construct(ti_sysbios_knl_Event_Struct *__obj, const ti_sysbios_knl_Event_Params *__paramsPtr )
{
    xdc_runtime_Error_raiseX(NULL, ti_sysbios_knl_Event_Module__id__C, NULL, 0, xdc_runtime_Error_E_generic, (xdc_IArg)"create policy error", 0);
}

However my configuration seems to be fine:

/*
 * SYSBIOS Modules
 */
var BIOS = xdc.useModule('ti.sysbios.BIOS');
var HeapMem = xdc.module('ti.sysbios.heaps.HeapMem');
var halHwi = xdc.useModule('ti.sysbios.hal.Hwi');
var Event = xdc.useModule("ti.sysbios.knl.Event");
var Clock = xdc.useModule('ti.sysbios.knl.Clock');
var Idle = xdc.useModule('ti.sysbios.knl.Idle');
var Task = xdc.useModule('ti.sysbios.knl.Task');
var Swi = xdc.useModule('ti.sysbios.knl.Swi');
var Semaphore = xdc.useModule('ti.sysbios.knl.Semaphore');
/* No dynamic creation of modules during runtime
 */
Defaults.common$.memoryPolicy = Types.STATIC_POLICY;

And I already allocated memory for this instance:

static Event_Struct Evt;

So, can events only be used if dynamically allocated? Or is there something else I'm missing here?

Thanks!

George