Auto-detect the firmware ELF for the given board.
(board: str, build_root: Path)
| 120 | |
| 121 | |
| 122 | def find_elf(board: str, build_root: Path) -> Path: |
| 123 | """Auto-detect the firmware ELF for the given board.""" |
| 124 | candidates = [ |
| 125 | build_root / "pio" / board / ".pio" / "build" / board / "firmware.elf", |
| 126 | build_root / board / "firmware.elf", |
| 127 | ] |
| 128 | for c in candidates: |
| 129 | if c.is_file(): |
| 130 | return c |
| 131 | paths = "\n ".join(str(c) for c in candidates) |
| 132 | raise SystemExit( |
| 133 | "Bloat: no firmware.elf found. Looked at:\n " |
| 134 | + paths |
| 135 | + "\nRun `bash compile " |
| 136 | + board |
| 137 | + " --examples Blink` first, or pass " |
| 138 | "--build." |
| 139 | ) |
| 140 | |
| 141 | |
| 142 | def assert_fbuild_has_symbols() -> None: |