Public Access
There is no Debug Build any more (ADR 0010, issue #68, Q188 to Q195). The console and the test commands are compiled into every firmware. It listens only while Settings > Debug Console is on, which isn't the default; off, neither its task nor its 4 KB ring exists. The token is made by the device and shown on that page; a client proves it knows it by answering a challenge with an HMAC, so it never crosses the network, and five wrong answers close the console for a minute. DBG in the Status Bar while it listens. Over USB serial only: debug on, debug token <value>, debug token new. scripts/flash.sh --debug uses them to set a device up with the developer's token. scripts/rdbg.py takes the token from -t, $RORO_DEBUG_TOKEN or the file, answers the challenge, and fetches a release's ELF to decode a crash. Gone: the cardputer-adv-debug environment, RORO_DEBUG, the +debug version, scripts/debug_flags.py, update install ... force, and the rule that a Debug Build doesn't install releases. Old clients and old firmwares don't talk to each other. Against the builds it replaces: 30 KB more flash and 88 bytes more static RAM than the release, 4 KB less RAM than the Debug Build. 468 host tests. Checked on the device: off by default, login, the pause after wrong tokens, Safe Mode with the console, the setting surviving an update, debug off. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EhqxQ49eCju4CzKYNjZzwT
31 lines
1.0 KiB
Python
31 lines
1.0 KiB
Python
# Injects the firmware version from `git describe` (semver tags like v0.1.0).
|
|
import subprocess
|
|
|
|
Import("env") # noqa: F821 (provided by PlatformIO)
|
|
|
|
try:
|
|
version = subprocess.check_output(
|
|
["git", "describe", "--tags", "--always", "--dirty"], text=True
|
|
).strip()
|
|
except Exception:
|
|
version = "unknown"
|
|
|
|
env.Append(CPPDEFINES=[("RORO_VERSION", '\\"%s\\"' % version)]) # noqa: F821
|
|
|
|
|
|
# Keep every build's ELF, named by version and the first 16 hex digits of its SHA-256 (the core dump
|
|
# names the crashed firmware by the same digest), so a crash can be decoded after later builds.
|
|
def archive_elf(source, target, env):
|
|
import hashlib
|
|
import os
|
|
import shutil
|
|
|
|
elf = str(target[0])
|
|
digest = hashlib.sha256(open(elf, "rb").read()).hexdigest()[:16]
|
|
folder = os.path.join(env.subst("$PROJECT_DIR"), ".pio", "elves")
|
|
os.makedirs(folder, exist_ok=True)
|
|
shutil.copy(elf, os.path.join(folder, "%s.%s.elf" % (version, digest)))
|
|
|
|
|
|
env.AddPostAction("$BUILD_DIR/${PROGNAME}.elf", archive_elf) # noqa: F821
|