From fd105b7e773e53bdfdec6b794e95a563dd603184 Mon Sep 17 00:00:00 2001 From: Joshua DeWeese Date: Wed, 20 Mar 2024 11:29:25 -0400 Subject: [PATCH 1/2] cpu/stm32: remove redundant conditional compile This patch removes a largely redundant block of conditional includes. The removed includes are moved into the family specific headers so that the more specific headers may override defaults defined in the shared headers. --- cpu/stm32/include/clk/c0/cfg_clock_default.h | 2 ++ cpu/stm32/include/clk/clk_conf.h | 11 ----------- cpu/stm32/include/clk/f0f1f3/cfg_clock_default.h | 2 ++ cpu/stm32/include/clk/f2f4f7/cfg_clock_default.h | 2 ++ cpu/stm32/include/clk/g0g4/cfg_clock_default.h | 2 ++ cpu/stm32/include/clk/l0l1/cfg_clock_default.h | 1 + cpu/stm32/include/clk/l4l5wx/cfg_clock_default.h | 2 ++ cpu/stm32/include/clk/mp1/cfg_clock_default.h | 2 ++ cpu/stm32/include/clk/u5/cfg_clock_default.h | 2 ++ 9 files changed, 15 insertions(+), 11 deletions(-) diff --git a/cpu/stm32/include/clk/c0/cfg_clock_default.h b/cpu/stm32/include/clk/c0/cfg_clock_default.h index 3118bb2688..527d88c465 100644 --- a/cpu/stm32/include/clk/c0/cfg_clock_default.h +++ b/cpu/stm32/include/clk/c0/cfg_clock_default.h @@ -19,6 +19,8 @@ #ifndef CLK_C0_CFG_CLOCK_DEFAULT_H #define CLK_C0_CFG_CLOCK_DEFAULT_H +#include "cfg_clock_common_fx_gx_mp1_c0.h" + #ifdef __cplusplus extern "C" { #endif diff --git a/cpu/stm32/include/clk/clk_conf.h b/cpu/stm32/include/clk/clk_conf.h index 4b093cdd82..3fecf62749 100644 --- a/cpu/stm32/include/clk/clk_conf.h +++ b/cpu/stm32/include/clk/clk_conf.h @@ -22,17 +22,6 @@ #include "kernel_defines.h" #include "macros/units.h" -#if defined(CPU_FAM_STM32F0) || defined(CPU_FAM_STM32F1) || \ - defined(CPU_FAM_STM32F2) || defined(CPU_FAM_STM32F3) || \ - defined(CPU_FAM_STM32F4) || defined(CPU_FAM_STM32F7) || \ - defined(CPU_FAM_STM32G0) || defined(CPU_FAM_STM32G4) || \ - defined(CPU_FAM_STM32MP1) || defined(CPU_FAM_STM32C0) -#include "cfg_clock_common_fx_gx_mp1_c0.h" -#else /* CPU_FAM_STM32L0 || CPU_FAM_STM32L1 || CPU_FAM_STM32L4 || - * CPU_FAM_STM32L5 || CPU_FAM_STM32U5 || CPU_FAM_STM32WB */ -#include "cfg_clock_common_lx_u5_wx.h" -#endif - #if defined(CPU_FAM_STM32F0) || defined(CPU_FAM_STM32F1) || \ defined(CPU_FAM_STM32F3) #include "f0f1f3/cfg_clock_default.h" diff --git a/cpu/stm32/include/clk/f0f1f3/cfg_clock_default.h b/cpu/stm32/include/clk/f0f1f3/cfg_clock_default.h index 180dff3719..e623c2e614 100644 --- a/cpu/stm32/include/clk/f0f1f3/cfg_clock_default.h +++ b/cpu/stm32/include/clk/f0f1f3/cfg_clock_default.h @@ -26,6 +26,8 @@ #ifndef CLK_F0F1F3_CFG_CLOCK_DEFAULT_H #define CLK_F0F1F3_CFG_CLOCK_DEFAULT_H +#include "cfg_clock_common_fx_gx_mp1_c0.h" + #ifdef __cplusplus extern "C" { #endif diff --git a/cpu/stm32/include/clk/f2f4f7/cfg_clock_default.h b/cpu/stm32/include/clk/f2f4f7/cfg_clock_default.h index 46d6c81fef..3e7e2335e9 100644 --- a/cpu/stm32/include/clk/f2f4f7/cfg_clock_default.h +++ b/cpu/stm32/include/clk/f2f4f7/cfg_clock_default.h @@ -19,6 +19,8 @@ #ifndef CLK_F2F4F7_CFG_CLOCK_DEFAULT_H #define CLK_F2F4F7_CFG_CLOCK_DEFAULT_H +#include "cfg_clock_common_fx_gx_mp1_c0.h" + #if defined(CPU_FAM_STM32F2) #include "f2f4f7/cfg_clock_default_120.h" #elif defined(CPU_FAM_STM32F4) diff --git a/cpu/stm32/include/clk/g0g4/cfg_clock_default.h b/cpu/stm32/include/clk/g0g4/cfg_clock_default.h index 7facc82ebb..92cf17ef61 100644 --- a/cpu/stm32/include/clk/g0g4/cfg_clock_default.h +++ b/cpu/stm32/include/clk/g0g4/cfg_clock_default.h @@ -23,6 +23,8 @@ #ifndef CLK_G0G4_CFG_CLOCK_DEFAULT_H #define CLK_G0G4_CFG_CLOCK_DEFAULT_H +#include "cfg_clock_common_fx_gx_mp1_c0.h" + #ifdef __cplusplus extern "C" { #endif diff --git a/cpu/stm32/include/clk/l0l1/cfg_clock_default.h b/cpu/stm32/include/clk/l0l1/cfg_clock_default.h index bdb0c092c8..1c90c5fe5b 100644 --- a/cpu/stm32/include/clk/l0l1/cfg_clock_default.h +++ b/cpu/stm32/include/clk/l0l1/cfg_clock_default.h @@ -19,6 +19,7 @@ #ifndef CLK_L0L1_CFG_CLOCK_DEFAULT_H #define CLK_L0L1_CFG_CLOCK_DEFAULT_H +#include "cfg_clock_common_lx_u5_wx.h" #include "periph_cpu.h" #ifdef __cplusplus diff --git a/cpu/stm32/include/clk/l4l5wx/cfg_clock_default.h b/cpu/stm32/include/clk/l4l5wx/cfg_clock_default.h index 89eb43735e..ca842fee48 100644 --- a/cpu/stm32/include/clk/l4l5wx/cfg_clock_default.h +++ b/cpu/stm32/include/clk/l4l5wx/cfg_clock_default.h @@ -21,6 +21,8 @@ #ifndef CLK_L4L5WX_CFG_CLOCK_DEFAULT_H #define CLK_L4L5WX_CFG_CLOCK_DEFAULT_H +#include "cfg_clock_common_lx_u5_wx.h" + #ifdef __cplusplus extern "C" { #endif diff --git a/cpu/stm32/include/clk/mp1/cfg_clock_default.h b/cpu/stm32/include/clk/mp1/cfg_clock_default.h index 8d6ba8f93e..10802d2542 100644 --- a/cpu/stm32/include/clk/mp1/cfg_clock_default.h +++ b/cpu/stm32/include/clk/mp1/cfg_clock_default.h @@ -19,6 +19,8 @@ #ifndef CLK_MP1_CFG_CLOCK_DEFAULT_H #define CLK_MP1_CFG_CLOCK_DEFAULT_H +#include "cfg_clock_common_fx_gx_mp1_c0.h" + /** * @name MP1 clock PLL settings (208MHz) * @{ diff --git a/cpu/stm32/include/clk/u5/cfg_clock_default.h b/cpu/stm32/include/clk/u5/cfg_clock_default.h index 6f29345a83..fa66f9b6c4 100644 --- a/cpu/stm32/include/clk/u5/cfg_clock_default.h +++ b/cpu/stm32/include/clk/u5/cfg_clock_default.h @@ -19,6 +19,8 @@ #ifndef CLK_U5_CFG_CLOCK_DEFAULT_H #define CLK_U5_CFG_CLOCK_DEFAULT_H +#include "cfg_clock_common_lx_u5_wx.h" + #ifdef __cplusplus extern "C" { #endif From 1e4526111f72c4b8f580961ecf4582d415826e64 Mon Sep 17 00:00:00 2001 From: Joshua DeWeese Date: Wed, 20 Mar 2024 11:56:05 -0400 Subject: [PATCH 2/2] cpu/stm32: moved includes out of header where not used --- cpu/stm32/include/clk/c0/cfg_clock_default.h | 2 ++ cpu/stm32/include/clk/cfg_clock_common_fx_gx_mp1_c0.h | 2 ++ cpu/stm32/include/clk/cfg_clock_common_lx_u5_wx.h | 2 ++ cpu/stm32/include/clk/clk_conf.h | 3 --- cpu/stm32/include/clk/f0f1f3/cfg_clock_default.h | 2 ++ cpu/stm32/include/clk/f2f4f7/cfg_clock_default.h | 1 + cpu/stm32/include/clk/f2f4f7/cfg_clock_default_100.h | 3 +++ cpu/stm32/include/clk/f2f4f7/cfg_clock_default_120.h | 3 +++ cpu/stm32/include/clk/f2f4f7/cfg_clock_default_180.h | 3 +++ cpu/stm32/include/clk/f2f4f7/cfg_clock_default_216.h | 3 +++ cpu/stm32/include/clk/f2f4f7/cfg_clock_default_84.h | 3 +++ cpu/stm32/include/clk/g0g4/cfg_clock_default.h | 2 ++ cpu/stm32/include/clk/l0l1/cfg_clock_default.h | 2 ++ cpu/stm32/include/clk/l4l5wx/cfg_clock_default.h | 2 ++ cpu/stm32/include/clk/mp1/cfg_clock_default.h | 2 ++ cpu/stm32/include/clk/u5/cfg_clock_default.h | 2 ++ 16 files changed, 34 insertions(+), 3 deletions(-) diff --git a/cpu/stm32/include/clk/c0/cfg_clock_default.h b/cpu/stm32/include/clk/c0/cfg_clock_default.h index 527d88c465..6b39758864 100644 --- a/cpu/stm32/include/clk/c0/cfg_clock_default.h +++ b/cpu/stm32/include/clk/c0/cfg_clock_default.h @@ -20,6 +20,8 @@ #define CLK_C0_CFG_CLOCK_DEFAULT_H #include "cfg_clock_common_fx_gx_mp1_c0.h" +#include "kernel_defines.h" +#include "macros/units.h" #ifdef __cplusplus extern "C" { diff --git a/cpu/stm32/include/clk/cfg_clock_common_fx_gx_mp1_c0.h b/cpu/stm32/include/clk/cfg_clock_common_fx_gx_mp1_c0.h index b9f7fd3958..7d0d59b282 100644 --- a/cpu/stm32/include/clk/cfg_clock_common_fx_gx_mp1_c0.h +++ b/cpu/stm32/include/clk/cfg_clock_common_fx_gx_mp1_c0.h @@ -23,6 +23,8 @@ #ifndef CLK_CFG_CLOCK_COMMON_FX_GX_MP1_C0_H #define CLK_CFG_CLOCK_COMMON_FX_GX_MP1_C0_H +#include "kernel_defines.h" + #ifdef __cplusplus extern "C" { #endif diff --git a/cpu/stm32/include/clk/cfg_clock_common_lx_u5_wx.h b/cpu/stm32/include/clk/cfg_clock_common_lx_u5_wx.h index 0703081a22..bd6b0ef9ec 100644 --- a/cpu/stm32/include/clk/cfg_clock_common_lx_u5_wx.h +++ b/cpu/stm32/include/clk/cfg_clock_common_lx_u5_wx.h @@ -23,6 +23,8 @@ #ifndef CLK_CFG_CLOCK_COMMON_LX_U5_WX_H #define CLK_CFG_CLOCK_COMMON_LX_U5_WX_H +#include "kernel_defines.h" + #ifdef __cplusplus extern "C" { #endif diff --git a/cpu/stm32/include/clk/clk_conf.h b/cpu/stm32/include/clk/clk_conf.h index 3fecf62749..c1636444a7 100644 --- a/cpu/stm32/include/clk/clk_conf.h +++ b/cpu/stm32/include/clk/clk_conf.h @@ -19,9 +19,6 @@ #ifndef CLK_CLK_CONF_H #define CLK_CLK_CONF_H -#include "kernel_defines.h" -#include "macros/units.h" - #if defined(CPU_FAM_STM32F0) || defined(CPU_FAM_STM32F1) || \ defined(CPU_FAM_STM32F3) #include "f0f1f3/cfg_clock_default.h" diff --git a/cpu/stm32/include/clk/f0f1f3/cfg_clock_default.h b/cpu/stm32/include/clk/f0f1f3/cfg_clock_default.h index e623c2e614..48df118e2f 100644 --- a/cpu/stm32/include/clk/f0f1f3/cfg_clock_default.h +++ b/cpu/stm32/include/clk/f0f1f3/cfg_clock_default.h @@ -27,6 +27,8 @@ #define CLK_F0F1F3_CFG_CLOCK_DEFAULT_H #include "cfg_clock_common_fx_gx_mp1_c0.h" +#include "kernel_defines.h" +#include "macros/units.h" #ifdef __cplusplus extern "C" { diff --git a/cpu/stm32/include/clk/f2f4f7/cfg_clock_default.h b/cpu/stm32/include/clk/f2f4f7/cfg_clock_default.h index 3e7e2335e9..d9cd275c9b 100644 --- a/cpu/stm32/include/clk/f2f4f7/cfg_clock_default.h +++ b/cpu/stm32/include/clk/f2f4f7/cfg_clock_default.h @@ -20,6 +20,7 @@ #define CLK_F2F4F7_CFG_CLOCK_DEFAULT_H #include "cfg_clock_common_fx_gx_mp1_c0.h" +#include "kernel_defines.h" #if defined(CPU_FAM_STM32F2) #include "f2f4f7/cfg_clock_default_120.h" diff --git a/cpu/stm32/include/clk/f2f4f7/cfg_clock_default_100.h b/cpu/stm32/include/clk/f2f4f7/cfg_clock_default_100.h index b6cb75273d..873413a80c 100644 --- a/cpu/stm32/include/clk/f2f4f7/cfg_clock_default_100.h +++ b/cpu/stm32/include/clk/f2f4f7/cfg_clock_default_100.h @@ -23,6 +23,9 @@ #ifndef CLK_F2F4F7_CFG_CLOCK_DEFAULT_100_H #define CLK_F2F4F7_CFG_CLOCK_DEFAULT_100_H +#include "kernel_defines.h" +#include "macros/units.h" + #ifdef __cplusplus extern "C" { #endif diff --git a/cpu/stm32/include/clk/f2f4f7/cfg_clock_default_120.h b/cpu/stm32/include/clk/f2f4f7/cfg_clock_default_120.h index 6e5a0a8e82..6424db0ef0 100644 --- a/cpu/stm32/include/clk/f2f4f7/cfg_clock_default_120.h +++ b/cpu/stm32/include/clk/f2f4f7/cfg_clock_default_120.h @@ -23,6 +23,9 @@ #ifndef CLK_F2F4F7_CFG_CLOCK_DEFAULT_120_H #define CLK_F2F4F7_CFG_CLOCK_DEFAULT_120_H +#include "kernel_defines.h" +#include "macros/units.h" + #ifdef __cplusplus extern "C" { #endif diff --git a/cpu/stm32/include/clk/f2f4f7/cfg_clock_default_180.h b/cpu/stm32/include/clk/f2f4f7/cfg_clock_default_180.h index e443a1effe..ab74b945ba 100644 --- a/cpu/stm32/include/clk/f2f4f7/cfg_clock_default_180.h +++ b/cpu/stm32/include/clk/f2f4f7/cfg_clock_default_180.h @@ -23,6 +23,9 @@ #ifndef CLK_F2F4F7_CFG_CLOCK_DEFAULT_180_H #define CLK_F2F4F7_CFG_CLOCK_DEFAULT_180_H +#include "kernel_defines.h" +#include "macros/units.h" + #ifdef __cplusplus extern "C" { #endif diff --git a/cpu/stm32/include/clk/f2f4f7/cfg_clock_default_216.h b/cpu/stm32/include/clk/f2f4f7/cfg_clock_default_216.h index 022ed32fab..47921c5196 100644 --- a/cpu/stm32/include/clk/f2f4f7/cfg_clock_default_216.h +++ b/cpu/stm32/include/clk/f2f4f7/cfg_clock_default_216.h @@ -23,6 +23,9 @@ #ifndef CLK_F2F4F7_CFG_CLOCK_DEFAULT_216_H #define CLK_F2F4F7_CFG_CLOCK_DEFAULT_216_H +#include "kernel_defines.h" +#include "macros/units.h" + #ifdef __cplusplus extern "C" { #endif diff --git a/cpu/stm32/include/clk/f2f4f7/cfg_clock_default_84.h b/cpu/stm32/include/clk/f2f4f7/cfg_clock_default_84.h index eb03e49e7e..bc7f57d39f 100644 --- a/cpu/stm32/include/clk/f2f4f7/cfg_clock_default_84.h +++ b/cpu/stm32/include/clk/f2f4f7/cfg_clock_default_84.h @@ -23,6 +23,9 @@ #ifndef CLK_F2F4F7_CFG_CLOCK_DEFAULT_84_H #define CLK_F2F4F7_CFG_CLOCK_DEFAULT_84_H +#include "kernel_defines.h" +#include "macros/units.h" + #ifdef __cplusplus extern "C" { #endif diff --git a/cpu/stm32/include/clk/g0g4/cfg_clock_default.h b/cpu/stm32/include/clk/g0g4/cfg_clock_default.h index 92cf17ef61..6d3be77938 100644 --- a/cpu/stm32/include/clk/g0g4/cfg_clock_default.h +++ b/cpu/stm32/include/clk/g0g4/cfg_clock_default.h @@ -24,6 +24,8 @@ #define CLK_G0G4_CFG_CLOCK_DEFAULT_H #include "cfg_clock_common_fx_gx_mp1_c0.h" +#include "kernel_defines.h" +#include "macros/units.h" #ifdef __cplusplus extern "C" { diff --git a/cpu/stm32/include/clk/l0l1/cfg_clock_default.h b/cpu/stm32/include/clk/l0l1/cfg_clock_default.h index 1c90c5fe5b..db02568c19 100644 --- a/cpu/stm32/include/clk/l0l1/cfg_clock_default.h +++ b/cpu/stm32/include/clk/l0l1/cfg_clock_default.h @@ -20,6 +20,8 @@ #define CLK_L0L1_CFG_CLOCK_DEFAULT_H #include "cfg_clock_common_lx_u5_wx.h" +#include "kernel_defines.h" +#include "macros/units.h" #include "periph_cpu.h" #ifdef __cplusplus diff --git a/cpu/stm32/include/clk/l4l5wx/cfg_clock_default.h b/cpu/stm32/include/clk/l4l5wx/cfg_clock_default.h index ca842fee48..a10365ac93 100644 --- a/cpu/stm32/include/clk/l4l5wx/cfg_clock_default.h +++ b/cpu/stm32/include/clk/l4l5wx/cfg_clock_default.h @@ -22,6 +22,8 @@ #define CLK_L4L5WX_CFG_CLOCK_DEFAULT_H #include "cfg_clock_common_lx_u5_wx.h" +#include "kernel_defines.h" +#include "macros/units.h" #ifdef __cplusplus extern "C" { diff --git a/cpu/stm32/include/clk/mp1/cfg_clock_default.h b/cpu/stm32/include/clk/mp1/cfg_clock_default.h index 10802d2542..44b5254ed3 100644 --- a/cpu/stm32/include/clk/mp1/cfg_clock_default.h +++ b/cpu/stm32/include/clk/mp1/cfg_clock_default.h @@ -20,6 +20,8 @@ #define CLK_MP1_CFG_CLOCK_DEFAULT_H #include "cfg_clock_common_fx_gx_mp1_c0.h" +#include "kernel_defines.h" +#include "macros/units.h" /** * @name MP1 clock PLL settings (208MHz) diff --git a/cpu/stm32/include/clk/u5/cfg_clock_default.h b/cpu/stm32/include/clk/u5/cfg_clock_default.h index fa66f9b6c4..4b2f94252d 100644 --- a/cpu/stm32/include/clk/u5/cfg_clock_default.h +++ b/cpu/stm32/include/clk/u5/cfg_clock_default.h @@ -20,6 +20,8 @@ #define CLK_U5_CFG_CLOCK_DEFAULT_H #include "cfg_clock_common_lx_u5_wx.h" +#include "kernel_defines.h" +#include "macros/units.h" #ifdef __cplusplus extern "C" {