nRF Connect: How to build from command line after doing automatic install

I followed the instructions to install the nRF Connect SDK using the automatic method:

http://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/gs_assistant.html

That worked and I was able to build sample applications and run them on the DK. Now I would also like the ability to build from the command line. The instructions say you need to start a new shell from the toolchain manager. This also works. However I cannot build from the shell if I start the shell without using the toolchain manager. How can I do that?

It seems my build problems are fixed if I set the environment variable ZEPHYR_SDK_INSTALL_DIR. I noticed this variable is set when I start my shell from the Toolchain Manager but it is not set when I launch a shell normally. 

ZEPHYR_SDK_INSTALL_DIR=/opt/nordic/ncs/toolchains/v2.1.0/opt/zephyr-sdk

So.. If I start a regular shell (without using toolchain manager) and set this variable the builds are working. Is this a valid way to use the SDK? 

Parents
  • Let me add some background here. When I started using nRF Connect I chose the automatic installation method. This seems like the best choice to get started quickly. Then I enrolled in the nRF Connect SDK Fundamentals course. So far so good. But now I started using some of the sample projects and they all seem to use the command line to build & flash. This works fine if you open the terminal from the toolchain manager. What is not clear to me is how to switch between command line and VS Code on the same project. For example, some of the example projects use kconfig overlay files which are listed on the build commands. If I switch over to VS Code I guess I need to edit the application setup and add the kconfig file there? This behavior is new to me. I'm used to running 'make' from the command line with no options because all the details are stored in the makefiles. Then your IDE can just run the same make command. 

    In short, I was hoping to learn how to use VS Code and the command line on the same project. In the short term I want to make this work for the sample projects but later I need to get the same behavior working with my own project.

Reply
  • Let me add some background here. When I started using nRF Connect I chose the automatic installation method. This seems like the best choice to get started quickly. Then I enrolled in the nRF Connect SDK Fundamentals course. So far so good. But now I started using some of the sample projects and they all seem to use the command line to build & flash. This works fine if you open the terminal from the toolchain manager. What is not clear to me is how to switch between command line and VS Code on the same project. For example, some of the example projects use kconfig overlay files which are listed on the build commands. If I switch over to VS Code I guess I need to edit the application setup and add the kconfig file there? This behavior is new to me. I'm used to running 'make' from the command line with no options because all the details are stored in the makefiles. Then your IDE can just run the same make command. 

    In short, I was hoping to learn how to use VS Code and the command line on the same project. In the short term I want to make this work for the sample projects but later I need to get the same behavior working with my own project.

Children
Related