cancel
Showing results for 
Search instead for 
Did you mean: 

I need tips on editing Make file

ihsanoglu
Senior

Hi,

I need to seperate my code into different .c and .h files

when I do this, the Keil IDE compile no problem. But the compiler from withing TouchGFX designer gives an error of undefined reference.

I know this issue is solvable my editing the Make file in target/gcc folder. But I have no idea how to edit it exactly,

help is appreciated

Converting images
Linking build/bin/target.elf
build/ST/STM32F746G-DISCO/gui/src/model/Model.o: In function `Model::transmit(unsigned char, unsigned char*, unsigned short)':
C:\TouchGFXProjects\AksApp/gui/src/model/Model.cpp:39: undefined reference to `esit::transmit(unsigned char, unsigned char*, unsigned short)'
build/ST/STM32F746G-DISCO/gui/src/model/Model.o: In function `Model::receive(unsigned char, unsigned short)':
C:\TouchGFXProjects\AksApp/gui/src/model/Model.cpp:48: undefined reference to `esit::receive(unsigned char, unsigned short)'
build/ST/STM32F746G-DISCO/gui/src/model/Model.o: In function `Model::receive_it(unsigned char)':
C:\TouchGFXProjects\AksApp/gui/src/model/Model.cpp:57: undefined reference to `receive_it'
build/ST/STM32F746G-DISCO/target/bsp/source/BoardConfiguration.o: In function `touchgfx::hw_init()':
C:\TouchGFXProjects\AksApp/target/bsp/source/BoardConfiguration.cpp:96: undefined reference to `esit::ESIT_USART1_Init()'
C:\TouchGFXProjects\AksApp/target/bsp/source/BoardConfiguration.cpp:97: undefined reference to `esit::ESIT_USART6_Init()'
C:\TouchGFXProjects\AksApp/target/bsp/source/BoardConfiguration.cpp:98: undefined reference to `esit::ESIT_USART7_Init()'
collect2.exe: error: ld returned 1 exit status
target/gcc/Makefile:289: recipe for target 'build/bin/target.elf' failed
make[2]: *** [build/bin/target.elf] Error 1
target/gcc/Makefile:285: recipe for target 'generate_assets' failed
make[1]: *** [generate_assets] Error 2
target/gcc/../gcc/Makefile:44: recipe for target 'all' failed
make: *** [all] Error 2

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Abdullah İhsanoğlu​,

Any source additions you have you have to add them to the Makefile. Look for something called

include_paths
source_paths

Add your folders here relative to the root of the application. e.g: In this case we're adding the "simulator" (already added) and "mycode" folders.

include_paths := $(library_includes) $(foreach comp, $(all_components), $(comp)/include) $(framework_includes) mycode
source_paths = $(foreach comp, $(all_components), $(comp)/src) $(framework_source) simulator mycode

This should make the symbols available.

/Martin

View solution in original post

4 REPLIES 4
Ozone
Lead

> I know this issue is solvable my editing the Make file in target/gcc folder. But I have no idea how to edit it exactly,

Not sure what you talk about, i.e. if Keil uVision has a "makefile" project option.

However, the linker errors suggest a source file is missing in the build. More specifically, the source implementing your "esit" class.

In a make file based project, you would have to add the appropriate file to the list of source files.

In the IDE GUI, you would use the "add existing files" feature.

sir thank you for your reply

If you read my post carefully you would notice that my Keil IDE is compiling with no issues.

my problem is with TouchGFX Designer compiler (GCC),

Hi @Abdullah İhsanoğlu​,

Any source additions you have you have to add them to the Makefile. Look for something called

include_paths
source_paths

Add your folders here relative to the root of the application. e.g: In this case we're adding the "simulator" (already added) and "mycode" folders.

include_paths := $(library_includes) $(foreach comp, $(all_components), $(comp)/include) $(framework_includes) mycode
source_paths = $(foreach comp, $(all_components), $(comp)/src) $(framework_source) simulator mycode

This should make the symbols available.

/Martin

Thank you, issue is solved.