Setting environment variable to use West outside Zephyr repository

Hi,

I have successfully built my application using the VS Code nRF build function. I am now trying to build an application using the West command in the terminal by following the instructions on this page under Application Development, Basics. The instructions tell me to set my environment variable correctly first and to follow these instructions.

I keep failing to run West (as expected because my ENV variable is obviously not set) but I also am not managing to set my ENV variable. I am using the following terminal code which gives an error:

set ZEPHYR_BASE = C:\ncs\v2.0.0\zephyr

Any suggestions?

Thanks,

Adam

Parents
  • Hi

    I am using the following terminal code which gives an error

    Could you please share what error it gives?

    set ZEPHYR_BASE = C:\ncs\v2.0.0\zephyr

    Have you tried set ZEPHYR_BASE=C:\ncs\v.2.0.0\zephyr without spaces?

    Best regards,

    Einar

  • Hi Einarh,

    Have you tried set ZEPHYR_BASE=C:\ncs\v.2.0.0\zephyr without spaces?

    This works now, thank you.

    However, running west build -b nrf52833dk_nrf2833 in the terminal still does not work. I have attached an image below of the error that I keep getting.

    Regards,

    Adam

  • Hi

    Instead of doing this from powershell, I would recommend that you open bash or command prompt from the Toolchain Manager in nRF Connect for Desktop as shown here:

    Then you will get a properly initialized environment to run your commands in.

    -Einar

  • Hi Einar,

    Thanks for the advice - that clears up most of the problem. However, when I go back to the pwoershell in VS code, I get the error "invalid choice: 'build' ". I looked at the troubleshooting guide on the Zephyr docs for this which suggested that I need to set my environment variable (which I had already done).

    I then permanently set Zephyr Base with the following terminal code: setx ZEPHYR_BASE C:\ncs\v.2.0.0\zephyr, to which I get the response: SUCCESS: Specified value was saved. If I now run west help, I can see build and numerous other commands listed there. However, after I close VS Code and reopen it, I can still use certain West commands but the build command dissapears again. Any suggestions please?

    I don't have this issue when I launch the command prompt from the toolchain manager as you previously suggested - west build is always there now.

    Thanks very much,

    Adam

Reply
  • Hi Einar,

    Thanks for the advice - that clears up most of the problem. However, when I go back to the pwoershell in VS code, I get the error "invalid choice: 'build' ". I looked at the troubleshooting guide on the Zephyr docs for this which suggested that I need to set my environment variable (which I had already done).

    I then permanently set Zephyr Base with the following terminal code: setx ZEPHYR_BASE C:\ncs\v.2.0.0\zephyr, to which I get the response: SUCCESS: Specified value was saved. If I now run west help, I can see build and numerous other commands listed there. However, after I close VS Code and reopen it, I can still use certain West commands but the build command dissapears again. Any suggestions please?

    I don't have this issue when I launch the command prompt from the toolchain manager as you previously suggested - west build is always there now.

    Thanks very much,

    Adam

Children
Related