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

cross mob

Command Line Compilation of PSoC1 Project

Command Line Compilation of PSoC1 Project

Anonymous
Not applicable
Question: How do I compile a PSoC1 project using the Command Line Interface (CLI)

 

Answer:

It is recommended that you use the new PDCLI introduced in PD5.1 since the old method (using batch files to invoke make’) will be deprecated in the future. Both methods, however, are discussed below.

How to use PDCLI.exe (recommended method):

1. If PSoC Designer is installed in the default location, change the working directory to C:\Cypress\PSoC Designer\5.1\PSoC      Designer 5. If PSoC Designer is installed elsewhere, use the equivalent directory in which PDCLI is installed.

2. To Clean a Project, Generate a Project or to successively Clean, Generate, and Build Project in a single command:

PDCLI [COMMAND] [PROJECT PATH] [COMPILER]


[COMMAND]

CGBP - Clean, generate, and build the project

CP - Clean the project

GP - Generate the project


[PROJECT PATH]

This is the path to your *.cmx project file.

For example: C:\MyProject\MyProject.cmx


[COMPILER]

IMAGECRAFT - IMAGECRAFT

HI-TECH - HI-TECH

ImageCraftPro - IMAGECRAFTPRO

 

Examples:

To clean, generate and build MyProject:

PDCLI “CGBP” “C:\Documents and Settings\user\Desktop\MyProject\MyProject.cmx” “IMAGECRAFT”

To clean MyProject:

PDCLI "CP" "C:\Documents and Settings\user\Desktop\MyProject\MyProject.cmx"

To generate MyProject:

PDCLI "GP" "C:\Documents and Settings\user\Desktop\MyProject\MyProject.cmx"

Building via ‘make’ from batch file steps (to be deprecated in the future):

Setting the Path:

The path for the tools directory in PSoC Designer needs to be added as a windows environment variable.  This step is necessary mainly for convenience. If this step is not taken, then the path for the tools directory will need to be added to every command in the CLI for the build process.

Note that this path variable can be set temporarily, if you do not want to permanently change your path environment.

Change your path by executing the following steps:

1. Open ‘System Properties’ by right clicking on My Computer, selecting the ‘Advanced Tab’ and clicking on ‘Environment Variables’.

2. Under ‘System Variables’ find the variable “path” and click edit.

3. Add the path for the tools folder here, noting that each path must be  separated by a semicolon(;).  The tools folder path for a default installation is:

C:\Program Files\Cypress\PSoC Designer\X.Y\Common\CypressSemiBuildMgr\tools.

4. After adding this path click ok and then restart your computer.  This will add the tools directory to the default path for CLI.

Next, open the CLI in Windows.  Change the directory to the project that you wish to build. 

Environmental Variables:

After you have navigated to the correct directory, several environment variables need to be set before building the project.

1. The path to ‘make’ and the compiler must be set using short paths. Short path names can be determined using ‘dir’ with the    /x switch.

2. The project name must be set.

3. The device needs to be set; this is the part number of the device used in the project. 

4. The base device needs to be set; this is the non-specific part number for the part that is used in the project.

5. The last ROM location needs to be set.  This is the highest ROM value in hex for the part.

Example:

set PSOCDIR=C:\PROGRA~2\Cypress\PSOCDE~1\5.1\Common\CY110F~1\tools

set PROJNAME=myEmbeddedDesign

set DEVICE=CY8C27443B

BASEDEVICE: The tools/include subdirectory of the PSoC Designer install directory contains the include files for the DEVICE.

set BASEDEVICE=CY8C27000B

set LASTROM=0x3FFF

To set the path temporarily:

set path = %PSOCDIR%

A quick way to get this information is to build a project in PSoC Designer.  Then open the makefile for that project and locate the needed information in the auto generated makefile.

Building the Project:

Now that all of the environmental variables are set-up a project can be build using the make commands.   There are four straightforward commands that need to be executed to build a project, see example below.  First, the project needs to be cleaned; this gets rid of all the old files.  Then a make file needs to be created for the project.  Next a dependency file needs to be created.  Lastly, the project needs to be compiled and a hex file generated. 

Example:

make -f %PSOCDIR%\Makefile clean

make -f %PSOCDIR%\Makefile makemake

make -f %PSOCDIR%\Makefile depend

make -f %PSOCDIR%\Makefile

0 Likes
530 Views
Contributors