工具/软件:Code Composer Studio
您好!
我对 LAUNCHXL-F28377S 和 CCS IDE 比较陌生。我一直在运行代码中出现未定义符号错误的问题、我在使用 UART 和 SPI 在线写入 SD 卡时发现:
未定义的首次引用
符号
------ --------
_xQueueCreateMutexStatic ./UART.obj
错误#10234-D:未解析的符号仍然存在
错误#10010:链接期间遇到错误;"ADC_SoC_ePWM_cpu01.out"不存在
我已将代码附加到我的项目中。 我对未定义的符号在这里的方式感到困惑、因为 我在 xQueueGenericCreateStatic 中没有未定义的符号错误
///---------------------------------------------------------- //简化的 UART 驱动程序。 ///////----- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- #include "FreeRTOS.h" #include "UART.h" #include "semphr.h" //--------------- static SemaphoreHandle_t xTxMutex = NULL; static Semaphore_t xTxMutexBuffer; static SemaphoreHandle_t xRxSemaphore = NULL; static Staticaphore_t xRxSemaphoreBuffer; //----- void UART_open (void) { // Init OS 基元。 xRxSemaphore = xSemaphoreCreateBinaryStatic (&xRxSemaphoreBuffer); xTxMutex = xSemaphoreCreateMutexStatic (&xTxMutexBuffer); ...
声明在 semaphr.h 中如下所示:
#if (configSUPPORT_static_allocation = 1)
#define xSemaphoreCreateBinaryStatic( pxStaticSemaphore ) xQueueGenericCreateStatic( UBaseType_t ) 1,semSEMAPHORE_Queue_item_length,NULL,pxStaticSemaphore,queueQUEUE_TYPE_Binary_Semaphore)
#endif
#if (configSUPPORT_static_allocation = 1)
#define xSemaphoreCreateMutexStatic( pxMutexBuffer ) xQueueCreateMutexStatic( queueQUEUE_TYPE_mutex,( pxMutexBuffer ))
#endif
最后、queue.h 包含在 semphr.h 中、其中定义了两个函数:
QueueHandle_t xQueueCreateMutexStatic( const uint8_t ucQueueType、StaticQueue_t *pxStaticQueue ) privacy_function;
#if (configSUPPORT_static_allocation = 1)
ucueHandle_t xQueueGenericCreateStatic( const UBaseType_t uxQueueLength、const UBaseType_t uxItemSize、uint8_t * puQueueStorage、StaticQueue_t * pxStaticQueue、const uint8_t QueueType ) privated_function;
#endif
如果有人能指出我出错的地方、我会非常感激。