summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/build.yml1
-rw-r--r--test/hil/hil_ci_set_matrix.py16
-rwxr-xr-xtest/hil/hil_test.py8
-rw-r--r--test/hil/tinyusb.json33
4 files changed, 39 insertions, 19 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index a7c7cf99a..3f6458285 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -278,6 +278,7 @@ jobs:
matrix:
toolchain:
- 'arm-gcc'
+ - 'riscv-gcc'
- 'esp-idf'
with:
build-system: 'cmake'
diff --git a/test/hil/hil_ci_set_matrix.py b/test/hil/hil_ci_set_matrix.py
index baa24afb1..13f7f1882 100644
--- a/test/hil/hil_ci_set_matrix.py
+++ b/test/hil/hil_ci_set_matrix.py
@@ -19,8 +19,12 @@ def main():
parser.add_argument('config_files', nargs='+', help='Configuration JSON file(s)')
args = parser.parse_args()
+ # Toolchain buckets must match the toolchains instantiated by the hil-build
+ # job in .github/workflows/build.yml. Keep all keys present (even if empty)
+ # so `fromJSON(hil_json)[toolchain]` always resolves to a list.
matrix = {
'arm-gcc': [],
+ 'riscv-gcc': [],
'esp-idf': []
}
@@ -38,22 +42,28 @@ def main():
for board in config['boards']:
name = board['name']
flasher = board['flasher']
+ # esptool boards must build under esp-idf; others default to arm-gcc
+ # but may opt into another bucket via an explicit "toolchain" field
+ # (e.g. RISC-V boards like ch32v20x need "riscv-gcc").
if flasher['name'] == 'esptool':
toolchain = 'esp-idf'
else:
- toolchain = 'arm-gcc'
+ toolchain = board.get('toolchain', 'arm-gcc')
build_board = f'-b {name}'
if 'build' in board and 'args' in board['build']:
build_board += ' ' + ' '.join(f'-D{a}' for a in board['build']['args'])
- # Each variant builds into cmake-build-<variant.name> with its raw CFLAGS.
- # No 'variant' -> a single build named after the board.
+ # Each variant builds into cmake-build-<variant.name> with its own cmake
+ # -D defines and raw CFLAGS. No 'variant' -> a single build named after
+ # the board.
variants = board.get('variant') or [{'name': name, 'flags': ''}]
for v in variants:
arg = build_board
if v['name'] != name:
arg += f' --build-name {v["name"]}'
+ for d in v.get('defines', []):
+ arg += f' -D{d}'
for tok in v.get('flags', '').split():
arg += f' --cflag={tok}'
append_build_arg(toolchain, arg)
diff --git a/test/hil/hil_test.py b/test/hil/hil_test.py
index da13fcbaf..fb9a8205c 100755
--- a/test/hil/hil_test.py
+++ b/test/hil/hil_test.py
@@ -126,8 +126,9 @@ class BuildCfg(TypedDict, total=False):
class VariantCfg(TypedDict, total=False):
- name: str # build dir (cmake-build-<name>) and HIL report row
- flags: str # raw CFLAGS, e.g. "-DCFG_TUD_DWC2_DMA_ENABLE=1"
+ name: str # build dir (cmake-build-<name>) and HIL report row
+ flags: str # raw CFLAGS, e.g. "-DCFG_TUD_DWC2_DMA_ENABLE=1"
+ defines: list[str] # cmake -D defines, e.g. ["RHPORT_DEVICE=1"] (vs flags which are compiler-only)
class Board(TypedDict):
@@ -137,6 +138,7 @@ class Board(TypedDict):
flasher: FlasherCfg
build: NotRequired[BuildCfg]
variant: NotRequired[list[VariantCfg]]
+ toolchain: NotRequired[str] # CI build bucket override, e.g. "riscv-gcc" (consumed by hil_ci_set_matrix.py)
class HilConfig(TypedDict):
@@ -1634,6 +1636,8 @@ def build_board(board: Board) -> tuple[str, int]:
cmd += ['-D', d]
if v['name'] != name:
cmd += ['--build-name', v['name']]
+ for d in v.get('defines', []):
+ cmd += ['-D', d]
for tok in v.get('flags', '').split():
cmd += [f'--cflag={tok}']
if verbose:
diff --git a/test/hil/tinyusb.json b/test/hil/tinyusb.json
index afe3c4d03..ea9342c03 100644
--- a/test/hil/tinyusb.json
+++ b/test/hil/tinyusb.json
@@ -458,6 +458,25 @@
"name": "stlink",
"uid": "0668FF575457657187061314"
}
+ },
+ {
+ "name": "nanoch32v203",
+ "uid": "CDAB277B0FBC03E339E339E3",
+ "toolchain": "riscv-gcc",
+ "variant": [
+ {"name": "nanoch32v203-fsdev", "defines": ["RHPORT_DEVICE=0"]},
+ {"name": "nanoch32v203-usbfs", "defines": ["RHPORT_DEVICE=1"]}
+ ],
+ "tests": {
+ "device": true,
+ "host": false,
+ "dual": false
+ },
+ "flasher": {
+ "name": "openocd_wch",
+ "uid": "EBCA8F0670AF",
+ "args": ""
+ }
}
],
"boards-skip": [
@@ -478,20 +497,6 @@
"uid": "000778170924",
"args": "-device stm32f769ni"
}
- },
- {
- "name": "nanoch32v203",
- "uid": "CDAB277B0FBC03E339E339E3",
- "tests": {
- "device": true,
- "host": false,
- "dual": false
- },
- "flasher": {
- "name": "openocd_wch",
- "uid": "EBCA8F0670AF",
- "args": ""
- }
}
]
}