From 5cc01bb562c3559c28c500141b0ddfa025529bf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20VINCENT?= <44554692+comejv@users.noreply.github.com> Date: Wed, 13 Aug 2025 18:03:36 -0400 Subject: [PATCH] arm/stm32h7: update makefile for capture & config name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add capture source files to the makefile pipeline. STM32H7_CAP to STM32H7_TIMX_CAP for clarity. Signed-off-by: Côme VINCENT <44554692+comejv@users.noreply.github.com> --- arch/arm/src/stm32h7/CMakeLists.txt | 5 ++++- arch/arm/src/stm32h7/Kconfig | 21 +++++++++++++++++++++ arch/arm/src/stm32h7/Make.defs | 8 ++++++++ arch/arm/src/stm32h7/stm32_capture.c | 10 +--------- 4 files changed, 34 insertions(+), 10 deletions(-) diff --git a/arch/arm/src/stm32h7/CMakeLists.txt b/arch/arm/src/stm32h7/CMakeLists.txt index eb96cf2ef9..11cb59004f 100644 --- a/arch/arm/src/stm32h7/CMakeLists.txt +++ b/arch/arm/src/stm32h7/CMakeLists.txt @@ -32,7 +32,6 @@ list( stm32_start.c stm32_rcc.c stm32_lowputc.c - stm32_capture.c stm32_serial.c stm32_uid.c) @@ -143,6 +142,10 @@ if(CONFIG_TIMER) list(APPEND SRCS stm32_tim_lowerhalf.c) endif() +if(CONFIG_STM32H7_TIMX_CAP) + list(APPEND SRCS stm32_capture.c) +endif() + if(CONFIG_CAPTURE) list(APPEND SRCS stm32_capture_lowerhalf.c) endif() diff --git a/arch/arm/src/stm32h7/Kconfig b/arch/arm/src/stm32h7/Kconfig index a91f8f1d9e..16100eaee6 100644 --- a/arch/arm/src/stm32h7/Kconfig +++ b/arch/arm/src/stm32h7/Kconfig @@ -4584,9 +4584,14 @@ config STM32H7_ADC3_TIMTRIG ---help--- Values 0:CC1 1:CC2 2:CC3 3:CC4 4:TRGO +config STM32H7_TIMX_CAP + default n + bool "Helpers for Capture Drivers" + config STM32H7_TIM1_CAP bool "TIM1 Capture" default n + select STM32H7_TIMX_CAP depends on STM32H7_TIM1 ---help--- Reserve timer 1 for use by the capture driver. @@ -4611,6 +4616,7 @@ endif # STM32H7_TIM1_CAP config STM32H7_TIM8_CAP bool "TIM8 Capture" default n + select STM32H7_TIMX_CAP depends on STM32H7_TIM8 ---help--- Reserve timer 8 for use by the capture driver. @@ -4639,6 +4645,7 @@ endif # STM32H7_TIM8_CAP config STM32H7_TIM2_CAP bool "TIM2 Capture" default n + select STM32H7_TIMX_CAP depends on STM32H7_TIM2 ---help--- Reserve timer 2 for use by the capture driver. @@ -4663,6 +4670,7 @@ endif # STM32H7_TIM2_CAP config STM32H7_TIM3_CAP bool "TIM3 Capture" default n + select STM32H7_TIMX_CAP depends on STM32H7_TIM3 ---help--- Reserve timer 3 for use by the capture driver. @@ -4687,6 +4695,7 @@ endif # STM32H7_TIM3_CAP config STM32H7_TIM4_CAP bool "TIM4 Capture" default n + select STM32H7_TIMX_CAP depends on STM32H7_TIM4 ---help--- Reserve timer 4 for use by the capture driver. @@ -4711,6 +4720,7 @@ endif # STM32H7_TIM4_CAP config STM32H7_TIM5_CAP bool "TIM5 Capture" default n + select STM32H7_TIMX_CAP depends on STM32H7_TIM5 ---help--- Reserve timer 5 for use by the capture driver. @@ -4739,6 +4749,7 @@ endif # STM32H7_TIM5_CAP config STM32H7_TIM12_CAP bool "TIM12 Capture" default n + select STM32H7_TIMX_CAP depends on STM32H7_TIM12 ---help--- Reserve timer 12 for use by the capture driver. @@ -4763,6 +4774,7 @@ endif # STM32H7_TIM12_CAP config STM32H7_TIM15_CAP bool "TIM15 Capture" default n + select STM32H7_TIMX_CAP depends on STM32H7_TIM15 ---help--- Reserve timer 15 for use by the capture driver. @@ -4791,6 +4803,7 @@ endif # STM32H7_TIM15_CAP config STM32H7_TIM13_CAP bool "TIM13 Capture" default n + select STM32H7_TIMX_CAP depends on STM32H7_TIM13 ---help--- Reserve timer 13 for use by the capture driver. @@ -4815,6 +4828,7 @@ endif # STM32H7_TIM13_CAP config STM32H7_TIM14_CAP bool "TIM14 Capture" default n + select STM32H7_TIMX_CAP depends on STM32H7_TIM14 ---help--- Reserve timer 14 for use by the capture driver. @@ -4839,6 +4853,7 @@ endif # STM32H7_TIM14_CAP config STM32H7_TIM16_CAP bool "TIM16 Capture" default n + select STM32H7_TIMX_CAP depends on STM32H7_TIM16 ---help--- Reserve timer 16 for use by the capture driver. @@ -4863,6 +4878,7 @@ endif # STM32H7_TIM16_CAP config STM32H7_TIM17_CAP bool "TIM17 Capture" default n + select STM32H7_TIMX_CAP depends on STM32H7_TIM17 ---help--- Reserve timer 17 for use by the capture driver. @@ -4891,6 +4907,7 @@ endif # STM32H7_TIM17_CAP config STM32H7_LPTIM1_CAP bool "LPTIM1 Capture" default n + select STM32H7_TIMX_CAP depends on STM32H7_LPTIM1 ---help--- Reserve low-power timer 1 for use by the capture driver. @@ -4915,6 +4932,7 @@ endif # STM32H7_LPTIM1_CAP config STM32H7_LPTIM2_CAP bool "LPTIM2 Capture" default n + select STM32H7_TIMX_CAP depends on STM32H7_LPTIM2 ---help--- Reserve low-power timer 2 for use by the capture driver. @@ -4939,6 +4957,7 @@ endif # STM32H7_LPTIM2_CAP config STM32H7_LPTIM3_CAP bool "LPTIM3 Capture" default n + select STM32H7_TIMX_CAP depends on STM32H7_LPTIM3 ---help--- Reserve low-power timer 3 for use by the capture driver. @@ -4963,6 +4982,7 @@ endif # STM32H7_LPTIM3_CAP config STM32H7_LPTIM4_CAP bool "LPTIM4 Capture" default n + select STM32H7_TIMX_CAP depends on STM32H7_LPTIM4 ---help--- Reserve low-power timer 4 for use by the capture driver. @@ -4987,6 +5007,7 @@ endif # STM32H7_LPTIM4_CAP config STM32H7_LPTIM5_CAP bool "LPTIM5 Capture" default n + select STM32H7_TIMX_CAP depends on STM32H7_LPTIM5 ---help--- Reserve low-power timer 5 for use by the capture driver. diff --git a/arch/arm/src/stm32h7/Make.defs b/arch/arm/src/stm32h7/Make.defs index 99ea4826e2..f83a080c94 100644 --- a/arch/arm/src/stm32h7/Make.defs +++ b/arch/arm/src/stm32h7/Make.defs @@ -144,6 +144,14 @@ ifeq ($(CONFIG_TIMER),y) CHIP_CSRCS += stm32_tim_lowerhalf.c endif +ifeq ($(CONFIG_STM32H7_TIMX_CAP),y) +CHIP_CSRCS += stm32_capture.c +endif + +ifeq ($(CONFIG_CAPTURE),y) +CHIP_CSRCS += stm32_capture_lowerhalf.c +endif + ifeq ($(CONFIG_STM32H7_LTDC),y) CHIP_CSRCS += stm32_ltdc.c endif diff --git a/arch/arm/src/stm32h7/stm32_capture.c b/arch/arm/src/stm32h7/stm32_capture.c index 1cc71acd0c..7f2677f63e 100644 --- a/arch/arm/src/stm32h7/stm32_capture.c +++ b/arch/arm/src/stm32h7/stm32_capture.c @@ -59,15 +59,7 @@ * intended for some other purpose. */ -#if defined(CONFIG_STM32H7_TIM1_CAP) || defined(CONFIG_STM32H7_TIM2_CAP) || \ - defined(CONFIG_STM32H7_TIM3_CAP) || defined(CONFIG_STM32H7_TIM4_CAP) || \ - defined(CONFIG_STM32H7_TIM5_CAP) || defined(CONFIG_STM32H7_TIM8_CAP) || \ - defined(CONFIG_STM32H7_TIM12_CAP) || defined(CONFIG_STM32H7_TIM13_CAP) || \ - defined(CONFIG_STM32H7_TIM14_CAP) || defined(CONFIG_STM32H7_TIM15_CAP) || \ - defined(CONFIG_STM32H7_TIM16_CAP) || defined(CONFIG_STM32H7_TIM17_CAP) || \ - defined(CONFIG_STM32H7_LPTIM1_CAP) || defined(CONFIG_STM32H7_LPTIM2_CAP) || \ - defined(CONFIG_STM32H7_LPTIM3_CAP) || defined(CONFIG_STM32H7_LPTIM4_CAP) || \ - defined(CONFIG_STM32H7_LPTIM5_CAP) +#if defined(CONFIG_STM32H7_TIMX_CAP) /* Check if any channel is enabled. * This is done to simplify the logic below.