tests: drivers: build half-bridge tests for STM32 boards and run in CI

Add a build-only twister scenario for boards using the STM32 TIM and
HRTIM half-bridge drivers. The tests are not run on hardware, as they
would switch the power stage.

The driver tests are run in CI with:

    west twister -T tests/drivers --integration

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Martin Jäger
2026-10-20 21:11:42 +02:00
co-authored by Claude Opus 5.5
parent afbc38a65b
commit b271dc0aba
6 changed files with 69 additions and 0 deletions
+4
View File
@@ -52,3 +52,7 @@ jobs:
- name: Run tests
run: |
west build -b native_sim -t run tests -p
- name: Run driver tests
run: |
west twister -T tests/drivers --integration --inline-logs
+1
View File
@@ -4,6 +4,7 @@
# folders generated by west
build
twister-out*
# editors
.vscode/*
@@ -0,0 +1,14 @@
/*
* Copyright (c) The Libre Solar Project Contributors
*
* SPDX-License-Identifier: Apache-2.0
*/
/ {
halfbridge: half-bridge {
compatible = "libresolar,half-bridge-emul";
clock-frequency = <24000000>;
frequency = <70000>;
deadtime-ns = <300>;
};
};
@@ -0,0 +1,34 @@
/*
* Copyright (c) The Libre Solar Project Contributors
*
* SPDX-License-Identifier: Apache-2.0
*/
/* HRTIM node is not yet defined in Zephyr's STM32G4 devicetree */
/ {
soc {
hrtim1: timers@40016800 {
compatible = "st,stm32-timers";
reg = <0x40016800 0x400>;
clocks = <&rcc STM32_CLOCK(APB2, 26)>,
<&rcc STM32_SRC_TIMPCLK2 NO_SEL>;
resets = <&rctl STM32_RESET(APB2, 26)>;
interrupts = <67 0>, <68 0>, <69 0>, <70 0>,
<71 0>, <72 0>, <73 0>, <74 0>;
interrupt-names = "master", "tima", "timb", "timc",
"timd", "time", "flt", "timf";
st,prescaler = <0>;
status = "okay";
halfbridge: halfbridge {
compatible = "libresolar,stm32-hrtim-half-bridge";
pinctrl-0 = <&hrtim1_cha1_pa8 &hrtim1_cha2_pa9>;
pinctrl-names = "default";
frequency = <70000>;
deadtime-ns = <300>;
adc-trigger;
};
};
};
};
+16
View File
@@ -8,3 +8,19 @@ tests:
- native_sim/native/64
integration_platforms:
- native_sim
# The tests switch the power stage of real hardware, so they must only be built for the boards.
drivers.half_bridge.stm32:
build_only: true
tags:
- drivers
- half_bridge
platform_allow:
- mppt_1210_hus
- mppt_2420_hc
- mppt_2420_lc
- nucleo_g474re
integration_platforms:
- mppt_1210_hus
- mppt_2420_hc
- mppt_2420_lc
- nucleo_g474re