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():

File diff suppressed because one or more lines are too long

View File

@@ -16,6 +16,13 @@ if "%~2"=="" goto usage
if "%~3"=="" goto usage
if "%~4"=="" goto usage
if not "%~5"=="" goto usage
rem Create the editable project configuration once; never overwrite user settings.
if not exist "%~f3" (
copy /Y "%~dp0firmware_identity.example.json" "%~f3" >nul
if errorlevel 1 exit /b 2
echo [firmware-build] Created configuration: "%~f3"
echo [firmware-build] Edit product, target and version in this file, then rebuild.
)
python "%~dp0..\..\..\c\firmware-info\tools\identity.py" prepare --repository "%~f2" --templates "%~dp0..\..\.." --config "%~f3" --output "%~f4"
exit /b %errorlevel%
:usage