Attachments are accessible only for community members.
Linking External C Files to a PSoC Designer Project with HiTech Compiler
Anonymous
Not applicable
Jul 28, 2011
07:09 AM
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
Jul 28, 2011
07:09 AM
Question: How to Link External C files to a PSoC Designer Project with HiTech compiler?
Answer:
-To link the external files located outside the project directory, to the PSoC Designer project, Local.mk file has to be edited.
The Sample project has been attached here which has been compiled correctly in PD5.1 with HiTech compiler. By adding following lines to local.mk file, an external c file has been linked. To open local.mk file, click on Project -> "Open Local.mk for this Project". Add the following lines to it.
CSRCS:=$(CSRCS) C:/ExtFile/ExtFunctions.c
OBJECT_SOURCES:=$(OBJECT_SOURCES) ExtFunctions.c
obj/%.p1 : C:/ExtFile/%.c project.mk
ifeq ($(ECHO_COMMANDS),novice)
echo $(call correct_path,$<)
endif
$(CCMD) $(CFLAGS) $(CDEFINES) $(INCLUDEFLAGS) $(DEFAULTCFLAGS) -O$@ $(call correct_path,$<)
There are some important points to note:
-There is a Tab(Not spaces) at the start of lines "echo ...." and " $(CCMD)...". This is important, if you copy and paste these lines to the local.mk file.
-You need to declare the functions which are defined in external C file at the top of your main code. Otherwise the compiler throws a warning.
-You do not need to add any "include" statements to your main code. Also, if you are using .h or include files located in an external directory, this process would have to be modified because the builder will not be able to find the files.
-These lines added to local.mk file will only work for HiTech compiler and not for Imagecraft compiler. There is seperate KB Article which is related to Imagecraft Compiler.
-It is better to create the project from scratch instead of saving existing project with different name and changing the compiler to HiTech. In case you get error messages.
In this example project, the external file "ExtFunctions.c" located in C:/Extfile has been linked. To test the project,
1. open the zip file attached and extract the contents.
2. Copy the 'ExtFile' folder to C: Drive.
3. Open the "Add_External_C_File" Project.
4. Generate and build the project.
5. Using CY3210 Kit, Download the code to CY8C29466-PXI device.
6. Verify whether the LED Connected to P0[0] blinks.
Labels
Rate this article:
Contributors
-
This widget could not be displayed.Anonymous