Skip to content

Commit 8380fb1

Browse files
authored
Update main.py
1 parent 4c912f8 commit 8380fb1

File tree

1 file changed

+0
-54
lines changed

1 file changed

+0
-54
lines changed

builder/main.py

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -303,60 +303,6 @@ def check_lib_archive_exists():
303303
return False
304304

305305

306-
def firmware_metrics(target, source, env):
307-
"""
308-
Custom target to run esp-idf-size with support for command line parameters.
309-
Usage: pio run -t metrics -- [esp-idf-size arguments]
310-
"""
311-
if terminal_cp != "utf-8":
312-
print(
313-
'Firmware metrics can not be shown. Set the terminal codepage '
314-
'to "utf-8"'
315-
)
316-
return
317-
318-
map_file = os.path.join(
319-
env.subst("$BUILD_DIR"), env.subst("$PROGNAME") + ".map"
320-
)
321-
if not os.path.isfile(map_file):
322-
# Map file can be in project dir
323-
map_file = os.path.join(
324-
get_project_dir(), env.subst("$PROGNAME") + ".map"
325-
)
326-
327-
if not os.path.isfile(map_file):
328-
print(f"Error: Map file not found: {map_file}")
329-
print("Make sure the project is built first with 'pio run'")
330-
return
331-
332-
cmd = [env.subst("$PYTHONEXE"), "-m", "esp_idf_size", "--ng"]
333-
334-
# Parameters from platformio.ini
335-
extra_args = env.GetProjectOption("custom_esp_idf_size_args", "")
336-
if extra_args:
337-
cmd.extend(shlex.split(extra_args))
338-
339-
# Command Line Parameter, after --
340-
cli_args = []
341-
if "--" in sys.argv:
342-
dash_index = sys.argv.index("--")
343-
if dash_index + 1 < len(sys.argv):
344-
cli_args = sys.argv[dash_index + 1 :]
345-
346-
# Map-file as last argument
347-
cmd.append(map_file)
348-
349-
# Debug-Info if wanted
350-
if env.GetProjectOption("custom_esp_idf_size_verbose", False):
351-
print(f"Running command: {' '.join(cmd)}")
352-
353-
# Call esp-idf-size
354-
result = subprocess.run(cmd, check=False, capture_output=False)
355-
356-
if result.returncode != 0:
357-
print(f"Warning: esp-idf-size exited with code {result.returncode}")
358-
359-
360306
# Initialize board configuration and MCU settings
361307
board = env.BoardConfig()
362308
mcu = board.get("build.mcu", "esp32")

0 commit comments

Comments
 (0)