Last active
April 3, 2020 13:27
-
-
Save cfriedt/6ef357e0e464a7a5544c544c94068182 to your computer and use it in GitHub Desktop.
Lisboa Greybus Demo Instructions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install some Ubuntu dependencies | |
apt install libnl-genl-3-dev libbluetooth-dev libavahi-client-dev gcc-arm-none-eabi curl build-essential git ssh python3-pip linux-headers-$(uname -r) flex bison gperf ninja-build cmake gpiod | |
# Install a newer version of cmake (required by zephyr) | |
# If you are using ubuntu:disco or newer, this can be ignored | |
PN=cmake | |
PV=3.15.2 | |
PR=1 | |
DEB="${PN}_${PV}-${PR}.deb" | |
curl -L -o "${DEB}" "https://github.com/cfriedt/${PN}-debs/releases/download/v${PV}/${DEB}" | |
dpkg -i "${DEB}" | |
# Build and install a newer version of Device Tree Compiler (required by zephyr) | |
git clone --depth 1 https://git.kernel.org/pub/scm/utils/dtc/dtc.git | |
cd dtc | |
make -j | |
mkdir -p /usr/local/bin | |
cp dtc /usr/local/bin | |
cd.. | |
# Install OpenOCD (It's possible that the head of openocd git will work for you) | |
# See https://repo.or.cz/w/openocd.git | |
# Otherwise, try the Zephyr SDK | |
# Build Greybus Out-of-Kernel (required due to gb-netlink) | |
git clone git@github.com:friedtco/greybus.git | |
cd greybus | |
make -j | |
# Make sure you're using bash not dash for this script. | |
# See https://anandmpandit.blogspot.com/2011/09/how-to-change-default-shell-from-dash.html | |
./gbprobe.sh | |
cd .. | |
# Get the tool to compile Greybus manifests (manifesto) | |
git clone https://github.com/projectara/manifesto | |
# Build gbridge (there are some dependencies, see readme, also openssl) | |
git clone git@github.com:friedtco/gbridge.git | |
cd gbridge | |
autoreconf -vfi | |
GBDIR="${PWD}/../greybus" ./configure --enable-uart --enable-tcpip --disable-gbsim --enable-netlink --disable-bluetooth --with-ssl | |
make -j | |
# Check out Zephyr | |
export PATH=${HOME}/.local/bin:${PATH} | |
pip3 install --user west | |
west init zephyrproject | |
cd zephyrproject | |
west update | |
pip3 install --user -r zephyr/scripts/requirements.txt | |
cd zephyr | |
# greybus dev branch is not yet merged into upstream zephyr | |
git remote rename origin upstream | |
git remote add origin git@github.com:cfriedt/zephyr.git | |
git fetch origin | |
git checkout -b feature/greybus origin/feature/greybus | |
sudo sh .ci/scripts/install-cmake.sh | |
source zephyr-env.sh | |
export ZEPHYR_TOOLCHAIN_VARIANT=cross-compile | |
export CROSS_COMPILE=/usr/bin/arm-none-eabi- | |
west build --pristine always -b cc1352r1_launchxl samples/subsys/greybus | |
# can also be done with | |
# openocd -f board/ti_cc13x2_launchpad.cfg -c "init" -c "reset halt" -c "reset_config trst_only" -c "flash write_image erase $PWD/build/zephyr/zephyr.elf" | |
west flash | |
cd ../gbridge | |
./gbridge -p /dev/ttyACM0 -b 115200 | |
# Below this line needs to be run as root (at least in Ubuntu) because gpio's are all root owned | |
# Note: this uses the gpiod package with accompanying libgpiod. | |
sudo -s | |
CHIP=`gpiodetect | grep "greybus_gpio" | awk '{print $1}'` | |
VAL=0; for ((;;)); do VAL=$((VAL^1)); echo $VAL | gpioset -m time -u 100000 ${CHIP} 0=${VAL}; done |
Removed pygbmodule, since manifest is now compiled-in
Figured out how to get it to work with the Ubuntu cross-compiler (it was in the Zephyr docs here).
install cmake from cmake-debs using .ci/scripts/install-cmake.sh
Went through the instructions to verify that it works with ubuntu:disco
Need to update these instructions for gpiod
sudo gpioset gpiochip0 0=1
Edit: done
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ubuntu 18.04.1 LTS \n \l
2030 sudo apt-get install libbluetooth-dev
2037 sudo apt install libnl-genl-3-dev
2042 sudo apt install libavahi-client-dev