-
Notifications
You must be signed in to change notification settings - Fork 1
Example build script
Ken Bannister edited this page Feb 20, 2020
·
2 revisions
This script can be used to build the client.
#!/bin/bash
# Build script for lwm2m-client, with useful parameters
# Must comment out CFLAGS line in Makefile to remove LWM2M_BOOTSTRAP, then
# readd it here as needed
if [ -n "$1" ]; then
flavor="$1"
else
echo "Must specify flavor: (native|ula|inet|inet.lwip|inet4.lwip)"
exit 1
fi
# target must be clean|all|all-debug|flash|term
if [ -n "$2" ]; then
target="$2"
else
target="all"
fi
# Add if SERVER_URI provides a boostrap server
#export CFLAGS="${CFLAGS} -DLWM2M_BOOTSTRAP"
# Required for bootstrap server
#BS_PORT=":5685"
# Allow override for unusual setups
makefile="Makefile"
if [ "$flavor" = "ula" ]; then
export SERVER_ADDR=\\\"fd00:bbbb::1\\\"
export IPV6_PREFIX="fd00:bbbb::/64"
makefile="Makefile.ula"
# Use SAMR21-xpro
export BOARD="samr21-xpro"
#export RIOTBASE="/home/kbee/dev/riot/repo"
elif [ "$flavor" = "native" ]; then
export SERVER_ADDR=\\\"fd00:bbbb::1\\\"
#export RIOTBASE="/home/kbee/dev/riot/repo"
# notice regex lookup
elif [[ "$flavor" =~ inet* ]]; then
# local workstation server
export SERVER_ADDR=\\\"2601:...\\\"
export RIOTBASE="/home/kbee/dev/riot/repo"
# Use Adafruit Feather ESP8266
export BOARD="esp8266-esp-12x"
export USEMODULE="esp_wifi"
export CFLAGS="${CFLAGS} -DESP_WIFI_SSID=\\\"${RIOT_WIFI_SSID}\\\""
export CFLAGS="${CFLAGS} -DESP_WIFI_PASS=\\\"${RIOT_WIFI_PASS}\\\""
fi
# Setup for specific inet scenarios
if [ "$flavor" = "inet.lwip" ]; then
#makefile="Makefile.inet.lwip"
export LWIP_IPV6=1
export LWIP_IPV4=0
elif [ "$flavor" = "inet4.lwip" ]; then
# Onset test
export SERVER_ADDR=\\\"xx.xx.xx.xx\\\"
export LWIP_IPV4=1
export LWIP_IPV6=0
fi
# debug logging
#export CFLAGS="${CFLAGS} -DLWM2M_WITH_LOGS"
make -f $makefile $target