Other Parts Discussed in Thread: SYSBIOS
Tool/software: TI-RTOS
I prefer to avoid the use of dynamic allocation in embedded systems. To enforce this in my xxx.cfg file I have:
var BIOS = xdc.useModule('ti.sysbios.BIOS');
BIOS.runtimeCreatesEnabled = false;
In my application code I have statically allocated structures like:
static struct {
bool initialized;
GateMutex_Struct gate;
} Crc32State = { false };
During application start up I call XXX_construct on these structures like:
if (!Crc32State.initialized) {
GateMutex_construct(&Crc32State.gate, NULL);
Crc32State.initialized = true;
}
*Note that I have also tried this with a statically allocated GateMutex_Params being passed in instead of NULL but it made no difference.
The call to GateMutex_construct fails and reports the error:
ti.sysbios.gates.GateMutex: create policy error
xdc.runtime.Error.raise: terminating execution
If I follow the call stack back I find this code in the automatically generated file Gateway_pem4f.c:
/* construct */
void ti_sysbios_gates_GateMutex_construct(ti_sysbios_gates_GateMutex_Struct *__obj, const ti_sysbios_gates_GateMutex_Params *__paramsPtr )
{
xdc_runtime_Error_raiseX(NULL, ti_sysbios_gates_GateMutex_Module__id__C, NULL, 0, xdc_runtime_Error_E_generic, (xdc_IArg)"create policy error", 0);
}
It seems I have some project option configured wrong. Isn't the point of the XXX_contruct methods not to require dynamic allocation?
Thanks for your help.