Add API validation tests, remove clock GetRate, and establish peripheral driver naming convention#29
Conversation
…ssing test suites for uart, i2c, dma, irq, supply, and sensor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR removes the GetRate/rate-reporting API from the clock subsystem, expands unit tests to validate NULL-argument handling across multiple drivers, and documents/implements a clearer naming convention for peripheral drivers (e.g., <chip>_<device_type>).
Changes:
- Removed
GetRatefromwhal_ClockDriver, core clock dispatch, and multiple platform clock drivers. - Added API validation tests for several modules (UART/I2C/DMA/IRQ/Supply/Sensor/etc.) and expanded test runner gating for platform-specific suites.
- Updated peripheral driver naming and includes (e.g.,
spi_nor_flash,sdhc_spi_block,lan8742a_eth_phy,bmi270_sensor) plus related documentation.
Reviewed changes
Copilot reviewed 52 out of 56 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| wolfHAL/clock/stm32wb_rcc.h | Removes clock rate API declarations from STM32WB RCC header. |
| wolfHAL/clock/stm32h5_rcc.h | Removes clock rate API declarations from STM32H5 RCC header. |
| wolfHAL/clock/stm32f4_rcc.h | Removes PLL GetRate declaration from STM32F4 RCC header. |
| wolfHAL/clock/stm32c0_rcc.h | Removes GetRate declaration from STM32C0 RCC header. |
| wolfHAL/clock/pic32cz_clock.h | Removes GetRate declaration from PIC32CZ clock header. |
| wolfHAL/clock/clock.h | Removes GetRate from the clock vtable and public API. |
| src/clock/clock.c | Removes whal_Clock_GetRate dispatch implementation. |
| src/clock/stm32wb_rcc.c | Removes STM32WB rate computations and vtable entries. |
| src/clock/stm32h5_rcc.c | Removes STM32H5 rate computations and vtable entries. |
| src/clock/stm32f4_rcc.c | Removes STM32F4 rate computation and vtable entry. |
| src/clock/stm32c0_rcc.c | Removes STM32C0 rate computation and vtable entry. |
| src/clock/pic32cz_clock.c | Removes PIC32CZ GetRate stub and vtable entry. |
| tests/core/test_dispatch.c | Updates dispatch mocks/tests to match removed clock API. |
| tests/clock/test_clock.c | Replaces GetRate test with basic NULL-arg clock API checks. |
| tests/watchdog/test_watchdog.c | Adds watchdog NULL-arg API validation test. |
| tests/timer/test_timer.c | Adds timer NULL-arg API validation test. |
| tests/rng/test_rng.c | Adds RNG NULL-arg API validation test. |
| tests/gpio/test_gpio.c | Adds GPIO NULL-arg API validation test. |
| tests/flash/test_flash.c | Adds flash NULL-arg API validation test. |
| tests/block/test_block.c | Adds block NULL-arg API validation test. |
| tests/eth/test_eth.c | Adds eth/phy NULL-arg API validation test. |
| tests/spi_loopback/test_spi_loopback.c | Adds SPI NULL-arg API validation test inside loopback suite. |
| tests/uart/test_uart.c | Adds UART NULL-arg API validation test suite (new file). |
| tests/i2c/test_i2c.c | Adds I2C NULL-arg API validation test suite (new file). |
| tests/dma/test_dma.c | Adds DMA NULL-arg API validation test suite (new file). |
| tests/irq/test_irq.c | Adds IRQ NULL-arg API validation test suite (new file). |
| tests/supply/test_supply.c | Adds supply NULL-arg API validation test suite (new file). |
| tests/sensor/test_sensor.c | Adds sensor NULL-arg API validation test suite (new file). |
| tests/sensor/imu/test_bmi270.c | Renames BMI270 test entrypoint and updates include naming. |
| tests/main.c | Adds enable-gates and runner calls for new/optional module & platform tests; renames BMI270 test gate. |
| tests/Makefile | Changes platform-test detection to use find rather than wildcard. |
| src/sensor/imu/bmi270.c | Updates include to new peripheral-driver header name. |
| src/flash/spi_nor.c | Updates include to new peripheral-driver header name. |
| src/block/sdhc_spi.c | Updates include to new peripheral-driver header name. |
| src/eth_phy/lan8742a.c | Updates include to new peripheral-driver header name. |
| boards/peripheral/Makefile.inc | Updates peripheral driver source file names to new naming convention. |
| boards/peripheral/sensor/imu/bmi270.h | Updates include to new peripheral-driver header name. |
| boards/peripheral/sensor/imu/bmi270.c | Updates include to new peripheral-driver header name. |
| boards/peripheral/flash/spi_nor_w25q64.h | Updates include to new peripheral-driver header name. |
| boards/peripheral/flash/spi_nor_w25q64.c | Updates include to new peripheral-driver header name. |
| boards/peripheral/block/sdhc_spi_sdcard32gb.h | Updates include to new peripheral-driver header name. |
| boards/peripheral/block/sdhc_spi_sdcard32gb.c | Updates include to new peripheral-driver header name. |
| boards/stm32h563zi_nucleo/board.c | Updates include to new Ethernet PHY header name. |
| boards/stm32wb55xx_nucleo/Makefile.inc | Expands default enabled test modules. |
| boards/stm32h563zi_nucleo/Makefile.inc | Expands default enabled test modules. |
| boards/stm32f411_blackpill/Makefile.inc | Expands default enabled test modules. |
| boards/stm32c031_nucleo/Makefile.inc | Expands default enabled test modules. |
| boards/pic32cz_curiosity_ultra/Makefile.inc | Expands default enabled test modules. |
| docs/writing_a_driver.md | Documents platform vs peripheral drivers, naming, and removes clock GetRate section. |
| docs/getting_started.md | Updates terminology from bus-device to peripheral drivers. |
| docs/adding_a_peripheral.md | Updates include naming and clarifies peripheral instance naming convention. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…convention. Move spi_loopback test into spi/. Add platform test support to main.c for all device type
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 52 out of 56 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
tests/Makefile:18
- Using
find .repeatedly inside $(foreach ...) both to detect platform tests and to build SOURCE traverses the entire tests tree (including build/ after the first build) multiple times, which can slow incremental builds and can pick up unintended matches. Consider restricting the search scope (e.g.,find $(t) -maxdepth 1 ...or pruning build/), or caching the results in a variable so eachfindruns once per build.
uc = $(shell echo $(1) | tr a-z A-Z)
CFLAGS += $(foreach t,$(TESTS),-DWHAL_TEST_ENABLE_$(call uc,$(t)))
CFLAGS += $(foreach t,$(TESTS),$(if $(shell find . -name 'test_$(PLATFORM)_$(t).c'),-DWHAL_TEST_ENABLE_$(call uc,$(t))_PLATFORM))
SOURCE = main.c
SOURCE += $(BOARD_SOURCE)
SOURCE += $(foreach t,$(TESTS),$(shell find . -name 'test_$(t).c'))
SOURCE += $(foreach t,$(TESTS),$(shell find . -name 'test_$(PLATFORM)_$(t).c'))
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
No description provided.