From a6956b10a38e14ed272cf338b85605ec7d8b611e Mon Sep 17 00:00:00 2001 From: maksyuki Date: Thu, 6 Aug 2026 16:37:46 +0800 Subject: [PATCH] feat: add ci_smoke application for UART and archinfo verification in CI --- Makefile | 2 +- README.md | 10 ++++++++++ app/README.md | 6 +++++- app/apps/ci_smoke/app.mk | 1 + app/apps/ci_smoke/main.c | 25 +++++++++++++++++++++++++ docs/engineering.md | 6 ++++++ scripts/regress.py | 17 ++++++++++++----- 7 files changed, 60 insertions(+), 7 deletions(-) create mode 100644 app/apps/ci_smoke/app.mk create mode 100644 app/apps/ci_smoke/main.c diff --git a/Makefile b/Makefile index 98974bb3..2c18fe72 100644 --- a/Makefile +++ b/Makefile @@ -110,7 +110,7 @@ VALID_STA := NONE OPENSTA VALID_PDK := ICS55 IHP130 SKY130 GF180 VALID_BOOL := YES NO VALID_ISA := RV32E RV32I RV32IM -VALID_APP := benchmark bringup coremark debug shell +VALID_APP := benchmark bringup ci_smoke coremark debug shell VALID_LINK_TYPE := xip ld2_all_sram ld2_sram ld2_psram ld2_sdram VALID_COREMARK_MODE := quick standard diff --git a/README.md b/README.md index 4e5411f2..a31d0cc6 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,16 @@ user core. | [`configs/benchmark/ihp130-hazard3-coremark.mk`](configs/benchmark/ihp130-hazard3-coremark.mk) | RV32IM | `coremark` | Fixed four-iteration SRAM CoreMark quick measurement, recorded by nightly IHP130 regression. | | [`configs/cluster/ics55.mk`](configs/cluster/ics55.mk) | RV32IM | `bringup` | Compatibility profile for site-specific ICS55 runs. | +CI Verilator firmware simulations explicitly select the `ci_smoke` +application, which checks UART, archinfo APB readback, and test-status +completion without the verbose startup report. The profiles retain `bringup` +as their default for manual diagnostics. To run the full report in Verilator, +use: + +```sh +make CONFIG=configs/ci/ihp130.mk APP=bringup SIMU=VERILATOR SOC_SIM_TIME=300 firmware sim +``` + ## Prerequisites The open-source development environment contains the exact Ubuntu 22.04 tool bundles, Python diff --git a/app/README.md b/app/README.md index 547f9f85..8a9575a1 100644 --- a/app/README.md +++ b/app/README.md @@ -28,7 +28,8 @@ The build selects an application with `APP=`. The supported profiles are: | Profile | Description | | --- | --- | | `benchmark` | Fixed-workload memory and DMA baseline with machine-readable wait counters and readback checksums. | -| `bringup` | Minimal firmware used for startup and basic SoC regression. | +| `bringup` | Manual startup diagnostic that prints complete application and archinfo details. | +| `ci_smoke` | Fast deterministic CI smoke test for UART, archinfo APB readback, and test-status completion. | | `coremark` | SRAM-resident Hazard3 CoreMark measurement; use the committed quick or standard profile. | | `debug` | Minimal SRAM image used only by the Hazard3 OpenOCD/GDB acceptance flow. | | `shell` | Interactive application that adds shell services, board drivers, media, FatFs, CoreMark, and UserIP integration. | @@ -43,6 +44,9 @@ Build and simulate the supported profiles from the repository root: # Bringup firmware and Verilator simulation make CONFIG=configs/ci/ihp130.mk SIMU=VERILATOR firmware sim +# Explicitly run the CI smoke firmware used by regressions +make CONFIG=configs/ci/ihp130.mk APP=ci_smoke SIMU=VERILATOR firmware sim + # Shell firmware and Verilator simulation make CONFIG=configs/ci/ihp130-shell.mk SIMU=VERILATOR firmware sim diff --git a/app/apps/ci_smoke/app.mk b/app/apps/ci_smoke/app.mk new file mode 100644 index 00000000..95dc1092 --- /dev/null +++ b/app/apps/ci_smoke/app.mk @@ -0,0 +1 @@ +APP_SRCS += $(ROOT_PATH)/app/apps/ci_smoke/main.c diff --git a/app/apps/ci_smoke/main.c b/app/apps/ci_smoke/main.c new file mode 100644 index 00000000..68925e4e --- /dev/null +++ b/app/apps/ci_smoke/main.c @@ -0,0 +1,25 @@ +#include +#include +#include +#include + +static bool rs_ci_smoke_archinfo_matches_reset_values(void) { + const uint32_t archinfo_sys = reg_archinfo_sys; + const uint32_t archinfo_idl = reg_archinfo_idl; + const uint32_t archinfo_idh = reg_archinfo_idh; + + return (archinfo_sys == UINT32_C(0x000F1010)) && (archinfo_idl == UINT32_C(0xFFFF2022)) && + (archinfo_idh == UINT32_C(0x00FFFFFF)); +} + +int main(void) { + uart0_init(CPU_FREQ, UART_BPS); + + if (!rs_ci_smoke_archinfo_matches_reset_values()) { + rs_test_finish(RS_TEST_FAILED, 1U); + } + + printf("ci_smoke: archinfo readback passed\n"); + rs_test_finish(RS_TEST_PASSED, 0U); + return 0; +} diff --git a/docs/engineering.md b/docs/engineering.md index 9d875c38..3280cde7 100644 --- a/docs/engineering.md +++ b/docs/engineering.md @@ -13,6 +13,12 @@ | Nightly | `configs/ci/ihp130.mk` | repeated full IHP130 regression | | Cluster | `configs/cluster/ics55.mk` | compatibility profile for site-specific ICS55 runs | +Regression Verilator firmware simulations override the profiles' manual +`bringup` default with `APP=ci_smoke`. This application verifies UART output, +archinfo APB readback, and test-status completion within the CI time budget; +`bringup` retains the full automatic application-information report for +manual runs. + OpenSTA runs a reproducible core-STA baseline for every CI PDK: IHP130 uses `slow_1p08V_125C`, GF180 uses `ss_125C_4v50`, ICS55 uses the H7CR `ss_1p08_125C` view, and SKY130 uses `ss_100C_1v40`. diff --git a/scripts/regress.py b/scripts/regress.py index d474ffec..cb97db26 100644 --- a/scripts/regress.py +++ b/scripts/regress.py @@ -15,6 +15,7 @@ sys.path.insert(0, str(ROOT)) from scripts.check_c_warnings import self_owned_warnings # noqa: E402 +CI_SMOKE_APP_VALUE = "APP=ci_smoke" RTL_LINT_VALUES = ("SIMU=VERILATOR", "HAVE_SVA=YES", "rtl-lint") RTL_LINT_OBSERVATION_VALUES = ( "SIMU=VERILATOR", @@ -26,9 +27,12 @@ OBSERVATION_TARGETS = ("check-warnings", "check-metrics") PR_COMMANDS = ( ("configs/ci/ihp130.mk", RTL_LINT_VALUES), - ("configs/ci/ihp130.mk", ("firmware",)), + ("configs/ci/ihp130.mk", (CI_SMOKE_APP_VALUE, "firmware")), ("configs/ci/ihp130-shell.mk", ("firmware",)), - ("configs/ci/ihp130.mk", ("SIMU=VERILATOR", "HAVE_SVA=YES", "firmware", "sim")), + ( + "configs/ci/ihp130.mk", + (CI_SMOKE_APP_VALUE, "SIMU=VERILATOR", "HAVE_SVA=YES", "firmware", "sim"), + ), ("configs/ci/ihp130-debug.mk", ("SIMU=VERILATOR", "debug-sim")), ("configs/ci/ihp130.mk", ("SIMU=IVERILOG", "RTL_SIM_TIMEOUT=5200000", "sim-asm")), ("configs/ci/ihp130.mk", ("SYNTH=YOSYS", "synth")), @@ -45,7 +49,7 @@ PR_COMMANDS = ( ) SMOKE_COMMANDS = ( ("configs/ci/ihp130.mk", RTL_LINT_VALUES), - ("configs/ci/ihp130.mk", ("firmware",)), + ("configs/ci/ihp130.mk", (CI_SMOKE_APP_VALUE, "firmware")), ( "configs/ci/ihp130.mk", ("SIMU=VERILATOR", "HAVE_SVA=YES", "comp"), @@ -77,8 +81,11 @@ PDK_PR_PROFILES = { def pdk_pr_commands(profile: str) -> tuple[tuple[str, tuple[str, ...]], ...]: return ( (profile, RTL_LINT_VALUES), - (profile, ("firmware",)), - (profile, ("SIMU=VERILATOR", "HAVE_SVA=YES", "firmware", "sim")), + (profile, (CI_SMOKE_APP_VALUE, "firmware")), + ( + profile, + (CI_SMOKE_APP_VALUE, "SIMU=VERILATOR", "HAVE_SVA=YES", "firmware", "sim"), + ), (profile, ("SIMU=IVERILOG", "RTL_SIM_TIMEOUT=5200000", "sim-asm")), (profile, ("SYNTH=YOSYS", "synth")), (profile, ("STA=OPENSTA", "sta")),