fix(firmware-build): support CCS artifact paths and bootstrap identity config

This commit is contained in:
2026-10-08 17:57:04 +03:00
parent 131f306131
commit eab8dc5e0a
3 changed files with 20 additions and 5 deletions

View File

@@ -17,10 +17,18 @@ from identity import archive_build, seal, verify
def postbuild(compiler: Path, build_dir: Path, artifact: str,
metadata: Path, output: Path, export: Path = None) -> Path:
if not artifact or artifact in (".", "..") or any(c in artifact for c in '\\/:*?"<>|'):
raise ValueError("artifact must be a file base name, without a path")
# CCS may include the configured output directory in this macro.
# Resolve the input separately; output filenames must use only its basename.
artifact_path = Path(artifact)
if not artifact or artifact_path.name in ("", ".", ".."):
raise ValueError("artifact must name an OUT file without its extension")
artifact = artifact_path.name
if any(c in artifact for c in '\\/:*?"<>|'):
raise ValueError("invalid artifact file base name")
source_base = (artifact_path if artifact_path.is_absolute()
else build_dir / artifact_path)
source = Path(str(source_base) + ".out").resolve()
tool = compiler.resolve() / "bin" / "hex2000.exe"
source = build_dir.resolve() / (artifact + ".out")
if not tool.is_file():
raise FileNotFoundError(f"C2000 Hex Utility not found: {tool}")
if not source.is_file():