Skip to main content
JZumt
Associate
July 14, 2021
Question

Linker error when building project in VSCode

  • July 14, 2021
  • 2 replies
  • 2578 views

I'm trying to port TouchGFX to VisualStudio Code + PlatformIO using ZephyrRTOS for the STM32F746-Disco board. To do that, I've just created an example project on TouchGFX Designer 4.17, generated the code, and added the required files manually as said in the "Using IDEs with TouchGFX" guide in the doc.

I get these 4 erros which are all undefined reference errors :

c:/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/8.2.1/../../../../arm-none-eabi/bin/ld.exe: .pio\build\disco_f746ng\src\TouchGFX\target\TouchGFXHAL.o:(.rodata._ZTV11TouchGFXHAL+0x6c): undefined reference to `touchgfx::HAL::copyFBRegionToMemory(touchgfx::Rect, unsigned short*, unsigned int)'

c:/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/8.2.1/../../../../arm-none-eabi/bin/ld.exe: .pio\build\disco_f746ng\src\TouchGFX\target\TouchGFXHAL.o:(.rodata._ZTV11TouchGFXHAL+0xb8): undefined reference to `touchgfx::HAL::touch(int, int)'

c:/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/8.2.1/../../../../arm-none-eabi/bin/ld.exe: .pio\build\disco_f746ng\src\TouchGFX\target\generated\TouchGFXConfiguration.o: in function `touchgfx_init':

C:\Users\jimmy\Documents\PlatformIO\Projects\Library417Test/src\touchgfx\target\generated/TouchGFXConfiguration.cpp:39: undefined reference to `touchgfx::Bitmap::registerBitmapDatabase(touchgfx::Bitmap::BitmapData const*, unsigned short, unsigned short*, unsigned int, unsigned int)'

c:/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/8.2.1/../../../../arm-none-eabi/bin/ld.exe: .pio\build\disco_f746ng\src\TouchGFX\target\generated\TouchGFXGeneratedHAL.o: in function 

`TouchGFXGeneratedHAL::blockCopy(void*, void const*, unsigned int)':

C:\Users\jimmy\Documents\PlatformIO\Projects\Library417Test/src\touchgfx\target\generated/TouchGFXGeneratedHAL.cpp:108: undefined reference to `touchgfx::HAL::blockCopy(void*, void const*, unsigned int)'

I would seem like I don't link properly with libtouchgfx.a since the definition of these functions is supposed to be found there. PlatformIO has an .ini file and I added the compiler flags to link with the library. Without these flags, I get hundreds of undefined references which is as expected. But with the flags, I get only 4 undefined references left, and I don't know how to fix this.

Edit : According to my professor helping me to work in this issue, it seems that some types used in the libraries don't match the types used in my project. For example an unsigned int in the compiled .a library won't take the same number of bytes in memory as an unsigned int defined in the headers files of the precompiled cpp library files.

This topic has been closed for replies.

2 replies

JZumt
JZumtAuthor
Associate
July 14, 2021

According to my professor helping me to work in this issue, it seems that some types used in the libraries don't match the types used in my project. For example an unsigned int in the compiled .a library won't take the same number of bytes in memory as an unsigned int defined in the headers files of the precompiled cpp library files.

AAdel.1
Visitor II
June 8, 2022

@JZumt​  Did you manage to solve this issue?

I'm having the exact same issue while trying to port TouchGFX to zephyr.

JZumt
JZumtAuthor
Associate
June 8, 2022

You need to modify the 4 method prototypes​ in the header files, and replace unsigned int to unsigned long if I remember correctly. In the end I had everything working so I can help you more if needed

AAdel.1
Visitor II
June 8, 2022

Thank you very much for your reply, now I can compile the project successfully, but I still, need to implement the TouchGFX abstraction layer.