2025-05-23 12:16 PM
I'm using STM32CubeMX 6.14.1
Recently I was added DAC to my project. I doesn't suppose to use DAC with interrupt, I wasn't enable it, but occasionally I was enabled DAC callbacks.
Generated the code for Makefile based project.
In the end of building process, linker thrown errors:
/usr/lib/gcc/arm-none-eabi/12.2.1/../../../arm-none-eabi/bin/ld: build/stm32f0xx_hal_dac.o: in function `HAL_DAC_Init':
/home/tovis/nusi/worke/STM32/F051_ccl/Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_dac.c:304: undefined reference to `HAL_DACEx_ConvCpltCallbackCh2'
/usr/lib/gcc/arm-none-eabi/12.2.1/../../../arm-none-eabi/bin/ld: /home/tovis/nusi/worke/STM32/F051_ccl/Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_dac.c:304: undefined reference to `HAL_DACEx_ConvHalfCpltCallbackCh2'
/usr/lib/gcc/arm-none-eabi/12.2.1/../../../arm-none-eabi/bin/ld: /home/tovis/nusi/worke/STM32/F051_ccl/Drivers/STM32F0xx_HAL_Driver/Src/stm32f0xx_hal_dac.c:304: undefined reference to `HAL_DACEx_ErrorCallbackCh2'
I made some investigation, and turns out, that in generated code stm32f0xx_hal_dac.c DAC handled as it have two channel - STN32F051 have only one channel DAC. From the other side, where the callbacks are defined there is a series #ifdef and list of STM32F0xx MCUs which have two channel DAC (stm32f0xx_hal_dac_ex.c row: 1088). With this setup callbacks for the second channel aren't generated, what leads to linker error.
When I understand what's the problem, I simply disabled callbacks. My problem is solved, but I think it's a bug and sometime shall be corrected.
2025-05-23 12:56 PM
Hello @tovis
could you please upload your .ioc file.
Best Regards.
STTwo-32
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2025-05-23 10:35 PM