Files
charge-controller-firmware/tests/CMakeLists.txt
T
Martin JägerandClaude Opus 5.5 6c2251e2c8 app: use half-bridge driver for DC/DC converter
Replace the register-level half_bridge.c module by the new half-bridge
drivers. The Dcdc class gets the half-bridge device injected via its
constructor, so that the emulated driver can be used in unit tests.

Board devicetrees are migrated to the new compatibles:

- TIM1 boards use libresolar,stm32-half-bridge with complementary
  outputs on channel 1. The ADC trigger via OC6/TRGO2 is enabled for
  the STM32G4 boards as before.
- MPPT 1210 HUS uses libresolar,stm32-half-bridge with TIM3 channel 3
  (high side) and channel 4 (low side).
- Nucleo G474RE uses libresolar,stm32-hrtim-half-bridge. The HRTIM
  node gets the timer clock source as second clock.

Instead of the half-bridge compatible, the halfbridge node label is now
used to detect if the board has a DC/DC converter.

The half-bridge unit tests are removed, as they are superseded by the
driver test suite in tests/drivers/half_bridge.

Note for out-of-tree boards: Nodes with "half-bridge" compatible must be
migrated to one of the new compatibles, and the deadtime property was
renamed to deadtime-ns.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 21:02:57 +02:00

48 lines
1.3 KiB
CMake

# Copyright (c) The Libre Solar Project Contributors
# SPDX-License-Identifier: Apache-2.0
set(BOARD_ROOT ${CMAKE_SOURCE_DIR}/..)
set(DTS_ROOT ${CMAKE_SOURCE_DIR}/..)
#set(BOARD "native_posix")
#set(ZEPHYR_TOOLCHAIN_VARIANT "host")
cmake_minimum_required(VERSION 3.13.1)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(libre_solar_charge_controller)
add_definitions(-DUNIT_TEST=1)
add_definitions(-DUNITY_OUTPUT_COLOR)
add_definitions(-DUNITY_EXCLUDE_SETJMP)
add_subdirectory(../app/src build/app)
zephyr_include_directories(./src)
zephyr_include_directories(../app/src)
zephyr_include_directories(../../modules/thingset/src)
zephyr_include_directories(../../modules/unity/src)
target_sources(app PRIVATE
../../modules/unity/src/unity.c
src/main.cpp
src/tests_bat_charger.cpp
src/tests_daq.cpp
src/tests_dcdc.cpp
src/tests_device_status.cpp
src/tests_load.cpp
src/tests_power_port.cpp
)
# determine git tag and commit hash for automatic firmware versioning
find_package(Git)
if(GIT_FOUND)
execute_process(
COMMAND ${GIT_EXECUTABLE} describe --long --dirty --tags
OUTPUT_VARIABLE FIRMWARE_VERSION_ID
OUTPUT_STRIP_TRAILING_WHITESPACE)
else()
set(FIRMWARE_VERSION_ID "unknown")
endif()
add_definitions(-DFIRMWARE_VERSION_ID="${FIRMWARE_VERSION_ID}")