Skip to content

Instantly share code, notes, and snippets.

@yeutterg
Last active February 25, 2023 03:23
Show Gist options
  • Save yeutterg/fbd672f7a4a0900785a4b9624aff2fd9 to your computer and use it in GitHub Desktop.
Save yeutterg/fbd672f7a4a0900785a4b9624aff2fd9 to your computer and use it in GitHub Desktop.
How to use PSoC Creator with Git
### PSoCCreator ###
# Modified from https://www.gitignore.io/?templates=psoccreator
# You may need to add additional directories, e.g. CortexM3/
# Project Settings
*.cywrk.*
*.cyprj.*
# Generated Assets and Resources
Debug/
Release/
Export/
CortexM0/
codegentemp
Generated_Source
*_datasheet.pdf
*_timing.html
*.cycdx
*.cyfit
*.rpt
*.svd
*.log
*.zip

How to use Git with Cypress PSoC Creator (Windows)

This script makes it easy to manage your PSoC Creator project with Git using Windows PowerShell. A .gitignore file is provided that works whether or not you decide to use this script.

Tested with PSoC Creator 4.2 on Windows 10

Git Setup

  1. Install Git
  2. Make sure Git is set up with your PATH
  3. Create a new repository
  4. In the PSoC Creator project directory:
git init
git remote add ...
  1. Make sure you are logged in to GitHub (or GitLab, BitBucket, etc.)
  2. Copy the .gitignore and .ps1 file to your project directory. Review them and make any changes. A helpful, but somewhat out-of-date, guide from Cypress about version control can be found here

Add, commit, push

Open PowerShell and invoke the .ps1 script, or right-click it and select "Run with PowerShell." Note that you may get a script execution warning, just press Y

You will see all the files that were added, and then you will be prompted for a commit message. Hopefully, the changes will commit and push to the repo

# Refer to the instructions for using PSoC Creator with version control:
# https://community.cypress.com/docs/DOC-11030
# Add the PSOC Creator Files
git add *.c *.h *.cydwr *.cyprj .\TopDesign\*.cysch
# Add additional files
git add *.md
# Added these files
echo 'Git Status:'
git status
# Ask for the commit message
$CommitMsg = Read-Host -Prompt 'Enter the commit message'
# Commit
git commit --m "$CommitMsg"
# Push
git push -u origin master
# Keep the console open after execution
Read-Host -Prompt 'Press Enter to exit'
@endolith
Copy link

endolith commented Nov 1, 2021

@dariy-vel Files in Generated_Source folder can be modified by user code. For example, in USB_episr.c, see the sections like

/***************************************
* Custom Declarations
***************************************/
/* `#START CUSTOM_DECLARATIONS` Place your declaration here */

/* `#END` */

Content within the tags is not modified when the files are generated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment