Other Parts Discussed in Thread: CC3120
I'm fairly sure that my problem is a basic one, i.e. I'm missing some configuration setting or something, so hopefully someone will immediately spot the issue.
I'm building and running the SL SDK WiFi plugin version 1.50.00 on an NXP K64 running FreeRTOS. I've got the portation layer written (user.h attached). I have sl_Task() launching in its own thread. I've also instrumented some of my cc_pal routines to assist with debug, and the MCUxpresso debugger is showing me the state of each of my FreeRTOS threads. The issue is with starting the device, and invoking the synchronization objects (semaphores).
After sl_Task() is up and running in its own thread, sl_Task() sleeps on g_SlInternalSpawnCB.SyncObj. I then call sl_Start(). That disables the devices, registers the interrupt handler, and enables the device. It then waits on a sync object for initialization to complete. I can also see that my GPIO IRQ handler has indeed been invoked. Because the SL IRQ handler was properly registered, my ISR calls _SlDrvRxIrqHandler().
Here's where things seem to go off the rails. The IRQ handler decides that g_pCB->WaitForCmdResp is false, so rather than calling OSI_RET_OK_CHECK(sl_SyncObjSignalFromIRQ(&g_pCB->CmdSyncObj)), it calls sl_Spawn(), with a flag indicating it's being called from the IRQ handler. _SlInternalSpawn() then runs this:
/* Increment the counter that specifies that async event has recived from interrupt context and should be handled by the internal spawn task */ if(flags & SL_SPAWN_FLAG_FROM_SL_IRQ_HANDLER) { g_SlInternalSpawnCB.IrqWriteCnt++; g_SlInternalSpawnCB.pIrqFuncValue = pValue; SL_DRV_SYNC_OBJ_SIGNAL(&g_SlInternalSpawnCB.SyncObj); return(Res); }
Problem is, we're still in an ISR context, but SL_DRV_SYNC_OBJ_SIGNAL() eventually calls xSemaphoreGive(), not xSemaphoreGiveFromISR(). This causes the system to hang (but not crash, thankfully).
So, what am I not configuring correctly? I defined SL_PLATFORM_MULTI_THREADED in user.h so that sl_Task() would run as a proper background task. But I don't see any other settings for me to adjust. Is it possible that _SlInternalSpawn() should be calling sl_SyncObjSignalFromIRQ() instead of the regular version? Let me know what I've screwed up, thanks.
Here's a screenshot of the debugger in this state, with relevant stack traces:
And here's my user.h: