What populates the values in c_cpp_properties.json for the nRF52840-DK

I built a sample Zephyr program using the nRF52840-DK using PlatformIO in VSCode to help me understand the configuration process. I can’t figure out where the following include paths for 'compilerArgs" are set.

                "-isystem",
                "/Users/mdcraver/.platformio/packages/framework-zephyr/lib/libc/minimal/include",
                "-isystem",
                "/Users/mdcraver/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/8.2.1/include",
                "-isystem",
                "/Users/mdcraver/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/8.2.1/include-fixed",

Following is the platform.ini file.

; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

[env:nrf52840_dk]
platform = nordicnrf52
board = nrf52840_dk
framework = zephyr
monitor_speed = 115200

Following is the c_cpp_properties.json file

{
    "configurations": [
        {
            "name": "!!! WARNING !!! AUTO-GENERATED FILE, PLEASE DO NOT MODIFY IT AND USE https://docs.platformio.org/page/projectconf/section_env_build.html#build-flags"
        },
        {
            "name": "Mac",
            "macFrameworkPath": [],
            "includePath": [
                "/Users/mdcraver/Documents/PlatformIO/Projects/nRF52840_DK_Test/include",
                "/Users/mdcraver/Documents/PlatformIO/Projects/nRF52840_DK_Test/src",
                "/Users/mdcraver/.platformio/packages/framework-zephyr/include",
                "/Users/mdcraver/Documents/PlatformIO/Projects/nRF52840_DK_Test/.pio/build/nrf52840_dk/zephyr/include/generated",
                "/Users/mdcraver/.platformio/packages/framework-zephyr/soc/arm/nordic_nrf/nrf52",
                "/Users/mdcraver/.platformio/packages/framework-zephyr-segger/rtt",
                "/Users/mdcraver/.platformio/packages/framework-zephyr-hal-nordic/nrfx",
                "/Users/mdcraver/.platformio/packages/framework-zephyr-hal-nordic/nrfx/drivers/include",
                "/Users/mdcraver/.platformio/packages/framework-zephyr-hal-nordic/nrfx/mdk",
                "/Users/mdcraver/.platformio/packages/framework-zephyr-hal-nordic",
                "/Users/mdcraver/.platformio/packages/framework-zephyr-cmsis/CMSIS/Core/Include",
                "/Users/mdcraver/.platformio/packages/tool-unity",
                ""
            ],
            "browse": {
                "limitSymbolsToIncludedHeaders": true,
                "path": [
                    "/Users/mdcraver/Documents/PlatformIO/Projects/nRF52840_DK_Test/include",
                    "/Users/mdcraver/Documents/PlatformIO/Projects/nRF52840_DK_Test/src",
                    "/Users/mdcraver/.platformio/packages/framework-zephyr/include",
                    "/Users/mdcraver/Documents/PlatformIO/Projects/nRF52840_DK_Test/.pio/build/nrf52840_dk/zephyr/include/generated",
                    "/Users/mdcraver/.platformio/packages/framework-zephyr/soc/arm/nordic_nrf/nrf52",
                    "/Users/mdcraver/.platformio/packages/framework-zephyr-segger/rtt",
                    "/Users/mdcraver/.platformio/packages/framework-zephyr-hal-nordic/nrfx",
                    "/Users/mdcraver/.platformio/packages/framework-zephyr-hal-nordic/nrfx/drivers/include",
                    "/Users/mdcraver/.platformio/packages/framework-zephyr-hal-nordic/nrfx/mdk",
                    "/Users/mdcraver/.platformio/packages/framework-zephyr-hal-nordic",
                    "/Users/mdcraver/.platformio/packages/framework-zephyr-cmsis/CMSIS/Core/Include",
                    "/Users/mdcraver/.platformio/packages/tool-unity",
                    ""
                ]
            },
            "defines": [
                "PLATFORMIO=40304",
                "ARDUINO_NRF52_DK",
                "BUILD_VERSION=zephyr-v20300",
                "KERNEL",
                "NRF52840_XXAA",
                "_FORTIFY_SOURCE=2",
                "__PROGRAM_START",
                "__ZEPHYR__=1",
                ""
            ],
            "intelliSenseMode": "clang-x64",
            "cStandard": "c99",
            "forcedInclude": [
                "/Users/mdcraver/.platformio/packages/framework-zephyr/include/toolchain/zephyr_stdint.h",
                "/Users/mdcraver/Documents/PlatformIO/Projects/nRF52840_DK_Test/.pio/build/nrf52840_dk/zephyr/include/generated/autoconf.h",
                ""
            ],
            "compilerPath": "/Users/mdcraver/.platformio/packages/toolchain-gccarmnoneeabi/bin/arm-none-eabi-gcc",
            "compilerArgs": [
                "-mabi=aapcs",
                "-mcpu=cortex-m4",
                "-mthumb",
                "-isystem",
                "/Users/mdcraver/.platformio/packages/framework-zephyr/lib/libc/minimal/include",
                "-isystem",
                "/Users/mdcraver/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/8.2.1/include",
                "-isystem",
                "/Users/mdcraver/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/8.2.1/include-fixed",
                ""
            ]
        }
    ],
    "version": 4
}

This project worked before I updated the Nordic nRF52 platform to v4.4.0.

Does anyone know what could have changed with the new version of the Nordic nRF52 platform to cause this problem including the zephyr and gcc toolchain system directories?

The c_cpp_properties.json is not used for compilation. It’s generated by PlatformIO as a hint for VSCode on where to look to do its code completion services. So, changing around paths in there won’t solve your problem of a failing build, it’s just a symptom of it.

If it doesn’t build after an update to v4.4.0, try explicitly stating an older platform version, as listed in the release pages and described in the docs, e.g.

; 4.3.0 has Zephyr v2.3.0
; 4.2.0 has v2.2.0
; 4.0.0 has "initial version"..
platform = nordicnrf52@4.3.0

The last major changes regarding Zephyr I’m seeing is the update to Zephyr 2.3.0 in platform version 4.3.0 and v2.2.0 in 4.2.0. Only mbed-os changes were supposedly done between 4.3.0 and 4.4.0.

If your project builds with 4.3.0 but not with 4.4.0 then something broke and you should report it to Issues · platformio/platform-nordicnrf52 · GitHub.

When I try to use the v4.2.0 of the nordicnrf52 platform my custom board is no longer found. However, if I use the command “pio boards” my board shows up.

In looking at the release notes for nordicnrf52 v4.3.0 and for the Zephyr framework v2.3.0 I noticed in the Zephyr release notes that the nRF52 boards were renamed. Also, it mentions a new Zephyr CMake package.

I created my custom board by simply copying and modifying the nRF52840DK_nRF52840 board. Since the example I made using the nRF52840DK_nRF52840 board works fine, and populates the c_cpp_properties.json file correctly, but my renamed and slightly modified copy doesn’t work. I think there has to be some background nordicnrf52 settings or files that aren’t linked to the custom board I created, but I am at a loss for what they could be.

Has anyone successfully created a custom nordic nRF52 board, using the recommended method of copying and modifying an existing board, that works with the most recent versions of PlatformIO, nordicnrf52, and Zephyr?