[En-Nut-Discussion] PWR_CR_VOS undeclared
Uwe Bonnes
bon at elektron.ikp.physik.tu-darmstadt.de
Sun Mar 15 11:52:39 CET 2015
>>>>> "Harald" == Harald Kipp <harald.kipp at egnite.de> writes:
Harald> Trying to build the trunk for CM3 fails with arm-none-eabi-gcc
Harald> -c -I../../usps_f205c-cm3-gcc-bld/include -I../.././nut/include
Harald> -I../.././nut/include/contrib -DUSPS -MD -MP -mcpu=cortex-m3
Harald> -mthumb -D__CORTEX__ -ffunction-sections -fdata-sections
Harald> -fomit-frame-pointer -Os -Wall -Wstrict-prototypes
Harald> -Werror-Wa,-a=cm3/dev/stm/stm32f4_clk.lst -o
Harald> cm3/dev/stm/stm32f4_clk.o
Harald> ../.././nut/arch/cm3/dev/stm/stm32f4_clk.c
Harald> ../.././nut/arch/cm3/dev/stm/stm32f4_clk.c: In function
Harald> 'SetSysClock':
Harald> ../.././nut/arch/cm3/dev/stm/stm32f4_clk.c:561:13: error:
Harald> 'PWR_CR_VOS' undeclared (first use in this function)
Harald> ../.././nut/arch/cm3/dev/stm/stm32f4_clk.c:561:13: note: each
Harald> undeclared identifier is reported only once for each function it
Harald> appears in ../.././nut/arch/cm3/dev/stm/stm32f4_clk.c:562:17:
Harald> error: 'PWR_CR_VOS_0' undeclared (first use in this function)
Harald> make[1]: *** [cm3/dev/stm/stm32f4_clk.o] Error 1 make[1]:
Harald> Leaving directory
Harald> `E:/ethernut/ethernut-5.2.6/usps_f205c-cm3-gcc-bld/arch' make:
Harald> *** [all] Error 2
Argh,
F2 has no voltage scaling. So the setting of the scaling register must be
conditional.
As I introduce some temporary varaiable before that purpose, some coding
style question emerges. Is is okay to defined the variable when needed
inside some conditional block or should this intermediate variable be
defined in the header of the block, eventually requiring another #if #endif
block, like my possible solution.
diff --git a/nut/arch/cm3/dev/stm/stm32f4_clk.c
b/nut/arch/cm3/dev/stm/stm32f4_clk.c
index 0317bdd..9fddd92 100644
--- a/nut/arch/cm3/dev/stm/stm32f4_clk.c
+++ b/nut/arch/cm3/dev/stm/stm32f4_clk.c
@@ -552,15 +552,17 @@ int SetSysClock(void)
{
int rc = 0;
uint32_t rcc_reg;
- uint32_t cr;
/* Select System frequency up to 168 MHz */
RCC->APB1ENR |= RCC_APB1ENR_PWREN;
+#if defined(PWR_CR_VOS) && defined(VOS)
+ uint32_t cr;
cr = PWR->CR;
cr &= ~(PWR_CR_VOS);
cr |= VOS * PWR_CR_VOS_0;
PWR->CR = cr;
+#endif
rcc_reg = RCC->PLLCFGR;
rcc_reg &= ~(RCC_PLLCFGR_PLLM | RCC_PLLCFGR_PLLN | RCC_PLLCFGR_PLLP |
RCC_PLLCFGR_PLLQ);
c
Bye
--
Uwe Bonnes bon at elektron.ikp.physik.tu-darmstadt.de
Institut fuer Kernphysik Schlossgartenstrasse 9 64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
More information about the En-Nut-Discussion
mailing list