STM32F429+CubeMX+FreeRTOS+UART中断

2019-07-20 02:50发布

本帖最后由 friendly 于 2018-5-18 11:11 编辑

请教大佬,我在使用CubeMX软件,使能了GPIO,UART,FreeRTOS。创建了两个任务,一个串口中断,一个队列。程序功能是:串口中断调用接收回调函数接收数据,接收完成后,向队列发送数据指针,在其中一个任务中读取队列内容并打印。因为在自动生成的UART.C文件中创建了串口接收回调函数,并使用到队列,所以要在UART.C文件中包含进相关头文件,现在只要包含进CMSIS_OS.H或FreeRTOS.H和QUEUE.H头文件,在UART.C文件还没有调用队列发送函数,在编译时都会产生错误。错误如下:

compiling freertos.c...
../Middlewares/Third_Party/FreeRTOS/Source/include/list.h(184): 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 descending order. */
../Middlewares/Third_Party/FreeRTOS/Source/include/list.h(196): error:  #20: identifier "TickType_t" is undefined
        configLIST_VOLATILE TickType_t xItemValue;
../Middlewares/Third_Party/FreeRTOS/Source/include/list.h(208): error:  #20: identifier "UBaseType_t" is undefined
        configLIST_VOLATILE UBaseType_t uxNumberOfItems;
../Middlewares/Third_Party/FreeRTOS/Source/include/list.h(386): error:  #77-D: this declaration has no storage class or type specifier
  PRIVILEGED_FUNCTION void vListInitialise( List_t * const pxList );
../Middlewares/Third_Party/FreeRTOS/Source/include/list.h(386): error:  #65: expected a ";"
  PRIVILEGED_FUNCTION void vListInitialise( List_t * const pxList );
../Middlewares/Third_Party/FreeRTOS/Source/include/list.h(397): error:  #77-D: this declaration has no storage class or type specifier
  PRIVILEGED_FUNCTION void vListInitialiseItem( ListItem_t * const pxItem );
../Middlewares/Third_Party/FreeRTOS/Source/include/list.h(397): error:  #65: expected a ";"
  PRIVILEGED_FUNCTION void vListInitialiseItem( ListItem_t * const pxItem );
../Middlewares/Third_Party/FreeRTOS/Source/include/list.h(410): error:  #77-D: this declaration has no storage class or type specifier
  PRIVILEGED_FUNCTION void vListInsert( List_t * const pxList, ListItem_t * const pxNewListItem );
../Middlewares/Third_Party/FreeRTOS/Source/include/list.h(410): error:  #65: expected a ";"
  PRIVILEGED_FUNCTION void vListInsert( List_t * const pxList, ListItem_t * const pxNewListItem );
../Middlewares/Third_Party/FreeRTOS/Source/include/list.h(431): error:  #77-D: this declaration has no storage class or type specifier
  PRIVILEGED_FUNCTION void vListInsertEnd( List_t * const pxList, ListItem_t * const pxNewListItem );
../Middlewares/Third_Party/FreeRTOS/Source/include/list.h(431): error:  #65: expected a ";"
  PRIVILEGED_FUNCTION void vListInsertEnd( List_t * const pxList, ListItem_t * const pxNewListItem );
../Middlewares/Third_Party/FreeRTOS/Source/include/list.h(446): error:  #757: variable "PRIVILEGED_FUNCTION"  is not a type name
  PRIVILEGED_FUNCTION UBaseType_t uxListRemove( ListItem_t * const pxItemToRemove );
../Middlewares/Third_Party/FreeRTOS/Source/include/list.h(446): error:  #65: expected a ";"
  PRIVILEGED_FUNCTION UBaseType_t uxListRemove( ListItem_t * const pxItemToRemove );
../Middlewares/Third_Party/FreeRTOS/Source/include/task.h(109): error:  #79: expected a type specifier
  typedef BaseType_t (*TaskHookFunction_t)( void * );
../Middlewares/Third_Party/FreeRTOS/Source/include/task.h(109): error:  #90: function returning function is not allowed
  typedef BaseType_t (*TaskHookFunction_t)( void * );
../Middlewares/Third_Party/FreeRTOS/Source/include/task.h(137): error:  #168: a function type is not allowed here
        BaseType_t xOverflowCount;
../Middlewares/Third_Party/FreeRTOS/Source/include/task.h(138): error:  #20: identifier "TickType_t" is undefined
        TickType_t xTimeOnEntering;
../Middlewares/Third_Party/FreeRTOS/Source/include/task.h(156): error:  #20: identifier "TaskFunction_t" is undefined
        TaskFunction_t pvTaskCode;
../Middlewares/Third_Party/FreeRTOS/Source/include/task.h(160): error:  #757: variable "UBaseType_t"  is not a type name
        UBaseType_t uxPriority;
../Middlewares/Third_Party/FreeRTOS/Source/include/task.h(161): error:  #20: identifier "StackType_t" is undefined
        StackType_t *puxStackBuffer;
../Middlewares/Third_Party/FreeRTOS/Source/include/task.h(162): error:  #20: identifier "portNUM_CONFIGURABLE_REGIONS" is undefined
        MemoryRegion_t xRegions[ portNUM_CONFIGURABLE_REGIONS ];
../Middlewares/Third_Party/FreeRTOS/Source/include/task.h(171): error:  #757: variable "UBaseType_t"  is not a type name
        UBaseType_t xTaskNumber;                /* A number unique to the task. */
../Middlewares/Third_Party/FreeRTOS/Source/include/task.h(173): error:  #757: variable "UBaseType_t"  is not a type name
        UBaseType_t uxCurrentPriority;  /* The priority at which the task was running (may be inherited) when the structure was populated. */
../Middlewares/Third_Party/FreeRTOS/Source/include/task.h(174): error:  #757: variable "UBaseType_t"  is not a type name
        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. */
../Middlewares/Third_Party/FreeRTOS/Source/include/task.h(176): error:  #20: identifier "StackType_t" is undefined
        StackType_t *pxStackBase;               /* Points to the lowest address of the task's stack area. */
../Middlewares/Third_Party/FreeRTOS/Source/include/task.h(602): error:  #77-D: this declaration has no storage class or type specifier
  PRIVILEGED_FUNCTION void vTaskAllocateMPURegions( TaskHandle_t xTask, const MemoryRegion_t * const pxRegions );
../Middlewares/Third_Party/FreeRTOS/Source/include/task.h(602): error:  #65: expected a ";"
  PRIVILEGED_FUNCTION void vTaskAllocateMPURegions( TaskHandle_t xTask, const MemoryRegion_t * const pxRegions );
../Middlewares/Third_Party/FreeRTOS/Source/include/task.h(643): error:  #77-D: this declaration has no storage class or type specifier
  PRIVILEGED_FUNCTION void vTaskDelete( TaskHandle_t xTaskToDelete );
../Middlewares/Third_Party/FreeRTOS/Source/include/task.h(643): error:  #65: expected a ";"
  PRIVILEGED_FUNCTION void vTaskDelete( TaskHandle_t xTaskToDelete );
../Middlewares/Third_Party/FreeRTOS/Source/include/task.h(695): error:  #77-D: this declaration has no storage class or type specifier
  PRIVILEGED_FUNCTION void vTaskDelay( const TickType_t xTicksToDelay );
../Src/freertos.c: 0 warnings, 30 errors



友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
该问题目前已经被作者或者管理员关闭, 无法添加新回复
2条回答
正点原子
1楼-- · 2019-07-20 07:20
这种问题要学会自己解决!!
无非就是头文件路径没添加,或者对应.c没加进来,或者就是输入了错误的标点符号,导致整个文件报错。
向上吧STM32
2楼-- · 2019-07-20 10:33
 精彩回答 2  元偷偷看……

一周热门 更多>