cancel
Showing results for 
Search instead for 
Did you mean: 

What does 'undefined reference ' mean in Truestudio

melt brink
Associate III
Posted on June 14, 2018 at 12:42

Im adding to touch to STM32f746 Disco. Using STCubeMx and STemwin + Guibuilder.  When trying to add touch I add the following two include files to main.h

&sharpinclude 'stm32746g_discovery.h'

&sharpinclude 'stm32746g_discovery_ts.h'

when I compile I two errors pop up :

         undefined reference to 'BSP_TS_GetState'

         undefined reference to BSP_TS_Init'

These are referenced in the stm32f746_discovery_ts.h  can someone tell me what these errors mean.

they are used in functions below from main.c (highlighted in bold)

void TouchTimer_Init()

{

BSP_TS_Init(480,272); // initialize touch screen

if (HAL_TIM_Base_Init(&htim3) != HAL_OK ) {while (1);} // start timers

if (HAL_TIM_Base_Start_IT(&htim3) != HAL_OK ) {while (1);}

}

and

void BSP_Pointer_Update(void)

{

GUI_PID_STATE TS_State; // structure that reports touch state

static TS_StateTypeDef prev_state; // previous touch state from touch sensor

TS_StateTypeDef ts; // actual touch state from the sensor from BSP package

uint16_t xDiff, yDiff; // difference in positions

BSP_TS_GetState(&ts); // read the touch state from sensor BSP API

TS_State.Pressed = ts.touchDetected; // Store the pressed state to Stemwin

xDiff = (prev_state.touchX[0] > ts.touchX) ? (prev_state.touchX[0] - ts.touchX[0]) : (ts.touchX[0] - prev_state.touchX[0]);

yDiff = (prev_state.touchY[0] > ts.touchY) ? (prev_state.touchY[0] - ts.touchY[0]) : (ts.touchY[0] - prev_state.touchY[0]);

if((prev_state.touchDetected = ts.touchDetected )|| (xDiff > 3 )||(yDiff > 3))

{

prev_state.touchDetected = ts.touchDetected;

if((ts.touchX[0] != 0) && (ts.touchY[0] != 0))

{

prev_state.touchX[0] = ts.touchX[0];

prev_state.touchY[0]= ts.touchY[0];

}

TS_State.Layer = 0;

TS_State.x = prev_state.touchX[0];

TS_State.y = prev_state.touchY[0];

//send touch state to stemnwin

GUI_TOUCH_StoreStateEx(&TS_State);

}

}

#undefined-reference #stm32f746-discovery #touch
1 ACCEPTED SOLUTION

Accepted Solutions
Posted on June 14, 2018 at 13:26

Compile errors or link errors?

You would need to make sure your project contains stm32746g_discovery_ts.c so the body code is present.

Also that has dependencies on  stm32746g_discovery_lcd.c and  ft5336.c

Other components must be enabled via stm32f7xx_hal_conf.h in your project directory.

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

View solution in original post

3 REPLIES 3
Posted on June 14, 2018 at 13:26

Compile errors or link errors?

You would need to make sure your project contains stm32746g_discovery_ts.c so the body code is present.

Also that has dependencies on  stm32746g_discovery_lcd.c and  ft5336.c

Other components must be enabled via stm32f7xx_hal_conf.h in your project directory.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
melt brink
Associate III
Posted on June 14, 2018 at 18:11

thanks Clive, yes linking.

I have created BSP directory and added stm32746g_discovery_ts.c as well as stm32746g_dicovery_lcd.c and the touch driver ft5336.c.

and can now debug.

My main aim here is to have a bare metal IOC file with touch functionality, STEMwin and guibuilder  all in order for me to add and remove perhipherals in Cubemx and then code applications from there.

Posted on July 13, 2018 at 14:31

Hi

brink.melt.001

,

My main aim here is to have a bare metal IOC file with touch functionality, STEMwin and guibuilder all in order for me to add and remove perhipherals in Cubemx and then code applications from there.

I think that

 will answer your request.

-Amel

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.