b-g431-esc1Arduino Compile Problem

Hi,

I started to test my board with arduino. I opened example sketch, but it is compile error. I did not change anything.
Here is my output.

c:/users/administrator/appdata/local/arduino15/packages/stmicroelectronics/tools/xpack-arm-none-eabi-gcc/10.3.1-2.3/bin/…/lib/gcc/arm-none-eabi/10.3.1/…/…/…/…/arm-none-eabi/bin/ld.exe: libraries\Simple_FOC\current_sense\hardware_specific\stm32\b_g431\b_g431_mcu.cpp.o: in function _configureOPAMP(OPAMP_HandleTypeDef*, OPAMP_TypeDef*)': b_g431_mcu.cpp:(.text._Z15_configureOPAMPP19OPAMP_HandleTypeDefP13OPAMP_TypeDef+0x22): undefined reference to HAL_OPAMP_Init’
c:/users/administrator/appdata/local/arduino15/packages/stmicroelectronics/tools/xpack-arm-none-eabi-gcc/10.3.1-2.3/bin/…/lib/gcc/arm-none-eabi/10.3.1/…/…/…/…/arm-none-eabi/bin/ld.exe: libraries\Simple_FOC\current_sense\hardware_specific\stm32\b_g431\b_g431_mcu.cpp.o: in function _configureADCInline(void const*, int, int, int)': b_g431_mcu.cpp:(.text._Z19_configureADCInlinePKviii+0x6c): undefined reference to HAL_OPAMP_Start’
c:/users/administrator/appdata/local/arduino15/packages/stmicroelectronics/tools/xpack-arm-none-eabi-gcc/10.3.1-2.3/bin/…/lib/gcc/arm-none-eabi/10.3.1/…/…/…/…/arm-none-eabi/bin/ld.exe: b_g431_mcu.cpp:(.text._Z19_configureADCInlinePKviii+0x72): undefined reference to HAL_OPAMP_Start' c:/users/administrator/appdata/local/arduino15/packages/stmicroelectronics/tools/xpack-arm-none-eabi-gcc/10.3.1-2.3/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: b_g431_mcu.cpp:(.text._Z19_configureADCInlinePKviii+0x78): undefined reference to HAL_OPAMP_Start’
collect2.exe: error: ld returned 1 exit status
exit status 1
Error compiling for board Discovery.

What can be the reason ?

1 Like

Ok. I resolved it by adding -D HAL_ADC_MODULE_ONLY -D HAL_OPAMP_MODULE_ENABLED flags to boards.txt.

2 Likes

Hi, I have a similar issue. Could you specify how did you change the boards.txt files?
I new to this, thank you

Hi, sorry for late reply.
C:\Users\Administrator\AppData\Local\Arduino15\packages\STMicroelectronics\hardware\stm32\2.3.0

this is my boards.txt folder

and this my discovery board definition.

Discovery boards

Disco.name=Discovery

Disco.build.core=arduino
Disco.build.board=Disco
Disco.build.variant_h=variant_{build.board}.h
Disco.build.st_extra_flags=-D{build.product_line} {build.enable_usb} {build.xSerial} -D HAL_ADC_MODULE_ONLY -D HAL_OPAMP_MODULE_ENABLED

I hope this helps.

2 Likes

@etempm It’s my first time compiling for the B-G and this is exactly what I needed!

Many thanks.
Barry M

I also had this problem and was able to get the board loaded with this update. Then Arduino IDE updated and replaced the file and I Now have to try the fix all over again. is this something that has been identified as an update item so it will get fixed in the github file?