I am starting a new project on a STM32L476 Nucleo board and planned to use FreeRTOS.
My initial project structure:
main.c
#include "project.h"
int main(void)
{
/* Configure the system clock */
Clock_Config();
/* Configure IOs */
GPIO_Config();
/* FreeRTOS Stuff */
NVIC_SetPriorityGrouping(3);
vTaskStartScheduler();
/* Should never get here! */
while (1){}
}
project.h
#ifndef PROJECT_H_
#define PROJECT_H_
/* MPU Files */
#include "stm32l4xx.h"
/* Project Files */
#include "gpio.h"
#include "clock.h"
/* FreeRTOS */
#include "FreeRTOS.h"
#include "queue.h"
#include "task.h"
#define TASKPRIO_STD ( tskIDLE_PRIORITY + 1 )
#define TICK_TASK_PERIOD_MS pdMS_TO_TICKS( 500 )
#endif /* PROJECT_H_ */
project.c
#include "project.h"
static void vSerialTask( void * pvParameters );
xTaskCreate( vSerialTask, "I2C", configMINIMAL_STACK_SIZE, NULL, TASKPRIO_STD, NULL);
static void vSerialTask( void *pvParameters ){
for( ;; )
{
}
}
I get a syntax error with this structure in xTaskCreate line: expected ')' before string constant
If I move xTaskCreate to my main.c and leave the task itself in my project.c (also have to delete static in this case) my project compiles successfully.
What is the problem here? I already saw working projects where xTaskCreate is not done within main.c so can't imagine this is the real problem?