cancel
Showing results for 
Search instead for 
Did you mean: 

Linker error when building project in VSCode

JZumt
Associate II

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.

4 REPLIES 4
JZumt
Associate II

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
Associate

@JZumt​  Did you manage to solve this issue?

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

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

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