summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhathach <[email protected]>2026-06-08 15:42:00 +0700
committerhathach <[email protected]>2026-06-08 15:42:00 +0700
commit46aded44af947e1be32426edcd6ff2c0596f1765 (patch)
tree6773f45dff25011e3b1d228e4c2fdedec42a479a
parentd38ba79ad4a9cd90589a422b6eebd90614af4008 (diff)
presets,hil: keep Ninja Multi-Config; make HIL find its output
Per review (HiFiPhile): Ninja Multi-Config is needed for IAR, otherwise the optimization level can't be lowered to none for debug. Revert gen_presets.py back to Ninja Multi-Config (keeping only the cmake-build-<board> binaryDir change), and instead teach hil_test.py to locate <ex>.elf whether it sits directly in the example dir (single-config) or under a per-config subdir like RelWithDebInfo/ (multi-config). Verified: stm32u083nucleo passes 13/13 remote HIL with a multi-config preset build (rsync preserves the RelWithDebInfo/ subdir; the resolver finds it). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
-rw-r--r--hw/bsp/BoardPresets.json4
-rwxr-xr-xtest/hil/hil_test.py14
-rwxr-xr-xtools/gen_presets.py4
3 files changed, 16 insertions, 6 deletions
diff --git a/hw/bsp/BoardPresets.json b/hw/bsp/BoardPresets.json
index a700e7309..09a9ef18f 100644
--- a/hw/bsp/BoardPresets.json
+++ b/hw/bsp/BoardPresets.json
@@ -5,10 +5,10 @@
"name": "default",
"hidden": true,
"description": "Configure preset for the ${presetName} board",
- "generator": "Ninja",
+ "generator": "Ninja Multi-Config",
"binaryDir": "${sourceDir}/cmake-build-${presetName}",
"cacheVariables": {
- "CMAKE_BUILD_TYPE": "RelWithDebInfo",
+ "CMAKE_DEFAULT_BUILD_TYPE": "RelWithDebInfo",
"BOARD": "${presetName}"
}
},
diff --git a/test/hil/hil_test.py b/test/hil/hil_test.py
index 2fb5f6b3f..2758d093c 100755
--- a/test/hil/hil_test.py
+++ b/test/hil/hil_test.py
@@ -1516,10 +1516,20 @@ def test_example(board: Board, f1: str, example: str) -> tuple[int, str]:
f1_str = f1_suffix(f1)
fw_dir = TINYUSB_ROOT / build_dir / f'cmake-build-{name}{f1_str}' / example
- fw_name = fw_dir / Path(example).name
+ base = Path(example).name
test_name = f'{name+f1_str:40} {example:30} ...'
- if not fw_dir.exists() or not ((fw_name.with_suffix('.elf')).exists() or (fw_name.with_suffix('.bin')).exists()):
+ # firmware sits directly in the example dir (single-config Ninja) or under a
+ # per-config subdir like RelWithDebInfo/ (Ninja Multi-Config); accept either.
+ fw_name = None
+ if fw_dir.is_dir():
+ for cand in [fw_dir / base, fw_dir / 'RelWithDebInfo' / base,
+ *(p.with_suffix('') for p in sorted(fw_dir.glob(f'*/{base}.elf')))]:
+ if cand.with_suffix('.elf').exists() or cand.with_suffix('.bin').exists():
+ fw_name = cand
+ break
+
+ if fw_name is None:
log_line(f'{test_name} Skip (no binary)')
return 0, 'skip'
diff --git a/tools/gen_presets.py b/tools/gen_presets.py
index 60404a5a7..6f32976a7 100755
--- a/tools/gen_presets.py
+++ b/tools/gen_presets.py
@@ -31,10 +31,10 @@ def main():
{"name": "default",
"hidden": True,
"description": r"Configure preset for the ${presetName} board",
- "generator": "Ninja",
+ "generator": "Ninja Multi-Config",
"binaryDir": r"${sourceDir}/cmake-build-${presetName}",
"cacheVariables": {
- "CMAKE_BUILD_TYPE": "RelWithDebInfo",
+ "CMAKE_DEFAULT_BUILD_TYPE": "RelWithDebInfo",
"BOARD": r"${presetName}"
}},
{"name": "default single config",