In PSoC Designer (PSD) 4.2 service pack 3 there is a new IDE User Guide. In there is an Appendix B that describes the Build Process. Section B.4.3 describes how to include "External Files" (sources).
You want to amend information (i.e. rules and assignments) to the overall GNU Make process using "local.mk", which is project specific.
Assume I have a project in C:\temp_b\Diamond. I want to include "common" source from another location, say C:\temp\T
In C:\temp\T I have foo.c and foo.h.
foo.c looks like:
- Code: Select all
#include <m8c.h>
#include "c:/temp/T/foo.h"
void foo( int k)
{
int i;
i = k * CONSTANT0;
}
Since the "build" process is project directory centric, I add the absolute path in the #include statement so that other projects can use it.
foo.h looks like:
- Code: Select all
#define CONSTANT0 0x34
'local.mk' looks like:
- Code: Select all
OBJECT_SOURCES:=$(OBJECT_SOURCES) foo.c
CSRCS:=$(CSRCS) ../../temp/T/foo.c
obj/%.o : ../../temp/T/%.c
ifeq ($ECHO_COMMANDS), novice)
echo $(call correct_path,$<)
endif
$(CCMD) $(CFLAGS) $(CDEFINES) $(INCLUDEFLAGS) $(DEFAULTCFLAGS) -o $@ $(call correct_path,$<)
Adding foo.c to OBJECT_SOURCES (without the path) places the .o file in the "obj" folder of the project - facilitating the debugger (symbols).
Adding ../../temp/T/foo.c to the CSRCS helps the dependencies (project.dep) to built properly.
local.mk also include a "rule" that specifically knows how to "compile" these external file(s).
Your external code can be "debugged" as well.
Hope this helps.