diff --git a/fpga_update/scripts/fpga_ru.py b/fpga_update/scripts/fpga_ru.py index 4f0eec3..8d37f5c 100644 --- a/fpga_update/scripts/fpga_ru.py +++ b/fpga_update/scripts/fpga_ru.py @@ -30,6 +30,25 @@ import socket import sys import time +def _env_lookup(key, default=None): + """Machine-relative value: real env var first, then ~/skills_env.md.""" + v = os.environ.get(key) + if v: + return v + path = os.path.join(os.path.expanduser("~"), "skills_env.md") + try: + with open(path, encoding="utf-8") as f: + for line in f: + m = re.match(rf"\s*{key}\s*=\s*(\S+)", line) + if m: + return m.group(1) + except OSError: + pass + if default is None: + sys.exit(f"missing {key}: add it to ~/skills_env.md or set it as an env var") + return default + + # ------------------------------------------------------------------ protocol constants HEAD, TAIL = 0xAA, 0xBB @@ -246,7 +265,7 @@ def do_finish(dev, timeout): def main(): ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) ap.add_argument("--mcs", required=True, help="path to the quickboot _update.mcs") - ap.add_argument("--host", default="192.168.1.143") + ap.add_argument("--host", default=_env_lookup("SMOD_BOARD_IP", "192.168.1.143")) ap.add_argument("--port", type=int, default=1234) ap.add_argument("--yes", action="store_true", help="skip the confirmation prompt") ap.add_argument("--dry-run", action="store_true", help="validate and frame the mcs, contact nothing") diff --git a/smod_atsc_dev/scripts/imx6_app.py b/smod_atsc_dev/scripts/imx6_app.py index ef9191e..390f545 100644 --- a/smod_atsc_dev/scripts/imx6_app.py +++ b/smod_atsc_dev/scripts/imx6_app.py @@ -52,7 +52,10 @@ def _env_lookup(key, default=None): return default -REPO = r"E:\Xilinx_design\smod\SMOD_ATSC\my_exciter" +# Machine-relative: the exciter checkout lives wherever this box keeps it. +# Recorded as SMOD_REPO_ROOT in ~/skills_env.md; the literal stays as the +# fallback so existing boxes keep working without touching that file. +REPO = _env_lookup("SMOD_REPO_ROOT", r"E:\Xilinx_design\smod\SMOD_ATSC\my_exciter") APP_SUBDIR = "imx6/src/atsc_app" # No default: the VM's IP moves with the VMware segment, so a stale fallback would