Undefined reference to `osThreadCreate'

使用STM32CubeMX+FreeRTOS,生产Makefile工程,导入到PIO中无法正常编译。出现变量未定义的错误!

但是,我确实有将相关头文件(.h)包含到头文件路径里。在VSCode中也可以正常索引到"cmsis_os.h"。

错误提示如下:

问题已经找到,是未将 Middlewares 文件加入到src_filter中。
PIO7

You can’t just -I Middlewares, it will not be compiled (no object file created). You have to put it in src or lib. The folder structures of STM32Cube projects cannot be directly used in PlatformIO, you have to move stuff around.

There is also GitHub - ussserrr/stm32pio: Automate managing of STM32CubeMX + PlatformIO projects to automate this.

非常感谢您的回复!
我有在项目文件中包含 Middlewares文件,出现未定义变量的问题,在我使用了“src_filter = + +<startup_stm32f407xx.s> + +”后已经解决。非常感谢您!

以下是工程目录:
PIO9

Your folder structure is still all wrong. And the startup file cannot just be in the root folder, it should be in src/ (not "Src"). The "Inc" folder must be include. Try to do as in GitHub - maxgerhardt/pio-stm32h7-stm32cube-freertos.