Compile error - STM32F412VE
-
- Posts: 5
- Joined: Sat Apr 03, 2021 3:03 pm
Compile error - STM32F412VE
The following STM32F412VE Arduino board is not available, hence I added the variant by copying the closest variant Generic_F412Rx and doing the necessary changes to files in it. On compiling the error I'm stuck at is :
/Library/Arduino15/packages/STM32/tools/xpack-arm-none-eabi-gcc/9.2.1-1.1/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: libraries/SrcWrapper/stm32/PortNames.c.o: in function set_GPIO_Port_Clock': PortNames.c:(.text.set_GPIO_Port_Clock+0xa2): undefined reference to __HAL_RCC_GPIOF_CLK_ENABLE'
/Library/Arduino15/packages/STM32/tools/xpack-arm-none-eabi-gcc/9.2.1-1.1/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: PortNames.c:(.text.set_GPIO_Port_Clock+0xaa): undefined reference to `__HAL_RCC_GPIOG_CLK_ENABLE'
collect2: error: ld returned 1 exit status
exit status 1
Error compiling for board Generic STM32F4 series.
Any idea or hint will be helpful ?
/Library/Arduino15/packages/STM32/tools/xpack-arm-none-eabi-gcc/9.2.1-1.1/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: libraries/SrcWrapper/stm32/PortNames.c.o: in function set_GPIO_Port_Clock': PortNames.c:(.text.set_GPIO_Port_Clock+0xa2): undefined reference to __HAL_RCC_GPIOF_CLK_ENABLE'
/Library/Arduino15/packages/STM32/tools/xpack-arm-none-eabi-gcc/9.2.1-1.1/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: PortNames.c:(.text.set_GPIO_Port_Clock+0xaa): undefined reference to `__HAL_RCC_GPIOG_CLK_ENABLE'
collect2: error: ld returned 1 exit status
exit status 1
Error compiling for board Generic STM32F4 series.
Any idea or hint will be helpful ?
Re: Compile error - STM32F412VE
First check the product_line entry in the boards.txt.
I guess you kept: STM32F412Rx while it should be STM32F412Vx
I guess you kept: STM32F412Rx while it should be STM32F412Vx
-
- Posts: 5
- Joined: Sat Apr 03, 2021 3:03 pm
Re: Compile error - STM32F412VE
Okay. This is what I added. Maybe I am missing something ?
# Generic F412VE
GenF4.menu.pnum.Generic_F412VE=Generic F412VE
GenF4.menu.pnum.Generic_F412VE.upload.maximum_size=524288
GenF4.menu.pnum.Generic_F412VE.upload.maximum_data_size=262144
GenF4.menu.pnum.Generic_F412VE.build.board=GENERIC_F412VE
GenF4.menu.pnum.Generic_F412VE.build.product_line=STM32F412Vx
GenF4.menu.pnum.Generic_F412VE.build.variant=Generic_F412Vx
# Generic F412VE
GenF4.menu.pnum.Generic_F412VE=Generic F412VE
GenF4.menu.pnum.Generic_F412VE.upload.maximum_size=524288
GenF4.menu.pnum.Generic_F412VE.upload.maximum_data_size=262144
GenF4.menu.pnum.Generic_F412VE.build.board=GENERIC_F412VE
GenF4.menu.pnum.Generic_F412VE.build.product_line=STM32F412Vx
GenF4.menu.pnum.Generic_F412VE.build.variant=Generic_F412Vx
-
- Posts: 5
- Joined: Sat Apr 03, 2021 3:03 pm
Re: Compile error - STM32F412VE
Update : On removing the following code below from PortNames.c fixed the compile error.
#if defined GPIOF_BASE
case PortF:
gpioPort = (GPIO_TypeDef *)GPIOF_BASE;
__HAL_RCC_GPIOF_CLK_ENABLE();
break;
#endif
#if defined GPIOG_BASE
case PortG:
#if defined(PWR_CR2_IOSV)
// Enable VDDIO2 supply for 14 I/Os (Port G[15:2])
HAL_PWREx_EnableVddIO2();
#endif
gpioPort = (GPIO_TypeDef *)GPIOG_BASE;
__HAL_RCC_GPIOG_CLK_ENABLE();
break;
#endif
#if defined GPIOF_BASE
case PortF:
gpioPort = (GPIO_TypeDef *)GPIOF_BASE;
__HAL_RCC_GPIOF_CLK_ENABLE();
break;
#endif
#if defined GPIOG_BASE
case PortG:
#if defined(PWR_CR2_IOSV)
// Enable VDDIO2 supply for 14 I/Os (Port G[15:2])
HAL_PWREx_EnableVddIO2();
#endif
gpioPort = (GPIO_TypeDef *)GPIOG_BASE;
__HAL_RCC_GPIOG_CLK_ENABLE();
break;
#endif
Re: Compile error - STM32F412VE
Yes removing that solved your issue but this is not correct as it is common and under preprocessing.
Re: Compile error - STM32F412VE
In fact it seems there is a mismatch between the CMSIS device drivers definition of the mcu:
https://raw.githubusercontent.com/stm32 ... 32f412vx.h
and the HAL RCC:
https://github.com/stm32duino/Arduino_C ... l_rcc_ex.h
That would be fine to open an issue in the STM32CubeF4 GitHub repository.
https://github.com/STMicroelectronics/STM32CubeF4
https://raw.githubusercontent.com/stm32 ... 32f412vx.h
and the HAL RCC:
https://github.com/stm32duino/Arduino_C ... l_rcc_ex.h
That would be fine to open an issue in the STM32CubeF4 GitHub repository.
https://github.com/STMicroelectronics/STM32CubeF4
Re: Compile error - STM32F412VE
Variants of STM32F412Vx with 100 pins or less dont have ports F and G according to datasheet, still GPIOF_BASE and GPIOG_BASE are defined in the stm32f412vx.h header file.
Since PortNames.c only checks if GPIOF_BASE is defined that will fail since __HAL_RCC_GPIOF_CLK_ENABLE() is not defined, see "stm32f4xx_hal_rcc_ex.h:4726" and above. Perhaps the code should check if the clock enable macro is defined.
EDIT: There is also a macro IS_GPIO_ALL_INSTANCE(GPIOx) that could be used to check if the port is present according to HAL code.
Since PortNames.c only checks if GPIOF_BASE is defined that will fail since __HAL_RCC_GPIOF_CLK_ENABLE() is not defined, see "stm32f4xx_hal_rcc_ex.h:4726" and above. Perhaps the code should check if the clock enable macro is defined.
EDIT: There is also a macro IS_GPIO_ALL_INSTANCE(GPIOx) that could be used to check if the port is present according to HAL code.
Re: Compile error - STM32F412VE
I've just check the datasheet and even if some PF/PG are mentioned for UFBGA144 and LQFP144 they are not available for the sales F412V version. Only 81 pins.mlundin wrote: Sun Apr 04, 2021 9:52 am Variants of STM32F412Vx with 100 pins or less dont have ports F and G according to datasheet, still GPIOF_BASE and GPIOG_BASE are defined in the stm32f412vx.h header file.
Since PortNames.c only checks if GPIOF_BASE is defined that will fail since __HAL_RCC_GPIOF_CLK_ENABLE() is not defined, see "stm32f4xx_hal_rcc_ex.h:4726" and above. Perhaps the code should check if the clock enable macro is defined.
EDIT: There is also a macro IS_GPIO_ALL_INSTANCE(GPIOx) that could be used to check if the port is present according to HAL code.
So the cmsis device should be fixed.
Code: Select all
IS_GPIO_ALL_INSTANCE
-
- Posts: 5
- Joined: Sat Apr 03, 2021 3:03 pm
Re: Compile error - STM32F412VE
Exactly!mlundin wrote: Sun Apr 04, 2021 9:52 am Variants of STM32F412Vx with 100 pins or less dont have ports F and G according to datasheet, still GPIOF_BASE and GPIOG_BASE are defined in the stm32f412vx.h header file.
Since PortNames.c only checks if GPIOF_BASE is defined that will fail since __HAL_RCC_GPIOF_CLK_ENABLE() is not defined, see "stm32f4xx_hal_rcc_ex.h:4726" and above. Perhaps the code should check if the clock enable macro is defined.
EDIT: There is also a macro IS_GPIO_ALL_INSTANCE(GPIOx) that could be used to check if the port is present according to HAL code.