stm32移植freeRTOS报错error: #20: identifier "TickType_t" is undefined;error: #20: identifier "UBaseType_t" is undefined
先说问题原因
头文件包含关系错乱,导致找不到变量类型的定义。
错误的编译结果
高亮的 代码片
.
compiling stm32f0xx_rtc.c...
compiling stm32f0xx_spi.c...
compiling stm32f0xx_syscfg.c...
compiling heap_4.c...
.\FreeRTOS\include\list.h(148): error: #20: identifier "TickType_t" is undefined
configLIST_VOLATILE TickType_t xItemValue; /*< The value being listed. In most cases this is used to sort the list in ascending order. */
.\FreeRTOS\include\list.h(176): error: #20: identifier "UBaseType_t" is undefined
volatile UBaseType_t uxNumberOfItems;
.\FreeRTOS\include\list.h(434): error: #130: expected a "{"
void vListInitialise( List_t * const pxList ) PRIVILEGED_FUNCTION;
.\FreeRTOS\include\task.h(97): warning: #12-D: parsing restarts here after previous syntax error
{
.\FreeRTOS\include\task.h(98): error: #20: identifier "eRunning" is undefined
eRunning = 0, /* A task is querying the state of itself, so must be running. */
.\FreeRTOS\include\task.h(99): error: #20: identifier "eReady" is undefined
eReady, /* The task being queried is in a ready or pending ready list. */
.\FreeRTOS\include\task.h(100): error: #20: identifier "eBlocked" is undefined
eBlocked, /* The task being queried is in the Blocked state. */
.\FreeRTOS\include\task.h(101): error: #20: identifier "eSuspended" is undefined
eSuspended, /* The task being queried is in the Suspended state, or is in the Blocked state with an infinite time out. */
.\FreeRTOS\include\task.h(102): error: #20: identifier "eDeleted" is undefined
eDeleted, /* The task being queried has been deleted, but its TCB has not yet been freed. */
.\FreeRTOS\include\task.h(103): error: #20: identifier "eInvalid" is undefined
eInvalid /* Used as an 'invalid state' value. */
.\FreeRTOS\include\task.h(104): error: #65: expected a ";"
} eTaskState;
.\FreeRTOS\include\task.h(104): error: #77-D: this declaration has no storage class or type specifier
} eTaskState;
.\FreeRTOS\include\task.h(121): error: #20: identifier "BaseType_t" is undefined
BaseType_t xOverflowCount;
.\FreeRTOS\include\task.h(122): error: #20: identifier "TickType_t" is undefined
TickType_t xTimeOnEntering;
.\FreeRTOS\include\task.h(140): error: #20: identifier "TaskFunction_t" is undefined
TaskFunction_t pvTaskCode;
.\FreeRTOS\include\task.h(142): error: #20: identifier "configSTACK_DEPTH_TYPE" is undefined
configSTACK_DEPTH_TYPE usStackDepth;
.\FreeRTOS\include\task.h(144): error: #20: identifier "UBaseType_t" is undefined
UBaseType_t uxPriority;
.\FreeRTOS\include\task.h(145): error: #20: identifier "StackType_t" is undefined
StackType_t * puxStackBuffer;
.\FreeRTOS\include\task.h(146): error: #20: identifier "portNUM_CONFIGURABLE_REGIONS" is undefined
MemoryRegion_t xRegions[ portNUM_CONFIGURABLE_REGIONS ];
.\FreeRTOS\include\task.h(156): error: #20: identifier "TaskHandle_t" is undefined
TaskHandle_t xHandle; /* The handle of the task to which the rest of the information in the structure relates. */
.\FreeRTOS\include\task.h(158): error: #20: identifier "UBaseType_t" is undefined
UBaseType_t xTaskNumber; /* A number unique to the task. */
.\FreeRTOS\include\task.h(159): error: #757: variable "eTaskState" is not a type name
eTaskState eCurrentState; /* The state in which the task existed when the structure was populated. */
.\FreeRTOS\include\task.h(160): error: #20: identifier "UBaseType_t" is undefined
UBaseType_t uxCurrentPriority; /* The priority at which the task was running (may be inherited) when the structure was populated. */
.\FreeRTOS\include\task.h(161): error: #20: identifier "UBaseType_t" is undefined
UBaseType_t uxBasePriority; /* The priority to which the task will return if the task's current priority has been inherited to avoid unbounded priority inversion when obtaining a mutex. Only valid if configUSE_MUTEXES is defined as 1 in FreeRTOSConfig.h. */
.\FreeRTOS\include\task.h(162): error: #20: identifier "configRUN_TIME_COUNTER_TYPE" is undefined
configRUN_TIME_COUNTER_TYPE ulRunTimeCounter; /* The total run time allocated to the task so far, as defined by the run time stats clock. See https://www.FreeRTOS.org/rtos-run-time-stats.html. Only valid when configGENERATE_RUN_TIME_STATS is defined as 1 in FreeRTOSConfig.h. */
.\FreeRTOS\include\task.h(163): error: #20: identifier "StackType_t" is undefined
StackType_t * pxStackBase; /* Points to the lowest address of the task's stack area. */
.\FreeRTOS\include\task.h(168): error: #20: identifier "configSTACK_DEPTH_TYPE" is undefined
configSTACK_DEPTH_TYPE usStackHighWaterMark; /* The minimum amount of stack space that has remained for the task since the task was created. The closer this value is to zero the closer the task has come to overflowing its stack. */
.\FreeRTOS\include\task.h(696): error: #20: identifier "TaskHandle_t" is undefined
void vTaskAllocateMPURegions( TaskHandle_t xTask,
.\FreeRTOS\include\task.h(697): error: #130: expected a "{"
const MemoryRegion_t * const pxRegions ) PRIVILEGED_FUNCTION;
.\FreeRTOS\include\portable.h(136): warning: #12-D: parsing restarts here after previous syntax error
{
.\FreeRTOS\include\portable.h(137): warning: #177-D: variable "pucStartAddress" was declared but never referenced
uint8_t * pucStartAddress;
.\FreeRTOS\include\portable.h(138): warning: #177-D: variable "xSizeInBytes" was declared but never referenced
size_t xSizeInBytes;
.\FreeRTOS\include\portable.h(139): error: #77-D: this declaration has no storage class or type specifier
} HeapRegion_t;
.\FreeRTOS\include\portable.h(164): error: #757: variable "HeapRegion_t" is not a type name
void vPortDefineHeapRegions( const HeapRegion_t * const pxHeapRegions ) PRIVILEGED_FUNCTION;
FreeRTOS\port\MemMang\heap_4.c: 4 warnings, 30 errors
compiling stm32f0xx_usart.c...
compiling stm32f0xx_wwdg.c...
compiling stm32f0xx_tim.c...
compiling croutine.c...
.\FreeRTOS\include\list.h(148): error: #20: identifier "TickType_t" is undefined
configLIST_VOLATILE TickType_t xItemValue; /*< The value being listed. In most cases this is used to sort the list in ascending order. */
.\FreeRTOS\include\list.h(176): error: #20: identifier "UBaseType_t" is undefined
volatile UBaseType_t uxNumberOfItems;
.\FreeRTOS\include\list.h(434): error: #130: expected a "{"
void vListInitialise( List_t * const pxList ) PRIVILEGED_FUNCTION;
.\FreeRTOS\include\task.h(97): warning: #12-D: parsing restarts here after previous syntax error
{
.\FreeRTOS\include\task.h(98): error: #20: identifier "eRunning" is undefined
eRunning = 0, /* A task is querying the state of itself, so must be running. */
.\FreeRTOS\include\task.h(99): error: #20: identifier "eReady" is undefined
eReady, /* The task being queried is in a ready or pending ready list. */
.\FreeRTOS\include\task.h(100): error: #20: identifier "eBlocked" is undefined
eBlocked, /* The task being queried is in the Blocked state. */
.\FreeRTOS\include\task.h(101): error: #20: identifier "eSuspended" is undefined
eSuspended, /* The task being queried is in the Suspended state, or is in the Blocked state with an infinite time out. */
.\FreeRTOS\include\task.h(102): error: #20: identifier "eDeleted" is undefined
eDeleted, /* The task being queried has been deleted, but its TCB has not yet been freed. */
.\FreeRTOS\include\task.h(103): error: #20: identifier "eInvalid" is undefined
eInvalid /* Used as an 'invalid state' value. */
.\FreeRTOS\include\task.h(104): error: #65: expected a ";"
} eTaskState;
.\FreeRTOS\include\task.h(104): error: #77-D: this declaration has no storage class or type specifier
} eTaskState;
.\FreeRTOS\include\task.h(121): error: #20: identifier "BaseType_t" is undefined
BaseType_t xOverflowCount;
.\FreeRTOS\include\task.h(122): error: #20: identifier "TickType_t" is undefined
TickType_t xTimeOnEntering;
.\FreeRTOS\include\task.h(140): error: #20: identifier "TaskFunction_t" is undefined
TaskFunction_t pvTaskCode;
.\FreeRTOS\include\task.h(142): error: #20: identifier "configSTACK_DEPTH_TYPE" is undefined
configSTACK_DEPTH_TYPE usStackDepth;
.\FreeRTOS\include\task.h(144): error: #20: identifier "UBaseType_t" is undefined
UBaseType_t uxPriority;
.\FreeRTOS\include\task.h(145): error: #20: identifier "StackType_t" is undefined
StackType_t * puxStackBuffer;
.\FreeRTOS\include\task.h(146): error: #20: identifier "portNUM_CONFIGURABLE_REGIONS" is undefined
MemoryRegion_t xRegions[ portNUM_CONFIGURABLE_REGIONS ];
.\FreeRTOS\include\task.h(156): error: #20: identifier "TaskHandle_t" is undefined
TaskHandle_t xHandle; /* The handle of the task to which the rest of the information in the structure relates. */
.\FreeRTOS\include\task.h(158): error: #20: identifier "UBaseType_t" is undefined
UBaseType_t xTaskNumber; /* A number unique to the task. */
.\FreeRTOS\include\task.h