0

将新的 cubeMX 项目导入 VisualGDB 时遇到一些问题。我收到大量错误说:( undefined reference to 'vPortFree'例如)

采取的步骤:

  1. 使用“其他工具链”在 CubeMX 中生成项目文件
  2. 然后在 VS 中,使用 Embedded Visual GDB 创建项目,并且大多遵循默认步骤。我完全按照这个过程。https://www.youtube.com/watch?v=XY4I0Nq6IGc

创建项目后,我尝试构建它,但出现以下错误:

Severity Description                                            Project                          File                                                                                                                               Line
Error    undefined reference to `vPortFree'                     stm32nucleof429zi_freertos_tcpip C:\Repos\stm32nucleof429zi_freertos_tcpip.git\stm32nucleof429zi_freertos_tcpip.git\Middlewares\Third_Party\FreeRTOS\Source\tasks.c 3920
Error    undefined reference to `vPortFree'                     stm32nucleof429zi_freertos_tcpip C:\Repos\stm32nucleof429zi_freertos_tcpip.git\stm32nucleof429zi_freertos_tcpip.git\Middlewares\Third_Party\FreeRTOS\Source\tasks.c 3921
Error    undefined reference to `vPortFree'                     stm32nucleof429zi_freertos_tcpip C:\Repos\stm32nucleof429zi_freertos_tcpip.git\stm32nucleof429zi_freertos_tcpip.git\Middlewares\Third_Party\FreeRTOS\Source\tasks.c 3927
Error    Build failed: arm-none-eabi-g++.exe exited with code 1 stm32nucleof429zi_freertos_tcpip                                                                                                                                    1   
Error    ld returned 1 exit status                              stm32nucleof429zi_freertos_tcpip C:\Repos\stm32nucleof429zi_freertos_tcpip.git\stm32nucleof429zi_freertos_tcpip.git\collect2.exe                                    0   

但是,当我右键单击 main.c 并编译时,项目编译成功。在使用构建工具和调试器时会出现这些错误。

我以前在导入项目时从未遇到过这个问题。任何帮助将不胜感激谢谢

4

1 回答 1

0

在玩了一段时间配置后,我发现了问题。CubeMx 创建的工具链文件不会告诉链接器包含 FreeRTOS 编译所需的所有文件。

仅当您使用 CMSIS_RTOS_V2 并且以下步骤为我修复了此问题时,此问题才相关:

通过以下步骤将 CMSIS_RTOS_V2 添加到项目空间:添加缺少的包括:

  • 转到:项目->VisualGDP 项目属性->MS 构建设置->包含目录并将文件夹 CMSIS_RTOS_V2 添加到文件路径

要解决未识别的引用“pvPortMalloc”错误:

于 2022-01-31T15:05:48.623 回答