Skip to main content
JDrew.469
Associate
October 25, 2019
Question

undefined reference to `HAL_UART_Init'

  • October 25, 2019
  • 2 replies
  • 2469 views

I am trying to get UART working on a project for debugging purposes but I can't get my project to compile correctly. I have uncommented "HAL_UART_MODULE_ENABLED" in stm32f4xx_hal_conf.h but it seems to have no affect on my build at all. My Paths and Symbols settings and build output are below:

0690X00000AqtVXQAZ.png

This topic has been closed for replies.

2 replies

Tesla DeLorean
Guru
October 25, 2019

Must add source code file stm32f4xx_hal_uart.c to project

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
JDrew.469
JDrew.469Author
Associate
October 25, 2019

Well that was easy. I thought that adding the /STM32F4xx_HALL_Driver/Src directory into the includes would make those .c files accessible to me. Is there a "more correct" way of adding these files into my project or should I just copy them into the same directory as my main.c file?

Tesla DeLorean
Guru
October 25, 2019

Include Paths are where it looks for.H files you #include, it can determine the search order too, but these things don't contain "code", just interface details.

The body of the code needs to come in as a .C or .LIB/A file

My preference is to keep them in the ...HAL_Driver/Src directory, and Add them into the project tree, if I need to modify them I will bring them into the project's own directory and add "localized" to the name to identify that they aren't the standard file.

Tools like CubeMX seem to copy in the whole kitchen sink, but I'm not a big fan.

At the end of the day it comes down to personal choice, or protocol defined by project lead or customer.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..