Compiler: arm-none-eabi-gcc 8.3.1
Platform/board: custom STM32L422KB, adapted from ST_NUCLEO32_L432KC
Failure: build errors --
Code: Select all
./lib/chibios/os/hal/ports/STM32/LLD/RCCv1/stm32_pll.inc: In function 'pll_init':
./lib/chibios/os/hal/ports/STM32/LLD/RCCv1/stm32_pll.inc:179:44: error: 'RCC_PLLCFGR_PLLP_Pos' undeclared (first use in this function); did you mean 'RCC_PLLCFGR_PLLN_Pos'?
#define STM32_PLLP (0U << RCC_PLLCFGR_PLLP_Pos)
^~~~~~~~~~~~~~~~~~~~
./lib/chibios/os/hal/ports/STM32/LLD/RCCv1/stm32_pll.inc:343:34: note: in expansion of macro 'STM32_PLLP'
STM32_PLLQEN | STM32_PLLP |
^~~~~~~~~~
./lib/chibios/os/hal/ports/STM32/LLD/RCCv1/stm32_pll.inc:179:44: note: each undeclared identifier is reported only once for each function it appears in
#define STM32_PLLP (0U << RCC_PLLCFGR_PLLP_Pos)
^~~~~~~~~~~~~~~~~~~~
./lib/chibios/os/hal/ports/STM32/LLD/RCCv1/stm32_pll.inc:343:34: note: in expansion of macro 'STM32_PLLP'
STM32_PLLQEN | STM32_PLLP |
^~~~~~~~~~
Was attempting to build against L422KB (well, L412KB but close enough), but can't do so as it seems as if it's configured incorrectly in the stm32_registry.h.
There is no PLLP on the chip (when looking at STM32CubeMX), though the stm32_registry.h says so.
I had to make two changes to get things to compile:
- Setting STM32_RCC_PLL_HAS_P to FALSE
- Seemingly changing STM32_PLLPEN to STM32_PLLPDIV, as the former was already defined in hal_lld.h.
I'm not sure if the second is correct -- PLLQ/PLLR etc. also look like they have the same issue with STM32_PLLPEN/STM32_PLLPDIV.
Code: Select all
diff --git a/os/hal/ports/STM32/LLD/RCCv1/stm32_pll.inc b/os/hal/ports/STM32/LLD/RCCv1/stm32_pll.inc
index 2b3af669d5..9d649d288f 100644
--- a/os/hal/ports/STM32/LLD/RCCv1/stm32_pll.inc
+++ b/os/hal/ports/STM32/LLD/RCCv1/stm32_pll.inc
@@ -222,7 +222,7 @@
#else /* !STM32_RCC_PLL_HAS_P */
#define STM32_PLLP 0U
-#define STM32_PLLPEN 0U
+#define STM32_PLLPDIV 0U
#endif /* !STM32_RCC_PLL_HAS_P */
/*---------------------------------------------------------------------------*/
diff --git a/os/hal/ports/STM32/STM32L4xx/stm32_registry.h b/os/hal/ports/STM32/STM32L4xx/stm32_registry.h
index ecb2efc5de..8fcb5dba41 100644
--- a/os/hal/ports/STM32/STM32L4xx/stm32_registry.h
+++ b/os/hal/ports/STM32/STM32L4xx/stm32_registry.h
@@ -353,7 +353,7 @@
#define STM32_RCC_HAS_HSE TRUE
#define STM32_RCC_HAS_PLL TRUE
-#define STM32_RCC_PLL_HAS_P TRUE
+#define STM32_RCC_PLL_HAS_P FALSE
#define STM32_RCC_PLL_HAS_Q TRUE
#define STM32_RCC_PLL_HAS_R TRUE