Skip to content

Instantly share code, notes, and snippets.

Created November 12, 2019 01:51
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save benemorius/5316899f07d29d3892d5007d9a74be15 to your computer and use it in GitHub Desktop.
configure a raspberry pi for a kw41z-slip module
set -x
# This script enables the UART and disables kernel output and getty on it
# and installs OpenOCD from source and compiles RIOT from source and flashes
# the gnrc_border_router example onto a kw41z-slip module.
# It takes about 5 minutes on rpi4 up to maybe an hour on rpi0.
# A reboot is required if /dev/serial0 isn't already enabled.
sudo apt install -y git picocom gcc-arm-none-eabi libtool
# disable getty on uart
sudo systemctl stop serial-getty@ttyS0.service
sudo systemctl mask serial-getty@ttyS0.service
# disable kernel output to uart
sudo sed 's/serial0,115200 //' -i /boot/cmdline.txt
# rpis with bluetooth have the uart disabled by default
# a reboot is required for this to take effect
if ! grep "^enable_uart=1" /boot/config.txt; then
/bin/echo -e "\n# enable uart for kw41z-slip radio\nenable_uart=1" | sudo tee -a /boot/config.txt
# fetch compile and install openocd
git clone
cd openocd/
./configure --enable-bcm2835gpio --enable-sysfsgpio --disable-jlink
nice make -j4
sudo make install
# fetch compile and flash riot onto kw41z-slip
git clone
cd RIOT/
# compile uhcpd and ethos
cd dist/tools/uhcpd/
cd ../ethos/
cd ../../..
# compile and flash firmware
# rpi4 introduced a new gpio base, so just use sysfsgpio instead of bcm2835gpio
#sudo ETHOS_BAUDRATE=115200 BOARD=openlabs-kw41z-slip make -j4 flash -C examples/gnrc_border_router/
sudo ETHOS_BAUDRATE=115200 DEBUG_ADAPTER=sysfsgpio BOARD=openlabs-kw41z-slip make -j4 flash -C examples/gnrc_border_router/
set +x
echo 'now run `sudo RIOT/dist/tools/ethos/ /dev/serial0 tap0 2001:db8:0:1540::/64 115200`'
echo '(reboot first if necessary to enable serial port /dev/serial0)'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment