Missing Include Path for nRF Connect v2.00 Build Under Visual Studio Code Using nRF Connect Extension

I am trying to upgrade from nRF Connect SDK v1.6.1, running under Ubuntu 18.04 using the Nordic Edition of SEGGER Embedded Studio as the Integrated Development Environment, to nRF Connect SDK v2.00, running under Ubuntu 20.04 using Microsoft Visual Studio Code. To set up the toolchain and the nRF Connect SDK v2.00 under Ubuntu 20.04, I followed the instructions under Getting Started Assistant v.2.0.2 steps 1-5 (excluding 6-7 which apply to SEGGER Embedded Studio) in nRF Connect for Desktop, then under the Toolchain Manager I installed NRF Connect SDK v2.00. Finally, I opened VS Code from the Toolchain Manager, installing the nRF Connect extensions as recommended.

I have a project that builds and runs under nRF Connect SDK v1.6.1 based on the Bluetooth peripheral UART example. I created a project under nRF Connect SDK 2.00 using the Bluetooth peripheral UART application template in Visual Studio Code, selecting and configuring the same board (nrf52840dk_nrf52840) as I had in 1.6.1, then I copied my source code into the project folder and tried to build it by clicking on Build under ACTIONS in the nRF Connect Extension for VS Code. It builds and links the zephyr objects and libraries successfully, then creates zephyr.elf.

When it gets to my project source, however, it produces this message:

/home/developer/project/prime_master/src/main.c:190:10: fatal error: tinycbor/cbor.h: No such file or directory
190 | #include <tinycbor/cbor.h>

I noticed the include path is missing for tinycbor/cbor.h in build.ninja even though I find that header file in the SDK at /home/developer/ncs/modules/lib/tinycbor/include. The same is true for compile_commands.json. When I try to add this include path for both, the two files get overwritten with the missing include path when I try to rebuild as they are automatically generated.

Why is this path not picked up when build.ninja and compile_commands.json are created? Is there a way for me to manually add the include path so that it doesn't get lost in a pristine build?

Also, do you have an updated set of instructions in nRF Connect for Desktop that shows how to set up nRF Connect SDK v2.00, the toolchain, and Visual Studio Code from scratch?

Thanks for your help.

Parents
  • Hello Alec,

    First of all, for NCS 2 and Ubuntu 20.04 and above, the recommended way of installing the SDK is the automatic way using the Toolchain Manager. You don't even have to use the Getting Started Assistant, just open the Toolchain Manager and press "Install".

    Also, do you have an updated set of instructions in nRF Connect for Desktop that shows how to set up nRF Connect SDK v2.00, the toolchain, and Visual Studio Code from scratch?

    Here you are. I believe this series is still up to date, though note that it might look a bit different on Ubuntu (eg. only NCS 2 is available).

    then I copied my source code into the project folder and tried to build it by clicking on Build under ACTIONS in the nRF Connect Extension for VS Code. It builds and links the zephyr objects and libraries successfully, then creates zephyr.elf.

    There can be differences between the different NCS versions, ie. code that works in NCS v1.6 may not work in NCS v2. Could you try running a default UART sample from NCS v2 and see if that gives you a similar error?

    Regards,

    Elfving

Reply
  • Hello Alec,

    First of all, for NCS 2 and Ubuntu 20.04 and above, the recommended way of installing the SDK is the automatic way using the Toolchain Manager. You don't even have to use the Getting Started Assistant, just open the Toolchain Manager and press "Install".

    Also, do you have an updated set of instructions in nRF Connect for Desktop that shows how to set up nRF Connect SDK v2.00, the toolchain, and Visual Studio Code from scratch?

    Here you are. I believe this series is still up to date, though note that it might look a bit different on Ubuntu (eg. only NCS 2 is available).

    then I copied my source code into the project folder and tried to build it by clicking on Build under ACTIONS in the nRF Connect Extension for VS Code. It builds and links the zephyr objects and libraries successfully, then creates zephyr.elf.

    There can be differences between the different NCS versions, ie. code that works in NCS v1.6 may not work in NCS v2. Could you try running a default UART sample from NCS v2 and see if that gives you a similar error?

    Regards,

    Elfving

Children
No Data
Related