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

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

commit b919ee2a8329fabe7c31f10fb2036694fb8e0b09
Author: raiden00pl <[email protected]>
AuthorDate: Thu May 28 12:12:39 2026 +0200

    !boards/arm/stm32: move common board sources
    
    BREAKING CHANGE: Move the existing STM32 board common sources to
    boards/arm/common/stm32 and fold in the common STM32F0/L0/G0/C0
    board helpers so split STM32 board families can share one source
    tree.
    
    Signed-off-by: raiden00pl <[email protected]>
---
 .../components/drivers/character/input/keypad.rst  |   2 +-
 .../components/drivers/character/input/mpr121.rst  |   2 +-
 .../components/drivers/character/input/sbutton.rst |   2 +-
 boards/Kconfig                                     |   4 +-
 .../common/src => common/stm32}/CMakeLists.txt     |  20 +--
 boards/arm/{stm32/common => common/stm32}/Kconfig  |   0
 .../common/src/Make.defs => common/stm32/Makefile} |  26 ++--
 .../stm32}/include/board_hall3ph.h                 |   8 +-
 .../common => common/stm32}/include/board_pwm.h    |   8 +-
 .../stm32}/include/board_qencoder.h                |   8 +-
 .../stm32}/include/board_sbutton.h                 |   8 +-
 .../stm32}/include/stm32_amg88xx.h                 |   8 +-
 .../common => common/stm32}/include/stm32_apa102.h |   8 +-
 .../stm32}/include/stm32_apds9960.h                |   8 +-
 .../common => common/stm32}/include/stm32_bh1750.h |   8 +-
 .../common => common/stm32}/include/stm32_bmp180.h |   8 +-
 .../common => common/stm32}/include/stm32_bmp280.h |   8 +-
 .../common => common/stm32}/include/stm32_dhtxx.h  |   8 +-
 .../stm32}/include/stm32_drv8266.h                 |   8 +-
 .../common => common/stm32}/include/stm32_ds1307.h |   8 +-
 .../common => common/stm32}/include/stm32_hcsr04.h |   8 +-
 .../stm32}/include/stm32_ihm07m1.h                 |   8 +-
 .../stm32}/include/stm32_ihm08m1.h                 |   8 +-
 .../stm32}/include/stm32_ihm16m1.h                 |   8 +-
 .../common => common/stm32}/include/stm32_ina219.h |   8 +-
 .../stm32}/include/stm32_kmatrix_gpio.h            |   8 +-
 .../stm32}/include/stm32_kmatrix_i2c.h             |   8 +-
 .../common => common/stm32}/include/stm32_l3gd20.h |   8 +-
 .../stm32}/include/stm32_lcd_backpack.h            |   8 +-
 .../stm32}/include/stm32_lis3dsh.h                 |   8 +-
 .../common => common/stm32}/include/stm32_lm75.h   |   8 +-
 .../stm32}/include/stm32_max31855.h                |   8 +-
 .../stm32}/include/stm32_max6675.h                 |   8 +-
 .../stm32}/include/stm32_max7219_matrix.h          |   8 +-
 .../stm32}/include/stm32_mfrc522.h                 |   8 +-
 .../stm32}/include/stm32_mlx90614.h                |   8 +-
 .../stm32}/include/stm32_mpl115a.h                 |   8 +-
 .../common => common/stm32}/include/stm32_mpr121.h |   8 +-
 .../common => common/stm32}/include/stm32_ms5611.h |   6 +-
 .../common => common/stm32}/include/stm32_mt6816.h |   8 +-
 .../stm32}/include/stm32_nrf24l01.h                |   8 +-
 .../stm32}/include/stm32_nunchuck.h                |   8 +-
 .../stm32}/include/stm32_ssd1306.h                 |   8 +-
 .../common => common/stm32}/include/stm32_tone.h   |   8 +-
 .../stm32}/include/stm32_veml6070.h                |   8 +-
 .../common => common/stm32}/include/stm32_ws2812.h |   8 +-
 .../stm32}/include/stm32_xen1210.h                 |   8 +-
 .../stm32}/include/stm32_zerocross.h               |   8 +-
 .../common => common/stm32}/src/CMakeLists.txt     |   8 +-
 .../{stm32/common => common/stm32}/src/Make.defs   |  19 ++-
 .../common => common/stm32}/src/board_hall3ph.c    |   2 +-
 .../common => common/stm32}/src/board_pwm.c        |   2 +-
 .../stm32/src/board_qencoder.c}                    |   2 +-
 .../common => common/stm32}/src/stm32_amg88xx.c    |   2 +-
 .../common => common/stm32}/src/stm32_apa102.c     |   2 +-
 .../common => common/stm32}/src/stm32_apds9960.c   |   2 +-
 .../common => common/stm32}/src/stm32_bh1750.c     |   2 +-
 .../common => common/stm32}/src/stm32_bmp180.c     |   2 +-
 .../common => common/stm32}/src/stm32_bmp280.c     |   2 +-
 .../common => common/stm32}/src/stm32_dhtxx.c      |   2 +-
 .../common => common/stm32}/src/stm32_drv8825.c    |   2 +-
 .../common => common/stm32}/src/stm32_ds1307.c     |   2 +-
 .../common => common/stm32}/src/stm32_hcsr04.c     |   2 +-
 .../common => common/stm32}/src/stm32_ihm07m1.c    |   2 +-
 .../common => common/stm32}/src/stm32_ihm08m1.c    |   2 +-
 .../common => common/stm32}/src/stm32_ihm16m1.c    |   2 +-
 .../common => common/stm32}/src/stm32_ina219.c     |   2 +-
 .../stm32}/src/stm32_kmatrix_gpio.c                |   2 +-
 .../stm32}/src/stm32_kmatrix_i2c.c                 |   2 +-
 .../common => common/stm32}/src/stm32_l3gd20.c     |   2 +-
 .../stm32}/src/stm32_lcd_backpack.c                |   2 +-
 .../common => common/stm32}/src/stm32_lis3dsh.c    |   2 +-
 .../common => common/stm32}/src/stm32_lm75.c       |   2 +-
 .../common => common/stm32}/src/stm32_max31855.c   |   2 +-
 .../common => common/stm32}/src/stm32_max6675.c    |   2 +-
 .../stm32}/src/stm32_max7219_matrix.c              |   2 +-
 .../common => common/stm32}/src/stm32_mfrc522.c    |   2 +-
 .../common => common/stm32}/src/stm32_mlx90614.c   |   2 +-
 .../common => common/stm32}/src/stm32_mpl115a.c    |   2 +-
 .../common => common/stm32}/src/stm32_mpr121.c     |   2 +-
 .../common => common/stm32}/src/stm32_ms5611.c     |   2 +-
 .../common => common/stm32}/src/stm32_mt6816.c     |   2 +-
 .../common => common/stm32}/src/stm32_nrf24l01.c   |   2 +-
 .../common => common/stm32}/src/stm32_nunchuck.c   |   2 +-
 .../common => common/stm32}/src/stm32_sbutton.c    |   2 +-
 .../common => common/stm32}/src/stm32_ssd1306.c    |   8 +-
 .../common => common/stm32}/src/stm32_tone.c       |   2 +-
 .../common => common/stm32}/src/stm32_veml6070.c   |   2 +-
 .../common => common/stm32}/src/stm32_ws2812.c     |   2 +-
 .../common => common/stm32}/src/stm32_xen1210.c    |   2 +-
 .../common => common/stm32}/src/stm32_zerocross.c  |   2 +-
 boards/arm/stm32/common/CMakeLists.txt             |   5 +-
 boards/arm/stm32/common/Kconfig                    |  67 +--------
 boards/arm/stm32/common/Makefile                   |   7 +-
 boards/arm/stm32/common/src/stm32_ssd1306.c        | 160 ---------------------
 boards/arm/stm32f0l0g0/common/CMakeLists.txt       |   5 +-
 boards/arm/stm32f0l0g0/common/Kconfig              |   1 +
 boards/arm/stm32f0l0g0/common/Makefile             |   7 +-
 .../stm32f0l0g0/common/include/board_qencoder.h    |  63 --------
 .../arm/stm32f0l0g0/common/include/stm32_ssd1306.h |  82 -----------
 boards/arm/stm32f0l0g0/common/src/board_qencoder.c |  68 ---------
 101 files changed, 263 insertions(+), 699 deletions(-)

diff --git a/Documentation/components/drivers/character/input/keypad.rst 
b/Documentation/components/drivers/character/input/keypad.rst
index 93d357bc7ac..58425f4fd5e 100644
--- a/Documentation/components/drivers/character/input/keypad.rst
+++ b/Documentation/components/drivers/character/input/keypad.rst
@@ -62,7 +62,7 @@ kbd-codec layer.
      ``board_kmatrix_initialize("/dev/keypad0")``).
 
 **Reference Implementation (STM32F4Discovery)**. The current reference
-is in ``boards/arm/stm32/common/src/stm32_kmatrix_gpio.c``:
+is in ``boards/arm/common/stm32/src/stm32_kmatrix_gpio.c``:
 
 - Rows: ``BOARD_KMATRIX_ROW0..3`` (outputs)
 - Columns: ``BOARD_KMATRIX_COL0..2`` (inputs with pull-up)
diff --git a/Documentation/components/drivers/character/input/mpr121.rst 
b/Documentation/components/drivers/character/input/mpr121.rst
index 9a24b3158fb..c8ccae10420 100644
--- a/Documentation/components/drivers/character/input/mpr121.rst
+++ b/Documentation/components/drivers/character/input/mpr121.rst
@@ -53,7 +53,7 @@ kbd-codec layer.
      ``board_mpr121_initialize(0, 1)`` for ``/dev/keymap0`` and ``i2c1``).
 
 **Reference Implementation (STM32F4Discovery)**. The current reference
-is in ``boards/arm/stm32/common/src/stm32_mpr121.c``:
+is in ``boards/arm/common/stm32/src/stm32_mpr121.c``:
 
 - Keymap: 4x3 keypad layout
 - Registration: ``board_mpr121_initialize()`` calls
diff --git a/Documentation/components/drivers/character/input/sbutton.rst 
b/Documentation/components/drivers/character/input/sbutton.rst
index 3281db7fd4a..ca118f95e74 100644
--- a/Documentation/components/drivers/character/input/sbutton.rst
+++ b/Documentation/components/drivers/character/input/sbutton.rst
@@ -23,7 +23,7 @@ It uses a kind of "polymorphism" in C to allow the driver to 
get
 access to the functions responsible to attach and enable the
 interrupt and to get the status of the pin.
 See ``include/nuttx/input/sbutton.h``
-and ``boards/arm/stm32/common/src/stm32_sbutton.c`` to understand
+and ``boards/arm/common/stm32/src/stm32_sbutton.c`` to understand
 better how it works. But basically the board file (config data)
 creates a struct when the first field (variable) is the config
 struct used the but SButton driver (``drivers/input/sbutton.c``).
diff --git a/boards/Kconfig b/boards/Kconfig
index 2a6a401dd15..ddcfbfbda2b 100644
--- a/boards/Kconfig
+++ b/boards/Kconfig
@@ -5207,13 +5207,13 @@ if ARCH_CHIP_SAMV7
 source "boards/arm/samv7/common/Kconfig"
 endif
 if ARCH_CHIP_STM32
-source "boards/arm/stm32/common/Kconfig"
+source "boards/arm/common/stm32/Kconfig"
 endif
 if ARCH_CHIP_STM32F7
 source "boards/arm/stm32f7/common/Kconfig"
 endif
 if ARCH_CHIP_STM32F0L0G0
-source "boards/arm/stm32f0l0g0/common/Kconfig"
+source "boards/arm/common/stm32/Kconfig"
 endif
 if ARCH_CHIP_RP2040
 source "boards/arm/rp2040/common/Kconfig"
diff --git a/boards/arm/stm32f0l0g0/common/src/CMakeLists.txt 
b/boards/arm/common/stm32/CMakeLists.txt
similarity index 74%
rename from boards/arm/stm32f0l0g0/common/src/CMakeLists.txt
rename to boards/arm/common/stm32/CMakeLists.txt
index 2b7dc2f3527..1c54914f408 100644
--- a/boards/arm/stm32f0l0g0/common/src/CMakeLists.txt
+++ b/boards/arm/common/stm32/CMakeLists.txt
@@ -1,5 +1,5 @@
 # 
##############################################################################
-# boards/arm/stm32f0l0g0/common/src/CMakeLists.txt
+# boards/arm/common/stm32/CMakeLists.txt
 #
 # SPDX-License-Identifier: Apache-2.0
 #
@@ -20,19 +20,5 @@
 #
 # 
##############################################################################
 
-if(CONFIG_ARCH_BOARD_COMMON)
-
-  if(CONFIG_LCD_SSD1306)
-    list(APPEND SRCS stm32_ssd1306.c)
-  endif()
-
-  if(CONFIG_SENSORS_QENCODER)
-    list(APPEND SRCS board_qencoder.c)
-  endif()
-
-  if(CONFIG_PWM)
-    list(APPEND SRCS board_pwm.c)
-  endif()
-
-endif()
-target_sources(board PRIVATE ${SRCS})
+add_subdirectory(src)
+target_include_directories(board PRIVATE include)
diff --git a/boards/arm/stm32/common/Kconfig b/boards/arm/common/stm32/Kconfig
similarity index 100%
copy from boards/arm/stm32/common/Kconfig
copy to boards/arm/common/stm32/Kconfig
diff --git a/boards/arm/stm32f0l0g0/common/src/Make.defs 
b/boards/arm/common/stm32/Makefile
similarity index 71%
rename from boards/arm/stm32f0l0g0/common/src/Make.defs
rename to boards/arm/common/stm32/Makefile
index 972383a6291..3ce135c1070 100644
--- a/boards/arm/stm32f0l0g0/common/src/Make.defs
+++ b/boards/arm/common/stm32/Makefile
@@ -1,5 +1,5 @@
 #############################################################################
-# boards/arm/stm32f0l0g0/common/src/Make.defs
+# boards/arm/common/stm32/Makefile
 #
 # SPDX-License-Identifier: Apache-2.0
 #
@@ -20,22 +20,16 @@
 #
 #############################################################################
 
-ifeq ($(CONFIG_ARCH_BOARD_COMMON),y)
+include $(TOPDIR)/Make.defs
 
-ifeq ($(CONFIG_LCD_SSD1306),y)
-  CSRCS += stm32_ssd1306.c
-endif
-
-ifeq ($(CONFIG_SENSORS_QENCODER),y)
-  CSRCS += board_qencoder.c
-endif
-
-ifeq ($(CONFIG_PWM),y)
-  CSRCS += board_pwm.c
-endif
+include board/Make.defs
+include src/Make.defs
 
+DEPPATH += --dep-path board
 DEPPATH += --dep-path src
-VPATH += :src
-CFLAGS += 
${INCDIR_PREFIX}$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)src
 
-endif
+include $(TOPDIR)/boards/Board.mk
+
+ARCHSRCDIR = $(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src
+BOARDDIR = $(ARCHSRCDIR)$(DELIM)board
+CFLAGS += ${INCDIR_PREFIX}$(BOARDDIR)$(DELIM)include
diff --git a/boards/arm/stm32/common/include/board_hall3ph.h 
b/boards/arm/common/stm32/include/board_hall3ph.h
similarity index 91%
rename from boards/arm/stm32/common/include/board_hall3ph.h
rename to boards/arm/common/stm32/include/board_hall3ph.h
index 3cd1f2d819a..21ab10f8220 100644
--- a/boards/arm/stm32/common/include/board_hall3ph.h
+++ b/boards/arm/common/stm32/include/board_hall3ph.h
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/include/board_hall3ph.h
+ * boards/arm/common/stm32/include/board_hall3ph.h
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -20,8 +20,8 @@
  *
  ****************************************************************************/
 
-#ifndef __BOARDS_ARM_STM32_COMMON_INCLUDE_BOARD_HALL3PH_H
-#define __BOARDS_ARM_STM32_COMMON_INCLUDE_BOARD_HALL3PH_H
+#ifndef __BOARDS_ARM_COMMON_STM32_INCLUDE_BOARD_HALL3PH_H
+#define __BOARDS_ARM_COMMON_STM32_INCLUDE_BOARD_HALL3PH_H
 
 /****************************************************************************
  * Included Files
@@ -66,4 +66,4 @@ int board_hall3ph_initialize(int devno, int pha, int phb, int 
phc);
 }
 #endif
 
-#endif /* __BOARDS_ARM_STM32_COMMON_INCLUDE_BOARD_HALL3PH_H */
+#endif /* __BOARDS_ARM_COMMON_STM32_INCLUDE_BOARD_HALL3PH_H */
diff --git a/boards/arm/stm32f0l0g0/common/include/board_pwm.h 
b/boards/arm/common/stm32/include/board_pwm.h
similarity index 85%
rename from boards/arm/stm32f0l0g0/common/include/board_pwm.h
rename to boards/arm/common/stm32/include/board_pwm.h
index b86407e0aa5..2e673915733 100644
--- a/boards/arm/stm32f0l0g0/common/include/board_pwm.h
+++ b/boards/arm/common/stm32/include/board_pwm.h
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32f0l0g0/common/include/board_pwm.h
+ * boards/arm/common/stm32/include/board_pwm.h
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -20,8 +20,8 @@
  *
  ****************************************************************************/
 
-#ifndef __BOARDS_ARM_STM32F0L0G0_COMMON_INCLUDE_BOARD_PWM_H
-#define __BOARDS_ARM_STM32F0L0G0_COMMON_INCLUDE_BOARD_PWM_H
+#ifndef __BOARDS_ARM_COMMON_STM32_INCLUDE_BOARD_PWM_H
+#define __BOARDS_ARM_COMMON_STM32_INCLUDE_BOARD_PWM_H
 
 /****************************************************************************
  * Included Files
@@ -37,4 +37,4 @@
 int stm32_pwm_setup(void);
 #endif
 
-#endif /* __BOARDS_ARM_STM32F0L0G0_COMMON_INCLUDE_BOARD_PWM_H */
+#endif /* __BOARDS_ARM_COMMON_STM32_INCLUDE_BOARD_PWM_H */
diff --git a/boards/arm/stm32/common/include/board_qencoder.h 
b/boards/arm/common/stm32/include/board_qencoder.h
similarity index 91%
rename from boards/arm/stm32/common/include/board_qencoder.h
rename to boards/arm/common/stm32/include/board_qencoder.h
index 5d6dbe19178..241f64d4ad0 100644
--- a/boards/arm/stm32/common/include/board_qencoder.h
+++ b/boards/arm/common/stm32/include/board_qencoder.h
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/include/board_qencoder.h
+ * boards/arm/common/stm32/include/board_qencoder.h
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -20,8 +20,8 @@
  *
  ****************************************************************************/
 
-#ifndef __BOARDS_ARM_STM32_COMMON_INCLUDE_BOARD_QENCODER_H
-#define __BOARDS_ARM_STM32_COMMON_INCLUDE_BOARD_QENCODER_H
+#ifndef __BOARDS_ARM_COMMON_STM32_INCLUDE_BOARD_QENCODER_H
+#define __BOARDS_ARM_COMMON_STM32_INCLUDE_BOARD_QENCODER_H
 
 /****************************************************************************
  * Included Files
@@ -72,4 +72,4 @@ int board_qencoder_initialize(int devno, int timerno);
 }
 #endif
 
-#endif /* __BOARDS_ARM_STM32_COMMON_INCLUDE_BOARD_QENCODER_H */
+#endif /* __BOARDS_ARM_COMMON_STM32_INCLUDE_BOARD_QENCODER_H */
diff --git a/boards/arm/stm32/common/include/board_sbutton.h 
b/boards/arm/common/stm32/include/board_sbutton.h
similarity index 92%
rename from boards/arm/stm32/common/include/board_sbutton.h
rename to boards/arm/common/stm32/include/board_sbutton.h
index 0dd67c11398..f123d0b4f57 100644
--- a/boards/arm/stm32/common/include/board_sbutton.h
+++ b/boards/arm/common/stm32/include/board_sbutton.h
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/include/board_sbutton.h
+ * boards/arm/common/stm32/include/board_sbutton.h
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -20,8 +20,8 @@
  *
  ****************************************************************************/
 
-#ifndef __BOARDS_ARM_STM32_COMMON_INCLUDE_BOARD_SBUTTON_H
-#define __BOARDS_ARM_STM32_COMMON_INCLUDE_BOARD_SBUTTON_H
+#ifndef __BOARDS_ARM_COMMON_STM32_INCLUDE_BOARD_SBUTTON_H
+#define __BOARDS_ARM_COMMON_STM32_INCLUDE_BOARD_SBUTTON_H
 
 /****************************************************************************
  * Included Files
@@ -80,4 +80,4 @@ int board_sbutton_initialize(int devno);
 }
 #endif
 
-#endif /* __BOARDS_ARM_STM32_COMMON_INCLUDE_BOARD_SBUTTON_H */
+#endif /* __BOARDS_ARM_COMMON_STM32_INCLUDE_BOARD_SBUTTON_H */
diff --git a/boards/arm/stm32/common/include/stm32_amg88xx.h 
b/boards/arm/common/stm32/include/stm32_amg88xx.h
similarity index 92%
rename from boards/arm/stm32/common/include/stm32_amg88xx.h
rename to boards/arm/common/stm32/include/stm32_amg88xx.h
index c8cb6fb724f..e11cee5e7e8 100644
--- a/boards/arm/stm32/common/include/stm32_amg88xx.h
+++ b/boards/arm/common/stm32/include/stm32_amg88xx.h
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/include/stm32_amg88xx.h
+ * boards/arm/common/stm32/include/stm32_amg88xx.h
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -20,8 +20,8 @@
  *
  ****************************************************************************/
 
-#ifndef __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_AMG88XX_H
-#define __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_AMG88XX_H
+#ifndef __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_AMG88XX_H
+#define __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_AMG88XX_H
 
 /****************************************************************************
  * Included Files
@@ -78,4 +78,4 @@ int board_amg88xx_initialize(int busno);
 }
 #endif
 
-#endif /* __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_AMG88XX_H */
+#endif /* __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_AMG88XX_H */
diff --git a/boards/arm/stm32/common/include/stm32_apa102.h 
b/boards/arm/common/stm32/include/stm32_apa102.h
similarity index 92%
rename from boards/arm/stm32/common/include/stm32_apa102.h
rename to boards/arm/common/stm32/include/stm32_apa102.h
index 241fb474b07..ad36c2e6068 100644
--- a/boards/arm/stm32/common/include/stm32_apa102.h
+++ b/boards/arm/common/stm32/include/stm32_apa102.h
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/include/stm32_apa102.h
+ * boards/arm/common/stm32/include/stm32_apa102.h
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -20,8 +20,8 @@
  *
  ****************************************************************************/
 
-#ifndef __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_APA102_H
-#define __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_APA102_H
+#ifndef __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_APA102_H
+#define __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_APA102_H
 
 /****************************************************************************
  * Included Files
@@ -83,4 +83,4 @@ int board_apa102_initialize(int devno, int spino);
 }
 #endif
 
-#endif /* __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_APA102_H */
+#endif /* __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_APA102_H */
diff --git a/boards/arm/stm32/common/include/stm32_apds9960.h 
b/boards/arm/common/stm32/include/stm32_apds9960.h
similarity index 92%
rename from boards/arm/stm32/common/include/stm32_apds9960.h
rename to boards/arm/common/stm32/include/stm32_apds9960.h
index c38b3a5bdf8..c2fe29bae60 100644
--- a/boards/arm/stm32/common/include/stm32_apds9960.h
+++ b/boards/arm/common/stm32/include/stm32_apds9960.h
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/include/stm32_apds9960.h
+ * boards/arm/common/stm32/include/stm32_apds9960.h
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -20,8 +20,8 @@
  *
  ****************************************************************************/
 
-#ifndef __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_APDS9960_H
-#define __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_APDS9960_H
+#ifndef __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_APDS9960_H
+#define __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_APDS9960_H
 
 /****************************************************************************
  * Included Files
@@ -79,4 +79,4 @@ int board_apds9960_initialize(int devno, int busno);
 }
 #endif
 
-#endif /* __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_APDS9960_H */
+#endif /* __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_APDS9960_H */
diff --git a/boards/arm/stm32/common/include/stm32_bh1750.h 
b/boards/arm/common/stm32/include/stm32_bh1750.h
similarity index 92%
rename from boards/arm/stm32/common/include/stm32_bh1750.h
rename to boards/arm/common/stm32/include/stm32_bh1750.h
index b9de5a874dd..96be9db21f1 100644
--- a/boards/arm/stm32/common/include/stm32_bh1750.h
+++ b/boards/arm/common/stm32/include/stm32_bh1750.h
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/include/stm32_bh1750.h
+ * boards/arm/common/stm32/include/stm32_bh1750.h
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -20,8 +20,8 @@
  *
  ****************************************************************************/
 
-#ifndef __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_BH1750_H
-#define __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_BH1750_H
+#ifndef __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_BH1750_H
+#define __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_BH1750_H
 
 /****************************************************************************
  * Included Files
@@ -79,4 +79,4 @@ int board_bh1750_initialize(int devno, int busno);
 }
 #endif
 
-#endif /* __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_BH1750_H */
+#endif /* __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_BH1750_H */
diff --git a/boards/arm/stm32/common/include/stm32_bmp180.h 
b/boards/arm/common/stm32/include/stm32_bmp180.h
similarity index 92%
rename from boards/arm/stm32/common/include/stm32_bmp180.h
rename to boards/arm/common/stm32/include/stm32_bmp180.h
index 0e963442c9b..6b7865c6e9b 100644
--- a/boards/arm/stm32/common/include/stm32_bmp180.h
+++ b/boards/arm/common/stm32/include/stm32_bmp180.h
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/include/stm32_bmp180.h
+ * boards/arm/common/stm32/include/stm32_bmp180.h
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -20,8 +20,8 @@
  *
  ****************************************************************************/
 
-#ifndef __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_BMP180_H
-#define __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_BMP180_H
+#ifndef __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_BMP180_H
+#define __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_BMP180_H
 
 /****************************************************************************
  * Included Files
@@ -83,4 +83,4 @@ int board_bmp180_initialize(int devno, int busno);
 }
 #endif
 
-#endif /* __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_BMP180_H */
+#endif /* __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_BMP180_H */
diff --git a/boards/arm/stm32/common/include/stm32_bmp280.h 
b/boards/arm/common/stm32/include/stm32_bmp280.h
similarity index 92%
rename from boards/arm/stm32/common/include/stm32_bmp280.h
rename to boards/arm/common/stm32/include/stm32_bmp280.h
index cf558b6791f..22b375eaaa5 100644
--- a/boards/arm/stm32/common/include/stm32_bmp280.h
+++ b/boards/arm/common/stm32/include/stm32_bmp280.h
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/include/stm32_bmp280.h
+ * boards/arm/common/stm32/include/stm32_bmp280.h
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -20,8 +20,8 @@
  *
  ****************************************************************************/
 
-#ifndef __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_BMP280_H
-#define __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_BMP280_H
+#ifndef __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_BMP280_H
+#define __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_BMP280_H
 
 /****************************************************************************
  * Included Files
@@ -83,4 +83,4 @@ int board_bmp280_initialize(int devno, int busno);
 }
 #endif
 
-#endif /* __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_BMP280_H */
+#endif /* __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_BMP280_H */
diff --git a/boards/arm/stm32/common/include/stm32_dhtxx.h 
b/boards/arm/common/stm32/include/stm32_dhtxx.h
similarity index 92%
rename from boards/arm/stm32/common/include/stm32_dhtxx.h
rename to boards/arm/common/stm32/include/stm32_dhtxx.h
index 7c1b5d6a9f4..5b971aa41ae 100644
--- a/boards/arm/stm32/common/include/stm32_dhtxx.h
+++ b/boards/arm/common/stm32/include/stm32_dhtxx.h
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/include/stm32_dhtxx.h
+ * boards/arm/common/stm32/include/stm32_dhtxx.h
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -20,8 +20,8 @@
  *
  ****************************************************************************/
 
-#ifndef __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_DHTXX_H
-#define __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_DHTXX_H
+#ifndef __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_DHTXX_H
+#define __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_DHTXX_H
 
 /****************************************************************************
  * Included Files
@@ -80,4 +80,4 @@ int board_dhtxx_initialize(int devno);
 }
 #endif
 
-#endif /* __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_DHTXX_H */
+#endif /* __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_DHTXX_H */
diff --git a/boards/arm/stm32/common/include/stm32_drv8266.h 
b/boards/arm/common/stm32/include/stm32_drv8266.h
similarity index 91%
rename from boards/arm/stm32/common/include/stm32_drv8266.h
rename to boards/arm/common/stm32/include/stm32_drv8266.h
index f0252073074..ec0dc22b10c 100644
--- a/boards/arm/stm32/common/include/stm32_drv8266.h
+++ b/boards/arm/common/stm32/include/stm32_drv8266.h
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/include/stm32_drv8266.h
+ * boards/arm/common/stm32/include/stm32_drv8266.h
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -20,8 +20,8 @@
  *
  ****************************************************************************/
 
-#ifndef __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_DRV8825_H
-#define __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_DRV8825_H
+#ifndef __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_DRV8825_H
+#define __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_DRV8825_H
 
 /****************************************************************************
  * Included Files
@@ -72,4 +72,4 @@ int board_drv8825_initialize(int devno);
 }
 #endif
 
-#endif /* __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_DRV8825_H */
+#endif /* __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_DRV8825_H */
diff --git a/boards/arm/stm32/common/include/stm32_ds1307.h 
b/boards/arm/common/stm32/include/stm32_ds1307.h
similarity index 92%
rename from boards/arm/stm32/common/include/stm32_ds1307.h
rename to boards/arm/common/stm32/include/stm32_ds1307.h
index 6baf58c63c4..2e39c16ffba 100644
--- a/boards/arm/stm32/common/include/stm32_ds1307.h
+++ b/boards/arm/common/stm32/include/stm32_ds1307.h
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/include/stm32_ds1307.h
+ * boards/arm/common/stm32/include/stm32_ds1307.h
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -20,8 +20,8 @@
  *
  ****************************************************************************/
 
-#ifndef __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_DS1307_H
-#define __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_DS1307_H
+#ifndef __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_DS1307_H
+#define __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_DS1307_H
 
 /****************************************************************************
  * Included Files
@@ -82,4 +82,4 @@ int board_ds1307_initialize(int busno);
 }
 #endif
 
-#endif /* __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_DS1307_H */
+#endif /* __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_DS1307_H */
diff --git a/boards/arm/stm32/common/include/stm32_hcsr04.h 
b/boards/arm/common/stm32/include/stm32_hcsr04.h
similarity index 92%
rename from boards/arm/stm32/common/include/stm32_hcsr04.h
rename to boards/arm/common/stm32/include/stm32_hcsr04.h
index d58e0e50356..59ab41da73b 100644
--- a/boards/arm/stm32/common/include/stm32_hcsr04.h
+++ b/boards/arm/common/stm32/include/stm32_hcsr04.h
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/include/stm32_hcsr04.h
+ * boards/arm/common/stm32/include/stm32_hcsr04.h
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -20,8 +20,8 @@
  *
  ****************************************************************************/
 
-#ifndef __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_HCSR04_H
-#define __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_HCSR04_H
+#ifndef __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_HCSR04_H
+#define __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_HCSR04_H
 
 /****************************************************************************
  * Included Files
@@ -80,4 +80,4 @@ int board_hcsr04_initialize(int devno);
 }
 #endif
 
-#endif /* __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_HCSR04_H */
+#endif /* __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_HCSR04_H */
diff --git a/boards/arm/stm32/common/include/stm32_ihm07m1.h 
b/boards/arm/common/stm32/include/stm32_ihm07m1.h
similarity index 89%
rename from boards/arm/stm32/common/include/stm32_ihm07m1.h
rename to boards/arm/common/stm32/include/stm32_ihm07m1.h
index 6de00e3ec97..32c5601bc73 100644
--- a/boards/arm/stm32/common/include/stm32_ihm07m1.h
+++ b/boards/arm/common/stm32/include/stm32_ihm07m1.h
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/include/stm32_ihm07m1.h
+ * boards/arm/common/stm32/include/stm32_ihm07m1.h
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -20,8 +20,8 @@
  *
  ****************************************************************************/
 
-#ifndef __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_IHM07M1_H
-#define __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_IHM07M1_H
+#ifndef __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_IHM07M1_H
+#define __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_IHM07M1_H
 
 /****************************************************************************
  * Included Files
@@ -58,4 +58,4 @@ int board_ihm07m1_initialize(struct stm32_foc_adc_s *adc_cfg);
 }
 #endif
 
-#endif /* __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_IHM07M1_H */
+#endif /* __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_IHM07M1_H */
diff --git a/boards/arm/stm32/common/include/stm32_ihm08m1.h 
b/boards/arm/common/stm32/include/stm32_ihm08m1.h
similarity index 89%
rename from boards/arm/stm32/common/include/stm32_ihm08m1.h
rename to boards/arm/common/stm32/include/stm32_ihm08m1.h
index 3f9738eadb3..eaee68a8875 100644
--- a/boards/arm/stm32/common/include/stm32_ihm08m1.h
+++ b/boards/arm/common/stm32/include/stm32_ihm08m1.h
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/include/stm32_ihm08m1.h
+ * boards/arm/common/stm32/include/stm32_ihm08m1.h
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -20,8 +20,8 @@
  *
  ****************************************************************************/
 
-#ifndef __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_IHM08M1_H
-#define __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_IHM08M1_H
+#ifndef __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_IHM08M1_H
+#define __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_IHM08M1_H
 
 /****************************************************************************
  * Included Files
@@ -58,4 +58,4 @@ int board_ihm08m1_initialize(struct stm32_foc_adc_s *adc_cfg);
 }
 #endif
 
-#endif /* __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_IHM08M1_H */
+#endif /* __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_IHM08M1_H */
diff --git a/boards/arm/stm32/common/include/stm32_ihm16m1.h 
b/boards/arm/common/stm32/include/stm32_ihm16m1.h
similarity index 89%
rename from boards/arm/stm32/common/include/stm32_ihm16m1.h
rename to boards/arm/common/stm32/include/stm32_ihm16m1.h
index 442dc3bb386..76ff0c49b8e 100644
--- a/boards/arm/stm32/common/include/stm32_ihm16m1.h
+++ b/boards/arm/common/stm32/include/stm32_ihm16m1.h
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/include/stm32_ihm16m1.h
+ * boards/arm/common/stm32/include/stm32_ihm16m1.h
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -20,8 +20,8 @@
  *
  ****************************************************************************/
 
-#ifndef __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_IHM16M1_H
-#define __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_IHM16M1_H
+#ifndef __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_IHM16M1_H
+#define __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_IHM16M1_H
 
 /****************************************************************************
  * Included Files
@@ -58,4 +58,4 @@ int board_ihm16m1_initialize(struct stm32_foc_adc_s *adc_cfg);
 }
 #endif
 
-#endif /* __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_IHM16M1_H */
+#endif /* __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_IHM16M1_H */
diff --git a/boards/arm/stm32/common/include/stm32_ina219.h 
b/boards/arm/common/stm32/include/stm32_ina219.h
similarity index 92%
rename from boards/arm/stm32/common/include/stm32_ina219.h
rename to boards/arm/common/stm32/include/stm32_ina219.h
index 4fa91899c3d..20b5a1e4656 100644
--- a/boards/arm/stm32/common/include/stm32_ina219.h
+++ b/boards/arm/common/stm32/include/stm32_ina219.h
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/include/stm32_ina219.h
+ * boards/arm/common/stm32/include/stm32_ina219.h
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -20,8 +20,8 @@
  *
  ****************************************************************************/
 
-#ifndef __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_INA219_H
-#define __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_INA219_H
+#ifndef __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_INA219_H
+#define __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_INA219_H
 
 /****************************************************************************
  * Included Files
@@ -79,4 +79,4 @@ int board_ina219_initialize(int devno, int busno);
 }
 #endif
 
-#endif /* __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_INA219_H */
+#endif /* __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_INA219_H */
diff --git a/boards/arm/stm32/common/include/stm32_kmatrix_gpio.h 
b/boards/arm/common/stm32/include/stm32_kmatrix_gpio.h
similarity index 92%
rename from boards/arm/stm32/common/include/stm32_kmatrix_gpio.h
rename to boards/arm/common/stm32/include/stm32_kmatrix_gpio.h
index 6615fcc9b36..bfad9923c9a 100644
--- a/boards/arm/stm32/common/include/stm32_kmatrix_gpio.h
+++ b/boards/arm/common/stm32/include/stm32_kmatrix_gpio.h
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/include/stm32_kmatrix_gpio.h
+ * boards/arm/common/stm32/include/stm32_kmatrix_gpio.h
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -20,8 +20,8 @@
  *
  ****************************************************************************/
 
-#ifndef __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_KMATRIX_GPIO_H
-#define __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_KMATRIX_GPIO_H
+#ifndef __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_KMATRIX_GPIO_H
+#define __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_KMATRIX_GPIO_H
 
 /****************************************************************************
  * Included Files
@@ -84,4 +84,4 @@ int board_kmatrix_initialize(const char *devpath);
 }
 #endif
 
-#endif /* __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_KMATRIX_GPIO_H */
+#endif /* __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_KMATRIX_GPIO_H */
diff --git a/boards/arm/stm32/common/include/stm32_kmatrix_i2c.h 
b/boards/arm/common/stm32/include/stm32_kmatrix_i2c.h
similarity index 92%
rename from boards/arm/stm32/common/include/stm32_kmatrix_i2c.h
rename to boards/arm/common/stm32/include/stm32_kmatrix_i2c.h
index 82669a943db..51f6295e5ec 100644
--- a/boards/arm/stm32/common/include/stm32_kmatrix_i2c.h
+++ b/boards/arm/common/stm32/include/stm32_kmatrix_i2c.h
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/include/stm32_kmatrix_i2c.h
+ * boards/arm/common/stm32/include/stm32_kmatrix_i2c.h
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -20,8 +20,8 @@
  *
  ****************************************************************************/
 
-#ifndef __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_KMATRIX_I2C_H
-#define __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_KMATRIX_I2C_H
+#ifndef __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_KMATRIX_I2C_H
+#define __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_KMATRIX_I2C_H
 
 /****************************************************************************
  * Included Files
@@ -84,4 +84,4 @@ int board_kmatrix_i2c_initialize(const char *devpath);
 }
 #endif
 
-#endif /* __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_KMATRIX_I2C_H */
+#endif /* __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_KMATRIX_I2C_H */
diff --git a/boards/arm/stm32/common/include/stm32_l3gd20.h 
b/boards/arm/common/stm32/include/stm32_l3gd20.h
similarity index 92%
rename from boards/arm/stm32/common/include/stm32_l3gd20.h
rename to boards/arm/common/stm32/include/stm32_l3gd20.h
index 8400e119345..edd5c6ca3b5 100644
--- a/boards/arm/stm32/common/include/stm32_l3gd20.h
+++ b/boards/arm/common/stm32/include/stm32_l3gd20.h
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/include/stm32_l3gd20.h
+ * boards/arm/common/stm32/include/stm32_l3gd20.h
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -20,8 +20,8 @@
  *
  ****************************************************************************/
 
-#ifndef __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_L3GD20_H
-#define __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_L3GD20_H
+#ifndef __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_L3GD20_H
+#define __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_L3GD20_H
 
 /****************************************************************************
  * Included Files
@@ -80,4 +80,4 @@ int board_l3gd20_initialize(int devno, int busno);
 }
 #endif
 
-#endif /* __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_L3GD20_H */
+#endif /* __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_L3GD20_H */
diff --git a/boards/arm/stm32/common/include/stm32_lcd_backpack.h 
b/boards/arm/common/stm32/include/stm32_lcd_backpack.h
similarity index 92%
rename from boards/arm/stm32/common/include/stm32_lcd_backpack.h
rename to boards/arm/common/stm32/include/stm32_lcd_backpack.h
index f0923df0c2a..731e0ed039f 100644
--- a/boards/arm/stm32/common/include/stm32_lcd_backpack.h
+++ b/boards/arm/common/stm32/include/stm32_lcd_backpack.h
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/include/stm32_lcd_backpack.h
+ * boards/arm/common/stm32/include/stm32_lcd_backpack.h
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -20,8 +20,8 @@
  *
  ****************************************************************************/
 
-#ifndef __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_LCD_BACKPACK_H
-#define __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_LCD_BACKPACK_H
+#ifndef __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_LCD_BACKPACK_H
+#define __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_LCD_BACKPACK_H
 
 /****************************************************************************
  * Included Files
@@ -82,4 +82,4 @@ int board_lcd_backpack_init(int devno, int busno, int rows, 
int cols);
 }
 #endif
 
-#endif /* __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_LCD_BACKPACK_H */
+#endif /* __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_LCD_BACKPACK_H */
diff --git a/boards/arm/stm32/common/include/stm32_lis3dsh.h 
b/boards/arm/common/stm32/include/stm32_lis3dsh.h
similarity index 92%
rename from boards/arm/stm32/common/include/stm32_lis3dsh.h
rename to boards/arm/common/stm32/include/stm32_lis3dsh.h
index 6c28d6e8b1c..ea92bd41f57 100644
--- a/boards/arm/stm32/common/include/stm32_lis3dsh.h
+++ b/boards/arm/common/stm32/include/stm32_lis3dsh.h
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/include/stm32_lis3dsh.h
+ * boards/arm/common/stm32/include/stm32_lis3dsh.h
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -20,8 +20,8 @@
  *
  ****************************************************************************/
 
-#ifndef __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_LIS3DSH_H
-#define __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_LIS3DSH_H
+#ifndef __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_LIS3DSH_H
+#define __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_LIS3DSH_H
 
 /****************************************************************************
  * Included Files
@@ -79,4 +79,4 @@ int board_lis3dsh_initialize(int devno, int busno);
 }
 #endif
 
-#endif /* __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_LIS3DSH_H */
+#endif /* __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_LIS3DSH_H */
diff --git a/boards/arm/stm32/common/include/stm32_lm75.h 
b/boards/arm/common/stm32/include/stm32_lm75.h
similarity index 92%
rename from boards/arm/stm32/common/include/stm32_lm75.h
rename to boards/arm/common/stm32/include/stm32_lm75.h
index 74e846e3a13..339d91433d1 100644
--- a/boards/arm/stm32/common/include/stm32_lm75.h
+++ b/boards/arm/common/stm32/include/stm32_lm75.h
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/include/stm32_lm75.h
+ * boards/arm/common/stm32/include/stm32_lm75.h
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -20,8 +20,8 @@
  *
  ****************************************************************************/
 
-#ifndef __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_LM75_H
-#define __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_LM75_H
+#ifndef __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_LM75_H
+#define __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_LM75_H
 
 /****************************************************************************
  * Included Files
@@ -79,4 +79,4 @@ int board_lm75_initialize(int devno, int busno);
 }
 #endif
 
-#endif /* __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_LM75_H */
+#endif /* __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_LM75_H */
diff --git a/boards/arm/stm32/common/include/stm32_max31855.h 
b/boards/arm/common/stm32/include/stm32_max31855.h
similarity index 92%
rename from boards/arm/stm32/common/include/stm32_max31855.h
rename to boards/arm/common/stm32/include/stm32_max31855.h
index 36196eb6602..243bd335ea9 100644
--- a/boards/arm/stm32/common/include/stm32_max31855.h
+++ b/boards/arm/common/stm32/include/stm32_max31855.h
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/include/stm32_max31855.h
+ * boards/arm/common/stm32/include/stm32_max31855.h
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -20,8 +20,8 @@
  *
  ****************************************************************************/
 
-#ifndef __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_MAX31855_H
-#define __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_MAX31855_H
+#ifndef __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_MAX31855_H
+#define __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_MAX31855_H
 
 /****************************************************************************
  * Included Files
@@ -79,4 +79,4 @@ int board_max31855_initialize(int devno, int busno);
 }
 #endif
 
-#endif /* __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_MAX31855_H */
+#endif /* __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_MAX31855_H */
diff --git a/boards/arm/stm32/common/include/stm32_max6675.h 
b/boards/arm/common/stm32/include/stm32_max6675.h
similarity index 92%
rename from boards/arm/stm32/common/include/stm32_max6675.h
rename to boards/arm/common/stm32/include/stm32_max6675.h
index 01cdd85bc61..6386116c9df 100644
--- a/boards/arm/stm32/common/include/stm32_max6675.h
+++ b/boards/arm/common/stm32/include/stm32_max6675.h
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/include/stm32_max6675.h
+ * boards/arm/common/stm32/include/stm32_max6675.h
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -20,8 +20,8 @@
  *
  ****************************************************************************/
 
-#ifndef __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_MAX6675_H
-#define __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_MAX6675_H
+#ifndef __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_MAX6675_H
+#define __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_MAX6675_H
 
 /****************************************************************************
  * Included Files
@@ -83,4 +83,4 @@ int board_max6675_initialize(int devno, int busno);
 }
 #endif
 
-#endif /* __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_MAX6675_H */
+#endif /* __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_MAX6675_H */
diff --git a/boards/arm/stm32/common/include/stm32_max7219_matrix.h 
b/boards/arm/common/stm32/include/stm32_max7219_matrix.h
similarity index 91%
rename from boards/arm/stm32/common/include/stm32_max7219_matrix.h
rename to boards/arm/common/stm32/include/stm32_max7219_matrix.h
index a22addd8543..fea20cbaea3 100644
--- a/boards/arm/stm32/common/include/stm32_max7219_matrix.h
+++ b/boards/arm/common/stm32/include/stm32_max7219_matrix.h
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/include/stm32_max7219_matrix.h
+ * boards/arm/common/stm32/include/stm32_max7219_matrix.h
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -20,8 +20,8 @@
  *
  ****************************************************************************/
 
-#ifndef __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_MAX7219_H
-#define __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_MAX7219_H
+#ifndef __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_MAX7219_H
+#define __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_MAX7219_H
 
 /****************************************************************************
  * Included Files
@@ -78,4 +78,4 @@ int board_max7219_matrix_initialize(int busno);
 }
 #endif
 
-#endif /* __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_MAX7219_H */
+#endif /* __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_MAX7219_H */
diff --git a/boards/arm/stm32/common/include/stm32_mfrc522.h 
b/boards/arm/common/stm32/include/stm32_mfrc522.h
similarity index 92%
rename from boards/arm/stm32/common/include/stm32_mfrc522.h
rename to boards/arm/common/stm32/include/stm32_mfrc522.h
index 6934ea3de6a..46a3956b264 100644
--- a/boards/arm/stm32/common/include/stm32_mfrc522.h
+++ b/boards/arm/common/stm32/include/stm32_mfrc522.h
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/include/stm32_mfrc522.h
+ * boards/arm/common/stm32/include/stm32_mfrc522.h
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -20,8 +20,8 @@
  *
  ****************************************************************************/
 
-#ifndef __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_MFRC522_H
-#define __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_MFRC522_H
+#ifndef __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_MFRC522_H
+#define __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_MFRC522_H
 
 /****************************************************************************
  * Included Files
@@ -78,4 +78,4 @@ int stm32_mfrc522initialize(const char *devpath);
 }
 #endif
 
-#endif /* __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_MFRC522_H */
+#endif /* __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_MFRC522_H */
diff --git a/boards/arm/stm32/common/include/stm32_mlx90614.h 
b/boards/arm/common/stm32/include/stm32_mlx90614.h
similarity index 92%
rename from boards/arm/stm32/common/include/stm32_mlx90614.h
rename to boards/arm/common/stm32/include/stm32_mlx90614.h
index 3f6bd970d8f..5115ae35de7 100644
--- a/boards/arm/stm32/common/include/stm32_mlx90614.h
+++ b/boards/arm/common/stm32/include/stm32_mlx90614.h
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/include/stm32_mlx90614.h
+ * boards/arm/common/stm32/include/stm32_mlx90614.h
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -20,8 +20,8 @@
  *
  ****************************************************************************/
 
-#ifndef __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_MLX90614_H
-#define __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_MLX90614_H
+#ifndef __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_MLX90614_H
+#define __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_MLX90614_H
 
 /****************************************************************************
  * Included Files
@@ -79,4 +79,4 @@ int board_mlx90614_initialize(int devno, int busno);
 }
 #endif
 
-#endif /* __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_MLX90614_H */
+#endif /* __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_MLX90614_H */
diff --git a/boards/arm/stm32/common/include/stm32_mpl115a.h 
b/boards/arm/common/stm32/include/stm32_mpl115a.h
similarity index 92%
rename from boards/arm/stm32/common/include/stm32_mpl115a.h
rename to boards/arm/common/stm32/include/stm32_mpl115a.h
index 88c3e3cc5a5..309d39481fd 100644
--- a/boards/arm/stm32/common/include/stm32_mpl115a.h
+++ b/boards/arm/common/stm32/include/stm32_mpl115a.h
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/include/stm32_mpl115a.h
+ * boards/arm/common/stm32/include/stm32_mpl115a.h
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -20,8 +20,8 @@
  *
  ****************************************************************************/
 
-#ifndef __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_MPL115A_H
-#define __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_MPL115A_H
+#ifndef __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_MPL115A_H
+#define __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_MPL115A_H
 
 /****************************************************************************
  * Included Files
@@ -79,4 +79,4 @@ int board_mpl115a_initialize(int devno, int busno);
 }
 #endif
 
-#endif /* __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_MPL115A_H */
+#endif /* __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_MPL115A_H */
diff --git a/boards/arm/stm32/common/include/stm32_mpr121.h 
b/boards/arm/common/stm32/include/stm32_mpr121.h
similarity index 92%
rename from boards/arm/stm32/common/include/stm32_mpr121.h
rename to boards/arm/common/stm32/include/stm32_mpr121.h
index 185f2aac544..a35b1c02476 100644
--- a/boards/arm/stm32/common/include/stm32_mpr121.h
+++ b/boards/arm/common/stm32/include/stm32_mpr121.h
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/include/stm32_mpr121.h
+ * boards/arm/common/stm32/include/stm32_mpr121.h
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -20,8 +20,8 @@
  *
  ****************************************************************************/
 
-#ifndef __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_MPR121_H
-#define __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_MPR121_H
+#ifndef __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_MPR121_H
+#define __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_MPR121_H
 
 /****************************************************************************
  * Included Files
@@ -79,4 +79,4 @@ int board_mpr121_initialize(int devno, int busno);
 }
 #endif
 
-#endif /* __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_MPR121_H */
+#endif /* __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_MPR121_H */
diff --git a/boards/arm/stm32/common/include/stm32_ms5611.h 
b/boards/arm/common/stm32/include/stm32_ms5611.h
similarity index 94%
rename from boards/arm/stm32/common/include/stm32_ms5611.h
rename to boards/arm/common/stm32/include/stm32_ms5611.h
index f5a27d33949..2e9c63e68b0 100644
--- a/boards/arm/stm32/common/include/stm32_ms5611.h
+++ b/boards/arm/common/stm32/include/stm32_ms5611.h
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/include/stm32_ms5611.h
+ * boards/arm/common/stm32/include/stm32_ms5611.h
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -20,8 +20,8 @@
  *
  ****************************************************************************/
 
-#ifndef __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_MS5611_H
-#define __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_MS5611_H
+#ifndef __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_MS5611_H
+#define __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_MS5611_H
 
 /****************************************************************************
  * Included Files
diff --git a/boards/arm/stm32/common/include/stm32_mt6816.h 
b/boards/arm/common/stm32/include/stm32_mt6816.h
similarity index 91%
rename from boards/arm/stm32/common/include/stm32_mt6816.h
rename to boards/arm/common/stm32/include/stm32_mt6816.h
index 2497d13aa9a..ff6447fded5 100644
--- a/boards/arm/stm32/common/include/stm32_mt6816.h
+++ b/boards/arm/common/stm32/include/stm32_mt6816.h
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/include/stm32_mt6816.h
+ * boards/arm/common/stm32/include/stm32_mt6816.h
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -20,8 +20,8 @@
  *
  ****************************************************************************/
 
-#ifndef __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_MT6816_H
-#define __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_MT6816_H
+#ifndef __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_MT6816_H
+#define __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_MT6816_H
 
 /****************************************************************************
  * Included Files
@@ -72,4 +72,4 @@ int board_mt6816_initialize(int devno, int spi_busno);
 }
 #endif
 
-#endif /* __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_MT6816_H */
+#endif /* __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_MT6816_H */
diff --git a/boards/arm/stm32/common/include/stm32_nrf24l01.h 
b/boards/arm/common/stm32/include/stm32_nrf24l01.h
similarity index 91%
rename from boards/arm/stm32/common/include/stm32_nrf24l01.h
rename to boards/arm/common/stm32/include/stm32_nrf24l01.h
index e5207c6d16d..8a676add6ba 100644
--- a/boards/arm/stm32/common/include/stm32_nrf24l01.h
+++ b/boards/arm/common/stm32/include/stm32_nrf24l01.h
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/include/stm32_nrf24l01.h
+ * boards/arm/common/stm32/include/stm32_nrf24l01.h
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -20,8 +20,8 @@
  *
  ****************************************************************************/
 
-#ifndef __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_NRF24L01_H
-#define __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_NRF24L01_H
+#ifndef __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_NRF24L01_H
+#define __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_NRF24L01_H
 
 /****************************************************************************
  * Included Files
@@ -78,4 +78,4 @@ int board_nrf24l01_initialize(int busno);
 }
 #endif
 
-#endif /* __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_NRF24L01_H */
+#endif /* __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_NRF24L01_H */
diff --git a/boards/arm/stm32/common/include/stm32_nunchuck.h 
b/boards/arm/common/stm32/include/stm32_nunchuck.h
similarity index 92%
rename from boards/arm/stm32/common/include/stm32_nunchuck.h
rename to boards/arm/common/stm32/include/stm32_nunchuck.h
index 138fab2feff..b08f8ee6b17 100644
--- a/boards/arm/stm32/common/include/stm32_nunchuck.h
+++ b/boards/arm/common/stm32/include/stm32_nunchuck.h
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/include/stm32_nunchuck.h
+ * boards/arm/common/stm32/include/stm32_nunchuck.h
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -20,8 +20,8 @@
  *
  ****************************************************************************/
 
-#ifndef __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_NUNCHUCK_H
-#define __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_NUNCHUCK_H
+#ifndef __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_NUNCHUCK_H
+#define __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_NUNCHUCK_H
 
 /****************************************************************************
  * Included Files
@@ -84,4 +84,4 @@ int board_nunchuck_initialize(int devno, int busno);
 }
 #endif
 
-#endif /* __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_NUNCHUCK_H */
+#endif /* __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_NUNCHUCK_H */
diff --git a/boards/arm/stm32/common/include/stm32_ssd1306.h 
b/boards/arm/common/stm32/include/stm32_ssd1306.h
similarity index 91%
rename from boards/arm/stm32/common/include/stm32_ssd1306.h
rename to boards/arm/common/stm32/include/stm32_ssd1306.h
index d5e2d527996..a23b2d776ad 100644
--- a/boards/arm/stm32/common/include/stm32_ssd1306.h
+++ b/boards/arm/common/stm32/include/stm32_ssd1306.h
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/include/stm32_ssd1306.h
+ * boards/arm/common/stm32/include/stm32_ssd1306.h
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -20,8 +20,8 @@
  *
  ****************************************************************************/
 
-#ifndef __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_SSD1306_H
-#define __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_SSD1306_H
+#ifndef __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_SSD1306_H
+#define __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_SSD1306_H
 
 /****************************************************************************
  * Included Files
@@ -79,4 +79,4 @@ struct lcd_dev_s *board_ssd1306_getdev(void);
 }
 #endif
 
-#endif /* __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_SSD1306_H */
+#endif /* __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_SSD1306_H */
diff --git a/boards/arm/stm32/common/include/stm32_tone.h 
b/boards/arm/common/stm32/include/stm32_tone.h
similarity index 92%
rename from boards/arm/stm32/common/include/stm32_tone.h
rename to boards/arm/common/stm32/include/stm32_tone.h
index 1834af76bab..5306c10f308 100644
--- a/boards/arm/stm32/common/include/stm32_tone.h
+++ b/boards/arm/common/stm32/include/stm32_tone.h
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/include/stm32_tone.h
+ * boards/arm/common/stm32/include/stm32_tone.h
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -20,8 +20,8 @@
  *
  ****************************************************************************/
 
-#ifndef __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_TONE_H
-#define __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_TONE_H
+#ifndef __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_TONE_H
+#define __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_TONE_H
 
 /****************************************************************************
  * Included Files
@@ -75,4 +75,4 @@ int board_tone_initialize(int devno);
 }
 #endif
 
-#endif /* __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_TONE_H */
+#endif /* __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_TONE_H */
diff --git a/boards/arm/stm32/common/include/stm32_veml6070.h 
b/boards/arm/common/stm32/include/stm32_veml6070.h
similarity index 92%
rename from boards/arm/stm32/common/include/stm32_veml6070.h
rename to boards/arm/common/stm32/include/stm32_veml6070.h
index 3b3a6899971..ab73c1504dd 100644
--- a/boards/arm/stm32/common/include/stm32_veml6070.h
+++ b/boards/arm/common/stm32/include/stm32_veml6070.h
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/include/stm32_veml6070.h
+ * boards/arm/common/stm32/include/stm32_veml6070.h
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -20,8 +20,8 @@
  *
  ****************************************************************************/
 
-#ifndef __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_VEML6070_H
-#define __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_VEML6070_H
+#ifndef __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_VEML6070_H
+#define __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_VEML6070_H
 
 /****************************************************************************
  * Included Files
@@ -84,4 +84,4 @@ int board_veml6070_initialize(int devno, int busno);
 }
 #endif
 
-#endif /* __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_VEML6070_H */
+#endif /* __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_VEML6070_H */
diff --git a/boards/arm/stm32/common/include/stm32_ws2812.h 
b/boards/arm/common/stm32/include/stm32_ws2812.h
similarity index 92%
rename from boards/arm/stm32/common/include/stm32_ws2812.h
rename to boards/arm/common/stm32/include/stm32_ws2812.h
index ef6dfb8d8ab..76fa9b5724b 100644
--- a/boards/arm/stm32/common/include/stm32_ws2812.h
+++ b/boards/arm/common/stm32/include/stm32_ws2812.h
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/include/stm32_ws2812.h
+ * boards/arm/common/stm32/include/stm32_ws2812.h
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -20,8 +20,8 @@
  *
  ****************************************************************************/
 
-#ifndef __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_WS2812_H
-#define __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_WS2812_H
+#ifndef __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_WS2812_H
+#define __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_WS2812_H
 
 /****************************************************************************
  * Included Files
@@ -84,4 +84,4 @@ int board_ws2812_initialize(int devno, int spino, uint16_t 
nleds);
 }
 #endif
 
-#endif /* __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_WS2812_H */
+#endif /* __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_WS2812_H */
diff --git a/boards/arm/stm32/common/include/stm32_xen1210.h 
b/boards/arm/common/stm32/include/stm32_xen1210.h
similarity index 92%
rename from boards/arm/stm32/common/include/stm32_xen1210.h
rename to boards/arm/common/stm32/include/stm32_xen1210.h
index 19ed0c4246e..a6b8e30955d 100644
--- a/boards/arm/stm32/common/include/stm32_xen1210.h
+++ b/boards/arm/common/stm32/include/stm32_xen1210.h
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/include/stm32_xen1210.h
+ * boards/arm/common/stm32/include/stm32_xen1210.h
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -20,8 +20,8 @@
  *
  ****************************************************************************/
 
-#ifndef __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_XEN1210_H
-#define __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_XEN1210_H
+#ifndef __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_XEN1210_H
+#define __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_XEN1210_H
 
 /****************************************************************************
  * Included Files
@@ -80,4 +80,4 @@ int board_xen1210_initialize(int devno, int busno);
 }
 #endif
 
-#endif /* __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_XEN1210_H */
+#endif /* __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_XEN1210_H */
diff --git a/boards/arm/stm32/common/include/stm32_zerocross.h 
b/boards/arm/common/stm32/include/stm32_zerocross.h
similarity index 91%
rename from boards/arm/stm32/common/include/stm32_zerocross.h
rename to boards/arm/common/stm32/include/stm32_zerocross.h
index ae07c6ddb5e..2d92fd900be 100644
--- a/boards/arm/stm32/common/include/stm32_zerocross.h
+++ b/boards/arm/common/stm32/include/stm32_zerocross.h
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/include/stm32_zerocross.h
+ * boards/arm/common/stm32/include/stm32_zerocross.h
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -20,8 +20,8 @@
  *
  ****************************************************************************/
 
-#ifndef __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_ZEROCROSS_H
-#define __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_ZEROCROSS_H
+#ifndef __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_ZEROCROSS_H
+#define __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_ZEROCROSS_H
 
 /****************************************************************************
  * Included Files
@@ -72,4 +72,4 @@ int board_zerocross_initialize(int devno);
 }
 #endif
 
-#endif /* __BOARDS_ARM_STM32_COMMON_INCLUDE_STM32_ZEROCROSS_H */
+#endif /* __BOARDS_ARM_COMMON_STM32_INCLUDE_STM32_ZEROCROSS_H */
diff --git a/boards/arm/stm32/common/src/CMakeLists.txt 
b/boards/arm/common/stm32/src/CMakeLists.txt
similarity index 95%
rename from boards/arm/stm32/common/src/CMakeLists.txt
rename to boards/arm/common/stm32/src/CMakeLists.txt
index c7d9426af29..1f9b3837368 100644
--- a/boards/arm/stm32/common/src/CMakeLists.txt
+++ b/boards/arm/common/stm32/src/CMakeLists.txt
@@ -1,5 +1,5 @@
 # 
##############################################################################
-# boards/arm/stm32/common/src/CMakeLists.txt
+# boards/arm/common/stm32/src/CMakeLists.txt
 #
 # SPDX-License-Identifier: Apache-2.0
 #
@@ -92,10 +92,14 @@ endif()
 
 if(CONFIG_SENSORS_QENCODER)
   if(CONFIG_STM32_QE)
-    list(APPEND SRCS stm32_qencoder.c)
+    list(APPEND SRCS board_qencoder.c)
   endif()
 endif()
 
+if(CONFIG_PWM AND NOT EXISTS ${NUTTX_BOARD_DIR}/src/stm32_pwm.c)
+  list(APPEND SRCS board_pwm.c)
+endif()
+
 if(CONFIG_SENSORS_INA219)
   list(APPEND SRCS stm32_ina219.c)
 endif()
diff --git a/boards/arm/stm32/common/src/Make.defs 
b/boards/arm/common/stm32/src/Make.defs
similarity index 87%
rename from boards/arm/stm32/common/src/Make.defs
rename to boards/arm/common/stm32/src/Make.defs
index 5b1f8556d76..9470fe63aac 100644
--- a/boards/arm/stm32/common/src/Make.defs
+++ b/boards/arm/common/stm32/src/Make.defs
@@ -1,5 +1,5 @@
 #############################################################################
-# boards/arm/stm32/common/src/Make.defs
+# boards/arm/common/stm32/src/Make.defs
 #
 # SPDX-License-Identifier: Apache-2.0
 #
@@ -22,6 +22,8 @@
 
 ifeq ($(CONFIG_ARCH_BOARD_COMMON),y)
 
+STM32_BOARD_COMMON_DIR := 
$(TOPDIR)$(DELIM)boards$(DELIM)arm$(DELIM)common$(DELIM)stm32
+
 ifeq ($(CONFIG_SENSORS_BMP180),y)
   CSRCS += stm32_bmp180.c
 endif
@@ -100,7 +102,13 @@ endif
 
 ifeq ($(CONFIG_SENSORS_QENCODER),y)
   ifeq ($(CONFIG_STM32_QE),y)
-    CSRCS += stm32_qencoder.c
+    CSRCS += board_qencoder.c
+  endif
+endif
+
+ifeq ($(CONFIG_PWM),y)
+  ifeq (,$(wildcard $(BOARD_DIR)$(DELIM)src$(DELIM)stm32_pwm.c))
+    CSRCS += board_pwm.c
   endif
 endif
 
@@ -184,8 +192,9 @@ ifeq ($(CONFIG_INPUT_KMATRIX_I2C),y)
   CSRCS += stm32_kmatrix_i2c.c
 endif
 
-DEPPATH += --dep-path src
-VPATH += :src
-CFLAGS += 
${INCDIR_PREFIX}$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)src
+DEPPATH += --dep-path $(STM32_BOARD_COMMON_DIR)$(DELIM)src
+VPATH += :$(STM32_BOARD_COMMON_DIR)$(DELIM)src
+CFLAGS += ${INCDIR_PREFIX}$(STM32_BOARD_COMMON_DIR)$(DELIM)include
+CFLAGS += ${INCDIR_PREFIX}$(STM32_BOARD_COMMON_DIR)$(DELIM)src
 
 endif
diff --git a/boards/arm/stm32/common/src/board_hall3ph.c 
b/boards/arm/common/stm32/src/board_hall3ph.c
similarity index 98%
rename from boards/arm/stm32/common/src/board_hall3ph.c
rename to boards/arm/common/stm32/src/board_hall3ph.c
index f96d5a953f3..3ce8efa7607 100644
--- a/boards/arm/stm32/common/src/board_hall3ph.c
+++ b/boards/arm/common/stm32/src/board_hall3ph.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/src/board_hall3ph.c
+ * boards/arm/common/stm32/src/board_hall3ph.c
  *
  * SPDX-License-Identifier: Apache-2.0
  *
diff --git a/boards/arm/stm32f0l0g0/common/src/board_pwm.c 
b/boards/arm/common/stm32/src/board_pwm.c
similarity index 98%
rename from boards/arm/stm32f0l0g0/common/src/board_pwm.c
rename to boards/arm/common/stm32/src/board_pwm.c
index d26772a5dc1..fdc3ad58f42 100644
--- a/boards/arm/stm32f0l0g0/common/src/board_pwm.c
+++ b/boards/arm/common/stm32/src/board_pwm.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32f0l0g0/common/src/board_pwm.c
+ * boards/arm/common/stm32/src/board_pwm.c
  *
  * SPDX-License-Identifier: Apache-2.0
  *
diff --git a/boards/arm/stm32/common/src/stm32_qencoder.c 
b/boards/arm/common/stm32/src/board_qencoder.c
similarity index 97%
rename from boards/arm/stm32/common/src/stm32_qencoder.c
rename to boards/arm/common/stm32/src/board_qencoder.c
index c701ecc0564..f67c7d857f4 100644
--- a/boards/arm/stm32/common/src/stm32_qencoder.c
+++ b/boards/arm/common/stm32/src/board_qencoder.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/src/stm32_qencoder.c
+ * boards/arm/common/stm32/src/board_qencoder.c
  *
  * SPDX-License-Identifier: Apache-2.0
  *
diff --git a/boards/arm/stm32/common/src/stm32_amg88xx.c 
b/boards/arm/common/stm32/src/stm32_amg88xx.c
similarity index 98%
rename from boards/arm/stm32/common/src/stm32_amg88xx.c
rename to boards/arm/common/stm32/src/stm32_amg88xx.c
index 4760fd947f1..995a28e1412 100644
--- a/boards/arm/stm32/common/src/stm32_amg88xx.c
+++ b/boards/arm/common/stm32/src/stm32_amg88xx.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/src/stm32_amg88xx.c
+ * boards/arm/common/stm32/src/stm32_amg88xx.c
  *
  * SPDX-License-Identifier: Apache-2.0
  *
diff --git a/boards/arm/stm32/common/src/stm32_apa102.c 
b/boards/arm/common/stm32/src/stm32_apa102.c
similarity index 98%
rename from boards/arm/stm32/common/src/stm32_apa102.c
rename to boards/arm/common/stm32/src/stm32_apa102.c
index 5b19432385c..5de33d0dc6b 100644
--- a/boards/arm/stm32/common/src/stm32_apa102.c
+++ b/boards/arm/common/stm32/src/stm32_apa102.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/src/stm32_apa102.c
+ * boards/arm/common/stm32/src/stm32_apa102.c
  *
  * SPDX-License-Identifier: Apache-2.0
  *
diff --git a/boards/arm/stm32/common/src/stm32_apds9960.c 
b/boards/arm/common/stm32/src/stm32_apds9960.c
similarity index 99%
rename from boards/arm/stm32/common/src/stm32_apds9960.c
rename to boards/arm/common/stm32/src/stm32_apds9960.c
index 902cac423d5..ff709d69497 100644
--- a/boards/arm/stm32/common/src/stm32_apds9960.c
+++ b/boards/arm/common/stm32/src/stm32_apds9960.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/src/stm32_apds9960.c
+ * boards/arm/common/stm32/src/stm32_apds9960.c
  *
  * SPDX-License-Identifier: Apache-2.0
  *
diff --git a/boards/arm/stm32/common/src/stm32_bh1750.c 
b/boards/arm/common/stm32/src/stm32_bh1750.c
similarity index 98%
rename from boards/arm/stm32/common/src/stm32_bh1750.c
rename to boards/arm/common/stm32/src/stm32_bh1750.c
index 4a21eee85c3..d8f742f357b 100644
--- a/boards/arm/stm32/common/src/stm32_bh1750.c
+++ b/boards/arm/common/stm32/src/stm32_bh1750.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/src/stm32_bh1750.c
+ * boards/arm/common/stm32/src/stm32_bh1750.c
  *
  * SPDX-License-Identifier: Apache-2.0
  *
diff --git a/boards/arm/stm32/common/src/stm32_bmp180.c 
b/boards/arm/common/stm32/src/stm32_bmp180.c
similarity index 98%
rename from boards/arm/stm32/common/src/stm32_bmp180.c
rename to boards/arm/common/stm32/src/stm32_bmp180.c
index 35b6bf15a32..3301d4baf1b 100644
--- a/boards/arm/stm32/common/src/stm32_bmp180.c
+++ b/boards/arm/common/stm32/src/stm32_bmp180.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/src/stm32_bmp180.c
+ * boards/arm/common/stm32/src/stm32_bmp180.c
  *
  * SPDX-License-Identifier: Apache-2.0
  *
diff --git a/boards/arm/stm32/common/src/stm32_bmp280.c 
b/boards/arm/common/stm32/src/stm32_bmp280.c
similarity index 98%
rename from boards/arm/stm32/common/src/stm32_bmp280.c
rename to boards/arm/common/stm32/src/stm32_bmp280.c
index c42be6b3ec8..2d748ac1128 100644
--- a/boards/arm/stm32/common/src/stm32_bmp280.c
+++ b/boards/arm/common/stm32/src/stm32_bmp280.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/src/stm32_bmp280.c
+ * boards/arm/common/stm32/src/stm32_bmp280.c
  *
  * SPDX-License-Identifier: Apache-2.0
  *
diff --git a/boards/arm/stm32/common/src/stm32_dhtxx.c 
b/boards/arm/common/stm32/src/stm32_dhtxx.c
similarity index 99%
rename from boards/arm/stm32/common/src/stm32_dhtxx.c
rename to boards/arm/common/stm32/src/stm32_dhtxx.c
index 017f7de8f14..24c82362750 100644
--- a/boards/arm/stm32/common/src/stm32_dhtxx.c
+++ b/boards/arm/common/stm32/src/stm32_dhtxx.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/src/stm32_dhtxx.c
+ * boards/arm/common/stm32/src/stm32_dhtxx.c
  *
  * SPDX-License-Identifier: Apache-2.0
  *
diff --git a/boards/arm/stm32/common/src/stm32_drv8825.c 
b/boards/arm/common/stm32/src/stm32_drv8825.c
similarity index 99%
rename from boards/arm/stm32/common/src/stm32_drv8825.c
rename to boards/arm/common/stm32/src/stm32_drv8825.c
index e11b644d947..60187a9eb9f 100644
--- a/boards/arm/stm32/common/src/stm32_drv8825.c
+++ b/boards/arm/common/stm32/src/stm32_drv8825.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/src/stm32_drv8825.c
+ * boards/arm/common/stm32/src/stm32_drv8825.c
  *
  * SPDX-License-Identifier: Apache-2.0
  *
diff --git a/boards/arm/stm32/common/src/stm32_ds1307.c 
b/boards/arm/common/stm32/src/stm32_ds1307.c
similarity index 98%
rename from boards/arm/stm32/common/src/stm32_ds1307.c
rename to boards/arm/common/stm32/src/stm32_ds1307.c
index 6d34e5255ca..fb7cf4129b2 100644
--- a/boards/arm/stm32/common/src/stm32_ds1307.c
+++ b/boards/arm/common/stm32/src/stm32_ds1307.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/src/stm32_ds1307.c
+ * boards/arm/common/stm32/src/stm32_ds1307.c
  *
  * SPDX-License-Identifier: Apache-2.0
  *
diff --git a/boards/arm/stm32/common/src/stm32_hcsr04.c 
b/boards/arm/common/stm32/src/stm32_hcsr04.c
similarity index 99%
rename from boards/arm/stm32/common/src/stm32_hcsr04.c
rename to boards/arm/common/stm32/src/stm32_hcsr04.c
index 7f8c235f0de..3f2d6ae229b 100644
--- a/boards/arm/stm32/common/src/stm32_hcsr04.c
+++ b/boards/arm/common/stm32/src/stm32_hcsr04.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/src/stm32_hcsr04.c
+ * boards/arm/common/stm32/src/stm32_hcsr04.c
  *
  * SPDX-License-Identifier: Apache-2.0
  *
diff --git a/boards/arm/stm32/common/src/stm32_ihm07m1.c 
b/boards/arm/common/stm32/src/stm32_ihm07m1.c
similarity index 99%
rename from boards/arm/stm32/common/src/stm32_ihm07m1.c
rename to boards/arm/common/stm32/src/stm32_ihm07m1.c
index 39e550affaa..6fa02180e41 100644
--- a/boards/arm/stm32/common/src/stm32_ihm07m1.c
+++ b/boards/arm/common/stm32/src/stm32_ihm07m1.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/src/stm32_ihm07m1.c
+ * boards/arm/common/stm32/src/stm32_ihm07m1.c
  *
  * SPDX-License-Identifier: Apache-2.0
  *
diff --git a/boards/arm/stm32/common/src/stm32_ihm08m1.c 
b/boards/arm/common/stm32/src/stm32_ihm08m1.c
similarity index 99%
rename from boards/arm/stm32/common/src/stm32_ihm08m1.c
rename to boards/arm/common/stm32/src/stm32_ihm08m1.c
index 97a12482b59..2c5b1b366a8 100644
--- a/boards/arm/stm32/common/src/stm32_ihm08m1.c
+++ b/boards/arm/common/stm32/src/stm32_ihm08m1.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/src/stm32_ihm08m1.c
+ * boards/arm/common/stm32/src/stm32_ihm08m1.c
  *
  * SPDX-License-Identifier: Apache-2.0
  *
diff --git a/boards/arm/stm32/common/src/stm32_ihm16m1.c 
b/boards/arm/common/stm32/src/stm32_ihm16m1.c
similarity index 99%
rename from boards/arm/stm32/common/src/stm32_ihm16m1.c
rename to boards/arm/common/stm32/src/stm32_ihm16m1.c
index d3d6ccb838e..6bf525ca0b7 100644
--- a/boards/arm/stm32/common/src/stm32_ihm16m1.c
+++ b/boards/arm/common/stm32/src/stm32_ihm16m1.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/src/stm32_ihm16m1.c
+ * boards/arm/common/stm32/src/stm32_ihm16m1.c
  *
  * SPDX-License-Identifier: Apache-2.0
  *
diff --git a/boards/arm/stm32/common/src/stm32_ina219.c 
b/boards/arm/common/stm32/src/stm32_ina219.c
similarity index 98%
rename from boards/arm/stm32/common/src/stm32_ina219.c
rename to boards/arm/common/stm32/src/stm32_ina219.c
index 98968b1adbc..20b1e565dad 100644
--- a/boards/arm/stm32/common/src/stm32_ina219.c
+++ b/boards/arm/common/stm32/src/stm32_ina219.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/src/stm32_ina219.c
+ * boards/arm/common/stm32/src/stm32_ina219.c
  *
  * SPDX-License-Identifier: BSD-3-Clause
  * SPDX-FileCopyrightText: 2018 Erle Robotics (Juan Flores Muñoz).
diff --git a/boards/arm/stm32/common/src/stm32_kmatrix_gpio.c 
b/boards/arm/common/stm32/src/stm32_kmatrix_gpio.c
similarity index 99%
rename from boards/arm/stm32/common/src/stm32_kmatrix_gpio.c
rename to boards/arm/common/stm32/src/stm32_kmatrix_gpio.c
index d76d94fa0f3..7f5a68d0acd 100644
--- a/boards/arm/stm32/common/src/stm32_kmatrix_gpio.c
+++ b/boards/arm/common/stm32/src/stm32_kmatrix_gpio.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/src/stm32_kmatrix_gpio.c
+ * boards/arm/common/stm32/src/stm32_kmatrix_gpio.c
  *
  * SPDX-License-Identifier: Apache-2.0
  *
diff --git a/boards/arm/stm32/common/src/stm32_kmatrix_i2c.c 
b/boards/arm/common/stm32/src/stm32_kmatrix_i2c.c
similarity index 99%
rename from boards/arm/stm32/common/src/stm32_kmatrix_i2c.c
rename to boards/arm/common/stm32/src/stm32_kmatrix_i2c.c
index 358c1d5584f..d4978eca0a5 100644
--- a/boards/arm/stm32/common/src/stm32_kmatrix_i2c.c
+++ b/boards/arm/common/stm32/src/stm32_kmatrix_i2c.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/src/stm32_kmatrix_i2c.c
+ * boards/arm/common/stm32/src/stm32_kmatrix_i2c.c
  *
  * SPDX-License-Identifier: Apache-2.0
  *
diff --git a/boards/arm/stm32/common/src/stm32_l3gd20.c 
b/boards/arm/common/stm32/src/stm32_l3gd20.c
similarity index 98%
rename from boards/arm/stm32/common/src/stm32_l3gd20.c
rename to boards/arm/common/stm32/src/stm32_l3gd20.c
index 5cbd5021d84..145060bd52d 100644
--- a/boards/arm/stm32/common/src/stm32_l3gd20.c
+++ b/boards/arm/common/stm32/src/stm32_l3gd20.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/src/stm32_l3gd20.c
+ * boards/arm/common/stm32/src/stm32_l3gd20.c
  *
  * SPDX-License-Identifier: Apache-2.0
  *
diff --git a/boards/arm/stm32/common/src/stm32_lcd_backpack.c 
b/boards/arm/common/stm32/src/stm32_lcd_backpack.c
similarity index 98%
rename from boards/arm/stm32/common/src/stm32_lcd_backpack.c
rename to boards/arm/common/stm32/src/stm32_lcd_backpack.c
index c288d2b4dd6..b65a3fcaaec 100644
--- a/boards/arm/stm32/common/src/stm32_lcd_backpack.c
+++ b/boards/arm/common/stm32/src/stm32_lcd_backpack.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/src/stm32_lcd_backpack.c
+ * boards/arm/common/stm32/src/stm32_lcd_backpack.c
  *
  * SPDX-License-Identifier: Apache-2.0
  *
diff --git a/boards/arm/stm32/common/src/stm32_lis3dsh.c 
b/boards/arm/common/stm32/src/stm32_lis3dsh.c
similarity index 98%
rename from boards/arm/stm32/common/src/stm32_lis3dsh.c
rename to boards/arm/common/stm32/src/stm32_lis3dsh.c
index 03d3fa84ad4..f1cfaa31ce3 100644
--- a/boards/arm/stm32/common/src/stm32_lis3dsh.c
+++ b/boards/arm/common/stm32/src/stm32_lis3dsh.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/src/stm32_lis3dsh.c
+ * boards/arm/common/stm32/src/stm32_lis3dsh.c
  *
  * SPDX-License-Identifier: Apache-2.0
  *
diff --git a/boards/arm/stm32/common/src/stm32_lm75.c 
b/boards/arm/common/stm32/src/stm32_lm75.c
similarity index 98%
rename from boards/arm/stm32/common/src/stm32_lm75.c
rename to boards/arm/common/stm32/src/stm32_lm75.c
index ce7c9f796e6..6f01942a00a 100644
--- a/boards/arm/stm32/common/src/stm32_lm75.c
+++ b/boards/arm/common/stm32/src/stm32_lm75.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/src/stm32_lm75.c
+ * boards/arm/common/stm32/src/stm32_lm75.c
  *
  * SPDX-License-Identifier: Apache-2.0
  *
diff --git a/boards/arm/stm32/common/src/stm32_max31855.c 
b/boards/arm/common/stm32/src/stm32_max31855.c
similarity index 98%
rename from boards/arm/stm32/common/src/stm32_max31855.c
rename to boards/arm/common/stm32/src/stm32_max31855.c
index b520888c597..ae21864b095 100644
--- a/boards/arm/stm32/common/src/stm32_max31855.c
+++ b/boards/arm/common/stm32/src/stm32_max31855.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/src/stm32_max31855.c
+ * boards/arm/common/stm32/src/stm32_max31855.c
  *
  * SPDX-License-Identifier: Apache-2.0
  *
diff --git a/boards/arm/stm32/common/src/stm32_max6675.c 
b/boards/arm/common/stm32/src/stm32_max6675.c
similarity index 98%
rename from boards/arm/stm32/common/src/stm32_max6675.c
rename to boards/arm/common/stm32/src/stm32_max6675.c
index bd6b20d0e0f..4082eea356a 100644
--- a/boards/arm/stm32/common/src/stm32_max6675.c
+++ b/boards/arm/common/stm32/src/stm32_max6675.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/src/stm32_max6675.c
+ * boards/arm/common/stm32/src/stm32_max6675.c
  *
  * SPDX-License-Identifier: Apache-2.0
  *
diff --git a/boards/arm/stm32/common/src/stm32_max7219_matrix.c 
b/boards/arm/common/stm32/src/stm32_max7219_matrix.c
similarity index 98%
rename from boards/arm/stm32/common/src/stm32_max7219_matrix.c
rename to boards/arm/common/stm32/src/stm32_max7219_matrix.c
index 4e5ac76473b..0ee46493a9c 100644
--- a/boards/arm/stm32/common/src/stm32_max7219_matrix.c
+++ b/boards/arm/common/stm32/src/stm32_max7219_matrix.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/src/stm32_max7219_matrix.c
+ * boards/arm/common/stm32/src/stm32_max7219_matrix.c
  *
  * SPDX-License-Identifier: Apache-2.0
  *
diff --git a/boards/arm/stm32/common/src/stm32_mfrc522.c 
b/boards/arm/common/stm32/src/stm32_mfrc522.c
similarity index 98%
rename from boards/arm/stm32/common/src/stm32_mfrc522.c
rename to boards/arm/common/stm32/src/stm32_mfrc522.c
index fc0d5bdf40e..0da85237c69 100644
--- a/boards/arm/stm32/common/src/stm32_mfrc522.c
+++ b/boards/arm/common/stm32/src/stm32_mfrc522.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/src/stm32_mfrc522.c
+ * boards/arm/common/stm32/src/stm32_mfrc522.c
  *
  * SPDX-License-Identifier: Apache-2.0
  *
diff --git a/boards/arm/stm32/common/src/stm32_mlx90614.c 
b/boards/arm/common/stm32/src/stm32_mlx90614.c
similarity index 98%
rename from boards/arm/stm32/common/src/stm32_mlx90614.c
rename to boards/arm/common/stm32/src/stm32_mlx90614.c
index 3d6944c30fd..984422d9149 100644
--- a/boards/arm/stm32/common/src/stm32_mlx90614.c
+++ b/boards/arm/common/stm32/src/stm32_mlx90614.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/src/stm32_mlx90614.c
+ * boards/arm/common/stm32/src/stm32_mlx90614.c
  *
  * SPDX-License-Identifier: Apache-2.0
  *
diff --git a/boards/arm/stm32/common/src/stm32_mpl115a.c 
b/boards/arm/common/stm32/src/stm32_mpl115a.c
similarity index 98%
rename from boards/arm/stm32/common/src/stm32_mpl115a.c
rename to boards/arm/common/stm32/src/stm32_mpl115a.c
index ad467fd5d16..f246d171684 100644
--- a/boards/arm/stm32/common/src/stm32_mpl115a.c
+++ b/boards/arm/common/stm32/src/stm32_mpl115a.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/src/stm32_mpl115a.c
+ * boards/arm/common/stm32/src/stm32_mpl115a.c
  *
  * SPDX-License-Identifier: Apache-2.0
  *
diff --git a/boards/arm/stm32/common/src/stm32_mpr121.c 
b/boards/arm/common/stm32/src/stm32_mpr121.c
similarity index 99%
rename from boards/arm/stm32/common/src/stm32_mpr121.c
rename to boards/arm/common/stm32/src/stm32_mpr121.c
index bd0d0d5ad5e..29a5049dfad 100644
--- a/boards/arm/stm32/common/src/stm32_mpr121.c
+++ b/boards/arm/common/stm32/src/stm32_mpr121.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/src/stm32_mpr121.c
+ * boards/arm/common/stm32/src/stm32_mpr121.c
  *
  * SPDX-License-Identifier: Apache-2.0
  *
diff --git a/boards/arm/stm32/common/src/stm32_ms5611.c 
b/boards/arm/common/stm32/src/stm32_ms5611.c
similarity index 98%
rename from boards/arm/stm32/common/src/stm32_ms5611.c
rename to boards/arm/common/stm32/src/stm32_ms5611.c
index 9e230e86afb..b38b0097608 100644
--- a/boards/arm/stm32/common/src/stm32_ms5611.c
+++ b/boards/arm/common/stm32/src/stm32_ms5611.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/src/stm32_ms5611.c
+ * boards/arm/common/stm32/src/stm32_ms5611.c
  *
  * SPDX-License-Identifier: Apache-2.0
  *
diff --git a/boards/arm/stm32/common/src/stm32_mt6816.c 
b/boards/arm/common/stm32/src/stm32_mt6816.c
similarity index 98%
rename from boards/arm/stm32/common/src/stm32_mt6816.c
rename to boards/arm/common/stm32/src/stm32_mt6816.c
index 834e1203850..41757f28677 100644
--- a/boards/arm/stm32/common/src/stm32_mt6816.c
+++ b/boards/arm/common/stm32/src/stm32_mt6816.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/src/stm32_mt6816.c
+ * boards/arm/common/stm32/src/stm32_mt6816.c
  *
  * SPDX-License-Identifier: Apache-2.0
  *
diff --git a/boards/arm/stm32/common/src/stm32_nrf24l01.c 
b/boards/arm/common/stm32/src/stm32_nrf24l01.c
similarity index 98%
rename from boards/arm/stm32/common/src/stm32_nrf24l01.c
rename to boards/arm/common/stm32/src/stm32_nrf24l01.c
index 62560e12443..9b086e8c3b3 100644
--- a/boards/arm/stm32/common/src/stm32_nrf24l01.c
+++ b/boards/arm/common/stm32/src/stm32_nrf24l01.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/src/stm32_nrf24l01.c
+ * boards/arm/common/stm32/src/stm32_nrf24l01.c
  *
  * SPDX-License-Identifier: Apache-2.0
  *
diff --git a/boards/arm/stm32/common/src/stm32_nunchuck.c 
b/boards/arm/common/stm32/src/stm32_nunchuck.c
similarity index 98%
rename from boards/arm/stm32/common/src/stm32_nunchuck.c
rename to boards/arm/common/stm32/src/stm32_nunchuck.c
index e25d7fe770a..27b4ba76b7f 100644
--- a/boards/arm/stm32/common/src/stm32_nunchuck.c
+++ b/boards/arm/common/stm32/src/stm32_nunchuck.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/src/stm32_nunchuck.c
+ * boards/arm/common/stm32/src/stm32_nunchuck.c
  *
  * SPDX-License-Identifier: Apache-2.0
  *
diff --git a/boards/arm/stm32/common/src/stm32_sbutton.c 
b/boards/arm/common/stm32/src/stm32_sbutton.c
similarity index 99%
rename from boards/arm/stm32/common/src/stm32_sbutton.c
rename to boards/arm/common/stm32/src/stm32_sbutton.c
index 5f2e52a9ac8..0659794a375 100644
--- a/boards/arm/stm32/common/src/stm32_sbutton.c
+++ b/boards/arm/common/stm32/src/stm32_sbutton.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/src/stm32_sbutton.c
+ * boards/arm/common/stm32/src/stm32_sbutton.c
  *
  * SPDX-License-Identifier: Apache-2.0
  *
diff --git a/boards/arm/stm32f0l0g0/common/src/stm32_ssd1306.c 
b/boards/arm/common/stm32/src/stm32_ssd1306.c
similarity index 98%
rename from boards/arm/stm32f0l0g0/common/src/stm32_ssd1306.c
rename to boards/arm/common/stm32/src/stm32_ssd1306.c
index cf14f06f943..1c73555da92 100644
--- a/boards/arm/stm32f0l0g0/common/src/stm32_ssd1306.c
+++ b/boards/arm/common/stm32/src/stm32_ssd1306.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32f0l0g0/common/src/stm32_ssd1306.c
+ * boards/arm/common/stm32/src/stm32_ssd1306.c
  *
  * SPDX-License-Identifier: Apache-2.0
  *
@@ -90,6 +90,9 @@ int board_ssd1306_initialize(int busno)
       /* And turn the OLED on */
 
       g_lcddev->setpower(g_lcddev, CONFIG_LCD_MAXPOWER);
+
+      ssd1306_fill(g_lcddev, 0xff);
+
       return OK;
     }
 }
@@ -138,9 +141,6 @@ int board_ssd1306_initialize(int busno)
       /* And turn the OLED on */
 
       g_lcddev->setpower(g_lcddev, CONFIG_LCD_MAXPOWER);
-
-      ssd1306_fill(g_lcddev, 0xff);
-
       return OK;
     }
 }
diff --git a/boards/arm/stm32/common/src/stm32_tone.c 
b/boards/arm/common/stm32/src/stm32_tone.c
similarity index 99%
rename from boards/arm/stm32/common/src/stm32_tone.c
rename to boards/arm/common/stm32/src/stm32_tone.c
index 58bbcd22242..178f8c1504c 100644
--- a/boards/arm/stm32/common/src/stm32_tone.c
+++ b/boards/arm/common/stm32/src/stm32_tone.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/src/stm32_tone.c
+ * boards/arm/common/stm32/src/stm32_tone.c
  *
  * SPDX-License-Identifier: Apache-2.0
  *
diff --git a/boards/arm/stm32/common/src/stm32_veml6070.c 
b/boards/arm/common/stm32/src/stm32_veml6070.c
similarity index 98%
rename from boards/arm/stm32/common/src/stm32_veml6070.c
rename to boards/arm/common/stm32/src/stm32_veml6070.c
index e5b38b9ac9b..b5e918973f2 100644
--- a/boards/arm/stm32/common/src/stm32_veml6070.c
+++ b/boards/arm/common/stm32/src/stm32_veml6070.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/src/stm32_veml6070.c
+ * boards/arm/common/stm32/src/stm32_veml6070.c
  *
  * SPDX-License-Identifier: Apache-2.0
  *
diff --git a/boards/arm/stm32/common/src/stm32_ws2812.c 
b/boards/arm/common/stm32/src/stm32_ws2812.c
similarity index 98%
rename from boards/arm/stm32/common/src/stm32_ws2812.c
rename to boards/arm/common/stm32/src/stm32_ws2812.c
index 640fb1e6308..d206941ed91 100644
--- a/boards/arm/stm32/common/src/stm32_ws2812.c
+++ b/boards/arm/common/stm32/src/stm32_ws2812.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/src/stm32_ws2812.c
+ * boards/arm/common/stm32/src/stm32_ws2812.c
  *
  * SPDX-License-Identifier: Apache-2.0
  *
diff --git a/boards/arm/stm32/common/src/stm32_xen1210.c 
b/boards/arm/common/stm32/src/stm32_xen1210.c
similarity index 99%
rename from boards/arm/stm32/common/src/stm32_xen1210.c
rename to boards/arm/common/stm32/src/stm32_xen1210.c
index 1dcb2a2787e..4b4311933c7 100644
--- a/boards/arm/stm32/common/src/stm32_xen1210.c
+++ b/boards/arm/common/stm32/src/stm32_xen1210.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/src/stm32_xen1210.c
+ * boards/arm/common/stm32/src/stm32_xen1210.c
  *
  * SPDX-License-Identifier: Apache-2.0
  *
diff --git a/boards/arm/stm32/common/src/stm32_zerocross.c 
b/boards/arm/common/stm32/src/stm32_zerocross.c
similarity index 99%
rename from boards/arm/stm32/common/src/stm32_zerocross.c
rename to boards/arm/common/stm32/src/stm32_zerocross.c
index c0a8a3900f4..660719d6fb9 100644
--- a/boards/arm/stm32/common/src/stm32_zerocross.c
+++ b/boards/arm/common/stm32/src/stm32_zerocross.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * boards/arm/stm32/common/src/stm32_zerocross.c
+ * boards/arm/common/stm32/src/stm32_zerocross.c
  *
  * SPDX-License-Identifier: Apache-2.0
  *
diff --git a/boards/arm/stm32/common/CMakeLists.txt 
b/boards/arm/stm32/common/CMakeLists.txt
index 48a2ca9e109..2d59a76459e 100644
--- a/boards/arm/stm32/common/CMakeLists.txt
+++ b/boards/arm/stm32/common/CMakeLists.txt
@@ -20,5 +20,6 @@
 #
 # 
##############################################################################
 
-add_subdirectory(src)
-target_include_directories(board PRIVATE include)
+if(CONFIG_ARCH_BOARD_COMMON)
+  add_subdirectory(${NUTTX_DIR}/boards/arm/common/stm32 stm32_common)
+endif()
diff --git a/boards/arm/stm32/common/Kconfig b/boards/arm/stm32/common/Kconfig
index 3e611724880..5c48f62a025 100644
--- a/boards/arm/stm32/common/Kconfig
+++ b/boards/arm/stm32/common/Kconfig
@@ -3,69 +3,4 @@
 # see the file kconfig-language.txt in the NuttX tools repository.
 #
 
-if STM32_FOC
-
-menuconfig BOARD_STM32_IHM07M1
-       bool "X-NUCLEO-IHM07M1 board support"
-       default n
-       ---help---
-               Board based on the L6230 DMOS driver.
-
-if BOARD_STM32_IHM07M1
-
-config BOARD_STM32_IHM07M1_VBUS
-       bool "X-NUCLEO-IHM07M1 board VBUS sense"
-       default n
-
-config BOARD_STM32_IHM07M1_POT
-       bool "X-NUCLEO-IHM07M1 board POT support"
-       default n
-
-endif # BOARD_STM32_IHM07M1
-
-menuconfig BOARD_STM32_IHM08M1
-       bool "X-NUCLEO-IHM08M1 board support"
-       default n
-       select STM32_FOC_HAS_PWM_COMPLEMENTARY
-       ---help---
-               Board based on the discrete L6398 gate drivers and STL220N6F7 
POWER MOSFETs.
-
-if BOARD_STM32_IHM08M1
-
-config BOARD_STM32_IHM08M1_VBUS
-       bool "X-NUCLEO-IHM08M1 board VBUS sense"
-       default n
-
-config BOARD_STM32_IHM08M1_POT
-       bool "X-NUCLEO-IHM08M1 board POT support"
-       default n
-
-endif # BOARD_STM32_IHM08M1
-
-menuconfig BOARD_STM32_IHM16M1
-       bool "X-NUCLEO-IHM16M1 board support"
-       default n
-       ---help---
-               Board based on the STSPIN830 three-phase brushless motor driver.
-
-if BOARD_STM32_IHM16M1
-
-config BOARD_STM32_IHM16M1_VBUS
-       bool "X-NUCLEO-IHM16M1 board VBUS sense"
-       default n
-
-config BOARD_STM32_IHM16M1_POT
-       bool "X-NUCLEO-IHM16M1 board POT support"
-       default n
-
-endif # BOARD_STM32_IHM16M1
-
-endif # STM32_FOC
-
-if SENSORS_HALL3PHASE
-
-config BOARD_STM32_HALL3PHASE_SAMPLES
-       int "3-phase Hall effect sensor number of samples"
-       default 10
-
-endif # SENSORS_HALL3PHASE
+source "boards/arm/common/stm32/Kconfig"
diff --git a/boards/arm/stm32/common/Makefile b/boards/arm/stm32/common/Makefile
index c6b78fa6a47..801cf99b184 100644
--- a/boards/arm/stm32/common/Makefile
+++ b/boards/arm/stm32/common/Makefile
@@ -22,14 +22,17 @@
 
 include $(TOPDIR)/Make.defs
 
+STM32_BOARD_COMMON_DIR := 
$(TOPDIR)$(DELIM)boards$(DELIM)arm$(DELIM)common$(DELIM)stm32
+STM32_COMMON_SRCDIR := 
$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)common$(DELIM)stm32
+
 include board/Make.defs
-include src/Make.defs
+include $(STM32_BOARD_COMMON_DIR)$(DELIM)src$(DELIM)Make.defs
 
 DEPPATH += --dep-path board
-DEPPATH += --dep-path src
 
 include $(TOPDIR)/boards/Board.mk
 
 ARCHSRCDIR = $(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src
 BOARDDIR = $(ARCHSRCDIR)$(DELIM)board
 CFLAGS += ${INCDIR_PREFIX}$(BOARDDIR)$(DELIM)include
+CFLAGS += ${INCDIR_PREFIX}$(STM32_COMMON_SRCDIR)
diff --git a/boards/arm/stm32/common/src/stm32_ssd1306.c 
b/boards/arm/stm32/common/src/stm32_ssd1306.c
deleted file mode 100644
index 093699e26b8..00000000000
--- a/boards/arm/stm32/common/src/stm32_ssd1306.c
+++ /dev/null
@@ -1,160 +0,0 @@
-/****************************************************************************
- * boards/arm/stm32/common/src/stm32_ssd1306.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 <nuttx/debug.h>
-
-#include <nuttx/board.h>
-#include <nuttx/lcd/lcd.h>
-#include <nuttx/lcd/ssd1306.h>
-#include <nuttx/i2c/i2c_master.h>
-#include <nuttx/spi/spi.h>
-
-#include "stm32_i2c.h"
-#include "stm32_spi.h"
-
-/****************************************************************************
- * Private Data
- ****************************************************************************/
-
-static struct lcd_dev_s    *g_lcddev;
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: board_ssd1306_initialize
- *
- * Description:
- *   Initialize and register the device. I2C version.
- *
- * Input Parameters:
- *   busno - The I2C bus number
- *
- * Returned Value:
- *   Zero (OK) on success; a negated errno value on failure.
- *
- ****************************************************************************/
-#ifdef CONFIG_LCD_SSD1306_I2C
-int board_ssd1306_initialize(int busno)
-{
-  struct i2c_master_s *i2c;
-  const int devno = 0;
-
-  /* Initialize I2C */
-
-  i2c = stm32_i2cbus_initialize(busno);
-  if (!i2c)
-    {
-      lcderr("ERROR: Failed to initialize I2C port %d\n", busno);
-      return -ENODEV;
-    }
-
-  /* Bind the I2C port to the OLED */
-
-  g_lcddev = ssd1306_initialize(i2c, NULL, devno);
-  if (!g_lcddev)
-    {
-      lcderr("ERROR: Failed to bind I2C port %d to OLED %d\n", busno, devno);
-      return -ENODEV;
-    }
-  else
-    {
-      lcdinfo("Bound I2C port %d to OLED %d\n", busno, devno);
-
-      /* And turn the OLED on */
-
-      g_lcddev->setpower(g_lcddev, CONFIG_LCD_MAXPOWER);
-      return OK;
-    }
-}
-#endif
-
-/****************************************************************************
- * Name: board_ssd1306_initialize
- *
- * Description:
- *   Initialize and register the device. SPI version.
- *
- * Input Parameters:
- *   busno - The SPI bus number
- *
- * Returned Value:
- *   Zero (OK) on success; a negated errno value on failure.
- *
- ****************************************************************************/
-#ifdef CONFIG_LCD_SSD1306_SPI
-int board_ssd1306_initialize(int busno)
-{
-  struct spi_dev_s *spi;
-  const int devno = 0;
-
-  /* Initialize SPI */
-
-  spi = stm32_spibus_initialize(busno);
-  if (!spi)
-    {
-      lcderr("ERROR: Failed to initialize SPI port %d\n", busno);
-      return -ENODEV;
-    }
-
-  /* Bind the SPI port to the OLED */
-
-  g_lcddev = ssd1306_initialize(spi, NULL, devno);
-  if (!g_lcddev)
-    {
-      lcderr("ERROR: Failed to bind SPI port %d to OLED %d\n", busno, devno);
-      return -ENODEV;
-    }
-  else
-    {
-      lcdinfo("Bound SPI port %d to OLED %d\n", busno, devno);
-
-      /* And turn the OLED on */
-
-      g_lcddev->setpower(g_lcddev, CONFIG_LCD_MAXPOWER);
-      return OK;
-    }
-}
-#endif
-
-/****************************************************************************
- * Name: board_ssd1306_getdev
- *
- * Description:
- *   Get the SSD1306 device driver instance
- *
- * Returned Value:
- *   Pointer to the instance
- *
- ****************************************************************************/
-
-struct lcd_dev_s *board_ssd1306_getdev(void)
-{
-  return g_lcddev;
-}
diff --git a/boards/arm/stm32f0l0g0/common/CMakeLists.txt 
b/boards/arm/stm32f0l0g0/common/CMakeLists.txt
index 4741419517f..3168617cea3 100644
--- a/boards/arm/stm32f0l0g0/common/CMakeLists.txt
+++ b/boards/arm/stm32f0l0g0/common/CMakeLists.txt
@@ -20,5 +20,6 @@
 #
 # 
##############################################################################
 
-add_subdirectory(src)
-target_include_directories(board PRIVATE include)
+if(CONFIG_ARCH_BOARD_COMMON)
+  add_subdirectory(${NUTTX_DIR}/boards/arm/common/stm32 stm32_common)
+endif()
diff --git a/boards/arm/stm32f0l0g0/common/Kconfig 
b/boards/arm/stm32f0l0g0/common/Kconfig
index 18c7905aed7..5c48f62a025 100644
--- a/boards/arm/stm32f0l0g0/common/Kconfig
+++ b/boards/arm/stm32f0l0g0/common/Kconfig
@@ -3,3 +3,4 @@
 # see the file kconfig-language.txt in the NuttX tools repository.
 #
 
+source "boards/arm/common/stm32/Kconfig"
diff --git a/boards/arm/stm32f0l0g0/common/Makefile 
b/boards/arm/stm32f0l0g0/common/Makefile
index 7318baae08c..43855190fc6 100644
--- a/boards/arm/stm32f0l0g0/common/Makefile
+++ b/boards/arm/stm32f0l0g0/common/Makefile
@@ -22,14 +22,17 @@
 
 include $(TOPDIR)/Make.defs
 
+STM32_BOARD_COMMON_DIR := 
$(TOPDIR)$(DELIM)boards$(DELIM)arm$(DELIM)common$(DELIM)stm32
+STM32_COMMON_SRCDIR := 
$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)common$(DELIM)stm32
+
 include board/Make.defs
-include src/Make.defs
+include $(STM32_BOARD_COMMON_DIR)$(DELIM)src$(DELIM)Make.defs
 
 DEPPATH += --dep-path board
-DEPPATH += --dep-path src
 
 include $(TOPDIR)/boards/Board.mk
 
 ARCHSRCDIR = $(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src
 BOARDDIR = $(ARCHSRCDIR)$(DELIM)board
 CFLAGS += ${INCDIR_PREFIX}$(BOARDDIR)$(DELIM)include
+CFLAGS += ${INCDIR_PREFIX}$(STM32_COMMON_SRCDIR)
diff --git a/boards/arm/stm32f0l0g0/common/include/board_qencoder.h 
b/boards/arm/stm32f0l0g0/common/include/board_qencoder.h
deleted file mode 100644
index b16fbb020d0..00000000000
--- a/boards/arm/stm32f0l0g0/common/include/board_qencoder.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/****************************************************************************
- * boards/arm/stm32f0l0g0/common/include/board_qencoder.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 __BOARDS_ARM_STM32F0L0G0_COMMON_INCLUDE_BOARD_QENCODER_H
-#define __BOARDS_ARM_STM32F0L0G0_COMMON_INCLUDE_BOARD_QENCODER_H
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-
-/****************************************************************************
- * Public Data
- ****************************************************************************/
-
-#ifdef __cplusplus
-#define EXTERN extern "C"
-extern "C"
-{
-#else
-#define EXTERN extern
-#endif
-
-/****************************************************************************
- * Public Function Prototypes
- ****************************************************************************/
-
-/****************************************************************************
- * Name: board_qencoder_initialize
- *
- * Description:
- *   Initialize the quadrature encoder driver for the given timer
- *
- ****************************************************************************/
-
-int board_qencoder_initialize(int devno, int timerno);
-
-#undef EXTERN
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __BOARDS_ARM_STM32F0L0G0_COMMON_INCLUDE_BOARD_QENCODER_H */
diff --git a/boards/arm/stm32f0l0g0/common/include/stm32_ssd1306.h 
b/boards/arm/stm32f0l0g0/common/include/stm32_ssd1306.h
deleted file mode 100644
index 3831d23592b..00000000000
--- a/boards/arm/stm32f0l0g0/common/include/stm32_ssd1306.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/****************************************************************************
- * boards/arm/stm32f0l0g0/common/include/stm32_ssd1306.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 __BOARDS_ARM_STM32F0L0G0_COMMON_INCLUDE_STM32_SSD1306_H
-#define __BOARDS_ARM_STM32F0L0G0_COMMON_INCLUDE_STM32_SSD1306_H
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-
-/****************************************************************************
- * Public Data
- ****************************************************************************/
-
-#ifdef __cplusplus
-#define EXTERN extern "C"
-extern "C"
-{
-#else
-#define EXTERN extern
-#endif
-
-/****************************************************************************
- * Public Function Prototypes
- ****************************************************************************/
-
-/****************************************************************************
- * Name: board_ssd1306_initialize
- *
- * Description:
- *   Initialize and register the device
- *
- * Input Parameters:
- *   busno - The I2C or SPI bus number
- *
- * Returned Value:
- *   Zero (OK) on success; a negated errno value on failure.
- *
- ****************************************************************************/
-
-int board_ssd1306_initialize(int busno);
-
-/****************************************************************************
- * Name: board_ssd1306_getdev
- *
- * Description:
- *   Get the SSD1306 device driver instance
- *
- * Returned Value:
- *   Pointer to the instance
- *
- ****************************************************************************/
-
-struct lcd_dev_s *board_ssd1306_getdev(void);
-
-#undef EXTERN
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __BOARDS_ARM_STM32F0L0G0_COMMON_INCLUDE_STM32_SSD1306_H */
diff --git a/boards/arm/stm32f0l0g0/common/src/board_qencoder.c 
b/boards/arm/stm32f0l0g0/common/src/board_qencoder.c
deleted file mode 100644
index 6f7e6260977..00000000000
--- a/boards/arm/stm32f0l0g0/common/src/board_qencoder.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/****************************************************************************
- * boards/arm/stm32f0l0g0/common/src/board_qencoder.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 <errno.h>
-#include <debug.h>
-#include <stdio.h>
-
-#include <nuttx/sensors/qencoder.h>
-#include <arch/board/board.h>
-
-#include "chip.h"
-#include "arm_internal.h"
-#include "stm32_qencoder.h"
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: board_qencoder_initialize
- *
- * Description:
- *   Initialize the quadrature encoder driver for the given timer
- *
- ****************************************************************************/
-
-int board_qencoder_initialize(int devno, int timerno)
-{
-  int ret;
-  char devpath[12];
-
-  /* Initialize a quadrature encoder interface. */
-
-  sninfo("Initializing the quadrature encoder using TIM%d\n", timerno);
-  snprintf(devpath, sizeof(devpath), "/dev/qe%d", devno);
-  ret = stm32_qeinitialize(devpath, timerno);
-  if (ret < 0)
-    {
-      snerr("ERROR: stm32_qeinitialize failed: %d\n", ret);
-    }
-
-  return ret;
-}

Reply via email to