I’m new to using FreeRTOS. I’m doing a course on it and I’ve been given a problem where I need to pass a (double**)c to the queue and then have another task receive it and print it.
I’m receiving an error. It says
ASSERT! Line 1246, file D:\FreeRTOS\FreeRTOSv10.0.1\FreeRTOS\Source\queue.c, GetLastError() 87
I’m unable to understand where am I going wrong. Would be great if you guys could point out my mistake or guide me in the right direction.
Here are the relevant code snippets
xQueueHandle Queue1;
static void matrix()
{
double** c = (double**)pvPortMalloc(ROW * sizeof(double*));
for (i = 0; i < ROW; i++) c[i] = (double*)pvPortMalloc(COL * sizeof(double)); /*creating a matrix */
if (Queue1 != 0) /* the if construct is inside an infinite while loop and inside the loop the contents of the matrix change*/
{
xQueueSend(Queue1, (double**)c,1000);
}
vTaskDelay(100);
}
}
static void reader_task() /*continuously reading the data from the queue and printing it*/
{
while (1)
{
printf("Reader Task has started\n");
double** variable = (double**)pvPortMalloc(ROW * sizeof(double*));
for (int i = 0; i < ROW; i++) variable[i] = (double*)pvPortMalloc(COL * sizeof(double));
xQueueReceive(Queue1, &variable, 500);
printf("Check\n");
for (int i = 0; i < SIZE; i++)
{
for (int j = 0; j < SIZE; j++)
{
printf("%f", variable[i][j]);
}
printf("\n");
}
}
}
int main()
{
xQueueHandle Queue1;
Queue1 = xQueueCreate(100, sizeof(double**));
printf("Queue created\n");
}