Hi everyone,
I am trying to implement a simple queue in a simple RTC task. My code is as follows:
#define RTC_TASK_PRIORITY 3
#define RTC_TASK_STACK_SIZE (configMINIMAL_STACK_SIZE)
#define RTC_TASK_QUEUE_ITEM_SIZE ( sizeof(RTC_Time) )
#define RTC_TASK_QUEUE_LENGTH ( 2 )
/* Declare the queue(s) */
//StaticQueue_t xRTCQueueBuffer;
StaticQueue_t xRTCTaskQueueBuffer1, xRTCTaskQueueBuffer2;
//QueueHandle_t RTCQueue; //, xRTCTaskQueue1, xRTCTaskQueue2;
QueueHandle_t xRTCTaskQueue1, xRTCTaskQueue2;
/* Allocate memory for the queues' storage */
uint8_t ucRTCTaskQueueStorage1[RTC_TASK_QUEUE_LENGTH
* RTC_TASK_QUEUE_ITEM_SIZE];
uint8_t ucRTCTaskQueueStorage2[RTC_TASK_QUEUE_LENGTH
* RTC_TASK_QUEUE_ITEM_SIZE];
/* Task handle and buffer */
StaticTask_t xRTCTaskBuffer;
StackType_t xRTCTaskStack[RTC_TASK_STACK_SIZE];
/* Task loop */
for (;;) {
if (rtcTaskTick) {
count++;
rtcTaskTick = false;
int prev_second = current_time->second;
vUpdateCurrentTime();
if (current_time->second > prev_second) {
printf("%04d-%02d-%02d %02d:%02d:%02d\r\n",
current_time->year, current_time->month, current_time->day, current_time->hour, current_time->minute, current_time->second);
}
/*Send the updated time incl ten_ms to log tasks */
BaseType_t xQueueSend(
QueueHandle_t xRTCTaskQueue1,
¤t_time,
TickType_t pdMS_TO_TICKS(5)
);
/* Send semaphore to UITask every second */
/* Send the updated time to UITask */
// xQueueSend(xRTCQueue1, ¤t_time, 0);
}
}
}
/* Initialization function */
void vInitRTCTask(void) {
InitTimer0(16);
vInitCurrentTime();
/* Create the queues statically */
xRTCTaskQueue1 = xQueueCreateStatic(
RTC_TASK_QUEUE_LENGTH,
RTC_TASK_QUEUE_ITEM_SIZE, ucRTCTaskQueueStorage1,
&xRTCTaskQueueBuffer1);
xRTCTaskQueue2 = xQueueCreateStatic(
RTC_TASK_QUEUE_LENGTH,
RTC_TASK_QUEUE_ITEM_SIZE, ucRTCTaskQueueStorage2,
&xRTCTaskQueueBuffer2);
if (xRTCTaskQueue1 == NULL) { // || xRTCTaskQueue2 == NULL) {
fprintf(stderr, "Failed to create the RTC task queues.\n");
return;
}
// Create the task statically
TaskHandle_t xRTCTaskHandle = xTaskCreateStatic(
vRTCTask, // Task function
"RTC Task", // Task name
RTC_TASK_STACK_SIZE, // Stack size
(void*)1, // Task parameter
RTC_TASK_PRIORITY, // Priority
xRTCTaskStack, // Stack buffer
&xRTCTaskBuffer // Task buffer
);
if (xRTCTaskHandle == NULL) {
fprintf(stderr, "Failed to create the RTC task.\n");
}
else {
// printf("The RTC task was created successfully.\n");
}
}
Before I added the queue, everything was fine. But after I added it, I have this:
C:\Users\Robert\source\repos\rrss\rcu_sw\freertos\freertos_kernel\include/queue.h:68:47: error: expected declaration specifiers or ββ¦β before β(β token
Line 68 is:
/* For internal use only. */
#define queueSEND_TO_BACK ( ( BaseType_t ) 0 ) // <== Line 68
#define queueSEND_TO_FRONT ( ( BaseType_t ) 1 )
#define queueOVERWRITE ( ( BaseType_t ) 2 )
Obviously I will never touch the FreeRTOS code. So what can this be? Did I somehow break queue.h with a simple queue?
I am in MCUXpresso with an Arm CM7
Kind regards and thanks,
Robert