cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F7xx --> Undefined Reference to 'HAL_UART_Transmit'

RHug.1
Associate II

Good afternoon,

I recently started working with TouchGFX and encountered a problem while flashing the programm on my board STM32F746NGH6 (with the display: ETEM043005XDH6)

After reading & understanding the code of the examples as well as building my own examples, I tried to rebuild the UART (RS232) example.

The Simulator compiles and runs without any problem.

Unfortunately when trying to "Run Target" flashing the programm on my board I encoutered a problem with the UART Library used.

It seems that it cannot find the reference I defined earlier in my code.

I tried the entire day to fix the problem but none of the fixes I tried worked out.

Could you please clarify the way to import such libraries which have been defined in the code or link me to a tutorial? I couldn't find anything.

Following files I looked through:

  • BoardConfiguration.cpp & .hpp
  • Model.cpp & .hpp
  • C:\TouchGFXProjects\ProjectName\target\bsp\source\vendor\ETEM043005XDH6
    • for usart.c & .h File
  • C:\TouchGFXProjects\ProjectName\target\bsp\source\platform\stm32f7xx\STM32F7xx_HAL_Driver
  • C:\TouchGFXProjects\ProjectName\target\bsp\include\platform\stm32f7xx\STM32F7xx_HAL_Driver

#include <gui/model/Model.hpp>
#include <gui/model/ModelListener.hpp>
 
#ifndef SIMULATOR
extern "C"
{
	#include "Calibration_Parameters.h"
	#include "stm32f7xx_hal.h"
	#include "stm32f7xx_hal_spi.h"
	#include "stm32f7xx_hal_tim.h"
	//#include "stm32f7xx_hal_uart.h"
	//#include "stm32f7xx_hal_usart.h"
	//#include "etem043005xdh6_usart.h"
 
	extern UART_HandleTypeDef huart2;
	extern UART_HandleTypeDef huart6;
 
}
#endif
 
 
Model::Model() : modelListener(0)
{
 
}
 
void Model::tick()
{
 
}
 
/**********************************************************************************************************/
//
//  RS232 and RS498 Transmission of Slider Value
//
/**********************************************************************************************************/
 
#ifndef SIMULATOR
 
void Model::send_data(unsigned char data)
{
	
	unsigned char tt[10];
	
	tt[0] = 0x0D;   //CR
	tt[1] = 0x0A;   //LF
	tt[2] = (data / 100) + '0';
	data %= 100;
	tt[3] = (data / 10) + '0';
	tt[4] = (data % 10) + '0';
 
	 //HAL_UART_Transmit(&huart2,tt,5,200);
	 //HAL_UART_Receive(&huart6, tt, 5, 200);   //RS232 Receive Data
        HAL_UART_Transmit(&huart6,tt,5,200);    // RS232 Blocking, Interrupt function under development
     //   HAL_UART_Transmit(&huart2,tt,5,200);    // RS485 Blocking, Interrupt function under development
}
#endif
	/*******************************************************************************************************/

Any help or links would be highly appreciated.

Rafael

2 REPLIES 2
Romain DIELEMAN
ST Employee

Hi,

Your code compiled as far as i can see. It is when linking that the issue appears, you should have a look at your makefile. I am not an expert but I will have a talk with some people internally and come back to you asap. Another option is to use IAR to define the right path.

RHug.1
Associate II

I was able to fix the problem by (hardcode) adding the dependencies to Makefile.

Is there also an easier way to build paths? I am not familiar with IAR, do you have further information regarding this?

For upcoming projects we need to be able adding pathes without editing the Makefile, if possible.