This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How import a non-VS Code project in VS Code

I'm newbie with the nRF environment. I learned how to create a new project in VS Code from SDK samples but now I have two questions:

1 - I want to crate a blank project. What's the best way to do it? Can I create a new application from any sample (zephyr or not) and change/delete only all the source files in /scr folder? 

2 - I want test this project in VS Code but if I import the source code as described in my first question above I get a build error. How should I import this non-VS Code project in my VS Code?

Thanks in advance.

Parents
  • Hi,

    1 - I want to crate a blank project. What's the best way to do it? Can I create a new application from any sample (zephyr or not) and change/delete only all the source files in /scr folder? 

    Yes, you can do this. The best way to create your own application in VS Code is to select 'Create a new application from sample'. I recommend selecting a sample that is as close to what you want for your application as possible. If you want to create a Bluetooth application you should select one of the Bluetooth samples, if you want to develop a Zigbee application select one of the Zigbee samples, and so forth. You can also start with a very simple sample, such as the Hello World sample in Zephyr, if you want to start out with an almost empty application. After this you can change/add/remove files almost as you want, but an important part is that you will need to have the three files CMakeLists.txt, prj.conf, and src/main.c in your project. You can make changes in these files, but make sure to at least have the following in CMakeLists.txt (where project also can be the name of your project instead of NONE):

    cmake_minimum_required(VERSION 3.20.0)
    
    find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
    project(NONE)
    
    target_sources(app PRIVATE src/main.c)

    Since you are new to the nRF environment I recommend checking out the nRF Connect for VS Code tutorials on YouTube. We also have some tutorials here on DevZone, such as the nRF Connect SDK Tutorial series, where you can learn how to create your own application. This is also very good, but you should be aware that the tutorial has not been updated lately, so it is using nRF Connect SDK v1.5.0, and therefore some of the code snippets and such might be outdated. However, it is still a good tutorial to get some more understanding.

    2 - I want test this project in VS Code but if I import the source code as described in my first question above I get a build error. How should I import this non-VS Code project in my VS Code?

    This is an example based on the nRF5 SDK, and can therefore unfortunately not be used with the VS Code extension. The extension only supports nRF Connect SDK. For more information about the two SDKs you can take a look at nRF Connect SDK and nRF5 SDK statement. For new projects we recommend using nRF Connect SDK and not nRF5 SDK, as nRF5 SDK is in maintenance mode and will not receive any new updates besides bug fixes. If you still want to work with nRF5 SDK you can start by looking at Getting started with nRF5 SDK and SES (nRF51 & nRF52 Series).

    Best regards,

    Marte

  • You can also start with a very simple sample, such as the Hello World sample in Zephyr, if you want to start out with an almost empty application.

    So can I start from a non-zephyr sample (eg. nRF/bluetooth/...) and then add zephyr's includes to use its features?

    We also have some tutorials here on DevZone, such as the nRF Connect SDK Tutorial series, where you can learn how to create your own application.

    Thanks for the suggestion.

    This is an example based on the nRF5 SDK, and can therefore unfortunately not be used with the VS Code extension.

    I got it. So I'll try to import it on my own starting from a basic example.

    Thanks very much.

Reply Children
Related