cancel
Showing results for 
Search instead for 
Did you mean: 

How to add additional header and source files to TouchGFX project

JustAnotherGuy
Associate II

So I've been messing with TouchGFX for a while now using the designer to construct the various GUI portions on my application. However I am now at a point that I need to add additional C++ classes to my project and I am having a hard time figuring out how to make them part of the TouchGFX project.

I have a STM32CubeIDE project named "Project" inside of which I have the "TouchGFX" folder that was generated when I configured the project for my target. I can successfully build and run my TouchGFX application on the target. Additionally I can also run the application using the simulator with out any issues.

I have added a new folder inside the "TouchGFX" folder called "additional" that contains a "src" and "include" folder for header and source files that I need to be included in the project (note the "src" and "include" folders also have sub folders in the to organize my files).

How can I make this "additional" folder and all its contents part of the project so they are compiled when I build the project for the target or the simulator and they show up correctly in the Visual Studio Solution Project?

If any one could help it would be much appreciated as I can't continue making progress on my application till this issue is resolved.

!!!!!!!!!!!!!!!!!EDIT UPDATE!!!!!!!!!!!!!!!!!

I have edited the ADDITIONAL_SOURCES and ADDITIONAL_INCLUDE_PATHS variables in the TouchGFX\simulator\gcc\Makefile... to read as follows but it still does not work... not sure what I'm doing wrong here...

temp_test_additional_path := ${application_path}/additional/src/

ADDITIONAL_SOURCES := $(call find, $(temp_test_additional_path),*.cpp)

ADDITIONAL_INCLUDE_PATHS := ${application_path}/additional/include/

!!!!!!!!!!!!!!!!!EDIT UPDATE!!!!!!!!!!!!!!!!!

Thanks,

10 REPLIES 10

A) Hi HTD, having a problem with adding my required source/header files to a TouchGFX project.

 

 

B) When I build the prj with my "Makefile.mk" mods in TouchGFX Designer, I get the following error:

########################################################################

make[2]: *** No rule to make target 'build/MINGW32_NT-6.2/../../App/SettingsData.o', needed by 'build/bin/simulator.exe'. Stop.
########################################################################

 

 

C) I'm not a .mk file expert... Trying to add SettingsData.cpp and SettingsData.hpp to "App" folder by modifying "Makefile.mk" as shown below, see PJD MOD START and PJD MOD END:

Also, see below pic of my folder structure below...

 

Any assistance would be appreciated, Thk...

#########################################################################

 

# Helper macros to convert spaces into question marks and back again
e := 
sp := $(e) $(e)
qs = $(subst ?,$(sp),$1)
sq = $(subst $(sp),?,$1)
 
# Get name of this Makefile (avoid getting word 0 and a starting space)
makefile_name := $(wordlist 1,1000,$(MAKEFILE_LIST))
 
# Get path of this Makefile
makefile_path := $(call qs,$(dir $(call sq,$(abspath $(call sq,$(makefile_name))))))
 
# Get path where the Application is
application_path := $(call qs,$(abspath $(call sq,$(makefile_path)../..)))
 
.PHONY: clean assets all
 
ifneq ($(words $(makefile_path))$(words $(MAKEFILE_LIST)),11)
all clean assets:
$(error Spaces not allowed in path)
else
 
#PJD MOD START
ADDITIONAL_INCLUDE_PATHS := ../../App
ADDITIONAL_SOURCES := ../../App/SettingsData.cpp
#PJD MOD END
 
ADDITIONAL_LIBRARY_PATHS := 
ADDITIONAL_LIBRARIES :=
export ADDITIONAL_SOURCES ADDITIONAL_INCLUDE_PATHS ADDITIONAL_LIBRARY_PATHS ADDITIONAL_LIBRARIES
 
all: $(filter assets,$(MAKECMDGOALS))
all assets: $(filter clean,$(MAKECMDGOALS))
all clean assets:
@$(MAKE) -r -f generated/simulator/gcc/Makefile -s $(MFLAGS) $@ -C "$(application_path)"
endif
 
###########################################################################
PJD_0-1728591977868.png