1

我希望有人可以帮助我解决这个问题,因为我真的不知道我在这里做错了什么。我想了解如何将 FreeRTOS 与一些 STM32F103RCTx (Cortex-M3) 设备一起使用。使用 STM32CubeIDE 软件(基于 Eclipse 的 IDE)进行编码。一些简单的任务创建和用于调试的 ITM Traces 没有问题并且可以无缝地工作。在这一点上,我了解到拥有像 SEGGER SystemView 或 Tracealyzer (percepio) 这样的分析工具来全面分析 FreeRTOS 的系统行为非常重要。我首先尝试了SEGGER SystemView的免费版本,并根据SEGGER手册实现了所有的源文件和头文件。我在路径环境中包含了新文件夹(C/C++ Build->Settings->Tool Settings->Include paths)。我还检查了编译时是否在我的 objects.list 中创建了适当的对象,就是这样。无论如何,我仍然会收到某些函数的“未定义引用”错误,尽管我可以轻松地跳转到 IDE 中的声明。我在 STM32 论坛和 SEGGERs 论坛上提出了几个关于这个问题的问题。至今没有回应。

两天没有解决问题,我认为工具 Tracealyzer 可能是一种可能性。所以我今天开始了评估。我再次在我的源文件文件夹和头文件文件夹中实现了所有必要的文件,以避免创建可能无法识别为包含或未正确索引的新文件夹。再次编译没有成功,我不明白为什么......

请在编译程序时找到我的控制台输出:

10:06:37 **** Incremental Build of configuration Debug for project W5500_EVB_M3_software ****
make -j12 all 
arm-none-eabi-gcc "../Core/Src/trcKernelPort.c" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32F103xE -DUSE_HAL_DRIVER -DDEBUG -c -I../Middlewares/Third_Party/FreeRTOS/Source/include -I../Drivers/CMSIS/Device/ST/STM32F1xx/Include -I../Drivers/CMSIS/Include -I../Core/Inc -I../Drivers/STM32F1xx_HAL_Driver/Inc/Legacy -I../Drivers/STM32F1xx_HAL_Driver/Inc -I../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS -I../Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM3 -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Core/Src/trcKernelPort.d" -MT"Core/Src/trcKernelPort.o" --specs=nano.specs -mfloat-abi=soft -mthumb -o "Core/Src/trcKernelPort.o"
../Core/Src/trcKernelPort.c: In function 'prvTraceGetTaskNumberLow16':
../Core/Src/trcKernelPort.c:175:9: warning: implicit declaration of function 'TRACE_GET_LOW16' [-Wimplicit-function-declaration]
  return TRACE_GET_LOW16(uxTaskGetTaskNumber(handle));
         ^~~~~~~~~~~~~~~
../Core/Src/trcKernelPort.c: In function 'prvTraceGetTaskNumberHigh16':
../Core/Src/trcKernelPort.c:180:9: warning: implicit declaration of function 'TRACE_GET_HIGH16' [-Wimplicit-function-declaration]
  return TRACE_GET_HIGH16(uxTaskGetTaskNumber(handle));
         ^~~~~~~~~~~~~~~~
../Core/Src/trcKernelPort.c: In function 'prvTraceSetTaskNumberLow16':
../Core/Src/trcKernelPort.c:185:29: warning: implicit declaration of function 'TRACE_SET_LOW16' [-Wimplicit-function-declaration]
  vTaskSetTaskNumber(handle, TRACE_SET_LOW16(uxTaskGetTaskNumber(handle), value));
                             ^~~~~~~~~~~~~~~
../Core/Src/trcKernelPort.c: In function 'prvTraceSetTaskNumberHigh16':
../Core/Src/trcKernelPort.c:190:29: warning: implicit declaration of function 'TRACE_SET_HIGH16' [-Wimplicit-function-declaration]
  vTaskSetTaskNumber(handle, TRACE_SET_HIGH16(uxTaskGetTaskNumber(handle), value));
                             ^~~~~~~~~~~~~~~~
../Core/Src/trcKernelPort.c: In function 'prvReportStackUsage':
../Core/Src/trcKernelPort.c:411:4: warning: implicit declaration of function 'prvTraceStoreKernelCallWithParam'; did you mean 'vTraceStoreKernelObjectName'? [-Wimplicit-function-declaration]
    prvTraceStoreKernelCallWithParam(TRACE_UNUSED_STACK, TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(tasksInStackMonitor[i].tcb), tasksInStackMonitor[i].uiPreviousLowMark);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    vTraceStoreKernelObjectName
../Core/Src/trcKernelPort.c:411:37: error: 'TRACE_UNUSED_STACK' undeclared (first use in this function)
    prvTraceStoreKernelCallWithParam(TRACE_UNUSED_STACK, TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(tasksInStackMonitor[i].tcb), tasksInStackMonitor[i].uiPreviousLowMark);
                                     ^~~~~~~~~~~~~~~~~~
../Core/Src/trcKernelPort.c:411:37: note: each undeclared identifier is reported only once for each function it appears in
../Core/Src/trcKernelPort.c:411:57: error: 'TRACE_CLASS_TASK' undeclared (first use in this function); did you mean 'TRACE_UNUSED_STACK'?
    prvTraceStoreKernelCallWithParam(TRACE_UNUSED_STACK, TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(tasksInStackMonitor[i].tcb), tasksInStackMonitor[i].uiPreviousLowMark);
                                                         ^~~~~~~~~~~~~~~~
                                                         TRACE_UNUSED_STACK
../Core/Src/trcKernelPort.c:411:75: warning: implicit declaration of function 'TRACE_GET_TASK_NUMBER' [-Wimplicit-function-declaration]
    prvTraceStoreKernelCallWithParam(TRACE_UNUSED_STACK, TRACE_CLASS_TASK, TRACE_GET_TASK_NUMBER(tasksInStackMonitor[i].tcb), tasksInStackMonitor[i].uiPreviousLowMark);
                                                                           ^~~~~~~~~~~~~~~~~~~~~
../Core/Src/trcKernelPort.c: At top level:
../Core/Src/trcKernelPort.c:776:2: error: 'TRACE_CLASS_QUEUE' undeclared here (not in a function); did you mean 'TRC_CFG_NQUEUE'?
  TRACE_CLASS_QUEUE,
  ^~~~~~~~~~~~~~~~~
  TRC_CFG_NQUEUE
../Core/Src/trcKernelPort.c:777:2: error: 'TRACE_CLASS_MUTEX' undeclared here (not in a function); did you mean 'TRACE_CLASS_QUEUE'?
  TRACE_CLASS_MUTEX,
  ^~~~~~~~~~~~~~~~~
  TRACE_CLASS_QUEUE
../Core/Src/trcKernelPort.c:778:2: error: 'TRACE_CLASS_SEMAPHORE' undeclared here (not in a function); did you mean 'TRC_CFG_NSEMAPHORE'?
  TRACE_CLASS_SEMAPHORE,
  ^~~~~~~~~~~~~~~~~~~~~
  TRC_CFG_NSEMAPHORE
../Core/Src/trcKernelPort.c:793:1: error: expected identifier or '(' before '{' token
 {
 ^
../Core/Src/trcKernelPort.c:806:1: error: expected identifier or '(' before '{' token
 {
 ^
../Core/Src/trcKernelPort.c:819:1: error: expected identifier or '(' before '{' token
 {
 ^
In file included from ../Core/Inc/FreeRTOSConfig.h:46:0,
                 from ../Middlewares/Third_Party/FreeRTOS/Source/include/FreeRTOS.h:56,
                 from ../Core/Src/trcKernelPort.c:45:
../Core/Inc/trcRecorder.h:1857:26: error: expected identifier or '(' before 'void'
 #define vTraceEnable(x) (void)(x)
                          ^
../Core/Src/trcKernelPort.c:907:6: note: in expansion of macro 'vTraceEnable'
 void vTraceEnable(int startOption)
      ^~~~~~~~~~~~
../Core/Src/trcKernelPort.c: In function 'vTraceInitObjectPropertyTable':
../Core/Src/trcKernelPort.c:965:2: error: 'RecorderDataPtr' undeclared (first use in this function)
  RecorderDataPtr->ObjectPropertyTable.NumberOfObjectClasses = TRACE_NCLASSES;
  ^~~~~~~~~~~~~~~
../Core/Src/trcKernelPort.c:965:63: error: 'TRACE_NCLASSES' undeclared (first use in this function); did you mean 'TRACE_CLASS_MUTEX'?
  RecorderDataPtr->ObjectPropertyTable.NumberOfObjectClasses = TRACE_NCLASSES;
                                                               ^~~~~~~~~~~~~~
                                                               TRACE_CLASS_MUTEX
../Core/Src/trcKernelPort.c:984:71: error: 'PropertyTableSizeQueue' undeclared (first use in this function)
  RecorderDataPtr->ObjectPropertyTable.TotalPropertyBytesPerClass[0] = PropertyTableSizeQueue;
                                                                       ^~~~~~~~~~~~~~~~~~~~~~
../Core/Src/trcKernelPort.c:985:71: error: 'PropertyTableSizeSemaphore' undeclared (first use in this function); did you mean 'PropertyTableSizeQueue'?
  RecorderDataPtr->ObjectPropertyTable.TotalPropertyBytesPerClass[1] = PropertyTableSizeSemaphore;
                                                                       ^~~~~~~~~~~~~~~~~~~~~~~~~~
                                                                       PropertyTableSizeQueue
../Core/Src/trcKernelPort.c:986:71: error: 'PropertyTableSizeMutex' undeclared (first use in this function); did you mean 'PropertyTableSizeQueue'?
  RecorderDataPtr->ObjectPropertyTable.TotalPropertyBytesPerClass[2] = PropertyTableSizeMutex;
                                                                       ^~~~~~~~~~~~~~~~~~~~~~
                                                                       PropertyTableSizeQueue
../Core/Src/trcKernelPort.c:987:71: error: 'PropertyTableSizeTask' undeclared (first use in this function); did you mean 'PropertyTableSizeMutex'?
  RecorderDataPtr->ObjectPropertyTable.TotalPropertyBytesPerClass[3] = PropertyTableSizeTask;
                                                                       ^~~~~~~~~~~~~~~~~~~~~
                                                                       PropertyTableSizeMutex
../Core/Src/trcKernelPort.c:988:71: error: 'PropertyTableSizeISR' undeclared (first use in this function); did you mean 'PropertyTableSizeTask'?
  RecorderDataPtr->ObjectPropertyTable.TotalPropertyBytesPerClass[4] = PropertyTableSizeISR;
                                                                       ^~~~~~~~~~~~~~~~~~~~
                                                                       PropertyTableSizeTask
../Core/Src/trcKernelPort.c:989:71: error: 'PropertyTableSizeTimer' undeclared (first use in this function); did you mean 'PropertyTableSizeTask'?
  RecorderDataPtr->ObjectPropertyTable.TotalPropertyBytesPerClass[5] = PropertyTableSizeTimer;
                                                                       ^~~~~~~~~~~~~~~~~~~~~~
                                                                       PropertyTableSizeTask
../Core/Src/trcKernelPort.c:990:71: error: 'PropertyTableSizeEventGroup' undeclared (first use in this function); did you mean 'PropertyTableSizeSemaphore'?
  RecorderDataPtr->ObjectPropertyTable.TotalPropertyBytesPerClass[6] = PropertyTableSizeEventGroup;
                                                                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                                       PropertyTableSizeSemaphore
../Core/Src/trcKernelPort.c:991:71: error: 'PropertyTableSizeStreamBuffer' undeclared (first use in this function); did you mean 'PropertyTableSizeTimer'?
  RecorderDataPtr->ObjectPropertyTable.TotalPropertyBytesPerClass[7] = PropertyTableSizeStreamBuffer;
                                                                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                                       PropertyTableSizeTimer
../Core/Src/trcKernelPort.c:992:71: error: 'PropertyTableSizeMessageBuffer' undeclared (first use in this function); did you mean 'PropertyTableSizeStreamBuffer'?
  RecorderDataPtr->ObjectPropertyTable.TotalPropertyBytesPerClass[8] = PropertyTableSizeMessageBuffer;
                                                                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                                       PropertyTableSizeStreamBuffer
../Core/Src/trcKernelPort.c:993:62: error: 'StartIndexQueue' undeclared (first use in this function)
  RecorderDataPtr->ObjectPropertyTable.StartIndexOfClass[0] = StartIndexQueue;
                                                              ^~~~~~~~~~~~~~~
../Core/Src/trcKernelPort.c:994:62: error: 'StartIndexSemaphore' undeclared (first use in this function); did you mean 'StartIndexQueue'?
  RecorderDataPtr->ObjectPropertyTable.StartIndexOfClass[1] = StartIndexSemaphore;
                                                              ^~~~~~~~~~~~~~~~~~~
                                                              StartIndexQueue
../Core/Src/trcKernelPort.c:995:62: error: 'StartIndexMutex' undeclared (first use in this function); did you mean 'StartIndexQueue'?
  RecorderDataPtr->ObjectPropertyTable.StartIndexOfClass[2] = StartIndexMutex;
                                                              ^~~~~~~~~~~~~~~
                                                              StartIndexQueue
../Core/Src/trcKernelPort.c:996:62: error: 'StartIndexTask' undeclared (first use in this function); did you mean 'StartIndexMutex'?
  RecorderDataPtr->ObjectPropertyTable.StartIndexOfClass[3] = StartIndexTask;
                                                              ^~~~~~~~~~~~~~
                                                              StartIndexMutex
../Core/Src/trcKernelPort.c:997:62: error: 'StartIndexISR' undeclared (first use in this function); did you mean 'StartIndexTask'?
  RecorderDataPtr->ObjectPropertyTable.StartIndexOfClass[4] = StartIndexISR;
                                                              ^~~~~~~~~~~~~
                                                              StartIndexTask
../Core/Src/trcKernelPort.c:998:62: error: 'StartIndexTimer' undeclared (first use in this function); did you mean 'StartIndexTask'?
  RecorderDataPtr->ObjectPropertyTable.StartIndexOfClass[5] = StartIndexTimer;
                                                              ^~~~~~~~~~~~~~~
                                                              StartIndexTask
../Core/Src/trcKernelPort.c:999:62: error: 'StartIndexEventGroup' undeclared (first use in this function); did you mean 'StartIndexSemaphore'?
  RecorderDataPtr->ObjectPropertyTable.StartIndexOfClass[6] = StartIndexEventGroup;
                                                              ^~~~~~~~~~~~~~~~~~~~
                                                              StartIndexSemaphore
../Core/Src/trcKernelPort.c:1000:62: error: 'StartIndexStreamBuffer' undeclared (first use in this function); did you mean 'StaticStreamBuffer_t'?
  RecorderDataPtr->ObjectPropertyTable.StartIndexOfClass[7] = StartIndexStreamBuffer;
                                                              ^~~~~~~~~~~~~~~~~~~~~~
                                                              StaticStreamBuffer_t
../Core/Src/trcKernelPort.c:1001:62: error: 'StartIndexMessageBuffer' undeclared (first use in this function); did you mean 'StartIndexStreamBuffer'?
  RecorderDataPtr->ObjectPropertyTable.StartIndexOfClass[8] = StartIndexMessageBuffer;
                                                              ^~~~~~~~~~~~~~~~~~~~~~~
                                                              StartIndexStreamBuffer
../Core/Src/trcKernelPort.c:1002:72: error: 'TRACE_OBJECT_TABLE_SIZE' undeclared (first use in this function); did you mean 'TRC_CFG_SYMBOL_TABLE_SIZE'?
  RecorderDataPtr->ObjectPropertyTable.ObjectPropertyTableSizeInBytes = TRACE_OBJECT_TABLE_SIZE;
                                                                        ^~~~~~~~~~~~~~~~~~~~~~~
                                                                        TRC_CFG_SYMBOL_TABLE_SIZE
../Core/Src/trcKernelPort.c: In function 'vTraceInitObjectHandleStack':
../Core/Src/trcKernelPort.c:1008:2: error: 'objectHandleStacks' undeclared (first use in this function)
  objectHandleStacks.indexOfNextAvailableHandle[0] = objectHandleStacks.lowestIndexOfClass[0] = 0;
  ^~~~~~~~~~~~~~~~~~
../Core/Src/trcKernelPort.c: In function 'pszTraceGetErrorNotEnoughHandles':
../Core/Src/trcKernelPort.c:1034:7: error: 'TRACE_CLASS_TASK' undeclared (first use in this function); did you mean 'TRACE_CLASS_MUTEX'?
  case TRACE_CLASS_TASK:
       ^~~~~~~~~~~~~~~~
       TRACE_CLASS_MUTEX
../Core/Src/trcKernelPort.c:1036:7: error: 'TRACE_CLASS_ISR' undeclared (first use in this function); did you mean 'TRACE_CLASS_TASK'?
  case TRACE_CLASS_ISR:
       ^~~~~~~~~~~~~~~
       TRACE_CLASS_TASK
../Core/Src/trcKernelPort.c:1044:7: error: 'TRACE_CLASS_TIMER' undeclared (first use in this function); did you mean 'TRACE_CLASS_ISR'?
  case TRACE_CLASS_TIMER:
       ^~~~~~~~~~~~~~~~~
       TRACE_CLASS_ISR
../Core/Src/trcKernelPort.c:1046:7: error: 'TRACE_CLASS_EVENTGROUP' undeclared (first use in this function); did you mean 'TRC_CFG_NEVENTGROUP'?
  case TRACE_CLASS_EVENTGROUP:
       ^~~~~~~~~~~~~~~~~~~~~~
       TRC_CFG_NEVENTGROUP
../Core/Src/trcKernelPort.c:1048:7: error: 'TRACE_CLASS_STREAMBUFFER' undeclared (first use in this function); did you mean 'TRC_CFG_NSTREAMBUFFER'?
  case TRACE_CLASS_STREAMBUFFER:
       ^~~~~~~~~~~~~~~~~~~~~~~~
       TRC_CFG_NSTREAMBUFFER
../Core/Src/trcKernelPort.c:1050:7: error: 'TRACE_CLASS_MESSAGEBUFFER' undeclared (first use in this function); did you mean 'TRACE_CLASS_STREAMBUFFER'?
  case TRACE_CLASS_MESSAGEBUFFER:
       ^~~~~~~~~~~~~~~~~~~~~~~~~
       TRACE_CLASS_STREAMBUFFER
In file included from ../Middlewares/Third_Party/FreeRTOS/Source/include/portable.h:52:0,
                 from ../Middlewares/Third_Party/FreeRTOS/Source/include/FreeRTOS.h:62,
                 from ../Core/Src/trcKernelPort.c:45:
At top level:
../Core/Src/trcKernelPort.c:946:26: warning: 'TzCtrl' defined but not used [-Wunused-function]
 static portTASK_FUNCTION(TzCtrl, pvParameters)
                          ^
../Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM3/portmacro.h:112:59: note: in definition of macro 'portTASK_FUNCTION'
 #define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void *pvParameters )
                                                           ^~~~~~~~~
../Core/Src/trcKernelPort.c:113:21: warning: 'tcbTzCtrl' defined but not used [-Wunused-variable]
 static StaticTask_t tcbTzCtrl;
                     ^~~~~~~~~
../Core/Src/trcKernelPort.c:112:20: warning: 'stackTzCtrl' defined but not used [-Wunused-variable]
 static StackType_t stackTzCtrl[TRC_CFG_CTRL_TASK_STACK_SIZE];
                    ^~~~~~~~~~~
../Core/Src/trcKernelPort.c:107:17: warning: 'HandleTzCtrl' defined but not used [-Wunused-variable]
 static TaskType HandleTzCtrl = NULL;       /* TzCtrl task TCB */
                 ^~~~~~~~~~~~
make: *** [Core/Src/subdir.mk:95: Core/Src/trcKernelPort.o] Error 1
"make -j12 all" terminated with exit code 2. Build might be incomplete.

10:06:39 Build Failed. 38 errors, 10 warnings. (took 2s.192ms)

也许有人也知道 SEGGER SystemView 实现发生了什么。我附上控制台输出的屏幕截图: 未定义的参考错误

希望有人可以帮助我。谢谢!

本杰明

4

0 回答 0