Release v2.1.0

This commit is contained in:
2026-05-03 18:31:08 +02:00
parent 2aba3f5653
commit bd17fe9649
9 changed files with 282 additions and 119 deletions

View File

@@ -5,6 +5,8 @@
from pathlib import Path
import neoecu.common
import subprocess
import sys
def gen_flash_script(jlink_path: Path, core: str, bin_path: Path) -> Path:
jlink_path.mkdir(parents=True, exist_ok=True)
@@ -29,51 +31,42 @@ def gen_flash_script(jlink_path: Path, core: str, bin_path: Path) -> Path:
new_script += "g\n"
new_script += "exit"
script_path.write_text(new_script);
script_path.write_text(new_script)
return script_path
def find_single_elf(build_path: Path, pattern: str, core: str) -> Path:
matches = list(build_path.glob(pattern))
if not matches:
raise FileNotFoundError(f"No {pattern} found in {core} build directory")
if len(matches) > 1:
raise RuntimeError(f"Multiple {core} ELF files found: {matches}")
return matches[0]
def run(root_path: Path):
def run(root_path: Path, args):
config = neoecu.common.load_config(root_path)
try:
cores = neoecu.common.select_cores(config, args)
except ValueError as exc:
print(exc)
sys.exit(1)
m7_root = root_path / config["build"]["m7_dir"]
m4_root = root_path / config["build"]["m4_dir"]
m7_jlink_scripts = m7_root / ".jlink_scripts"
m4_jlink_scripts = m4_root / ".jlink_scripts"
m7_build = m7_root / "CM7" / "build"
matches = list(m7_build.glob("*_CM7.elf"))
if not matches:
raise FileNotFoundError("No *_CM7.elf found in build directory")
if len(matches) > 1:
raise RuntimeError(f"Multiple CM7 ELF files found: {matches}")
m7_bin = matches[0]
m4_build = m4_root / "build" / "zephyr"
matches = list(m4_build.glob("zephyr.elf"))
if not matches:
raise FileNotFoundError("No *_CM4.elf found in build directory")
if len(matches) > 1:
raise RuntimeError(f"Multiple CM4 ELF files found: {matches}")
m4_bin = matches[0]
m7_flash_script = gen_flash_script(m7_jlink_scripts, "CM7", m7_bin)
m4_flash_script = gen_flash_script(m4_jlink_scripts, "CM4", m4_bin)
subprocess.run(["JLinkExe", "-CommanderScript", f"{m4_flash_script}"], cwd=m4_root)
subprocess.run(["JLinkExe", "-CommanderScript", f"{m7_flash_script}"], cwd=m7_root)
if "CM4" in cores:
m4_root = neoecu.common.core_root(root_path, config, "CM4")
m4_jlink_scripts = m4_root / ".jlink_scripts"
m4_build = m4_root / "build" / "zephyr"
m4_bin = find_single_elf(m4_build, "zephyr.elf", "CM4")
m4_flash_script = gen_flash_script(m4_jlink_scripts, "CM4", m4_bin)
subprocess.run(["JLinkExe", "-CommanderScript", f"{m4_flash_script}"], cwd=m4_root)
if "CM7" in cores:
m7_root = neoecu.common.core_root(root_path, config, "CM7")
m7_jlink_scripts = m7_root / ".jlink_scripts"
m7_build = m7_root / "CM7" / "build"
m7_bin = find_single_elf(m7_build, "*_CM7.elf", "CM7")
m7_flash_script = gen_flash_script(m7_jlink_scripts, "CM7", m7_bin)
subprocess.run(["JLinkExe", "-CommanderScript", f"{m7_flash_script}"], cwd=m7_root)