8 Replies Latest reply on May 7, 2014 5:40 AM by kim.kaptruski

    External build command, PSoC Creator 3

    kim.kaptruski

      Is it possible to define an external command to be called each time I build my project? You see, I want to compile in values from my revision control system. We use TortoiseSVN, and there is a program called SubWCRev to use, http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-subwcrev-example.html

         

       

         

       

         

      I also thought about solving this manually by always building my project from command line, by creating a build script. Is then the Cypress command line program cyprjmgr.exe the way to go? Actually, since I am a programmer, I prefer using command line anyway, so is it possible (in an easy way) to do building, programming and debugging from command line?

        • 1. Re: External build command, PSoC Creator 3
          naman.jain

          For building Creator projects using commands, check the link - http://www.cypress.com/?id=4&rID=91866.

             

          For Programming, check the link - http://www.cypress.com/?id=4&rID=92892. This link will tell you the the scripts available in various languages (C#, C++ , Perl, and Python) to program PSoC.

             

          Debugging is tough using commands, but you can find useful information on ARM website for PSoC4/5.

          • 2. Re: External build command, PSoC Creator 3
            kim.kaptruski

            Thank you for the links. Yes, it is probably easier to just use the debugger in PSoC Creator.

               

             

               

            I was able to create a command line build script (in Cygwin), which runs the SubCWRev program before building my project. But SubCWRev will not be run if I build from GUI. So I am still wondering how to define an external command to be run each time I build my project,  regardless of building from PSoC Creator (GUI) or cyprjmgr (command line). If this is possible. Because I want to be sure that each build will have the correct values.

            • 3. Re: External build command, PSoC Creator 3
              user_78878863

              Unfortunately, there is no way to add commands to a build in Creator.

              • 4. Re: External build command, PSoC Creator 3
                user_14586677

                One could imagine using Python, something similiar, to modify script

                   

                and code files to customize them, and the script of course run compiler/linker

                   

                at command line/batch level ? Although I think this would be a involved to implement

                   

                this, not portable. Not clean.

                   

                 

                   

                Of course if you took a bootloader approach that would be relativelky easy.

                   

                 

                   

                Regards, Dana.

                • 5. Re: External build command, PSoC Creator 3
                  kim.kaptruski
                  For Your Interest, I post my Cygwin bash-shell script, ./compile.sh :  #!/bin/bash  # switch to directory of this file PATH_DIR="$( cd "$( dirname "$0" )" && pwd )" cd $PATH_DIR   PATH_CYPRESS_BIN='/cygdrive/c/Program Files (x86)/Cypress/PSoC Creator/3.0/PSoC Creator/bin/' PATH_SOURCE="$(readlink -f FinalApp/MainApp/)" PATHWIN_WRK=$(cygpath -w $(readlink -f FinalApp/PSoC5LP.cywrk))   export PATH="$PATH:$PATH_CYPRESS_BIN"   echo "creating 'cfg_revision.h' from TortoiseSVN..." SubWCRev . cfg_revision.h.template FinalApp/MainApp/app_cfg/cfg_revision.h echo ""  echo "building project 'PSoC5LP'..." #cyprjmgr.exe -wrk $USER_PATH_WRK -prj PSoC5LP -build #^ did don work :( cygstart -w cyprjmgr -wrk $PATHWIN_WRK -prj PSoC5LP -build echo ""
                  • 6. Re: External build command, PSoC Creator 3
                    kim.kaptruski

                    #!/bin/bash

                       



                    # switch to directory of this file

                       


                    PATH_DIR="$( cd "$( dirname "$0" )" && pwd )"

                       


                    cd $PATH_DIR

                       




                    PATH_CYPRESS_BIN='/cygdrive/c/Program Files (x86)/Cypress/PSoC Creator/3.0/PSoC Creator/bin/'

                       


                    PATH_SOURCE="$(readlink -f FinalApp/MainApp/)"

                       


                    PATHWIN_WRK=$(cygpath -w $(readlink -f FinalApp/PSoC5LP.cywrk))

                       

                     

                       




                    export PATH="$PATH:$PATH_CYPRESS_BIN"

                       




                    echo "creating 'cfg_revision.h' from TortoiseSVN..."

                       


                    SubWCRev . cfg_revision.h.template FinalApp/MainApp/app_cfg/cfg_revision.h

                       


                    echo ""

                       



                    echo "building project 'PSoC5LP'..."

                       


                    #cyprjmgr.exe -wrk $USER_PATH_WRK -prj PSoC5LP -build

                       


                    #^ did don work :(

                       


                    cygstart -w cyprjmgr -wrk $PATHWIN_WRK -prj PSoC5LP -build

                       


                    echo ""

                    • 8. Re: External build command, PSoC Creator 3
                      kim.kaptruski

                      There is a little detail with the script above. I had to run cyprojmgr.exe through cmd.exe (this script is for cygwin bash). cmd.exe will just close when finished, regardless of cyprojmgr.exe program result. So it is not easy to see any build errors. This could probably be solved by calling a "wait' program if non-zero program result. But I am not good at scripting, so I just leave this for now. I program my chips with PSoC Creator 3 anyway, so I wil see my errors there.

                         

                       

                         

                      And for this script, the project folder is FinalApp/ and source folder is FinalApp/MainApp/