- Flash-Skript flasht jetzt das App-Image (ninlight_<dev>_gz.img) mit 460800 baud - -rs none statt -rs rts, Reset-Taste manuell nötig - Optionales Argument 'full' für Vollbild-Flash (blank chips nur) - Checkliste Light und Persistenz als bestanden markiert, Testdatum notiert
22 lines
1.1 KiB
Bash
Executable File
22 lines
1.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Flashes app image (ninlight_<device>_gz.img) over the serial port (runs natively on the Mac).
|
|
# For blank/erased chips only: pass "full" as third argument to flash ninlight_<device>.fls instead.
|
|
# Usage: tools/flash.sh <device> <port-name as listed by `build/host-tools/wm_tool -l`> [full]
|
|
set -euo pipefail
|
|
DEV=${1:?usage: tools/flash.sh <device> <port> [full]}
|
|
PORT=${2:?usage: tools/flash.sh <device> <port> [full]}
|
|
MODE=${3:-app}
|
|
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
|
|
if [ "$MODE" = "full" ]; then
|
|
echo "Bitte bei \"please manually reset the device\" die Reset-Taste drücken."
|
|
"$TOOL" -c "$PORT" -ds 460800 -rs none -eo secboot -dl "$ROOT/build/$DEV/ninlight_$DEV.fls"
|
|
else
|
|
echo "Bitte bei \"please manually reset the device\" die Reset-Taste drücken."
|
|
"$TOOL" -c "$PORT" -ds 460800 -rs none -dl "$ROOT/build/$DEV/ninlight_${DEV}_gz.img"
|
|
fi
|