cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 6

JoYa_4324706
New Contributor II

Hi,

I am using PSoC Creator 4.3 and have created two projects which I would like to share the same TopDesign file with, but however I could not find a way to include external TopDesign in my project like what I can do with Design Wide Resources. Is there anyway I can achieve this? Thanks!

0 Likes
1 Solution
MotooTanaka
Esteemed Contributor

Hi,

Since the question seemed to be fun,  I gave it a try. (I used CY8CKIT-044)

But please note that the following is my experiment and is not recommended by Cypress nor anyone else including myself.

And proceed at your own risk.

(1) I prepared a couple of workspaces, namely workspac1 and workspace2

010-workspacex2.JPG

(2) I created a project named "share_test1" in the workspace1 with usual method.

And I placed a UART and a LED_R in the schematic.

001-test1_sch_with_LED_R.JPG

(3) I created a project named "share_test2" in the workspace2 with usual method.

(4) After quitting the PSoC Creator(s), I moved "workspace2\share_test2.cydsn\TopDesign\TopDesign.cysch" to the trash. (aka removed)

(5) I started the "command prompt" and change directory to "workspace2\share_test2.cydsn\TopDesign\"

(6) I entered the following command at the prompt

mklink /H TopDesign.cysch ..\..\..\workspace1\share_test1.cydsn\TopDesign\TopDesign.cysch

(7) Then I closed the command prompt

(8) I started PSoC Creator by double clicking "workspace2\workspace2.cywrk"

(9) Now share_test2 project has components in its schematic.

     I added another Digital Output "LED_G" and saved the schematic using "ctrl-s"

002-test2_add_LED_G.JPG

(10) Then I opened another PSoC Creator by double clicking "workspace1\workspace1.cywrk".

PSoC Creator noticed that the schematic was modified externally.

I selected OK.

003-test1_updated.JPG

Now in the schematic of share_test1, there is a new LED_G

004_test1.JPG

(11) To test the opposite path, I added another component "LED_B" in the share_test1's schematic

005-test1_added_LED_B.JPG

(12) When I switched to the PSoC Creator of share_test2, similar thing happed.

006-test2_updated.JPG

Now the schematic of share_test2 has the third LED, LED_B.

007-test2_sch.JPG

(12) To test if the project works, I assigned pins

011-pins.JPG

(13) I wrote main.c for both project with slight difference to confirm that they are different and working.

main.c (share_test1)

==========================

#include "project.h"

#include "stdio.h"

#define STR_LEN 64

char    str[STR_LEN+1] ;

void    print(char *str)

{

UART_UartPutString(str) ; /* PSoC 4 */

// UART_PutString(str) ;     /* PSoC 5 */

}

void cls(void)

{

print("\x1b[2J\x1b[;H") ;

}

void splash(char *prog_name)

{

    cls() ;

    if (prog_name && *prog_name) {

        print(prog_name) ;

    }

    print(" (") ;

    print(__DATE__) ;

    print(" ") ;

    print(__TIME__) ;

    print(")\n") ;

}

int main(void)

{

    CyGlobalIntEnable; /* Enable global interrupts. */

    UART_Start() ;

    splash("Test1") ;

  

    for(;;)

    {

        if (LED_R_Read()) {

            LED_R_Write(0) ;

        } else {

            LED_R_Write(1) ;

        }

        CyDelay(100) ;

    }

}

==========================

main.c (share_test2)

==========================

#include "project.h"

#include "stdio.h"

#define STR_LEN 64

char    str[STR_LEN+1] ;

void    print(char *str)

{

UART_UartPutString(str) ; /* PSoC 4 */

// UART_PutString(str) ;     /* PSoC 5 */

}

void cls(void)

{

print("\x1b[2J\x1b[;H") ;

}

void splash(char *prog_name)

{

    cls() ;

    if (prog_name && *prog_name) {

        print(prog_name) ;

    }

    print(" (") ;

    print(__DATE__) ;

    print(" ") ;

    print(__TIME__) ;

    print(")\n") ;

}

int main(void)

{

    CyGlobalIntEnable; /* Enable global interrupts. */

    UART_Start() ;

    splash("Test2") ;

  

    for(;;)

    {

        if (LED_G_Read()) {

            LED_G_Write(0) ;

        } else {

            LED_G_Write(1) ;

        }

        CyDelay(500) ;

    }

}

==========================

(14) Then I compiled and ran each project and confirmed that they are working

as the message written to the terminal were different and the blinking speed and led were different.

009-test1_log.JPG

008-test2_log.JPG

Conclusion by using "mklink /H <link> <target>" command, I could fool PSoC Creator.

For the time being it seems to be working.

But there is no guarantee that this will continue to work with future version(s) of PSoC Creator.

So again please proceed at your own risk 😉

moto

View solution in original post

4 Replies
MotooTanaka
Esteemed Contributor

Hi,

Since the question seemed to be fun,  I gave it a try. (I used CY8CKIT-044)

But please note that the following is my experiment and is not recommended by Cypress nor anyone else including myself.

And proceed at your own risk.

(1) I prepared a couple of workspaces, namely workspac1 and workspace2

010-workspacex2.JPG

(2) I created a project named "share_test1" in the workspace1 with usual method.

And I placed a UART and a LED_R in the schematic.

001-test1_sch_with_LED_R.JPG

(3) I created a project named "share_test2" in the workspace2 with usual method.

(4) After quitting the PSoC Creator(s), I moved "workspace2\share_test2.cydsn\TopDesign\TopDesign.cysch" to the trash. (aka removed)

(5) I started the "command prompt" and change directory to "workspace2\share_test2.cydsn\TopDesign\"

(6) I entered the following command at the prompt

mklink /H TopDesign.cysch ..\..\..\workspace1\share_test1.cydsn\TopDesign\TopDesign.cysch

(7) Then I closed the command prompt

(8) I started PSoC Creator by double clicking "workspace2\workspace2.cywrk"

(9) Now share_test2 project has components in its schematic.

     I added another Digital Output "LED_G" and saved the schematic using "ctrl-s"

002-test2_add_LED_G.JPG

(10) Then I opened another PSoC Creator by double clicking "workspace1\workspace1.cywrk".

PSoC Creator noticed that the schematic was modified externally.

I selected OK.

003-test1_updated.JPG

Now in the schematic of share_test1, there is a new LED_G

004_test1.JPG

(11) To test the opposite path, I added another component "LED_B" in the share_test1's schematic

005-test1_added_LED_B.JPG

(12) When I switched to the PSoC Creator of share_test2, similar thing happed.

006-test2_updated.JPG

Now the schematic of share_test2 has the third LED, LED_B.

007-test2_sch.JPG

(12) To test if the project works, I assigned pins

011-pins.JPG

(13) I wrote main.c for both project with slight difference to confirm that they are different and working.

main.c (share_test1)

==========================

#include "project.h"

#include "stdio.h"

#define STR_LEN 64

char    str[STR_LEN+1] ;

void    print(char *str)

{

UART_UartPutString(str) ; /* PSoC 4 */

// UART_PutString(str) ;     /* PSoC 5 */

}

void cls(void)

{

print("\x1b[2J\x1b[;H") ;

}

void splash(char *prog_name)

{

    cls() ;

    if (prog_name && *prog_name) {

        print(prog_name) ;

    }

    print(" (") ;

    print(__DATE__) ;

    print(" ") ;

    print(__TIME__) ;

    print(")\n") ;

}

int main(void)

{

    CyGlobalIntEnable; /* Enable global interrupts. */

    UART_Start() ;

    splash("Test1") ;

  

    for(;;)

    {

        if (LED_R_Read()) {

            LED_R_Write(0) ;

        } else {

            LED_R_Write(1) ;

        }

        CyDelay(100) ;

    }

}

==========================

main.c (share_test2)

==========================

#include "project.h"

#include "stdio.h"

#define STR_LEN 64

char    str[STR_LEN+1] ;

void    print(char *str)

{

UART_UartPutString(str) ; /* PSoC 4 */

// UART_PutString(str) ;     /* PSoC 5 */

}

void cls(void)

{

print("\x1b[2J\x1b[;H") ;

}

void splash(char *prog_name)

{

    cls() ;

    if (prog_name && *prog_name) {

        print(prog_name) ;

    }

    print(" (") ;

    print(__DATE__) ;

    print(" ") ;

    print(__TIME__) ;

    print(")\n") ;

}

int main(void)

{

    CyGlobalIntEnable; /* Enable global interrupts. */

    UART_Start() ;

    splash("Test2") ;

  

    for(;;)

    {

        if (LED_G_Read()) {

            LED_G_Write(0) ;

        } else {

            LED_G_Write(1) ;

        }

        CyDelay(500) ;

    }

}

==========================

(14) Then I compiled and ran each project and confirmed that they are working

as the message written to the terminal were different and the blinking speed and led were different.

009-test1_log.JPG

008-test2_log.JPG

Conclusion by using "mklink /H <link> <target>" command, I could fool PSoC Creator.

For the time being it seems to be working.

But there is no guarantee that this will continue to work with future version(s) of PSoC Creator.

So again please proceed at your own risk 😉

moto

View solution in original post

JoYa_4324706
New Contributor II

Hi MoTa_728816​,

I just tried and it seems to work so far. Thank you for the very helpful experiment!

Best,

Joseph

JoYa_4324706
New Contributor II

The reason I've been trying to do this is because in order to debug multiple devices "at the same time", I would like to open multiple workspaces to include the exact same project.

I'd like to ask is it possible to do so? And, by saying that, I mean including the same project in different workspaces without any conflicts in building/debugging the two separate project "instances". If so, then how?

Thanks!

0 Likes
MotooTanaka
Esteemed Contributor

Dear JoYa-san,

Although I'm willing try to attack the problem,

since the theme is now using multiple instance(s) of the same project,

which is different from the subject of this discussion.

Could you create another question/discussion with the appropriate subject?

Best Regards,

19-Jun-2020

Motoo Tanaka

Top labels