()
| 246 | |
| 247 | |
| 248 | def main() -> int: |
| 249 | parser = argparse.ArgumentParser( |
| 250 | description="Per-symbol flash/RAM bloat analysis for FastLED builds." |
| 251 | ) |
| 252 | parser.add_argument( |
| 253 | "board", |
| 254 | help="Board name (esp32s3, esp32, esp32c3, ...). " |
| 255 | "See BOARD_CHIP_MAP in ci/bloat.py to add a new target.", |
| 256 | ) |
| 257 | parser.add_argument( |
| 258 | "--example", |
| 259 | default="Blink", |
| 260 | help="Example whose build to analyze (default: Blink).", |
| 261 | ) |
| 262 | parser.add_argument( |
| 263 | "--top", |
| 264 | type=int, |
| 265 | default=10, |
| 266 | help="Top-N symbols to print in the summary (default: 10).", |
| 267 | ) |
| 268 | parser.add_argument( |
| 269 | "--no-summary", |
| 270 | action="store_true", |
| 271 | help="Skip the stdout summary; just write the JSON + MD artifacts.", |
| 272 | ) |
| 273 | parser.add_argument( |
| 274 | "--build", |
| 275 | action="store_true", |
| 276 | help="Run `bash compile <board> --examples <example> --platformio` " |
| 277 | "first to produce a fresh ELF.", |
| 278 | ) |
| 279 | parser.add_argument( |
| 280 | "--build-root", |
| 281 | default=".build", |
| 282 | help="Build output root (default: .build).", |
| 283 | ) |
| 284 | args = parser.parse_args() |
| 285 | |
| 286 | project_root = Path(__file__).resolve().parent.parent |
| 287 | os.chdir(project_root) |
| 288 | |
| 289 | assert_fbuild_has_symbols() |
| 290 | |
| 291 | if args.build: |
| 292 | compile_script = "compile.bat" if os.name == "nt" else "./compile" |
| 293 | if os.name != "nt" and not shutil.which("bash"): |
| 294 | raise SystemExit("bash not on PATH; cannot --build") |
| 295 | cmd = [ |
| 296 | compile_script, |
| 297 | args.board, |
| 298 | "--examples", |
| 299 | args.example, |
| 300 | "--platformio", |
| 301 | ] |
| 302 | print(f"$ {' '.join(cmd)}") |
| 303 | subprocess.run(cmd, check=True) |
| 304 | |
| 305 | nm = resolve_nm(args.board) |
no test coverage detected