hil: enable nanoch32v203 in CI with fsdev + usbfs variants (#3707)

* hil: enable nanoch32v203 in CI with fsdev + usbfs variants
nanoch32v203 was parked in boards-skip; move it into the active pool now
that the board is wired to the ci.lan rig. Cover both USB device IPs as
build variants:
  - nanoch32v203-fsdev: RHPORT_DEVICE=0 (USBD / stm32 FSDev IP)
  - nanoch32v203-usbfs: RHPORT_DEVICE=1 (WCH USBFS IP)
This commit is contained in:
Ha Thach
2026-06-16 17:42:31 +07:00
committed by GitHub
parent 7b791916a7
commit d9f736dcf9
4 changed files with 39 additions and 19 deletions

View File

@ -278,6 +278,7 @@ jobs:
matrix:
toolchain:
- 'arm-gcc'
- 'riscv-gcc'
- 'esp-idf'
with:
build-system: 'cmake'

View File

@ -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)

View File

@ -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:

View File

@ -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": ""
}
}
]
}