This is an automated email from the ASF dual-hosted git repository. xiaoxiang781216 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit f6cc311d6eac0ead90320cb2ee80a619ac9004de Author: raiden00pl <[email protected]> AuthorDate: Tue Nov 3 11:00:24 2026 +0100 boards/nucleo-g070rb: Register the timers with the board common code. TIM6 and TIM7 were registered as /dev/timer0 and /dev/timer1 by the board. nsh now uses BOARD_STM32_COMMON_TIM6_TIMER, which registers /dev/timer6. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: raiden00pl <[email protected]> --- .../stm32g0/nucleo-g070rb/configs/nsh/defconfig | 2 + .../arm/stm32g0/nucleo-g070rb/src/CMakeLists.txt | 4 -- boards/arm/stm32g0/nucleo-g070rb/src/Make.defs | 4 -- .../arm/stm32g0/nucleo-g070rb/src/nucleo-g070rb.h | 21 ------ .../arm/stm32g0/nucleo-g070rb/src/stm32_bringup.c | 24 ------- boards/arm/stm32g0/nucleo-g070rb/src/stm32_timer.c | 81 ---------------------- 6 files changed, 2 insertions(+), 134 deletions(-) diff --git a/boards/arm/stm32g0/nucleo-g070rb/configs/nsh/defconfig b/boards/arm/stm32g0/nucleo-g070rb/configs/nsh/defconfig index 42f97cfc62a..6b40333c387 100644 --- a/boards/arm/stm32g0/nucleo-g070rb/configs/nsh/defconfig +++ b/boards/arm/stm32g0/nucleo-g070rb/configs/nsh/defconfig @@ -18,6 +18,7 @@ CONFIG_ARCH_CHIP_STM32G0=y CONFIG_ARCH_IRQBUTTONS=y CONFIG_ARCH_STACKDUMP=y CONFIG_BOARD_LOOPSPERMSEC=2796 +CONFIG_BOARD_STM32_COMMON_TIM6_TIMER=y CONFIG_BUILTIN=y CONFIG_DEBUG_FULLOPT=y CONFIG_DEBUG_SYMBOLS=y @@ -32,6 +33,7 @@ CONFIG_EXAMPLES_GPIO=y CONFIG_EXAMPLES_HELLO=y CONFIG_EXAMPLES_PWM=y CONFIG_EXAMPLES_TIMER=y +CONFIG_EXAMPLES_TIMER_DEVNAME="/dev/timer6" CONFIG_I2C=y CONFIG_I2CTOOL_MAXADDR=0xff CONFIG_I2CTOOL_MINADDR=0x00 diff --git a/boards/arm/stm32g0/nucleo-g070rb/src/CMakeLists.txt b/boards/arm/stm32g0/nucleo-g070rb/src/CMakeLists.txt index be5dd5b81a9..4eec980be83 100644 --- a/boards/arm/stm32g0/nucleo-g070rb/src/CMakeLists.txt +++ b/boards/arm/stm32g0/nucleo-g070rb/src/CMakeLists.txt @@ -38,10 +38,6 @@ if(CONFIG_PWM) list(APPEND SRCS stm32_pwm.c) endif() -if(CONFIG_TIMER) - list(APPEND SRCS stm32_timer.c) -endif() - target_sources(board PRIVATE ${SRCS}) set_property(GLOBAL PROPERTY LD_SCRIPT "${NUTTX_BOARD_DIR}/scripts/ld.script") diff --git a/boards/arm/stm32g0/nucleo-g070rb/src/Make.defs b/boards/arm/stm32g0/nucleo-g070rb/src/Make.defs index 60c597b0c01..691a9eed165 100644 --- a/boards/arm/stm32g0/nucleo-g070rb/src/Make.defs +++ b/boards/arm/stm32g0/nucleo-g070rb/src/Make.defs @@ -38,10 +38,6 @@ ifeq ($(CONFIG_PWM),y) CSRCS += stm32_pwm.c endif -ifeq ($(CONFIG_TIMER),y) -CSRCS += stm32_timer.c -endif - DEPPATH += --dep-path board VPATH += :board CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board diff --git a/boards/arm/stm32g0/nucleo-g070rb/src/nucleo-g070rb.h b/boards/arm/stm32g0/nucleo-g070rb/src/nucleo-g070rb.h index 7db19ce4ced..84a19c4be5e 100644 --- a/boards/arm/stm32g0/nucleo-g070rb/src/nucleo-g070rb.h +++ b/boards/arm/stm32g0/nucleo-g070rb/src/nucleo-g070rb.h @@ -126,27 +126,6 @@ int stm32_gpio_initialize(void); int stm32_pwm_setup(void); #endif -/**************************************************************************** - * Name: stm32_timer_driver_setup - * - * Description: - * Configure the timer driver. - * - * Input Parameters: - * devpath - The full path to the timer device. This should be of the - * form /dev/timer0 - * timer - The timer's number. - * - * Returned Value: - * Zero (OK) is returned on success; A negated errno value is returned - * to indicate the nature of any failure. - * - ****************************************************************************/ - -#ifdef CONFIG_TIMER -int stm32_timer_driver_setup(const char *devpath, int timer); -#endif - /**************************************************************************** * Name: stm32_bringup * diff --git a/boards/arm/stm32g0/nucleo-g070rb/src/stm32_bringup.c b/boards/arm/stm32g0/nucleo-g070rb/src/stm32_bringup.c index 808197bac5b..4b939ddb87b 100644 --- a/boards/arm/stm32g0/nucleo-g070rb/src/stm32_bringup.c +++ b/boards/arm/stm32g0/nucleo-g070rb/src/stm32_bringup.c @@ -123,30 +123,6 @@ int stm32_bringup(void) } #endif -#ifdef CONFIG_TIMER - /* Initialize basic timers */ - -#if defined(CONFIG_STM32_TIM6) - syslog(LOG_ERR, "Init timer\n"); - ret = stm32_timer_driver_setup("/dev/timer0", 6); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: stm32_timer_driver_setup failed. TIM6: %d\n", - ret); - } -#endif - -#if defined(CONFIG_STM32_TIM7) - ret = stm32_timer_driver_setup("/dev/timer1", 7); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: stm32_timer_driver_setup failed. TIM7: %d\n", - ret); - } - -#endif -#endif - #if defined(CONFIG_PWM) /* Initialize PWM and register the PWM device */ diff --git a/boards/arm/stm32g0/nucleo-g070rb/src/stm32_timer.c b/boards/arm/stm32g0/nucleo-g070rb/src/stm32_timer.c deleted file mode 100644 index 886e6f72ca0..00000000000 --- a/boards/arm/stm32g0/nucleo-g070rb/src/stm32_timer.c +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** - * boards/arm/stm32g0/nucleo-g070rb/src/stm32_timer.c - * - * SPDX-License-Identifier: BSD-3-Clause - * SPDX-FileCopyrightText: Fundação CERTI. All rights reserved. - * SPDX-FileContributor: Daniel Pereira Volpato <[email protected]> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************/ - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include <nuttx/config.h> -#include <nuttx/timers/timer.h> - -#include <nuttx/debug.h> - -#include "stm32_tim.h" -#include "nucleo-g070rb.h" - -#ifdef CONFIG_TIMER - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: stm32_timer_driver_setup - * - * Description: - * Configure the timer driver. - * - * Input Parameters: - * devpath - The full path to the timer device. This should be of the form - * /dev/timer0 - * timer - The timer's number. - * - * Returned Value: - * Zero (OK) is returned on success; A negated errno value is returned - * to indicate the nature of any failure. - * - ****************************************************************************/ - -int stm32_timer_driver_setup(const char *devpath, int timer) -{ - return stm32_timer_initialize(devpath, timer); -} - -#endif /* CONFIG_TIMER */
