Linking Object files of one project to another poject

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Here is an example on how the object files of one project can be linked to another.

   

Objective is to link the object files of the compiled source files of one project to another project(One cannot see the other's source files). The top design of the projects have to be the same and only the source files can be different.

   

The attached work-space that contains two projects (built using PSoC Creator 3.0). The first project is LCD_Test_PSoC3. In this project, I have defined a user defined header file LCD_Display.h and the corresponding source file is LCD_Display.c. In this file, I have defined a function LCD_Print_MyNumber and this function would print the number 10 on the LCD. From main.c, I will call this function and the number 10 would be displayed.

   

Now the second project in the work-space is LCD_Test_PSoC3_1. My intention is to print the number 10 in the LCD using this project and with the function that is defined in LCD_Test_PSoC3. For this, you just need to do one thing. Open the "Build Settings" of LCD_Test_PSoC3_1 (by right clicking the project)-> DP8051 Keil 9.51->Linker->General. Now add the object file corresponding to LCD_Display.c (this would be LCD_Display.obj which can be opened from LCD_Test_PSoC3\LCD_Test_PSoC3.cydsn\DP8051\DP8051_Keil_951\Debug) and add this in the Additional Link Files.

   

Now from the project LCD_Test_PSoC3_1, if I am calling the function LCD_Print_MyNumber()( which was actually defined in LCD_Test_PSoC3), the number 10 would be displayed on the LCD. You can check this by programming the project LCD_Test_PSoC3_1 in CY8CKIT-030.

0 Likes
0 Replies