Skip to main content
Associate II
January 14, 2025
Solved

Touchgfx include additional paths

  • January 14, 2025
  • 4 replies
  • 1765 views

The problem I'm facing is that the Touchgfx doesn't know anything about additional link paths that I've setting up through IDE. Steps:
1. Create the project with touchgfx designer;
2. In the root of the project create a folder, then add .h and .c files there. Let's say myfile.h and myfile.c. In myfile.h file you defines one function, in myfile.c just an empty implementation;
3. Add path to included files in linker;
4. Include myfile.h in main.c and use somewhere empty function;
5. Build the project.
The project will build without errors. But if you go to the designer and press button "Program and Run Target", it will cause an error: Core/Src/main.c:28:10: fatal error: myfile.h: No such file or directory #include "myfile.h".

Best answer by Wiser1201

I did this $(foreach comp, $(user_paths), $(comp)/Inc) for include_paths and I did this $(foreach comp, $(user_paths), $(comp)/Src) for source_paths. And it worked.

4 replies

GaetanGodart
Technical Moderator
January 14, 2025

Hello @Wiser1201 ,

 

TouchGFX Designer and STM32CubeIDE do not share the include paths.
So if you want to flash through TouchGFX Designer, you need to include your extra files to the include and source paths.
To do so, go to your gcc folder and open the Makefile.
Now you have to add your files to the include_paths and the source_paths variable.

 

Regards,

Senior
February 24, 2025

I am trying to study the simulator/gcc/Makefile to add C projects placed in git submodules.

Looking at the generated version, the easiest I see would be to have a symbol called "ADDITIONAL_COMPONENTS". It would be relative paths from root to .c/.cpp files to be compiled.

 

generated/simulator/gcc/Makefile

 

 

components := gui simulator generated/gui_generated generated/simulator
components += ADDITIONAL_COMPONENTS

 

 



Edit: This is the syntax and relation between the simulation/gcc/Makefile, project path and shell path.

 

// Continues from where makefile is executed (validate path with "> makefile -w")

// This is on a simulation board so the arboressance is:
// Root/
// dep
// gui
// simulator
// touchgfx

ADDITIONAL_SOURCES := \
	$(wildcard dep/foo/*.c) \
	$(wildcard dep/bar/*.c) \
	$(wildcard dep/baz/*.c)
ADDITIONAL_INCLUDE_PATHS :=	dep/

 




Wiser1201Author
Associate II
January 14, 2025

Thanks for the answer. My Inc and Src files are located at: $(application_path)/User/Inc and $(application_path)/User/Src.
After I added this to the makefile I get an error: 
Compile
make -f ../gcc/Makefile -j8
../gcc/Makefile:293: *** multiple target patterns. Stop.
Failed
I have attached my makefile, please take a look.

Wiser1201AuthorBest answer
Associate II
January 14, 2025

I did this $(foreach comp, $(user_paths), $(comp)/Inc) for include_paths and I did this $(foreach comp, $(user_paths), $(comp)/Src) for source_paths. And it worked.