MCPcopy Create free account
hub / github.com/FastLED/FastLED / main

Function main

ci/inspect_binary.py:182–340  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

180
181
182def main() -> int:
183 args = parse_args()
184 if args.cwd:
185 root_build_dir = args.cwd / ".build"
186 else:
187 root_build_dir = Path(".build")
188
189 # Support nested PlatformIO structure: .build/pio/<board>
190 nested_pio_dir = root_build_dir / "pio"
191 if nested_pio_dir.is_dir():
192 root_build_dir = nested_pio_dir
193
194 board_dirs = [d for d in root_build_dir.iterdir() if d.is_dir()]
195 if not board_dirs:
196 print(f"No board directories found in {root_build_dir.absolute()}")
197 return 1
198
199 print("Available boards:")
200 for i, board_dir in enumerate(board_dirs):
201 print(f"[{i}]: {board_dir.name}")
202
203 which = (
204 0
205 if args.first
206 else int(input("Enter the number of the board you want to inspect: "))
207 )
208 board_dir = board_dirs[which]
209
210 # Find build_info.json (try example-specific files first, then generic)
211 build_info_files = list(board_dir.glob("build_info_*.json"))
212 if build_info_files:
213 # Prefer example-specific files
214 build_info_json = build_info_files[0]
215 else:
216 # Fall back to generic build_info.json
217 build_info_json = board_dir / "build_info.json"
218
219 if not build_info_json.exists():
220 print(f"Error: No build_info*.json found in {board_dir}")
221 return 1
222
223 build_info = load_build_info(build_info_json)
224 board = board_dir.name
225 board_info = build_info.get(board) or build_info[next(iter(build_info))]
226
227 # Validate paths from build_info.json
228 elf_path = Path(board_info.get("prog_path", ""))
229 if not elf_path.exists():
230 print(
231 f"Error: ELF path '{elf_path}' does not exist. Check the 'prog_path' in build_info.json."
232 )
233 return 1
234
235 bin_file = elf_path.with_suffix(".bin")
236 if not bin_file.exists():
237 # use .hex or .uf2 if .bin doesn't exist
238 bin_file = elf_path.with_suffix(".hex")
239 if not bin_file.exists():

Callers 1

inspect_binary.pyFile · 0.70

Calls 12

analyze_symbolsFunction · 0.90
bin_to_elfFunction · 0.90
dump_symbol_sizesFunction · 0.90
map_dumpFunction · 0.90
listClass · 0.85
load_build_infoFunction · 0.85
display_function_sizesFunction · 0.85
parse_argsFunction · 0.70
printFunction · 0.50
getMethod · 0.45

Tested by

no test coverage detected