#!/usr/bin/env bash # Flashes build//ninlight_.fls over the serial port (runs natively on the Mac). # Usage: tools/flash.sh set -euo pipefail DEV=${1:?usage: tools/flash.sh } PORT=${2:?usage: tools/flash.sh } ROOT=$(cd "$(dirname "$0")/.." && pwd) TOOL="$ROOT/build/host-tools/wm_tool" if [ ! -x "$TOOL" ] || [ "$ROOT/sdk/tools/wm_tool.c" -nt "$TOOL" ]; then mkdir -p "$(dirname "$TOOL")" cc -O2 -w -o "$TOOL" "$ROOT/sdk/tools/wm_tool.c" -lpthread fi "$TOOL" -c "$PORT" -ds 921600 -rs rts -dl "$ROOT/build/$DEV/ninlight_$DEV.fls"