nrf52 与 nrf sdk(不是 nrf-connect!)vscode 上的 15.2 - 智能感知问题

问题描述 投票:0回答:1

我将从枯燥的细节开始: 主机系统:ubuntu 22.04 与代码 1.80.2 该项目: 使用 nrf sdk 15.2 和 gcc arm 工具链嵌入 nrf52840 处理器:gcc-arm-none-eabi-9-2020-q2-update。 该项目是使用 makefile 进行编译的,makefile 从 env 变量中获取 sdk 目录,在 nrf-sdk 中,工具链从 sdk 内的配置文件中获取。

这是我的 c_cpp_properties.json:

{
"env": {
    "nrfSDK": "/home/eyal/develop/sdks/nRF5_SDK_15.2.0_9412b96/"
},
"configurations": [
    {
        "name": "nrf52",
        "includePath": [
            "${workspaceFolder}/**",
            "${nrfSDK}/components",
            "${nrfSDK}/components/softdevice/common",
            "${nrfSDK}/components/softdevice/s140/headers",
            "${nrfSDK}/components/softdevice/s140/headers/nrf52",
            "${nrfSDK}/components/toolchain/cmsis/include",
            "${nrfSDK}/components/libraries/**",
            "${nrfSDK}/components/boards",
            "${nrfSDK}/modules/**",
            "${nrfSDK}/modules/",
            "${nrfSDK}/integration/nrfx",
            "${nrfSDK}/integration/nrfx/legacy",
            "${nrfSDK}/external/**"
        ],
        "defines": [
            "BOARD_PCA10056",
            "BSP_DEFINES_ONLY",
            "CONFIG_GPIO_AS_PINRESET",
            "FLOAT_ABI_HARD",
            "NRF52840_XXAA"
        ],
        "compilerPath": "/home/eyal/develop/sdks/gcc-arm-none-eabi-9-2020-q2-update/bin/arm-none-eabi-gcc",
        "cStandard": "c11",
        "cppStandard": "c++14",
        "intelliSenseMode": "linux-gcc-arm",
        "compilerArgs": [
            "-O3",
            "-g3",
            "-mcpu=cortex-m4",
            "-mthumb",
            "-mabi=aapcs",
            "-Wall -Werror",
            "-mfloat-abi=hard ",
            "-mfpu=fpv4-sp-d16",
            "-ffunction-sections",
            "-fdata-sections",
            "-fno-strict-aliasing",
            "-fno-builtin",
            "-fshort-enums"
        ]
    }
],
"version": 4
}

我使用的是眨眼示例,因此只有一个 main.c 文件。 如果我要求 vscode 转到定义,那么我定义的包含路径中存在的文件就可以正常定向。但是与编译器到达的库路径相关的所有内容 - 我可以看到 vscode 带我到主机的 clang 目录! 我已经验证,当 vscode 启动时,arm-gcc 文件被调用并输出所有标志、const 和包含路径,因此该插件确实完成了它的工作,但一路上有些事情变坏了,任何有 vscode 经验的人都可以提供帮助吗? 我想也许我需要更改 settings.json 中的系统包含路径。

c visual-studio-code embedded intellisense
1个回答
0
投票

很好,没有 1 人回答,要么没有太多人使用 VSCODE,要么没有人真正知道如何配置它,只是愚蠢地遵循说明。

通过打开所有日志并看到编译器无法运行来解决问题,因为我的参数 defs 中的两个命令由空格连接,而 vscode 不知道如何很好地传递它。

将它们分开解决了问题,现在系统路径是正确的。

© www.soinside.com 2019 - 2024. All rights reserved.