Implementing 'Developing Bluetooth Low Energy products using nRF Connect' video on nRF5340-DK

I am working from this video:

https://webinars.nordicsemi.com/developing-bluetooth-low-energy-6

Which nRF5340-DK build configuration should I use please?

  • nrff5340dk_nrf5340_cpuapp
  • nrff5340dk_nrf5340_cpuapp_ns
  • nrff5340dk_nrf5340_cpunet

I've downloaded the source files and manually put the folders named 'bluetooth_remote' and 'bluetooth_remote_template' in my macOS workspace folder.

I add the 'bluetooth_remote_template' folder as a new application into VS Code, immediately I'm asked if I want to change from the current v1.9.0 version of the nRF Connect SDK. I assume that I should be working with the latest version, so confirm that I don't want to change. When I then open the project in Explorer and look at main.c I see the following Includes underlined with red squiggles.

main.c

#include <zephyr.h>
#include <logging/log.h>
#include <dk_buttons_and_leds.h>
#include "remote.h"

The same is true for the Includes in remote.c and remote.h:

remote.c
  
#include "remote.h"
    
remote.h
   
#include <zephyr.h>
#include <logging/log.h>
 
What do I need to do to provide the paths to these header files please?

Parents Reply Children
  • IMPORTANT: The data below could contain sensitive or confidential information about your environment.
    If you do not wish this to be seen by others, please make sure to remove it before sharing.
    
    For help and support, visit the Nordic DevZone at https://devzone.nordicsemi.com/.
    
    {
      "platform": {
        "os": "darwin",
        "osVersion": "Darwin Kernel Version 21.3.0: Wed Jan  5 21:37:58 PST 2022; root:xnu-8019.80.24~20/RELEASE_X86_64",
        "osKernel": "21.3.0",
        "vscode": "1.64.2",
        "electron": "13.5.2",
        "node": "v14.16.0"
      },
      "system": {
        "date": "2022-02-28T13:58:43.108Z",
        "vscodeRoot": "/Applications/Visual Studio Code.app/Contents/Resources/app",
        "nrfConnectForDesktopInstalled": true,
        "vscodeUptime": "00:00:22",
        "osUptime": "149:38:49",
        "cpu": {
          "model": "Intel(R) Core(TM) i7-5557U CPU @ 3.10GHz",
          "speed": "3100 MHz",
          "count": 2
        },
        "memory": {
          "total": "16.00 GB",
          "free": "2.69 GB"
        }
      },
      "workspace": {
        "name": "Untitled (Workspace)",
        "workspaceFile": "1644932005920",
        "folders": [
          "/Users/XXXXXX/workspace/bluetooth_remote_template"
        ]
      },
      "extensions": {
        "internal": {
          "nordic-semiconductor.nrf-connect": {
            "version": "2022.1.192",
            "path": "/Users/XXXXXX/.vscode/extensions/nordic-semiconductor.nrf-connect-2022.1.192",
            "isActive": true
          },
          "nordic-semiconductor.nrf-terminal": {
            "version": "2022.1.30",
            "path": "/Users/XXXXXX/.vscode/extensions/nordic-semiconductor.nrf-terminal-2022.1.30",
            "isActive": true
          },
          "nordic-semiconductor.devicetree": null,
          "nordic-semiconductor.kconfig": null
        },
        "external": {
          "marus25.cortex-debug": "1.2.2",
          "ms-vscode.cpptools": "1.8.4",
          "ms-vscode.js-debug": "1.64.3",
          "ms-vscode.js-debug-companion": "1.0.15",
          "ms-vscode.references-view": "0.0.81",
          "ms-vscode.vscode-js-profile-table": "0.0.18",
          "cschlosser.doxdocgen": "1.4.0",
          "jeff-hykin.better-cpp-syntax": "1.15.13",
          "ms-vscode-remote.remote-containers": "0.217.4",
          "ms-vscode-remote.remote-ssh": "0.74.0",
          "ms-vscode-remote.remote-ssh-edit": "0.74.0",
          "ms-vscode-remote.remote-wsl": "0.64.2",
          "ms-vscode.cmake-tools": "1.9.2",
          "ms-vscode.cpptools-extension-pack": "1.1.0",
          "ms-vscode.cpptools-themes": "1.0.0",
          "trond-snekvik.gnu-mapfiles": "1.1.0",
          "twxs.cmake": "0.0.17"
        }
      },
      "tools": {
        "/Applications/SEGGER/JLink/JLinkExe": "7.58b",
        "/usr/local/bin/nrfjprog": "10.15.2",
        "/opt/nordic/ncs/v1.9.0/toolchain/bin/cmake": "3.21.1",
        "/opt/nordic/ncs/v1.9.0/toolchain/bin/west": "0.12.0",
        "/opt/nordic/ncs/v1.9.0/toolchain/bin/python3": "3.9.6",
        "/opt/nordic/ncs/v1.9.0/toolchain/bin/ninja": "1.10.2",
        "/opt/nordic/ncs/v1.9.0/toolchain/bin/gperf": "3.1",
        "/opt/nordic/ncs/v1.9.0/toolchain/bin/dtc": "1.6.1",
        "/opt/nordic/ncs/v1.9.0/toolchain/bin/arm-none-eabi-gcc": "9-2019-q4-major",
        "/opt/nordic/ncs/v1.9.0/toolchain/bin/gn": "1975",
        "/opt/nordic/ncs/v1.9.0/toolchain/bin/git": "2.32.0"
      },
      "connectedDevices": [
        {
          "id": "682337947"
        }
      ],
      "config": {
        "nordic-semiconductor.nrf-connect": {
          "topdir": "${nrf-connect.sdk:1.9.0}",
          "toolchain": {
            "path": "${nrf-connect.toolchain:1.9.0}"
          },
          "ozonePath": "",
          "applications": [
            "${workspaceFolder:bluetooth_remote}",
            "${workspaceFolder}"
          ],
          "jlink": {
            "rtosPlugin": ""
          },
          "kconfig": {
            "interface": "kconfig"
          },
          "welcome": {
            "showOnStartup": false
          },
          "west": {
            "env": {
              "$base": "terminal"
            }
          },
          "boardRoots": [],
          "enableTelemetry": true
        },
        "nordic-semiconductor.nrf-terminal": {
          "terminalMode": "character"
        },
        "nordic-semiconductor.devicetree": {
          "modules": [
            "${zephyrBase}",
            "${zephyrBase}/../nrf",
            "."
          ],
          "zephyr": "",
          "ctxFile": "",
          "defaultBoard": ""
        },
        "nordic-semiconductor.kconfig": {
          "root": "",
          "env": {},
          "cfiles": true,
          "disable": false,
          "zephyr": {
            "base": ""
          },
          "python": "",
          "liveValue": true
        },
        "marus25.cortex-debug": {
          "armToolchainPath": null,
          "armToolchainPrefix": "arm-none-eabi",
          "gdbPath": null,
          "objdumpPath": null,
          "JLinkGDBServerPath": null,
          "openocdPath": null,
          "pyocdPath": null,
          "PEGDBServerPath": null,
          "stutilPath": null,
          "stlinkPath": null,
          "stm32cubeprogrammer": null,
          "enableTelemetry": true,
          "flattenAnonymous": false,
          "registerUseNaturalFormat": true,
          "variableUseNaturalFormat": true,
          "dbgServerLogfile": null,
          "showDevDebugOutput": "none"
        }
      },
      "environment": {
        "westExe": "/opt/nordic/ncs/v1.9.0/toolchain/bin/west",
        "westEnv": {
          "ELECTRON_RUN_AS_NODE": "1",
          "GIT_EXEC_PATH": "/opt/nordic/ncs/v1.9.0/toolchain/Cellar/git/2.32.0_1/libexec/git-core",
          "HOME": "/Users/XXXXXX",
          "PATH": "/opt/nordic/ncs/v1.9.0/toolchain/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin",
          "ZEPHYR_BASE": "/opt/nordic/ncs/v1.9.0/zephyr",
          "GNUARMEMB_TOOLCHAIN_PATH": "/opt/nordic/ncs/v1.9.0/toolchain",
          "ZEPHYR_TOOLCHAIN_VARIANT": "gnuarmemb",
          "USER": "XXXXXX"
        },
        "toolchainPath": "/opt/nordic/ncs/v1.9.0/toolchain",
        "toolchainBinPath": "/opt/nordic/ncs/v1.9.0/toolchain/bin",
        "toolchainVersion": "1.9.0"
      },
      "terminal": {
        "shell": null,
        "defaultProfile": null
      }
    }
    
    -------- Diagnostics - 2/28/2022, 2:06:05 PM
    Version: 1.8.4
    Current Configuration:
    {
        "name": "Mac",
        "includePath": [
            "${workspaceFolder}/**"
        ],
        "defines": [],
        "macFrameworkPath": [
            "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks"
        ],
        "compilerPath": "/usr/bin/clang",
        "cStandard": "c11",
        "cppStandard": "c++98",
        "intelliSenseMode": "macos-clang-x64",
        "configurationProvider": "ms-vscode.cmake-tools",
        "compilerPathIsExplicit": true,
        "cStandardIsExplicit": true,
        "cppStandardIsExplicit": true,
        "intelliSenseModeIsExplicit": true,
        "compilerArgs": [],
        "mergeConfigurations": false,
        "browse": {
            "path": [
                "${workspaceFolder}/**"
            ],
            "limitSymbolsToIncludedHeaders": true
        }
    }
    Custom browse configuration: 
    {
        "browsePath": []
    }
    Translation Unit Mappings:
    [ /Users/XXXXXX/workspace/bluetooth_remote_template/src/main.c ]:
        /Users/XXXXXX/workspace/bluetooth_remote_template/src/main.c
    Translation Unit Configurations:
    [ /Users/XXXXXX/workspace/bluetooth_remote_template/src/main.c ]:
        Process ID: 83846
        Memory Usage: 8 MB
        Compiler Path: /usr/bin/clang
        Includes:
            /usr/local/include
            /Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/include
            /Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk/usr/include
            /Library/Developer/CommandLineTools/usr/include
            /Users/XXXXXX/workspace/bluetooth_remote_template/src/remote_service
        Frameworks:
            /Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk/System/Library/Frameworks
        Standard Version: c11
        IntelliSense Mode: macos-clang-x64
        Other Flags:
            --clang
            --clang_version=110000
    Total Memory Usage: 8 MB
    
    

    Thanks very much Sigurd, please find requested files attached.

  • Hi

    How does your c_cpp_properties.json look now?

    According to the diagnostics your setup sees "IntelliSense Mode: macos-clang-x64" which is wrong. ("IntelliSense Mode: macos-gcc-arm" is expected) This could be because the file is not opened, the build is not selected, or maybe the intellisense extension was installed or enabled later then our extension. If the latter is true a simple quit and restart would solve the problem.

    Regards,
    Sigurd Hellesvik

  • Hi Sigurd,

    Thanks very much, please see attached text file showing c_app_properties.json both before and after quitting and restarting nRF Connect for Desktop Toolchain Manager and VS Code. As you will see, there is no difference in the file contents.

    {
        "configurations": [
            {
                "name": "Mac",
                "includePath": [
                    "${workspaceFolder}/**"
                ],
                "defines": [],
                "macFrameworkPath": [
                    "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks"
                ],
                "compilerPath": "/usr/bin/clang",
                "cStandard": "c11",
                "cppStandard": "c++98",
                "intelliSenseMode": "macos-clang-x64",
                "configurationProvider": "ms-vscode.cmake-tools"
            }
        ],
        "version": 4
    }
    
    
    *********** After Quit and Restart nRF Connect Toolchain Manager and VS Code ***********
    
    {
        "configurations": [
            {
                "name": "Mac",
                "includePath": [
                    "${workspaceFolder}/**"
                ],
                "defines": [],
                "macFrameworkPath": [
                    "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks"
                ],
                "compilerPath": "/usr/bin/clang",
                "cStandard": "c11",
                "cppStandard": "c++98",
                "intelliSenseMode": "macos-clang-x64",
                "configurationProvider": "ms-vscode.cmake-tools"
            }
        ],
        "version": 4
    }
    

  • Is this file settings you have set yourself, or is it automatically created?

    Regards,
    Sigurd Hellesvik

  • Thanks Sigurd, it’s all automatically created, I have not edited any of the filepaths.

Related