2019-04-05 05:50 AM
Hello!
I have created a new folder. It's called sensor. In this folder I put a .c and .h file.
I also modified the Makefile this way:
components := TouchGFX/gui target TouchGFX/generated/gui_generated sensor
But I get the following error:
Compiling Core/Src/main.cpp
Core/Src/main.cpp:63:27: fatal error: sensor/bmp180.h: No such file or directory
#include "sensor/bmp180.h"
^
compilation terminated.
gcc/Makefile:360: recipe for target 'TouchGFX/build/ST/STM32F769I-DISCO/Core/Src/main.o' failed
make[2]: *** [TouchGFX/build/ST/STM32F769I-DISCO/Core/Src/main.o] Error 1
gcc/Makefile:327: recipe for target 'generate_assets' failed
make[1]: *** [generate_assets] Error 2
../gcc/Makefile:45: recipe for target 'all' failed
make: *** [all] Error 2
Can you tell me how to make it work?
Thank you very much!
2019-04-08 02:12 AM
The "components" expect a certain structure that we define - But can be used to quickly add header and source files. Sometimes you're using a third party lib that does not follow this structure.
You can then just modify the include paths and source paths to include the "sensor" folder.
2020-02-26 06:08 AM
Touchgfx 4.13.0
@Martin KJELDSEN
I'm trying to add an include path to the simulator makefile in "generated\simulator\gcc\Makefile" Whenever I add or make changes to the makefile, it is regenerated and my changes are gone. In reality, this include path should be for all targets. There are three Makefiles in the directory structure: 1. "generated\simulator\gcc\makefile", 2. "simulator\gcc\Makefile" and 3. "target\gcc\Makefile"
Where and how to add additional include and source directories for all builds, both simulator and target?
2020-02-27 06:30 AM
@Martin KJELDSEN I finally figured this out, it appears I can make the path changes to the app.mk file and include the app.mk file which is included in the simulator makefile. I can then add include app.mk to the target makefile. after that, any path changes I can add to app.mk and both simulator and target will be updated.
2020-02-28 01:29 AM
Great :)
2020-02-28 02:34 AM
What is the expected Strucutre? I am also planning to add a 3rd party lib
2020-02-28 05:56 AM
@Martin KJELDSEN I declared victory too soon. It seems I can add the include path, and I can add "some" C++ source files, but I cannot add "C" files to the simulator. How do I stop the simulator Makefile from being regenerated by touchgfx each time I run the simulator?
Better yet, I've created a blank project based on the STM32L4R9I and simulator. I need to add some C files and some Header files to both the simulator and the target. Can you tell me the best way to accomplish this?
Thanks,
Paul
2020-02-28 06:04 AM
It shouldn't regenerate the Makefile - Are you sure?
2020-02-28 06:07 AM
And, sure, it should be easy just to modify the Makefile to achieve this.
From the makefile:
c_source_files :=
include_paths :=
2020-02-28 10:00 AM
Hi Martin,
Fairly certain. I started with a blank template of the STM32L4R9I disco board and simply added a red circle for a screen element. I have 3 makefiles in the default project:
MyApplication_new/gcc/Makefile //< this looks like the target board makefile
MyApplication_new/TouchGFX/simulator/gcc/Makefile //< this looks like where I would add extra paths i.e where ADDITIONAL_SOURCES are defined and exported.
MyApplication_new/TouchGFX/generated/simulator/gcc/Makefile //< This looks like the actual makefule for building the simulator. Any time I change this file, and rebuild through TouchGFX designer, my changes are overwritten.
The problem appears to be somewhere in the last file
source_files := $(call find, $(source_paths),*.cpp) $(framework_files) $(ADDITIONAL_SOURCES)
c_source_files := $(call find, $(source_paths),*.c) $(os_source_files)
object_files := $(source_files:$(touchgfx_path)/%.cpp=$(object_output_path)/touchgfx/%.o) $(c_source_files:$(touchgfx_path)/%.c=$(object_output_path)/touchgfx/%.o)
ADDITIONAL_SOURCES only adds sources to the .cpp generation, not the .c generation of the object files. This would be easy to fix if my file didn't keep getting regenerated =)