nrfutils vs cmake

the official way to build zephyr projects with nordic ncs seem to create some magic shell:

nrfutil sdk-manager toolchain launch --ncs-version v3.4.0 --shell

however I prefer the proper cmake way (which I am always doing with upstream-zephyr). therfore I source my .venv and build cmake.

nordic suggests an env script like this:

ncs_install_dir=/opt/nordic/ncs # ~/ncs on Linux, C:/ncs on Windows
ncs_sdk_version=v3.4.0
ncs_bin_version=<toolchain_hash> # check toolchains/ directory

export PATH=$PATH:$ncs_install_dir/toolchains/$ncs_bin_version/bin

export ZEPHYR_TOOLCHAIN_VARIANT=zephyr
export ZEPHYR_SDK_INSTALL_DIR=$ncs_install_dir/toolchains/$ncs_bin_version/opt/zephyr-sdk

# Source Zephyr's own environment script
source $ncs_install_dir/$ncs_sdk_version/zephyr/zephyr-env.sh

west zephyr-export

however this is missing the .venv and thus not working, ...

I cannot find a way without using the magic ncs shell => what is the nordic way of compiling zephyr with cmake?

Parents
  • Hi,

    I'm not sure to follow what you want to do. It doesn't really make sense to me to use a venv and the toolchain at the same time...

    The toolchain we provide is bundled with all the software required to build an NCS project and adds them to your path while the toolchain environment is active. Thus, it doesn't make a lot of sense to use a venv with the toolchain.

    If you want to use a venv, you can follow this guide (link) and perform the system-wide installation.

    But, please, don't try to do something in between where you use the toolchain inside a venv. This just doesn't feel right. (If you have a good reason to do so, I'll be genuinely interested to hear it though)

    Best regards,

    Simon

Reply
  • Hi,

    I'm not sure to follow what you want to do. It doesn't really make sense to me to use a venv and the toolchain at the same time...

    The toolchain we provide is bundled with all the software required to build an NCS project and adds them to your path while the toolchain environment is active. Thus, it doesn't make a lot of sense to use a venv with the toolchain.

    If you want to use a venv, you can follow this guide (link) and perform the system-wide installation.

    But, please, don't try to do something in between where you use the toolchain inside a venv. This just doesn't feel right. (If you have a good reason to do so, I'll be genuinely interested to hear it though)

    Best regards,

    Simon

Children
No Data
Related