You are here

Linking External C Files to a PSoC Designer Project with HiTech Compiler | Cypress Semiconductor

Support & Community

Linking External C Files to a PSoC Designer Project with HiTech Compiler

Last Updated: July 28, 2011

How to Link External C files to a PSoC Designer Project with HiTech compiler?



-To link the external files located outside the project directory, to the PSoC Designer project, 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 file, an external c file has been linked.  To open file, click on Project -> "Open for this Project". Add the following lines to it. 

CSRCS:=$(CSRCS) C:/ExtFile/ExtFunctions.c 
obj/%.p1 : C:/ExtFile/%.c 
ifeq ($(ECHO_COMMANDS),novice) 
     echo $(call correct_path,$<) 
     $(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 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 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. 
File TitleLanguageFile SizeLast Updated
Download Linking External C Files to a PSoC Designer Project with HiTech CompilerEnglish351.95 KB07/28/11
Knowledge Base Tags: 

Provide feedback on this article

Browse KB By Product

Browse KB by Type