This is an automated email from the ASF dual-hosted git repository.

linguini1 pushed a commit to branch releases/13.0
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/releases/13.0 by this push:
     new 3470f2bad3d arch/stm32: commonize stm32_waste across all STM32 
families.
3470f2bad3d is described below

commit 3470f2bad3d2681c9d546037474c39dfc5bb89fd
Author: raiden00pl <[email protected]>
AuthorDate: Sat May 30 18:13:45 2026 +0200

    arch/stm32: commonize stm32_waste across all STM32 families.
    
    Remove duplicated family-local *_waste.c/.h copies (stm32l4, stm32l5, 
stm32wb,
    stm32wl5, stm32u5, stm32f7) and use common implementation.
    
    Signed-off-by: raiden00pl <[email protected]>
---
 arch/arm/src/common/stm32/CMakeLists.txt           |  5 +-
 arch/arm/src/common/stm32/Make.defs                |  5 +-
 .../src/{stm32f7 => common/stm32}/stm32_waste.c    |  2 +-
 arch/arm/src/common/stm32/stm32_waste_m3m4_v1.c    | 44 ---------------
 arch/arm/src/stm32f7/CMakeLists.txt                |  5 +-
 arch/arm/src/stm32f7/Make.defs                     |  5 +-
 arch/arm/src/stm32f7/stm32_waste.h                 | 66 ----------------------
 arch/arm/src/stm32l4/CMakeLists.txt                |  3 +-
 arch/arm/src/stm32l4/Make.defs                     |  5 +-
 arch/arm/src/stm32l4/stm32l4_flash.c               |  2 +-
 arch/arm/src/stm32l4/stm32l4_i2c.c                 |  2 +-
 arch/arm/src/stm32l4/stm32l4_lse.c                 |  2 +-
 arch/arm/src/stm32l4/stm32l4_rcc.c                 |  2 +-
 arch/arm/src/stm32l4/stm32l4_waste.c               | 44 ---------------
 arch/arm/src/stm32l4/stm32l4_waste.h               | 66 ----------------------
 arch/arm/src/stm32l5/CMakeLists.txt                |  3 +-
 arch/arm/src/stm32l5/Make.defs                     |  5 +-
 arch/arm/src/stm32l5/stm32l5_flash.c               |  2 +-
 arch/arm/src/stm32l5/stm32l5_lse.c                 |  2 +-
 arch/arm/src/stm32l5/stm32l5_rcc.c                 |  2 +-
 arch/arm/src/stm32l5/stm32l5_waste.h               | 66 ----------------------
 arch/arm/src/stm32u5/CMakeLists.txt                |  3 +-
 arch/arm/src/stm32u5/Make.defs                     |  5 +-
 arch/arm/src/stm32u5/stm32_waste.c                 | 44 ---------------
 arch/arm/src/stm32u5/stm32_waste.h                 | 66 ----------------------
 arch/arm/src/stm32wb/CMakeLists.txt                |  3 +-
 arch/arm/src/stm32wb/Make.defs                     |  5 +-
 arch/arm/src/stm32wb/stm32wb_flash.c               |  2 +-
 arch/arm/src/stm32wb/stm32wb_i2c.c                 |  2 +-
 arch/arm/src/stm32wb/stm32wb_rcc_lse.c             |  2 +-
 arch/arm/src/stm32wb/stm32wb_waste.h               | 66 ----------------------
 arch/arm/src/stm32wl5/CMakeLists.txt               |  3 +-
 arch/arm/src/stm32wl5/Make.defs                    |  5 +-
 arch/arm/src/stm32wl5/stm32wl5_flash.c             |  2 +-
 arch/arm/src/stm32wl5/stm32wl5_lse.c               |  2 +-
 arch/arm/src/stm32wl5/stm32wl5_rcc.c               |  2 +-
 arch/arm/src/stm32wl5/stm32wl5_waste.h             | 65 ---------------------
 37 files changed, 53 insertions(+), 562 deletions(-)

diff --git a/arch/arm/src/common/stm32/CMakeLists.txt 
b/arch/arm/src/common/stm32/CMakeLists.txt
index 34640d535af..a46ebc57005 100644
--- a/arch/arm/src/common/stm32/CMakeLists.txt
+++ b/arch/arm/src/common/stm32/CMakeLists.txt
@@ -29,6 +29,10 @@ endif()
 
 set(SRCS)
 
+# Architecture-neutral sources used by every STM32 family
+
+list(APPEND SRCS stm32_waste.c)
+
 if(CONFIG_STM32_COMMON_LEGACY)
   list(
     APPEND
@@ -38,7 +42,6 @@ if(CONFIG_STM32_COMMON_LEGACY)
     stm32_lse_m3m4_v1.c
     stm32_lsi_m3m4_v1.c
     stm32_irq_m3m4_v1.c
-    stm32_waste_m3m4_v1.c
     stm32_capture_m3m4_v1.c)
 
   if(CONFIG_STM32_HAVE_IP_GPIO_M3M4_V1)
diff --git a/arch/arm/src/common/stm32/Make.defs 
b/arch/arm/src/common/stm32/Make.defs
index 729ce0b5983..2939660ae8a 100644
--- a/arch/arm/src/common/stm32/Make.defs
+++ b/arch/arm/src/common/stm32/Make.defs
@@ -37,6 +37,10 @@ ARCHXXINCLUDES += ${INCDIR_PREFIX}$(STM32_COMMON_SRCDIR)
 #    the M3/M4 block because the other Cortex-M4 families (L4/WB/WL5) include
 #    this file too but provide their own implementation.
 
+# Architecture-neutral sources used by every STM32 family
+
+CHIP_CSRCS += stm32_waste.c
+
 ifeq ($(CONFIG_STM32_COMMON_LEGACY),y)
 
 CHIP_CSRCS += stm32_allocateheap_m3m4_v1.c
@@ -81,7 +85,6 @@ endif
 ifeq ($(CONFIG_STM32_HAVE_IP_TIMERS),y)
 CHIP_CSRCS += stm32_tim_m3m4_v1v2v3.c
 endif
-CHIP_CSRCS += stm32_waste_m3m4_v1.c
 ifeq ($(CONFIG_STM32_HAVE_IP_CCM_M3M4_V1),y)
 CHIP_CSRCS += stm32_ccm_m3m4_v1.c
 endif
diff --git a/arch/arm/src/stm32f7/stm32_waste.c 
b/arch/arm/src/common/stm32/stm32_waste.c
similarity index 97%
rename from arch/arm/src/stm32f7/stm32_waste.c
rename to arch/arm/src/common/stm32/stm32_waste.c
index 5bbc052d872..afe7b826619 100644
--- a/arch/arm/src/stm32f7/stm32_waste.c
+++ b/arch/arm/src/common/stm32/stm32_waste.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * arch/arm/src/stm32f7/stm32_waste.c
+ * arch/arm/src/common/stm32/stm32_waste.c
  *
  * SPDX-License-Identifier: Apache-2.0
  *
diff --git a/arch/arm/src/common/stm32/stm32_waste_m3m4_v1.c 
b/arch/arm/src/common/stm32/stm32_waste_m3m4_v1.c
deleted file mode 100644
index b689d1d91b0..00000000000
--- a/arch/arm/src/common/stm32/stm32_waste_m3m4_v1.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/****************************************************************************
- * arch/arm/src/common/stm32/stm32_waste_m3m4_v1.c
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.  The
- * ASF licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
- * License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
- * License for the specific language governing permissions and limitations
- * under the License.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-#include <stdint.h>
-#include "stm32_waste.h"
-
-/****************************************************************************
- * Public Data
- ****************************************************************************/
-
-uint32_t g_waste_counter = 0;
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-void stm32_waste(void)
-{
-  g_waste_counter++;
-}
diff --git a/arch/arm/src/stm32f7/CMakeLists.txt 
b/arch/arm/src/stm32f7/CMakeLists.txt
index 265a7421098..65bec6f53ff 100644
--- a/arch/arm/src/stm32f7/CMakeLists.txt
+++ b/arch/arm/src/stm32f7/CMakeLists.txt
@@ -34,8 +34,7 @@ list(
   stm32_serial.c
   stm32_start.c
   stm32_capture.c
-  stm32_uid.c
-  stm32_waste.c)
+  stm32_uid.c)
 
 if(CONFIG_STM32_TICKLESS_TIMER)
   list(APPEND SRCS stm32_tickless.c)
@@ -189,3 +188,5 @@ if(CONFIG_STM32_FOC)
 endif()
 
 target_sources(arch PRIVATE ${SRCS})
+
+add_subdirectory(${NUTTX_DIR}/arch/arm/src/common/stm32 stm32_common)
diff --git a/arch/arm/src/stm32f7/Make.defs b/arch/arm/src/stm32f7/Make.defs
index b9b5fdb7467..816b0e859e4 100644
--- a/arch/arm/src/stm32f7/Make.defs
+++ b/arch/arm/src/stm32f7/Make.defs
@@ -26,12 +26,13 @@
 # Common ARM and Cortex-M7 files
 
 include armv7-m/Make.defs
+include common/stm32/Make.defs
 
 # Required STM32F7 files
 
-CHIP_CSRCS  = stm32_allocateheap.c stm32_exti_gpio.c stm32_gpio.c
+CHIP_CSRCS += stm32_allocateheap.c stm32_exti_gpio.c stm32_gpio.c
 CHIP_CSRCS += stm32_irq.c stm32_lowputc.c stm32_rcc.c stm32_serial.c
-CHIP_CSRCS += stm32_start.c stm32_capture.c stm32_uid.c stm32_waste.c
+CHIP_CSRCS += stm32_start.c stm32_capture.c stm32_uid.c
 
 ifneq ($(CONFIG_SCHED_TICKLESS),y)
 CHIP_CSRCS += stm32_timerisr.c
diff --git a/arch/arm/src/stm32f7/stm32_waste.h 
b/arch/arm/src/stm32f7/stm32_waste.h
deleted file mode 100644
index 96eb7e6b40b..00000000000
--- a/arch/arm/src/stm32f7/stm32_waste.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/****************************************************************************
- * arch/arm/src/stm32f7/stm32_waste.h
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.  The
- * ASF licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
- * License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
- * License for the specific language governing permissions and limitations
- * under the License.
- *
- ****************************************************************************/
-
-#ifndef __ARCH_ARM_SRC_STM32_STM32_WASTE_H
-#define __ARCH_ARM_SRC_STM32_STM32_WASTE_H
-
-/* Waste CPU Time */
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-#ifndef __ASSEMBLY__
-
-#undef EXTERN
-#if defined(__cplusplus)
-#define EXTERN extern "C"
-extern "C"
-{
-#else
-#define EXTERN extern
-#endif
-
-/****************************************************************************
- * Public Function Prototypes
- ****************************************************************************/
-
-/* Waste CPU Time
- *
- *  stm32_waste() is the logic that will be executed when portions of kernel
- *  or user-app is polling some register or similar, waiting for desired
- *  status. This time is wasted away.  This function offers a measure of
- *  badly written piece of software or some undesired behavior.
- *
- *  At the same time this function adds to some IDLE time which portion
- *  cannot be used for other purposes (yet).
- */
-
-void stm32_waste(void);
-
-#undef EXTERN
-#if defined(__cplusplus)
-}
-#endif
-
-#endif /* __ASSEMBLY__ */
-#endif /* __ARCH_ARM_SRC_STM32_STM32_WASTE_H */
diff --git a/arch/arm/src/stm32l4/CMakeLists.txt 
b/arch/arm/src/stm32l4/CMakeLists.txt
index f27e4933b24..672fa1cf49b 100644
--- a/arch/arm/src/stm32l4/CMakeLists.txt
+++ b/arch/arm/src/stm32l4/CMakeLists.txt
@@ -33,7 +33,6 @@ list(
   stm32l4_rcc.c
   stm32l4_serial.c
   stm32l4_start.c
-  stm32l4_waste.c
   stm32l4_uid.c
   stm32l4_spi.c
   stm32l4_i2c.c
@@ -197,3 +196,5 @@ if(CONFIG_STM32_1WIREDRIVER)
 endif()
 
 target_sources(arch PRIVATE ${SRCS})
+
+add_subdirectory(${NUTTX_DIR}/arch/arm/src/common/stm32 stm32_common)
diff --git a/arch/arm/src/stm32l4/Make.defs b/arch/arm/src/stm32l4/Make.defs
index d7609705c50..05a5f419064 100644
--- a/arch/arm/src/stm32l4/Make.defs
+++ b/arch/arm/src/stm32l4/Make.defs
@@ -26,12 +26,13 @@
 # Common ARM and Cortex-M4 files (copied from stm32/Make.defs)
 
 include armv7-m/Make.defs
+include common/stm32/Make.defs
 
 # Required STM32L4 files
 
-CHIP_CSRCS  = stm32l4_allocateheap.c stm32l4_exti_gpio.c stm32l4_gpio.c
+CHIP_CSRCS += stm32l4_allocateheap.c stm32l4_exti_gpio.c stm32l4_gpio.c
 CHIP_CSRCS += stm32l4_irq.c stm32l4_lowputc.c stm32l4_rcc.c
-CHIP_CSRCS += stm32l4_serial.c stm32l4_start.c stm32l4_waste.c stm32l4_uid.c
+CHIP_CSRCS += stm32l4_serial.c stm32l4_start.c stm32l4_uid.c
 CHIP_CSRCS += stm32l4_spi.c stm32l4_i2c.c stm32l4_lse.c stm32l4_lsi.c
 CHIP_CSRCS += stm32l4_pwr.c stm32l4_tim.c stm32l4_flash.c
 CHIP_CSRCS += stm32l4_dfumode.c
diff --git a/arch/arm/src/stm32l4/stm32l4_flash.c 
b/arch/arm/src/stm32l4/stm32l4_flash.c
index 6905cd47afe..299199b5bb5 100644
--- a/arch/arm/src/stm32l4/stm32l4_flash.c
+++ b/arch/arm/src/stm32l4/stm32l4_flash.c
@@ -46,7 +46,7 @@
 #include <sys/param.h>
 
 #include "stm32l4_rcc.h"
-#include "stm32l4_waste.h"
+#include "stm32_waste.h"
 #include "stm32l4_flash.h"
 #include "arm_internal.h"
 
diff --git a/arch/arm/src/stm32l4/stm32l4_i2c.c 
b/arch/arm/src/stm32l4/stm32l4_i2c.c
index a7ad24d6416..235ae86b9ff 100644
--- a/arch/arm/src/stm32l4/stm32l4_i2c.c
+++ b/arch/arm/src/stm32l4/stm32l4_i2c.c
@@ -268,7 +268,7 @@
 #include "stm32l4_gpio.h"
 #include "stm32l4_rcc.h"
 #include "stm32l4_i2c.h"
-#include "stm32l4_waste.h"
+#include "stm32_waste.h"
 
 /* At least one I2C peripheral must be enabled */
 
diff --git a/arch/arm/src/stm32l4/stm32l4_lse.c 
b/arch/arm/src/stm32l4/stm32l4_lse.c
index c273c49d3e8..bd434cf69f3 100644
--- a/arch/arm/src/stm32l4/stm32l4_lse.c
+++ b/arch/arm/src/stm32l4/stm32l4_lse.c
@@ -29,7 +29,7 @@
 #include "arm_internal.h"
 #include "stm32l4_pwr.h"
 #include "stm32l4_rcc.h"
-#include "stm32l4_waste.h"
+#include "stm32_waste.h"
 
 /****************************************************************************
  * Pre-processor Definitions
diff --git a/arch/arm/src/stm32l4/stm32l4_rcc.c 
b/arch/arm/src/stm32l4/stm32l4_rcc.c
index 26830f433d5..f50e55aa0c7 100644
--- a/arch/arm/src/stm32l4/stm32l4_rcc.c
+++ b/arch/arm/src/stm32l4/stm32l4_rcc.c
@@ -38,7 +38,7 @@
 #include "stm32l4_rcc.h"
 #include "stm32l4_flash.h"
 #include "stm32.h"
-#include "stm32l4_waste.h"
+#include "stm32_waste.h"
 #include "stm32l4_rtc.h"
 
 /* Include chip-specific clocking initialization logic */
diff --git a/arch/arm/src/stm32l4/stm32l4_waste.c 
b/arch/arm/src/stm32l4/stm32l4_waste.c
deleted file mode 100644
index 054d0324afe..00000000000
--- a/arch/arm/src/stm32l4/stm32l4_waste.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/****************************************************************************
- * arch/arm/src/stm32l4/stm32l4_waste.c
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.  The
- * ASF licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
- * License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
- * License for the specific language governing permissions and limitations
- * under the License.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-#include <stdint.h>
-#include "stm32l4_waste.h"
-
-/****************************************************************************
- * Public Data
- ****************************************************************************/
-
-uint32_t g_waste_counter = 0;
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-void stm32_waste(void)
-{
-  g_waste_counter++;
-}
diff --git a/arch/arm/src/stm32l4/stm32l4_waste.h 
b/arch/arm/src/stm32l4/stm32l4_waste.h
deleted file mode 100644
index 6281c7dbde0..00000000000
--- a/arch/arm/src/stm32l4/stm32l4_waste.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/****************************************************************************
- * arch/arm/src/stm32l4/stm32l4_waste.h
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.  The
- * ASF licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
- * License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
- * License for the specific language governing permissions and limitations
- * under the License.
- *
- ****************************************************************************/
-
-#ifndef __ARCH_ARM_SRC_STM32L4_STM32L4_WASTE_H
-#define __ARCH_ARM_SRC_STM32L4_STM32L4_WASTE_H
-
-/* Waste CPU Time */
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-#ifndef __ASSEMBLY__
-
-#undef EXTERN
-#if defined(__cplusplus)
-#define EXTERN extern "C"
-extern "C"
-{
-#else
-#define EXTERN extern
-#endif
-
-/****************************************************************************
- * Public Function Prototypes
- ****************************************************************************/
-
-/* Waste CPU Time
- *
- *   stm32_waste() is the logic that will be executed when portions of
- *   kernel or user-app is polling some register or similar, waiting for
- *   desired status. This time is wasted away. This function offers a
- *   measure of badly written piece of software or some undesired behavior.
- *
- *   At the same time this function adds to some IDLE time which portion
- *   cannot be used for other purposes (yet).
- */
-
-void stm32_waste(void);
-
-#undef EXTERN
-#if defined(__cplusplus)
-}
-#endif
-
-#endif /* __ASSEMBLY__ */
-#endif /* __ARCH_ARM_SRC_STM32L4_STM32L4_WASTE_H */
diff --git a/arch/arm/src/stm32l5/CMakeLists.txt 
b/arch/arm/src/stm32l5/CMakeLists.txt
index 4f10e5e8aa1..0e2a8694a92 100644
--- a/arch/arm/src/stm32l5/CMakeLists.txt
+++ b/arch/arm/src/stm32l5/CMakeLists.txt
@@ -33,7 +33,6 @@ list(
   stm32l5_rcc.c
   stm32l5_serial.c
   stm32l5_start.c
-  stm32l5_waste.c
   stm32l5_uid.c
   stm32l5_spi.c
   stm32l5_lse.c
@@ -66,3 +65,5 @@ if(CONFIG_STM32_STM32L562XX)
 endif()
 
 target_sources(arch PRIVATE ${SRCS})
+
+add_subdirectory(${NUTTX_DIR}/arch/arm/src/common/stm32 stm32_common)
diff --git a/arch/arm/src/stm32l5/Make.defs b/arch/arm/src/stm32l5/Make.defs
index 4c69a8265bc..80d2655d84d 100644
--- a/arch/arm/src/stm32l5/Make.defs
+++ b/arch/arm/src/stm32l5/Make.defs
@@ -28,13 +28,14 @@ HEAD_ASRC =
 # Common ARM and Cortex-M4 files (copied from stm32/Make.defs)
 
 include armv8-m/Make.defs
+include common/stm32/Make.defs
 
 # Required STM32L5 files
 
 CHIP_ASRCS  =
-CHIP_CSRCS  = stm32l5_allocateheap.c stm32l5_exti_gpio.c stm32l5_gpio.c
+CHIP_CSRCS += stm32l5_allocateheap.c stm32l5_exti_gpio.c stm32l5_gpio.c
 CHIP_CSRCS += stm32l5_irq.c stm32l5_lowputc.c stm32l5_rcc.c
-CHIP_CSRCS += stm32l5_serial.c stm32l5_start.c stm32l5_waste.c stm32l5_uid.c
+CHIP_CSRCS += stm32l5_serial.c stm32l5_start.c stm32l5_uid.c
 CHIP_CSRCS += stm32l5_spi.c stm32l5_lse.c stm32l5_lsi.c
 CHIP_CSRCS += stm32l5_pwr.c stm32l5_tim.c stm32l5_flash.c stm32l5_timerisr.c
 
diff --git a/arch/arm/src/stm32l5/stm32l5_flash.c 
b/arch/arm/src/stm32l5/stm32l5_flash.c
index f4182f8239a..78d9e669f16 100644
--- a/arch/arm/src/stm32l5/stm32l5_flash.c
+++ b/arch/arm/src/stm32l5/stm32l5_flash.c
@@ -46,7 +46,7 @@
 #include <nuttx/mutex.h>
 
 #include "stm32l5_rcc.h"
-#include "stm32l5_waste.h"
+#include "stm32_waste.h"
 #include "stm32l5_flash.h"
 #include "arm_internal.h"
 
diff --git a/arch/arm/src/stm32l5/stm32l5_lse.c 
b/arch/arm/src/stm32l5/stm32l5_lse.c
index 0a18e77e627..88a4c676ea1 100644
--- a/arch/arm/src/stm32l5/stm32l5_lse.c
+++ b/arch/arm/src/stm32l5/stm32l5_lse.c
@@ -31,7 +31,7 @@
 #include "arm_internal.h"
 #include "stm32l5_pwr.h"
 #include "stm32l5_rcc.h"
-#include "stm32l5_waste.h"
+#include "stm32_waste.h"
 
 /****************************************************************************
  * Pre-processor Definitions
diff --git a/arch/arm/src/stm32l5/stm32l5_rcc.c 
b/arch/arm/src/stm32l5/stm32l5_rcc.c
index b624e1aed3d..bf74e79a0c4 100644
--- a/arch/arm/src/stm32l5/stm32l5_rcc.c
+++ b/arch/arm/src/stm32l5/stm32l5_rcc.c
@@ -38,7 +38,7 @@
 #include "stm32l5_rcc.h"
 #include "stm32l5_flash.h"
 #include "stm32.h"
-#include "stm32l5_waste.h"
+#include "stm32_waste.h"
 
 /****************************************************************************
  * Pre-processor Definitions
diff --git a/arch/arm/src/stm32l5/stm32l5_waste.h 
b/arch/arm/src/stm32l5/stm32l5_waste.h
deleted file mode 100644
index 2f7b068ed28..00000000000
--- a/arch/arm/src/stm32l5/stm32l5_waste.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/****************************************************************************
- * arch/arm/src/stm32l5/stm32l5_waste.h
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.  The
- * ASF licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
- * License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
- * License for the specific language governing permissions and limitations
- * under the License.
- *
- ****************************************************************************/
-
-#ifndef __ARCH_ARM_SRC_STM32L5_STM32L5_WASTE_H
-#define __ARCH_ARM_SRC_STM32L5_STM32L5_WASTE_H
-
-/* Waste CPU Time */
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-#ifndef __ASSEMBLY__
-
-#undef EXTERN
-#if defined(__cplusplus)
-#define EXTERN extern "C"
-extern "C"
-{
-#else
-#define EXTERN extern
-#endif
-
-/****************************************************************************
- * Public Function Prototypes
- ****************************************************************************/
-
-/* Waste CPU Time
- *
- * stm32_waste() is the logic that will be executed when portions of kernel
- * or user-app is polling some register or similar, waiting for desired
- * status. This time is wasted away. This function offers a measure of badly
- * written piece of software or some undesired behavior.
- *
- * At the same time this function adds to some IDLE time which portion
- * cannot be used for other purposes (yet).
- */
-
-void stm32_waste(void);
-
-#undef EXTERN
-#if defined(__cplusplus)
-}
-#endif
-
-#endif /* __ASSEMBLY__ */
-#endif /* __ARCH_ARM_SRC_STM32L5_STM32L5_WASTE_H */
diff --git a/arch/arm/src/stm32u5/CMakeLists.txt 
b/arch/arm/src/stm32u5/CMakeLists.txt
index 73e71736950..1fd0658ffbe 100644
--- a/arch/arm/src/stm32u5/CMakeLists.txt
+++ b/arch/arm/src/stm32u5/CMakeLists.txt
@@ -30,7 +30,6 @@ set(SRCS
     stm32_i2c.c
     stm32_serial.c
     stm32_start.c
-    stm32_waste.c
     stm32_uid.c
     stm32_spi.c
     stm32_lse.c
@@ -62,3 +61,5 @@ if(CONFIG_USBDEV)
 endif()
 
 target_sources(arch PRIVATE ${SRCS})
+
+add_subdirectory(${NUTTX_DIR}/arch/arm/src/common/stm32 stm32_common)
diff --git a/arch/arm/src/stm32u5/Make.defs b/arch/arm/src/stm32u5/Make.defs
index 5247b22d5d5..de127a90476 100644
--- a/arch/arm/src/stm32u5/Make.defs
+++ b/arch/arm/src/stm32u5/Make.defs
@@ -28,13 +28,14 @@ HEAD_ASRC =
 # Common ARM and Cortex-M4 files (copied from stm32/Make.defs)
 
 include armv8-m/Make.defs
+include common/stm32/Make.defs
 
 # Required STM32U5 files
 
 CHIP_ASRCS  =
-CHIP_CSRCS  = stm32_allocateheap.c stm32_exti_gpio.c stm32_gpio.c
+CHIP_CSRCS += stm32_allocateheap.c stm32_exti_gpio.c stm32_gpio.c
 CHIP_CSRCS += stm32_irq.c stm32_lowputc.c stm32_rcc.c stm32_i2c.c
-CHIP_CSRCS += stm32_serial.c stm32_start.c stm32_waste.c stm32_uid.c
+CHIP_CSRCS += stm32_serial.c stm32_start.c stm32_uid.c
 CHIP_CSRCS += stm32_spi.c stm32_lse.c stm32_lsi.c stm32u5xx_rcc.c
 CHIP_CSRCS += stm32_pwr.c stm32_tim.c stm32_flash.c stm32_timerisr.c
 
diff --git a/arch/arm/src/stm32u5/stm32_waste.c 
b/arch/arm/src/stm32u5/stm32_waste.c
deleted file mode 100644
index da56c6755ee..00000000000
--- a/arch/arm/src/stm32u5/stm32_waste.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/****************************************************************************
- * arch/arm/src/stm32u5/stm32_waste.c
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.  The
- * ASF licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
- * License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
- * License for the specific language governing permissions and limitations
- * under the License.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-#include <stdint.h>
-#include "stm32_waste.h"
-
-/****************************************************************************
- * Private Data
- ****************************************************************************/
-
-uint32_t idle_wastecounter = 0;
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-void stm32_waste(void)
-{
-  idle_wastecounter++;
-}
diff --git a/arch/arm/src/stm32u5/stm32_waste.h 
b/arch/arm/src/stm32u5/stm32_waste.h
deleted file mode 100644
index ab5a5c8a89b..00000000000
--- a/arch/arm/src/stm32u5/stm32_waste.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/****************************************************************************
- * arch/arm/src/stm32u5/stm32_waste.h
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.  The
- * ASF licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
- * License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
- * License for the specific language governing permissions and limitations
- * under the License.
- *
- ****************************************************************************/
-
-#ifndef __ARCH_ARM_SRC_STM32U5_STM32_WASTE_H
-#define __ARCH_ARM_SRC_STM32U5_STM32_WASTE_H
-
-/* Waste CPU Time */
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-#ifndef __ASSEMBLY__
-
-#undef EXTERN
-#if defined(__cplusplus)
-#define EXTERN extern "C"
-extern "C"
-{
-#else
-#define EXTERN extern
-#endif
-
-/****************************************************************************
- * Public Function Prototypes
- ****************************************************************************/
-
-/* Waste CPU Time
- *
- * stm32_waste() is the logic that will be executed when portions of kernel
- * or user-app is polling some register or similar, waiting for desired
- * status. This time is wasted away. This function offers a measure of badly
- * written piece of software or some undesired behavior.
- *
- * At the same time this function adds to some IDLE time which portion
- * cannot be used for other purposes (yet).
- */
-
-void stm32_waste(void);
-
-#undef EXTERN
-#if defined(__cplusplus)
-}
-#endif
-
-#endif /* __ASSEMBLY__ */
-#endif /* __ARCH_ARM_SRC_STM32U5_STM32_WASTE_H */
diff --git a/arch/arm/src/stm32wb/CMakeLists.txt 
b/arch/arm/src/stm32wb/CMakeLists.txt
index c9646782740..a4942012d1c 100644
--- a/arch/arm/src/stm32wb/CMakeLists.txt
+++ b/arch/arm/src/stm32wb/CMakeLists.txt
@@ -33,7 +33,6 @@ set(SRCS
     stm32wb_serial.c
     stm32wb_i2c.c
     stm32wb_start.c
-    stm32wb_waste.c
     stm32wb_rcc_lse.c
     stm32wb_rcc_lsi.c
     stm32wb_pwr.c
@@ -117,3 +116,5 @@ if(CONFIG_DEBUG_FEATURES)
 endif()
 
 target_sources(arch PRIVATE ${SRCS})
+
+add_subdirectory(${NUTTX_DIR}/arch/arm/src/common/stm32 stm32_common)
diff --git a/arch/arm/src/stm32wb/Make.defs b/arch/arm/src/stm32wb/Make.defs
index 2bf29ecfd14..304e8bd6b36 100644
--- a/arch/arm/src/stm32wb/Make.defs
+++ b/arch/arm/src/stm32wb/Make.defs
@@ -26,12 +26,13 @@
 # Common ARM and Cortex-M4 files (copied from stm32/Make.defs)
 
 include armv7-m/Make.defs
+include common/stm32/Make.defs
 
 # Required STM32WB files
 
-CHIP_CSRCS  = stm32wb_allocateheap.c stm32wb_exti_gpio.c stm32wb_gpio.c
+CHIP_CSRCS += stm32wb_allocateheap.c stm32wb_exti_gpio.c stm32wb_gpio.c
 CHIP_CSRCS += stm32wb_irq.c stm32wb_lowputc.c stm32wb_rcc.c stm32wb_spi.c
-CHIP_CSRCS += stm32wb_serial.c stm32wb_i2c.c stm32wb_start.c stm32wb_waste.c
+CHIP_CSRCS += stm32wb_serial.c stm32wb_i2c.c stm32wb_start.c
 CHIP_CSRCS += stm32wb_rcc_lse.c stm32wb_rcc_lsi.c
 CHIP_CSRCS += stm32wb_pwr.c stm32wb_tim.c
 CHIP_CSRCS += stm32wb_flash.c stm32wb_uid.c
diff --git a/arch/arm/src/stm32wb/stm32wb_flash.c 
b/arch/arm/src/stm32wb/stm32wb_flash.c
index 4b1baf8a7ae..e3d1b28d1eb 100644
--- a/arch/arm/src/stm32wb/stm32wb_flash.c
+++ b/arch/arm/src/stm32wb/stm32wb_flash.c
@@ -45,7 +45,7 @@
 
 #include "arm_internal.h"
 #include "stm32wb_rcc.h"
-#include "stm32wb_waste.h"
+#include "stm32_waste.h"
 #include "stm32wb_flash.h"
 
 #if !defined(CONFIG_STM32_FLASH_OVERRIDE_DEFAULT)
diff --git a/arch/arm/src/stm32wb/stm32wb_i2c.c 
b/arch/arm/src/stm32wb/stm32wb_i2c.c
index 50fdb01b3fd..e2c67abe444 100644
--- a/arch/arm/src/stm32wb/stm32wb_i2c.c
+++ b/arch/arm/src/stm32wb/stm32wb_i2c.c
@@ -186,7 +186,7 @@
 #include "stm32wb_gpio.h"
 #include "stm32wb_rcc.h"
 #include "stm32wb_i2c.h"
-#include "stm32wb_waste.h"
+#include "stm32_waste.h"
 
 /* At least one I2C peripheral must be enabled */
 
diff --git a/arch/arm/src/stm32wb/stm32wb_rcc_lse.c 
b/arch/arm/src/stm32wb/stm32wb_rcc_lse.c
index 8a830216564..f5af711a996 100644
--- a/arch/arm/src/stm32wb/stm32wb_rcc_lse.c
+++ b/arch/arm/src/stm32wb/stm32wb_rcc_lse.c
@@ -29,7 +29,7 @@
 #include "arm_internal.h"
 #include "stm32wb_pwr.h"
 #include "stm32wb_rcc.h"
-#include "stm32wb_waste.h"
+#include "stm32_waste.h"
 
 /****************************************************************************
  * Pre-processor Definitions
diff --git a/arch/arm/src/stm32wb/stm32wb_waste.h 
b/arch/arm/src/stm32wb/stm32wb_waste.h
deleted file mode 100644
index 66c493178f5..00000000000
--- a/arch/arm/src/stm32wb/stm32wb_waste.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/****************************************************************************
- * arch/arm/src/stm32wb/stm32wb_waste.h
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.  The
- * ASF licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
- * License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
- * License for the specific language governing permissions and limitations
- * under the License.
- *
- ****************************************************************************/
-
-#ifndef __ARCH_ARM_SRC_STM32WB_STM32WB_WASTE_H
-#define __ARCH_ARM_SRC_STM32WB_STM32WB_WASTE_H
-
-/* Waste CPU Time */
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-#ifndef __ASSEMBLY__
-
-#undef EXTERN
-#if defined(__cplusplus)
-#define EXTERN extern "C"
-extern "C"
-{
-#else
-#define EXTERN extern
-#endif
-
-/****************************************************************************
- * Public Function Prototypes
- ****************************************************************************/
-
-/* Waste CPU Time
- *
- *   stm32_waste() is the logic that will be executed when portions of
- *   kernel or user-app is polling some register or similar, waiting for
- *   desired status. This time is wasted away. This function offers a
- *   measure of badly written piece of software or some undesired behavior.
- *
- *   At the same time this function adds to some IDLE time which portion
- *   cannot be used for other purposes (yet).
- */
-
-void stm32_waste(void);
-
-#undef EXTERN
-#if defined(__cplusplus)
-}
-#endif
-
-#endif /* __ASSEMBLY__ */
-#endif /* __ARCH_ARM_SRC_STM32WB_STM32WB_WASTE_H */
diff --git a/arch/arm/src/stm32wl5/CMakeLists.txt 
b/arch/arm/src/stm32wl5/CMakeLists.txt
index cfee3e8c42e..a0fbfdb8ca0 100644
--- a/arch/arm/src/stm32wl5/CMakeLists.txt
+++ b/arch/arm/src/stm32wl5/CMakeLists.txt
@@ -31,7 +31,6 @@ set(SRCS
     stm32wl5_rcc.c
     stm32wl5_serial.c
     stm32wl5_start.c
-    stm32wl5_waste.c
     stm32wl5_uid.c
     stm32wl5_lse.c
     stm32wl5_lsi.c
@@ -47,3 +46,5 @@ if(CONFIG_STM32_IPCC)
 endif()
 
 target_sources(arch PRIVATE ${SRCS})
+
+add_subdirectory(${NUTTX_DIR}/arch/arm/src/common/stm32 stm32_common)
diff --git a/arch/arm/src/stm32wl5/Make.defs b/arch/arm/src/stm32wl5/Make.defs
index e0df51091d0..05dfb1790b6 100644
--- a/arch/arm/src/stm32wl5/Make.defs
+++ b/arch/arm/src/stm32wl5/Make.defs
@@ -26,12 +26,13 @@
 # Common ARM and Cortex-M4 files (copied from stm32/Make.defs)
 
 include armv7-m/Make.defs
+include common/stm32/Make.defs
 
 # Required STM32WL5 files
 
-CHIP_CSRCS  = stm32wl5_allocateheap.c stm32wl5_exti_gpio.c stm32wl5_gpio.c
+CHIP_CSRCS += stm32wl5_allocateheap.c stm32wl5_exti_gpio.c stm32wl5_gpio.c
 CHIP_CSRCS += stm32wl5_irq.c stm32wl5_lowputc.c stm32wl5_rcc.c
-CHIP_CSRCS += stm32wl5_serial.c stm32wl5_start.c stm32wl5_waste.c 
stm32wl5_uid.c
+CHIP_CSRCS += stm32wl5_serial.c stm32wl5_start.c stm32wl5_uid.c
 CHIP_CSRCS += stm32wl5_lse.c stm32wl5_lsi.c stm32wl5_idle.c
 CHIP_CSRCS += stm32wl5_pwr.c stm32wl5_tim.c stm32wl5_flash.c 
stm32wl5_timerisr.c
 CHIP_CSRCS += stm32wl5_spi.c
diff --git a/arch/arm/src/stm32wl5/stm32wl5_flash.c 
b/arch/arm/src/stm32wl5/stm32wl5_flash.c
index 40737cbe801..4c251c982dc 100644
--- a/arch/arm/src/stm32wl5/stm32wl5_flash.c
+++ b/arch/arm/src/stm32wl5/stm32wl5_flash.c
@@ -46,7 +46,7 @@
 #include <sys/param.h>
 
 #include "stm32wl5_rcc.h"
-#include "stm32wl5_waste.h"
+#include "stm32_waste.h"
 #include "stm32wl5_flash.h"
 #include "arm_internal.h"
 
diff --git a/arch/arm/src/stm32wl5/stm32wl5_lse.c 
b/arch/arm/src/stm32wl5/stm32wl5_lse.c
index 4ab6997b283..50857241ebc 100644
--- a/arch/arm/src/stm32wl5/stm32wl5_lse.c
+++ b/arch/arm/src/stm32wl5/stm32wl5_lse.c
@@ -32,7 +32,7 @@
 
 #include "stm32wl5_pwr.h"
 #include "stm32wl5_rcc.h"
-#include "stm32wl5_waste.h"
+#include "stm32_waste.h"
 
 /****************************************************************************
  * Pre-processor Definitions
diff --git a/arch/arm/src/stm32wl5/stm32wl5_rcc.c 
b/arch/arm/src/stm32wl5/stm32wl5_rcc.c
index 832c71e1ff0..4bd2376b79e 100644
--- a/arch/arm/src/stm32wl5/stm32wl5_rcc.c
+++ b/arch/arm/src/stm32wl5/stm32wl5_rcc.c
@@ -39,7 +39,7 @@
 #include "stm32wl5_rcc.h"
 #include "stm32wl5_flash.h"
 #include "stm32.h"
-#include "stm32wl5_waste.h"
+#include "stm32_waste.h"
 
 /****************************************************************************
  * Pre-processor Definitions
diff --git a/arch/arm/src/stm32wl5/stm32wl5_waste.h 
b/arch/arm/src/stm32wl5/stm32wl5_waste.h
deleted file mode 100644
index f79b8b1f591..00000000000
--- a/arch/arm/src/stm32wl5/stm32wl5_waste.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/****************************************************************************
- * arch/arm/src/stm32wl5/stm32wl5_waste.h
- *
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.  The
- * ASF licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
- * License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
- * License for the specific language governing permissions and limitations
- * under the License.
- *
- ****************************************************************************/
-
-#ifndef __ARCH_ARM_SRC_STM32WL5_STM32WL5_WASTE_H
-#define __ARCH_ARM_SRC_STM32WL5_STM32WL5_WASTE_H
-
-/* Waste CPU Time */
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-#ifndef __ASSEMBLY__
-
-#undef EXTERN
-#if defined(__cplusplus)
-#define EXTERN extern "C"
-extern "C"
-{
-#else
-#define EXTERN extern
-#endif
-
-/****************************************************************************
- * Public Function Prototypes
- ****************************************************************************/
-
-/* Waste CPU Time
- *
- * stm32_waste() is the logic that will be executed when portions of
- * kernel or user-app is polling some register or similar, waiting for
- * desired status. This time is wasted away. This function offers a measure
- * of badly written piece of software or some undesired behavior. At
- * the same time this function adds to some IDLE time which portion cannot
- * be used for other purposes (yet).
- */
-
-void stm32_waste(void);
-
-#undef EXTERN
-#if defined(__cplusplus)
-}
-#endif
-
-#endif /* __ASSEMBLY__ */
-#endif /* __ARCH_ARM_SRC_STM32WL5_STM32WL5_WASTE_H */


Reply via email to