Version control in PSoC Creator

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

cross mob
DaKo_463136
Level 5
Level 5
10 likes received 10 likes given 5 likes given

(I originally posted this on element14 community: https://www.element14.com/community/people/koudelad/blog/2019/06/18/version-control-in-psoc-creator  )

Hello,

There is a newer IDE, ModusToolbox Software Environment (based on Eclipse), but currently only for PSoC 6 devices. However, for PSoC 5 and lower, there is only the old PSoC Creator ​(which works only on Windows). The trouble is, PSoC Creator has no integrated version control support. There are hundreds of files in each project directory, so the important files might not be visible at a first glance.

The only supporting information I found was a knowledge base article about what to include in the version control: Revision Control for PSoC® Creator™ Projects - KBA86358​ (By the way it includes a few typos of the files that should be included, so you have to double check everything.)

Professional developers probably use different structure, but I use the following:

PSoC Creator folder is located in Documents of a current user by default. (Here is also the .gitignore file located, as explained below.)

  • 4.2 is a version specific folder containing downloads like components, examples etc.
  • common is my own folder with custom header and source files
  • CY8CKIT-044-4200M etc. - one folder per workspace for a specific hardware - in my case development boards with a particular PSoC family (I have 4 of these)
    • each workspace contains 1 to n projects - project_name.cydsn
      • each project contains main.c , project files, schematics, generated files etc.
  • PSoC4 Examples is my own folder with downloaded application notes, 3rd party projects etc.

I decided to use git as a version control system. And if I want to work on all of this alone as a hobby and mainly have version control system as a great backup system, I don't want to use a version control repository or project per PSoC project or per PSoC workspace.

With a great help of a colleague, I put up the following .gitignore file to respect the PSoC Creator structure. It is not easy to read at first, but is a generic way of solving a problem, how to version files or folders nested deep in a directory structure, but not version the rest of the structure.

# For nested folders, ignore the folder contents, but whitelist its subfolders.

/*

!/*/

# Ignore folder containg PSoC Creator version specific downloads

# like components, examples etc.

/4.2

# Then again ignore all the contents, but whitelist its subfolders etc.

# Git doesn’t list excluded directories, so this is the way to get to files

# nested in up to x subfolders

# (where x is the number of asterisks in the "pyramid" below).

/*/*

# Side effect is ignoring all the contents along the route,

# so whitelisting a specific folder content at a specific level needs to be

# stated after blacklisting the contents of the folder one level up.

# Custom folder with shared header and source files

!/common/*

!/*/*/

/*/*/*

!/*/*/*/

/*/*/*/*

!/*/*/*/*/

/*/*/*/*/*

!/*/*/*/*/*/

/*/*/*/*/*/*

!/*/*/*/*/*/*/

/*/*/*/*/*/*/*

!/*/*/*/*/*/*/*/

# Project Directory (project_name.cydsn)

!main.c

!cyapicallbacks.h

!*.cydwr

!*.cyprj

!*.cysch

# Optional files - workspace related

!*.cyprj.*

!*.cywrk

!*.cywrk.*

# Generated source and other source files inside the folder structure

#!*.c

#!*.h

#!*.inc

#!*.icf

#!*.ld

#!*.s

#!*.scat

# Binary files

#!*.hex

#!*.cyacd

Here is the output for the one specific project shown above. Please note most of the generated files are excluded, as they are commented in the .gitignore file above.

Someone might find it useful. I haven't seen exactly solutions like this on the web, because people usually know exact folder names along the way (sometimes it is really necessary).

Do you use a different setup? PSoCs are heavily tight to the PSoC Creator, so I haven't seen anyone using something else.

David

1 Reply