Other Parts Discussed in Thread: LAUNCHXL-CC26X2R1
Tool/software:
Hi TI!
I am experiencing a weird problem with DMM sample named "DMM 15.4 Collector + BLE Remote Display". I am using LaunchXL-CC26X2R1 and Simple Link SDK 7.40.0.77
I have a need for allocating and using some dynamically allocated memory prior to Bluetooth stack initialization. This results in an issue - sample code stops working and probably enters some assert handler (no logs are shown, Bluetooth is no longer advertising, UART console does not respond to input). Here you can see a simple sample that demonstrates how to trigger the issue:
/* Update User Configuration of the stack */
user0Cfg.appServiceInfo->timerTickPeriod = Clock_tickPeriod;
user0Cfg.appServiceInfo->timerMaxMillisecond = ICall_getMaxMSecs();
#ifdef BLE_START
/* Initialize ICall module */
ICall_init();
uint8_t *data = ICall_malloc(8196);
if(NULL != data) {
memset(data, 0xAB, 8096);
ICall_free(data);
}
/* Start tasks of external images */
ICall_createRemoteTasks();
pBleTaskHndl = ICall_getRemoteTaskHandle(0);
RemoteDisplay_createTask();
As you can see above I am allocating quite a big chunk of memory and setting it to a value of 0xAB (this is very important!). This memory is immediately deallocated but the memory value remains 0xAB - this results in Radio MCU stopping normal operation.
However if I modify the memset to set this memory area to 0x00 then everything works as if nothing happens. This ultimately results in inability to allocate and use any memory prior to Bluetooth initialization.
Questions:
- I have not seen any documentation mentioning that ICall_malloc cannot be used prior to Bluetooth initialization - is this correct? Can one use ICall_malloc prior to calling ICall_createRemoteTasks
- Why Bluetooth stack is not immune to initial memory value in dynamically allocated chunk? This seems like a bug