cancel
Showing results for 
Search instead for 
Did you mean: 

Code Examples

JoYa_4324706
New Contributor II

Hi,

I've been trying to include same project in different workspaces on PSoC Creator 4.3, with the reason being to debug multiple devices simultaneously.

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
1 Solution
MotooTanaka
Esteemed Contributor

Hi,

I think that there are some regular method and not so regular method.

First for the regular method you can create an archive from the "master" project

and copy the archive to each workspace you want to have clone project.

Then extract the archive using the tool of your choice.

Probably this is the usual and regular way to do what you asked.

But in the previous discussion, adding top of the previous method

you wrote that you want to reflect a change made to the schematic of one copy to all other copies.

So from here, things get a little bit complicated and probably we are leaving "regular" path.

Although as far as I tested this seems to be working there is no guarantee from Cypress nor anyone else.

So please proceed this second method at your own risk.

Having written above, here is the first "regular" method.

(1.1) Prepare a project to use, here I use a project named "test_proj_200620"

000-Initial_project.JPG

(1.2) Clean the project, so that the archive won't be too big.

001-clean_project.JPG

(1.3) Make an Archive of the project.

Note: I right-clicked the project then selected the "Archive Workspace/Project..."

If you don't select a project, all projects in the workspace will be archived as "Workspace" archive.

002-archive-project.JPG

(1.4) Select "Minimal"

003-archive-dialog.JPG

(1.5) Report dialog. (make sure "Open archive in Windows Explorer" is checked)

004-archive-report.JPG

(1.6) Now the folder which contains the archive is opened.

Note: In my case, I had some other archives, too. But please focus on "test_proj_200620.cyprj.Archive01.zip"

which is highlighted here.

005-archive-in-folder.JPG

(1.7) To test multiple workspaces, I created folder tree as

PRJ_SHARE_TEST/

PRJ_SHARE_TEST/workspace1

PRJ_SHARE_TEST/workspace2

006-test-workspaces.JPG

(1.8) I copied the archive file into the workspace1

007-archive-copied-to-workspace1.JPG

(1.9) Extracted the archive file

008-archive-expanded.JPG

(1.10) In the extracted project folder, double clicking the "test_proj_200620.cyprj" will start PSoC Creator for this instance.

009-open-project.JPG

(1.11) Repeating (1.8) to (1.10) for workspace2, too. I got a couple of PSoC Creators running for different instances of the same project.

013-2-creators.JPG

Up to here, we can debug multiple instance of a same project without problem.

But in case you make changes in one project, others will not reflect it.

From here, the second method which IMHO is not "regular'

Now to reflect change in one instance to all other instances,

I used "hard link", which we can do with command line

mklink /H <link> <original>

To do this, I decided that I need to have a "master" copy of the project.

So I made a folder

C:\Master

And placed the master copy of the project.

(2.1) Copied the archive in to "C:\Master"

020-c_master.JPG

(2.2) And extracted the archive there

021-archive-expanded.JPG

(2.3) To prepare working instance(s), I decided that I need a batch file to avoid typing the cryptic commands forever.

Below is the contents of the batch file "clone_project.bat"

Note: you need to change the "proj_name" for your project

Also you need add/remove lines after the line

rem "from here, taking care of additional sources"

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

set master_dir="C:\Master\"

set proj_name="test_proj_200620"

set proj_dir=%proj_name%.cydsn

set proj_dwr=%proj_name%.cydwr

echo creating folder %proj_dir%

mkdir %proj_dir%

cd %proj_dir%

echo "Copy the original project to local"

xcopy %master_dir%\%proj_dir% . /e

echo "replacing and hardlink the schematic"

cd TopDesign

del TopDesign.cysch

mklink /H TopDesign.cysch %master_dir%\%proj_dir%\TopDesign\TopDesign.cysch

cd ..

echo "replacing Design Wide Resources"

del %proj_dwr%

mklink /H %proj_dwr% %master_dir%\"%proj_dir%\%proj_dwr%

echo "replacing main_cm0p.c"

del main_cm0p.c

mklink /H main_cm0p.c %master_dir%\%proj_dir%\main_cm0p.c

del main_cm4.c

mklink /H main_cm4.c %master_dir%\%proj_dir%\main_cm4.c

rem "from here, taking care of additional sources"

cd sources

del tty_utils.h tty_utils.c

mklink /H tty_utils.h %master_dir%\%proj_dir%\sources\tty_utils.h

mklink /H tty_utils.c %master_dir%\%proj_dir%\sources\tty_utils.c

cd ..\..

echo "Done"

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

(2.4)

To store the batch file, I added a folder named "tools"

022-tools-folder-created.JPG

(2.5) Now I made sure that "workspace1" is empty

023-empty-workspace1.JPG

(2.6) I started Windows' "command prompt" and changed directory to "workspace1"

Then I enter command "..\tools\clone_proj.bat"

024-start-clone_proj_bat.JPG

(2.7) The batch file did its work.

025-done.JPG

(2.8) Now there is the copied instance of the project in workspace1.

026-project_cloned_workspace1.JPG

(2.9) Just like the method 1, double clicking the project file starts up PSoC Creator for this instance.

027-open_project_workspace1.JPG

(2.10) Repeat (2.5) ~ (2.9) for workspace2

Now we have 2 PSoC Creators running for each instance of the project.

(2.11) In the PSoC Creator of workspace1, I added a Digital Output Pin for LED_R

040-LED_R-added-workspace1.JPG

(2.12) Assigned pin for LED_R

041-PIN_assigned.JPG

(2.13) in main_cm4.c, I added a few lines to make LED_R toggle each time an input line is enter from the uart terminal.

042-main_cm4_changed.JPG

(2.14) I compiled and confirmed that the program was working as I expected.

(2.15) I switched to the PSoC Creator of workspace2, then PSoC Creator noticed that there were files modified externally.

043-switched-dialob.JPG

(2.16)  In the schematic, LED_R was added

044-the-other-schematic-updated.JPG

(2.17) In the DWR > Pins, LED_R is assigned to P0[3]

045-pin-updated.JPG

(2.18) In main_cm4.c, the lines for LED_R were added.

Note: Since I have not done "generate application" for this workspace, Cy_GPIO_Write()s are

marked as error. But once "generate application" or "debug" will be started, they will be fine.

046-source-updated-not-genarated.JPG

(2.19) So I debugged the instance of workspace2.

Note: The errors of Cy_GPIO_Write()s are gone and debugger started normally.

048-debugger-started-normally.JPG

Conclusion, although I think that this method is "unsupported", in case multiple instances of a same project need to be debugged simultaneously

and in case there is/are changes to any of the instance, the changed must be shared/reflected to all instances,

this method may be useful.

Well, at least trying this was fun.

moto

P.S. Attached are the CY8CKIT-062-BLE project used for example and the batch file "clone_proj.bat"

View solution in original post

1 Reply
MotooTanaka
Esteemed Contributor

Hi,

I think that there are some regular method and not so regular method.

First for the regular method you can create an archive from the "master" project

and copy the archive to each workspace you want to have clone project.

Then extract the archive using the tool of your choice.

Probably this is the usual and regular way to do what you asked.

But in the previous discussion, adding top of the previous method

you wrote that you want to reflect a change made to the schematic of one copy to all other copies.

So from here, things get a little bit complicated and probably we are leaving "regular" path.

Although as far as I tested this seems to be working there is no guarantee from Cypress nor anyone else.

So please proceed this second method at your own risk.

Having written above, here is the first "regular" method.

(1.1) Prepare a project to use, here I use a project named "test_proj_200620"

000-Initial_project.JPG

(1.2) Clean the project, so that the archive won't be too big.

001-clean_project.JPG

(1.3) Make an Archive of the project.

Note: I right-clicked the project then selected the "Archive Workspace/Project..."

If you don't select a project, all projects in the workspace will be archived as "Workspace" archive.

002-archive-project.JPG

(1.4) Select "Minimal"

003-archive-dialog.JPG

(1.5) Report dialog. (make sure "Open archive in Windows Explorer" is checked)

004-archive-report.JPG

(1.6) Now the folder which contains the archive is opened.

Note: In my case, I had some other archives, too. But please focus on "test_proj_200620.cyprj.Archive01.zip"

which is highlighted here.

005-archive-in-folder.JPG

(1.7) To test multiple workspaces, I created folder tree as

PRJ_SHARE_TEST/

PRJ_SHARE_TEST/workspace1

PRJ_SHARE_TEST/workspace2

006-test-workspaces.JPG

(1.8) I copied the archive file into the workspace1

007-archive-copied-to-workspace1.JPG

(1.9) Extracted the archive file

008-archive-expanded.JPG

(1.10) In the extracted project folder, double clicking the "test_proj_200620.cyprj" will start PSoC Creator for this instance.

009-open-project.JPG

(1.11) Repeating (1.8) to (1.10) for workspace2, too. I got a couple of PSoC Creators running for different instances of the same project.

013-2-creators.JPG

Up to here, we can debug multiple instance of a same project without problem.

But in case you make changes in one project, others will not reflect it.

From here, the second method which IMHO is not "regular'

Now to reflect change in one instance to all other instances,

I used "hard link", which we can do with command line

mklink /H <link> <original>

To do this, I decided that I need to have a "master" copy of the project.

So I made a folder

C:\Master

And placed the master copy of the project.

(2.1) Copied the archive in to "C:\Master"

020-c_master.JPG

(2.2) And extracted the archive there

021-archive-expanded.JPG

(2.3) To prepare working instance(s), I decided that I need a batch file to avoid typing the cryptic commands forever.

Below is the contents of the batch file "clone_project.bat"

Note: you need to change the "proj_name" for your project

Also you need add/remove lines after the line

rem "from here, taking care of additional sources"

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

set master_dir="C:\Master\"

set proj_name="test_proj_200620"

set proj_dir=%proj_name%.cydsn

set proj_dwr=%proj_name%.cydwr

echo creating folder %proj_dir%

mkdir %proj_dir%

cd %proj_dir%

echo "Copy the original project to local"

xcopy %master_dir%\%proj_dir% . /e

echo "replacing and hardlink the schematic"

cd TopDesign

del TopDesign.cysch

mklink /H TopDesign.cysch %master_dir%\%proj_dir%\TopDesign\TopDesign.cysch

cd ..

echo "replacing Design Wide Resources"

del %proj_dwr%

mklink /H %proj_dwr% %master_dir%\"%proj_dir%\%proj_dwr%

echo "replacing main_cm0p.c"

del main_cm0p.c

mklink /H main_cm0p.c %master_dir%\%proj_dir%\main_cm0p.c

del main_cm4.c

mklink /H main_cm4.c %master_dir%\%proj_dir%\main_cm4.c

rem "from here, taking care of additional sources"

cd sources

del tty_utils.h tty_utils.c

mklink /H tty_utils.h %master_dir%\%proj_dir%\sources\tty_utils.h

mklink /H tty_utils.c %master_dir%\%proj_dir%\sources\tty_utils.c

cd ..\..

echo "Done"

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

(2.4)

To store the batch file, I added a folder named "tools"

022-tools-folder-created.JPG

(2.5) Now I made sure that "workspace1" is empty

023-empty-workspace1.JPG

(2.6) I started Windows' "command prompt" and changed directory to "workspace1"

Then I enter command "..\tools\clone_proj.bat"

024-start-clone_proj_bat.JPG

(2.7) The batch file did its work.

025-done.JPG

(2.8) Now there is the copied instance of the project in workspace1.

026-project_cloned_workspace1.JPG

(2.9) Just like the method 1, double clicking the project file starts up PSoC Creator for this instance.

027-open_project_workspace1.JPG

(2.10) Repeat (2.5) ~ (2.9) for workspace2

Now we have 2 PSoC Creators running for each instance of the project.

(2.11) In the PSoC Creator of workspace1, I added a Digital Output Pin for LED_R

040-LED_R-added-workspace1.JPG

(2.12) Assigned pin for LED_R

041-PIN_assigned.JPG

(2.13) in main_cm4.c, I added a few lines to make LED_R toggle each time an input line is enter from the uart terminal.

042-main_cm4_changed.JPG

(2.14) I compiled and confirmed that the program was working as I expected.

(2.15) I switched to the PSoC Creator of workspace2, then PSoC Creator noticed that there were files modified externally.

043-switched-dialob.JPG

(2.16)  In the schematic, LED_R was added

044-the-other-schematic-updated.JPG

(2.17) In the DWR > Pins, LED_R is assigned to P0[3]

045-pin-updated.JPG

(2.18) In main_cm4.c, the lines for LED_R were added.

Note: Since I have not done "generate application" for this workspace, Cy_GPIO_Write()s are

marked as error. But once "generate application" or "debug" will be started, they will be fine.

046-source-updated-not-genarated.JPG

(2.19) So I debugged the instance of workspace2.

Note: The errors of Cy_GPIO_Write()s are gone and debugger started normally.

048-debugger-started-normally.JPG

Conclusion, although I think that this method is "unsupported", in case multiple instances of a same project need to be debugged simultaneously

and in case there is/are changes to any of the instance, the changed must be shared/reflected to all instances,

this method may be useful.

Well, at least trying this was fun.

moto

P.S. Attached are the CY8CKIT-062-BLE project used for example and the batch file "clone_proj.bat"

View solution in original post