Skip to content

Instantly share code, notes, and snippets.

@cfriedt
Last active May 1, 2024 14:54
Show Gist options
  • Save cfriedt/aa769407395c731920b3c73ae5081d73 to your computer and use it in GitHub Desktop.
Save cfriedt/aa769407395c731920b3c73ae5081d73 to your computer and use it in GitHub Desktop.
My Zephyr RC file
# The contents of this file should go into ~/.zephyrrc
# It is sourced with
# source zephyr-env.sh
# Download the Zephyr SDK from
# https://github.com/zephyrproject-rtos/sdk-ng/releases
ZEPHYR_SDK_VERSION=0.16.5-1
PREFIX=/opt/zephyr
VENV=$PREFIX/.venv
# return arch in the format used by zephyr sdk archives
filter_arch() {
local a=`uname -m`
case $a in
arm64)
echo "aarch64"
;;
*)
echo $a
;;
esac
}
# return os in the format used by zephyr sdk archives
filter_os() {
local os=`uname -s`
case $os in
Darwin)
echo "macos"
;;
Linux)
echo "linux"
;;
*)
echo $a
;;
esac
}
ARCH=`filter_arch`
OS=`filter_os`
#export ZEPHYR_TOOLCHAIN_VARIANT=llvm
export ZEPHYR_TOOLCHAIN_VARIANT=zephyr
export ZEPHYR_SDK_INSTALL_DIR=${PREFIX}/zephyr-sdk-${ZEPHYR_SDK_VERSION}
if [ "$ZEPHYR_TOOLCHAIN_VARIANT" = "zephyr" ]; then
if [ "$OS" = "linux" ]; then
if [ "$ARCH" = "x86_64" -o "$ARCH" = "aarch64" ]; then
# path for dtc, qemu-system*, openocd, net-tools, etc
PATH=${ZEPHYR_SDK_INSTALL_DIR}/sysroots/${ARCH}-pokysdk-${OS}/usr/bin:${PATH}
fi
fi
# path for all supported Zephyr toolchains
toolchains=(
"aarch64-zephyr-elf"
"arc64-zephyr-elf"
"arc-zephyr-elf"
"arm-zephyr-eabi"
"mips-zephyr-elf"
"nios2-zephyr-elf"
"riscv64-zephyr-elf"
"sparc-zephyr-elf"
"x86_64-zephyr-elf"
"xtensa-espressif_esp32_zephyr-elf"
"xtensa-espressif_esp32s2_zephyr-elf"
"xtensa-intel_apl_adsp_zephyr-elf"
"xtensa-intel_bdw_adsp_zephyr-elf"
"xtensa-intel_byt_adsp_zephyr-elf"
"xtensa-intel_s1000_zephyr-elf"
"xtensa-nxp_imx_adsp_zephyr-elf"
"xtensa-nxp_imx8m_adsp_zephyr-elf"
"xtensa-sample_controller_zephyr-elf"
)
for i in ${toolchains[@]}; do
PATH=${ZEPHYR_SDK_INSTALL_DIR}/${i}/bin:${PATH}
done
export PATH
fi
# activate python virtual environment installed in the GSG
# See https://docs.zephyrproject.org/latest/develop/getting_started/index.html
. $VENV/bin/activate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment