Public Access
cardputer-adv-debug (-DRORO_DEBUG, version +debug) adds a Debug Console: after a token line, a client gets the last 6 KB of console output, live lines (ESP-IDF logs included) and the serial commands. The socket task only queues lines; the main loop runs them. Release builds compile none of it. The token lives in ~/.config/roro9stack/debug-token, created by _docker.sh and passed into the container. All output now goes through `console`, which never waits for USB: a host that was attached but not reading stalled the main loop up to 2 s per line. New commands everywhere: info (slots with their versions from NVS, since the framework stamps its own into each image), tasks, reboot, boot other, log level, help. scripts/rdbg.py is the client; flash.sh --debug builds it; CI builds both variants. ADR 0004. Verified on the device: USB-flashed, then updated over Wi-Fi to a Debug Build that confirmed on Probation; both slots hold Debug Builds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EhqxQ49eCju4CzKYNjZzwT
34 lines
1.9 KiB
Bash
Executable File
34 lines
1.9 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Flash the firmware over USB, then open the serial monitor.
|
|
# Usage: scripts/flash.sh [--debug] [port] USB (default: the first Espressif device found)
|
|
# scripts/flash.sh [--debug] --ota [host] Wi-Fi: build, sign and push a Firmware Update
|
|
# (host: the device's IP from Settings > About, or $RORO_OTA_HOST)
|
|
# --debug builds the Debug Build (cardputer-adv-debug): the Debug Console on TCP 2323, see ADR 0004.
|
|
set -euo pipefail
|
|
ENV=cardputer-adv
|
|
if [ "${1:-}" = "--debug" ]; then
|
|
ENV=cardputer-adv-debug
|
|
shift
|
|
fi
|
|
|
|
if [ "${1:-}" = "--ota" ]; then
|
|
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|
HOST="${2:-${RORO_OTA_HOST:-}}"
|
|
[ -n "$HOST" ] || { echo "Usage: scripts/flash.sh --ota <device IP> (or set RORO_OTA_HOST)" >&2; exit 1; }
|
|
source "$(dirname "$0")/_docker.sh"
|
|
DOCKER_EXTRA=()
|
|
run_in_container bash -c "git config --global --add safe.directory /work && pio run -e $ENV" | tail -3
|
|
VERSION="$(git -C "$ROOT" describe --tags --always --dirty)"
|
|
[ "$ENV" = cardputer-adv-debug ] && VERSION="$VERSION+debug" # as scripts/version.py names it
|
|
OUT="$ROOT/.pio/build/$ENV/roro9stack-$VERSION.ota"
|
|
"$ROOT/scripts/make_ota.py" "$ROOT/.pio/build/$ENV/firmware.bin" "$VERSION" "$OUT"
|
|
exec "$ROOT/scripts/ota_push.py" "$OUT" "$HOST"
|
|
fi
|
|
PORT="${1:-$(readlink -f /dev/serial/by-id/*Espressif* 2>/dev/null | head -1)}"
|
|
[ -n "$PORT" ] || { echo "No Cardputer found on USB (is it plugged in / attached to the VM?)" >&2; exit 1; }
|
|
source "$(dirname "$0")/_docker.sh"
|
|
docker rm -f roro9stack-serial >/dev/null 2>&1 || true # a serial log would hold the port
|
|
DOCKER_EXTRA=(--device "$PORT" --group-add "$(stat -c %g "$PORT")" -it)
|
|
|
|
run_in_container bash -c "git config --global --add safe.directory /work && pio run -e $ENV -t upload --upload-port $PORT && pio device monitor -p $PORT -b 115200"
|