Start of the process of bringing the zephyr sdk install up to date.
This commit is contained in:
parent
bcd1ad7963
commit
9d31152ede
|
|
@ -3,49 +3,115 @@
|
|||
# https://www.zephyrproject.org/zephyr-rtos-on-esp32/
|
||||
# https://zmk.dev/docs/development/setup/
|
||||
|
||||
DEST=${1:-${HOME}/zephyr-sdk}
|
||||
#DEST=${1:-${HOME}/.local/zephyr-sdk}
|
||||
|
||||
# Manual flash instructions https://github.com/seemoo-lab/openhaystack/wiki/Flashing-nRF-with-OpenOCD---ST-Link
|
||||
# $ openocd \
|
||||
# -f ${ZEPHYR_SDK_INSTALL_DIR}/sysroots/${MACHINE}-pokysdk-linux/usr/share/openocd/scripts/interface/stlink.cfg \
|
||||
# -f ${ZEPHYR_SDK_INSTALL_DIR}/sysroots/${MACHINE}-pokysdk-linux/usr/share/openocd/scripts/target/nrf51.cfg
|
||||
#
|
||||
# $ telnet localhost 4444
|
||||
# $ help
|
||||
#
|
||||
# You can backup the existing firmware:
|
||||
# $ dump_image /Your/File/Path/flash.bin 0 0x40000`
|
||||
#
|
||||
# Erase the flash using
|
||||
# $ nrf5 mass_erase
|
||||
|
||||
# Verify and program your device by using (use the .bin not .hex file)
|
||||
# $ program /your/path/to/the/firmware.bin verify
|
||||
# $ program /your/path/to/the/firmware.bin
|
||||
# $ program /home/default/zephyrproject/zephyr/build/zephyr/zephyr.bin verify
|
||||
|
||||
|
||||
DEST=${1:-${HOME}}
|
||||
|
||||
ARCH=$(dpkg --print-architecture)
|
||||
MACHINE=$(uname -m)
|
||||
|
||||
USER=zephyrproject-rtos
|
||||
PROJECT=sdk-ng
|
||||
API_URL=https://api.github.com/repos/${USER}/${PROJECT}/releases/latest
|
||||
RELEASE=$(curl -s ${API_URL} | grep tarball_url | cut -d '"' -f 4 | awk -F "/" {'print $8'})
|
||||
SDK_FILENAME=zephyr-sdk-${RELEASE:1}-linux-x86_64-setup.run
|
||||
SDK_URL=https://github.com/${USER}/${PROJECT}/releases/download/${RELEASE}
|
||||
SDK_FILENAME=zephyr-sdk-${RELEASE#v}_linux-${MACHINE}_minimal.tar.xz # 41.8 MB
|
||||
# SDK_FILENAME=zephyr-sdk-${RELEASE#v}_linux-${MACHINE}.tar.xz # 1.35 GB
|
||||
SDK_URL=https://github.com/${USER}/${PROJECT}/releases/download/${RELEASE}/
|
||||
|
||||
# fetch the sdk
|
||||
wget ${SDK_URL}/${SDK_FILENAME}
|
||||
wget -O - ${SDK_URL}/sha256.sum | shasum --check --ignore-missing
|
||||
|
||||
|
||||
SDK_DEST=${DEST}/zephyr-sdk-${RELEASE#v}
|
||||
PROJECT_DEST=${DEST}/zephyrproject}
|
||||
#
|
||||
export ZEPHYR_TOOLCHAIN_VARIANT=zephyr
|
||||
export ZEPHYR_SDK_INSTALL_DIR="${SDK_DEST}"
|
||||
|
||||
pushd ${ZEPHYR_SDK_INSTALL_DIR}
|
||||
west update
|
||||
# bash ./setup.sh -t x86_64-zephyr-elf
|
||||
bash ./setup.sh -t arm-zephyr-eabi
|
||||
bash ./setup.sh -h
|
||||
popd
|
||||
|
||||
# install udev rules
|
||||
sudo cp ~/zephyr-sdk-${RELEASE#v}/sysroots/x86_64-pokysdk-linux/usr/share/openocd/contrib/60-openocd.rules /etc/udev/rules.d
|
||||
sudo udevadm control --reload
|
||||
|
||||
RSS_FEED="https://github.com/${USER}/${PROJECT}/releases.atom"
|
||||
# xdg-open ${RSS_FEED}
|
||||
cat ${RSS_FEE}
|
||||
cat ${RSS_FEED}
|
||||
|
||||
echo "*** Installing dependencies. ***"
|
||||
sudo apt-get update
|
||||
|
||||
sudo apt install --no-install-recommends -y autoconf automake build-essential bzip2 ccache coccinelle cmake device-tree-compiler dfu-util git gperf gcc g++ gcc-multilib g++-multilib libsdl2-dev libtool python3-dev python3-pip python3-setuptools python3-tk python3-wheel ninja-build file make wget xz-utils
|
||||
sudo apt install --no-install-recommends -y autoconf automake \
|
||||
build-essential bzip2 ccache coccinelle cmake device-tree-compiler dfu-util \
|
||||
git gperf gcc g++ gcc-multilib g++-multilib libsdl2-dev libtool python3-dev \
|
||||
python3-pip python3-setuptools python3-tk python3-wheel ninja-build file make \
|
||||
wget xz-utils dfu-utils
|
||||
|
||||
echo "*** Getting Zephyr and installing Python dependencies. ***"
|
||||
# Install west and ensure that ${HOME}/.local/bin is part of your PATH environment variable:
|
||||
|
||||
echo "*** Installing west with pip3 ***"
|
||||
pip3 install -U --user west
|
||||
echo ‘export PATH=${HOME}/.local/bin:”$PATH”’ >>${HOME}/.bashrc
|
||||
# pip3 install -U --user west
|
||||
# echo ‘export PATH=${HOME}/.local/bin:”$PATH”’ >>${HOME}/.bashrc
|
||||
|
||||
if [[ -d ${HOME}/.zshrc.d ]]; then
|
||||
echo 'export PATH=${HOME}/.local/bin:"$PATH"' >>${HOME}/.zshrc.d/001_dot_local_path.sh
|
||||
# if [[ -d ${HOME}/.zshrc.d ]]; then
|
||||
# echo 'export PATH=${HOME}/.local/bin:"$PATH"' >>${HOME}/.zshrc.d/001_dot_local_path.sh
|
||||
# fi
|
||||
|
||||
# ensure a conda env exists for zephyr python requirements
|
||||
# https://www.nordicsemi.com/Products/Development-tools/nRF-Command-Line-Tools/Download?lang=en#infotabs
|
||||
# https://nsscprodmedia.blob.core.windows.net/prod/software-and-other-downloads/desktop-software/nrf-command-line-tools/sw/versions-10-x-x/10-24-2/nrf-command-line-tools_10.24.2_amd64.deb
|
||||
if [[ ! -d ${HOME}/.conda/envs/zephyr ]];
|
||||
conda init -n zephyr python west pynrfjprog
|
||||
fi
|
||||
|
||||
conda activate zephyr
|
||||
|
||||
# add 'west' completion to zsh - use /usr/share/when packaging for debian
|
||||
COMPLETION_FILE="/usr/share/zsh/site-functions/_west"
|
||||
COMPLETION_FILE="${HOME}/.zshrc.d/001_west-completion.zsh"
|
||||
west completion zsh > ${COMPLETION_FILE}
|
||||
|
||||
# 'west' is the tool that manages the entire life-cycle of a Zephyr-based project.
|
||||
echo "*** Getting zephyr source code ***"
|
||||
|
||||
west init ${HOME}/zephyrproject
|
||||
cd ${HOME}/zephyrproject
|
||||
git clone https://github.com/${USER}/zephyr
|
||||
mkdir -p ${DEST}/zephyr
|
||||
cd ${DEST}/zephyr
|
||||
git show -s --pretty=format:%cd
|
||||
west update
|
||||
west espressif update
|
||||
|
||||
conda activate zephyr
|
||||
|
||||
echo "Exporting a Zephyr CMake package."
|
||||
west zephyr-export
|
||||
|
||||
echo "Installing additional python dependencies via pip3."
|
||||
pip3 install --user -r \
|
||||
pip install -r \
|
||||
${HOME}/zephyrproject/zephyr/scripts/requirements.txt
|
||||
|
||||
echo "Installing Zephyr’s toolchain."
|
||||
|
|
|
|||
Loading…
Reference in New Issue