akimata wrote on Monday, November 11, 2019:
Hello,
I’ve been playing with RTOS and i can’t quite understand why queue fails on passing address of pointer to constant literal.
void eventGive(void *pv)
{
eventControl_t *eControl = (eventControl_t *)pv;
uint8_t requiredBits = (EVENT1_BIT | EVENT2_BIT | EVENT3_BIT);
for(;;)
{
xQueueSend(gatekeeperQueue, &tekst[eControl->textNum], portMAX_DELAY);
xEventGroupSync(eventGroupTest, eControl->eventBit, requiredBits, portMAX_DELAY);
xQueueSend(gatekeeperQueue, &"sync", portMAX_DELAY);
vTaskDelay(rand() % 200);
}
}
Right after xQueueSend(the one after EventGroupSync) finishes and preemption starts my processor hardfaults without a reason. The weirder part is that if i replace :
xQueueSend(gatekeeperQueue, &"sync", portMAX_DELAY);
with:
> const char *syncText = "sync";
> xQueueSend(gatekeeperQueue, &syncText, portMAX_DELAY);
Everything is back to normal and works as intended.
Hardware: NXP K22 processor with Cortex M4 core