STM32的VSCODE编译问题

发布于 2025-02-09 11:36:11 字数 3593 浏览 1 评论 0原文

因此,VSCODE愉快地为我的STM MicroController(STM32WB)编写代码。我将在VSCODE中编写代码,并在STM32Cubeide中编译并运行。 但是,最近,Vscode的Intellisense正在行动。它检测到诸如 标识符“ UINT8_T”是未定义的。此外,VSCODE的“输出”选项卡给出以下错误:

Unable to resolve configuration with compilerPath: "C:/ST/STM32CubeIDE_1.8.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.0.202111181127/tools/bin/arm-none-eabi-gcc.exe"

路径本身似乎很好。如果我从命令提示符中发出该命令,我会得到

arm-none-eabi-gcc.exe: fatal error: no input files
compilation terminated.

这是预期的响应。

关于我接下来可以尝试的什么建议?我觉得我缺少一些小东西!

更多信息:

  • 我尝试在C_CPP_Properties.json中广泛玩耍 文件。
  • 我尝试通过STM32Cubeide下载另一个工具链,然后使用该路径。
  • 我尝试在Windows环境路径中添加路径。

这是我的C_CPP_PROPERTIES.JSON文件(大多数设置是从STM32Cubeide默认设置的内容复制/粘贴:

{
"configurations": [
    {
        "name": "STM32",
        "includePath": [
            "${workspaceFolder}/**",
            "C:\\ST\\STM32CubeIDE_1.8.0\\STM32CubeIDE\\plugins\\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.0.202111181127\\tools\\**",
            "${workspaceFolder}/Drivers/STM32WBxx_HAL_Driver/Inc",
            "${workspaceFolder}/Drivers/CMSIS/Device/ST/STM32WBxx/Include",
            "${workspaceFolder}/Drivers/CMSIS/Include",
            "${workspaceFolder}/Core/Inc",
            "${workspaceFolder}/STM32CubeIDE/Application/Core",
            "${workspaceFolder}/STM32CubeIDE/Drivers/STM32WBxx_HAL_Driver",
            "${workspaceFolder}/Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread",
            "${workspaceFolder}/Middlewares/ST/STM32_WPAN/ble/core",
            "${workspaceFolder}/Middlewares/ST/STM32_WPAN/utilities",
            "${workspaceFolder}/Middlewares/ST/STM32_WPAN/ble",
            "${workspaceFolder}/STM32_WPAN/App",
            "${workspaceFolder}/Middlewares/ST/STM32_WPAN/ble/core/template",
            "${workspaceFolder}/Middlewares/ST/STM32_WPAN",
            "${workspaceFolder}/Utilities/sequencer"
        ],
        "defines": [
            "_DEBUG",
            "UNICODE",
            "_UNICODE",
            "USE_HAL_DRIVER",
            "DEBUG",
            "STM32WB55xx"
        ],
        "compilerPath": "C:/ST/STM32CubeIDE_1.8.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.0.202111181127/tools/bin/arm-none-eabi-gcc.exe",
        "compilerArgs": [
            "-mcpu=cortex-m4 -std=gnu11 -g3 -DUSE_HAL_DRIVER -DUSE_STM32WBXX_NUCLEO -DCORE_CM4 -DSTM32WB55xx -c -I../../Core/Inc -I../../Utilities/lpm/tiny_lpm -I../../Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread/shci -I../../Utilities/sequencer -I../../Drivers/CMSIS/Device/ST/STM32WBxx/Include -I../../Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread -I../../Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread/tl -I../../STM32_WPAN/App -I../../Middlewares/ST/STM32_WPAN/ble/core -I../../Middlewares/ST/STM32_WPAN -I../../Middlewares/ST/STM32_WPAN/ble/core/template -I../../Drivers/BSP/P-NUCLEO-WB55.Nucleo -I../../Drivers/STM32WBxx_HAL_Driver/Inc -I../../Middlewares/ST/STM32_WPAN/ble/core/auto -I../../Middlewares/ST/STM32_WPAN/utilities -I../../Middlewares/ST/STM32_WPAN/ble -I../../Drivers/CMSIS/Include -Os -ffunction-sections -fdata-sections -Wall -fstack-usage --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb"
        ],
        "cStandard": "gnu11",
        "cppStandard": "gnu++11",
        "intelliSenseMode": "windows-gcc-arm",
    }
],
"version": 4

}

So, VSCode was working happily for writing code for my STM microcontroller (STM32WB). I would write the code in VSCode and compile and run in STM32CubeIDE.
Lately, however, VSCode's IntelliSense is acting up. It detects problems such as
identifier "uint8_t" is undefined. Furthermore, the 'Output' tab of VSCode gives the following error:

Unable to resolve configuration with compilerPath: "C:/ST/STM32CubeIDE_1.8.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.0.202111181127/tools/bin/arm-none-eabi-gcc.exe"

The path itself appears to be fine. If I issue that command from command prompt, I get

arm-none-eabi-gcc.exe: fatal error: no input files
compilation terminated.

which is the expected response.

Any suggestions on what I can try next? I feel like I'm missing something small!

More info:

  • I've tried extensively playing around in the c_cpp_properties.json
    file.
  • I've tried downloading another toolchain through STM32CubeIDE and using that path instead.
  • I've tried adding the path to the Windows environment path.

Here is my c_cpp_properties.json file (most of the settings are copy/paste from what STM32CubeIDE sets up by default:

{
"configurations": [
    {
        "name": "STM32",
        "includePath": [
            "${workspaceFolder}/**",
            "C:\\ST\\STM32CubeIDE_1.8.0\\STM32CubeIDE\\plugins\\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.0.202111181127\\tools\\**",
            "${workspaceFolder}/Drivers/STM32WBxx_HAL_Driver/Inc",
            "${workspaceFolder}/Drivers/CMSIS/Device/ST/STM32WBxx/Include",
            "${workspaceFolder}/Drivers/CMSIS/Include",
            "${workspaceFolder}/Core/Inc",
            "${workspaceFolder}/STM32CubeIDE/Application/Core",
            "${workspaceFolder}/STM32CubeIDE/Drivers/STM32WBxx_HAL_Driver",
            "${workspaceFolder}/Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread",
            "${workspaceFolder}/Middlewares/ST/STM32_WPAN/ble/core",
            "${workspaceFolder}/Middlewares/ST/STM32_WPAN/utilities",
            "${workspaceFolder}/Middlewares/ST/STM32_WPAN/ble",
            "${workspaceFolder}/STM32_WPAN/App",
            "${workspaceFolder}/Middlewares/ST/STM32_WPAN/ble/core/template",
            "${workspaceFolder}/Middlewares/ST/STM32_WPAN",
            "${workspaceFolder}/Utilities/sequencer"
        ],
        "defines": [
            "_DEBUG",
            "UNICODE",
            "_UNICODE",
            "USE_HAL_DRIVER",
            "DEBUG",
            "STM32WB55xx"
        ],
        "compilerPath": "C:/ST/STM32CubeIDE_1.8.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.0.202111181127/tools/bin/arm-none-eabi-gcc.exe",
        "compilerArgs": [
            "-mcpu=cortex-m4 -std=gnu11 -g3 -DUSE_HAL_DRIVER -DUSE_STM32WBXX_NUCLEO -DCORE_CM4 -DSTM32WB55xx -c -I../../Core/Inc -I../../Utilities/lpm/tiny_lpm -I../../Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread/shci -I../../Utilities/sequencer -I../../Drivers/CMSIS/Device/ST/STM32WBxx/Include -I../../Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread -I../../Middlewares/ST/STM32_WPAN/interface/patterns/ble_thread/tl -I../../STM32_WPAN/App -I../../Middlewares/ST/STM32_WPAN/ble/core -I../../Middlewares/ST/STM32_WPAN -I../../Middlewares/ST/STM32_WPAN/ble/core/template -I../../Drivers/BSP/P-NUCLEO-WB55.Nucleo -I../../Drivers/STM32WBxx_HAL_Driver/Inc -I../../Middlewares/ST/STM32_WPAN/ble/core/auto -I../../Middlewares/ST/STM32_WPAN/utilities -I../../Middlewares/ST/STM32_WPAN/ble -I../../Drivers/CMSIS/Include -Os -ffunction-sections -fdata-sections -Wall -fstack-usage --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb"
        ],
        "cStandard": "gnu11",
        "cppStandard": "gnu++11",
        "intelliSenseMode": "windows-gcc-arm",
    }
],
"version": 4

}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

暮年 2025-02-16 11:36:11

The c_cpp_properties.json reference indicates that some fields are optional. Indeed, simply commenting out the optional compilerArgs parameter resolves the issue. At least to a point that IntelliSense is working correctly again. Note that some of the -DXXXX parameters had to be moved to defines (e.g. -DUSE_STM32WBXX_NUCLEO).

It does make some sense, since you are already defining a lot of the compilerArgs elsewhere in the .json file (like defines and includePath).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文