ST意法半导体
直播中

李霞

7年用户 1184经验值
私信 关注
[问答]

如何向TouchGFX项目添加额外的c源文件?

嘿,我的问题是如何向 TouchGFX 项目添加额外的c 源文件,以便我可以在 TouchGFX Designer 中构建项目?
我知道我必须编辑 Makefile 。我已经尝试过了,但没有成功。
这是我的生成文件的代码:
  • # 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
  • project_path := $(call qs,$(abspath $(call sq,$(makefile_path)../../..)))
  • core_path := $(project_path)/Core/Inc
  • core_src := $(project_path)/Core/Src
  • ADDITIONAL_SOURCES :=$(core_src)
  • ADDITIONAL_INCLUDE_PATHS :=$(core_path)
  • 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








回帖(1)

卢灏

2023-1-30 11:50:44
我相信路径从您拥有 .touchgfx 文件的地方开始。
因此,我认为你可以写类似 ../Core/Src/"file name".c 的东西
我建议明确指出所有源文件
所以它会像


  • ADDITIONAL_SOURCES :=   ../Core/Src/main.c
  • ADDITIONAL_INCLUDE_PATHS := ../Core/Inc/
举报

更多回帖

发帖
×
20
完善资料,
赚取积分