Locate the cross-toolchain `nm` binary for the given board.
(board: str)
| 95 | |
| 96 | |
| 97 | def resolve_nm(board: str) -> Path: |
| 98 | """Locate the cross-toolchain `nm` binary for the given board.""" |
| 99 | if board not in BOARD_CHIP_MAP: |
| 100 | raise SystemExit( |
| 101 | f"Bloat: board '{board}' has no nm mapping. Add it to " |
| 102 | "BOARD_CHIP_MAP in ci/bloat.py — entries are mechanical " |
| 103 | "(arch + chip prefix). Supported boards today: " |
| 104 | f"{', '.join(sorted(BOARD_CHIP_MAP))}." |
| 105 | ) |
| 106 | arch, chip = BOARD_CHIP_MAP[board] |
| 107 | pkg_dir, prefix_tpl = PIO_NM_BY_ARCH[arch] |
| 108 | prefix = prefix_tpl.format(board_chip=chip) |
| 109 | bin_dir = pio_packages_dir() / pkg_dir / "bin" |
| 110 | # Windows has .exe; Unix doesn't. Prefer the os-specific one. |
| 111 | nm = bin_dir / f"{prefix}-nm.exe" |
| 112 | if not nm.exists(): |
| 113 | nm = bin_dir / f"{prefix}-nm" |
| 114 | if not nm.exists(): |
| 115 | raise SystemExit( |
| 116 | f"Bloat: nm binary not found under {bin_dir}. Expected " |
| 117 | f"`{prefix}-nm[.exe]`. Has the toolchain been installed via PIO?" |
| 118 | ) |
| 119 | return nm |
| 120 | |
| 121 | |
| 122 | def find_elf(board: str, build_root: Path) -> Path: |
no test coverage detected