size gate: emit flash_bytes from ELF for targets without a packaged .bin (#10940)
* size gate: emit flash_bytes from ELF for targets without a packaged .bin nRF52 builds package hex/uf2/DFU zip but no raw .bin, so collect_sizes.py dropped budgeted envs like rak4631 entirely and the size-budget-gate failed closed. Emit ELF text+data as flash_bytes in the manifest and use it as the fallback flash measurement. * Factor shared size-tool invocation into run_size_tool helper
This commit is contained in:
co-authored by
GitHub
parent
8d20606203
commit
ba473bf529
+19
-8
@@ -5,10 +5,13 @@
|
||||
Output schema (consumed by bin/size_report.py):
|
||||
{"<env>": {"flash_bytes": <int>, "ram_bytes": <int>}}
|
||||
|
||||
flash_bytes is the size of the main firmware image (.bin). ram_bytes is the
|
||||
static RAM footprint (.data + .bss) emitted into the manifest by
|
||||
bin/platformio-custom.py; it is omitted for manifests that predate it, and
|
||||
size_report.py renders those as "n/a".
|
||||
flash_bytes is the size of the main firmware image (.bin); for targets whose
|
||||
packaged artifacts include no raw .bin (e.g. nRF52) it falls back to the
|
||||
flash_bytes value (ELF text + data) emitted into the manifest by
|
||||
bin/platformio-custom.py. ram_bytes is the static RAM footprint (.data + .bss)
|
||||
emitted into the manifest by bin/platformio-custom.py; either metric is
|
||||
omitted for manifests that predate it, and size_report.py renders those as
|
||||
"n/a".
|
||||
"""
|
||||
|
||||
import json
|
||||
@@ -42,11 +45,19 @@ def collect_sizes(manifest_dir):
|
||||
):
|
||||
bin_size = entry["bytes"]
|
||||
break
|
||||
# Fallback: flash footprint emitted into the manifest (ELF text + data),
|
||||
# for targets that package no raw .bin (e.g. nRF52 hex/uf2/DFU zip)
|
||||
if bin_size is None:
|
||||
flash_bytes = data.get("flash_bytes")
|
||||
if isinstance(flash_bytes, int) and not isinstance(flash_bytes, bool):
|
||||
bin_size = flash_bytes
|
||||
entry = {}
|
||||
if bin_size is not None:
|
||||
entry = {"flash_bytes": bin_size}
|
||||
ram_bytes = data.get("ram_bytes")
|
||||
if isinstance(ram_bytes, int) and not isinstance(ram_bytes, bool):
|
||||
entry["ram_bytes"] = ram_bytes
|
||||
entry["flash_bytes"] = bin_size
|
||||
ram_bytes = data.get("ram_bytes")
|
||||
if isinstance(ram_bytes, int) and not isinstance(ram_bytes, bool):
|
||||
entry["ram_bytes"] = ram_bytes
|
||||
if entry:
|
||||
sizes[board] = entry
|
||||
return sizes
|
||||
|
||||
|
||||
Reference in New Issue
Block a user