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
  • Hi

    The .vscode folder is generated from VS Code in your workspace root folder.

    See What is a VS Code "workspace"?, and the "Single-folder workspaces".

    If you first open a workspace in another folder(such as /Users/alan/tmp), a folder /Users/alan/tmp/.vscode should be generated. If you add an application to this workspace, no .vscode folder should be added in the application folder.
    Use the "Open Folder..." function to try this.
    Does .vscode appear expected if you do this?

    Regards,
    Sigurd Hellesvik

  • Hi Sigurd,

    If I use Open Folder with an empty folder that I previously create in my workspace folder, I do not get a .vscode file generated.

    Folder location 'Test':

    Users/XXXXXX/workspace/Test/

    For information, I updated to nRF Connect SDK v1.9.1 and had a problem with CMake on launch

    I unstalled CMake and then quit VS Code and relaunched it from nRF Connect. It then reinstalled CMake and the issue went away. However as you can see, despite launching the v1.9.1 SDK, the Zephyr installation still points to the v1.9.0 version.

    As for the Shell Initialisation conflict with nRF Connect, it appears to be this:

    https://nrfconnect.github.io/vscode-nrf-connect/connect/troubleshooting.html#shell-initialization-conflicts-nrf-connect-terminal-profile

    I Relaunched VS Code from nRF Connect, and this issue is no longer reported at launch. Neither do I get the 'Bad CMake' error at launch either.

  • Hi Sigurd,

    Any progress please?

    I need to see this issue resolved in a timely manner or respectfully I will ask for it to be escalated,

  • Hi Al

    I am sorry about this, but I thought you managed to fix your problem in your last answer.

    alwalker said:
    I Relaunched VS Code from nRF Connect, and this issue is no longer reported at launch. Neither do I get the 'Bad CMake' error at launch either.

    After looking through the post below, I think I am missing the bigger picture.
    To avoid further misunderstandings, could you recap your issue?

    Regards,
    Sigurd Hellesvik

  • Hi Sigurd,

    Some definite progress, however when I launch VS Code with the nRF Connect SDK v1.9.1 in Toolchain Manager I still need to manually change the toolchain etc. to v1.9.1 as it is not set automatically. It would be good if this was set as specified by the selection made in Toolchain Manager.

    I can build the bluetooth_remote_template project ok as reported in Terminal:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    > Executing task: nRF Connect: Generate config nrf5340dk_nrf5340_cpuapp for /Users/alwalker/workspace/bluetooth_remote_template <
    Building bluetooth_remote_template
    west build --build-dir /Users/alwalker/workspace/bluetooth_remote_template/build /Users/alwalker/workspace/bluetooth_remote_template --pristine --board nrf5340dk_nrf5340_cpuapp -- -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=On -DNCS_TOOLCHAIN_VERSION:STRING="NONE"
    -- west build: generating a build system
    Including boilerplate (Zephyr base): /opt/nordic/ncs/v1.9.1/zephyr/cmake/app/boilerplate.cmake
    -- Application: /Users/alwalker/workspace/bluetooth_remote_template
    -- Zephyr version: 2.7.99 (/opt/nordic/ncs/v1.9.1/zephyr), build: v2.7.99-ncs1-1
    -- Found Python3: /opt/nordic/ncs/v1.9.1/toolchain/opt/python@3.9/bin/python3.9 (found suitable exact version "3.9.6") found components: Interpreter
    -- Found west (found suitable version "0.12.0", minimum required is "0.7.1")
    -- Board: nrf5340dk_nrf5340_cpuapp
    -- Cache files will be written to: /Users/alwalker/Library/Caches/zephyr
    -- Found dtc: /opt/nordic/ncs/v1.9.1/toolchain/bin/dtc (found suitable version "1.6.1", minimum required is "1.4.6")
    -- Found toolchain: gnuarmemb (/opt/nordic/ncs/v1.9.1/toolchain)
    -- Found BOARD.dts: /opt/nordic/ncs/v1.9.1/zephyr/boards/arm/nrf5340dk_nrf5340/nrf5340dk_nrf5340_cpuapp.dts
    -- Generated zephyr.dts: /Users/alwalker/workspace/bluetooth_remote_template/build/zephyr/zephyr.dts
    -- Generated devicetree_unfixed.h: /Users/alwalker/workspace/bluetooth_remote_template/build/zephyr/include/generated/devicetree_unfixed.h
    -- Generated device_extern.h: /Users/alwalker/workspace/bluetooth_remote_template/build/zephyr/include/generated/device_extern.h
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    One the Build is completed, there are no red squiggles under the #include statements in main.c

    However a few problems are still reported:

    Is there any news on a fix or workaround for this error please?

    boards/arm/nrf5340dk_nrf5340/Kconfig.defconfig:62: error: couldn't parse 'default $(dt_chosen_reg_size_hex,$(DT_CHOSEN_Z_CODE_PARTITION))': macro expanded to blank string

    Are the other two C syntax errors something that would be fixed by code from the snippets.c file please?

    too few arguments in invocation of macro "Z_FOR_LOOP_1"