cancel
Showing results for 
Search instead for 
Did you mean: 

Looking for advice on the best way to create files similar to TouchGFX framework code.

scottSD
Senior III

I need to add functionality to some framework code (in this case, the painters).

What is the best way to do this?

I can think of couple of possibilities:

Duplicate files I want to modify in the framework and add these new files along side the framework files. Then add these files whenever I get an update to the framework.

Or would it be better to add this functionality into the "third party" section of the "Middlewares" folder?

I'd appreciate any advice offered.

1 ACCEPTED SOLUTION

Accepted Solutions
scottSD
Senior III

I was able to figure out what to change in the Simulator/gcc/Makefile to get it to compile and use my modified framework files. I am including it in this thread anyone else wants to do the same thing.

First, add a new variable to be able to add the source file you want to have compiled as part of the simulator. I named it "my_framework_file". I placed it after the variables "framework_files" and "framework_source":

#only take in the source we want to build for this sim
framework_files := $(touchgfx_path)/framework/source/platform/driver/touch/SDL2TouchController.cpp
framework_source := $(touchgfx_path)/framework/source/platform/hal/simulator/sdl2
my_framework_file := $(touchgfx_path)/framework/source/touchgfx/widgets/canvas/PainterRGB565L8Bitmap.cpp

Then append this variable to the end of the "source_files" variable further down in the Makefile.

source_files := $(call find, $(source_paths),*.cpp) $(framework_files) $(my_framework_file)

 There may be better ways to accomplish this, but it worked for me.

View solution in original post

3 REPLIES 3
Martin KJELDSEN
Chief III

So you're basically looking for some code "repository" you can add on to TouchGFX for any new application?

Maybe put this on github or whereever you want and then use repo for any new application to install those files along side your application, or subtree or submodule. That kind of thing. When i was more involved with customer projects i used to have a toolbox in a repo that i could simply add on to any application.

/Martin

scottSD
Senior III

Martin,

Thanks for the reply.

I am using a repository and maintaining my framework changes that way.

I found something very peculiar about this, however. The files I am modifying are PainterRGB565L8Bitmap.hpp and PainterRGB565L8Bitmap.cpp. I can successfully compile my changes and run them on an STM32F745G-Discovery with the STM32CubeIDE debugger. However, I cannot run the TouchGFX Simulator because it complains that a function I added to that class is "undefined".

Doesn't the Simulator compiler use the same framework files as the rest of the project (when debugging)?

Any insight on why this may be happening would be appreciated. I think there may be something I can change in the simulator/gcc/Makefile but not sure what.

scottSD
Senior III

I was able to figure out what to change in the Simulator/gcc/Makefile to get it to compile and use my modified framework files. I am including it in this thread anyone else wants to do the same thing.

First, add a new variable to be able to add the source file you want to have compiled as part of the simulator. I named it "my_framework_file". I placed it after the variables "framework_files" and "framework_source":

#only take in the source we want to build for this sim
framework_files := $(touchgfx_path)/framework/source/platform/driver/touch/SDL2TouchController.cpp
framework_source := $(touchgfx_path)/framework/source/platform/hal/simulator/sdl2
my_framework_file := $(touchgfx_path)/framework/source/touchgfx/widgets/canvas/PainterRGB565L8Bitmap.cpp

Then append this variable to the end of the "source_files" variable further down in the Makefile.

source_files := $(call find, $(source_paths),*.cpp) $(framework_files) $(my_framework_file)

 There may be better ways to accomplish this, but it worked for me.