Custom build step

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

cross mob
HuEl_264296
Level 5
Level 5
First like given 25 sign-ins First solution authored

 Hi there,

   

I would to add a custom build step to my PSoC Designer project. Is this possible?  I can't find any options for it in the GUI. Is there some way I can do this?

   

Many thanks

   

Hugo Elias

0 Likes
11 Replies
pushekm_21
Employee
Employee
10 likes received 5 likes given First like received

 What specifically you want to achieve by custom build. There is an option to build the project via Comand Line Interface. I can suggest you whether it'll help or not based on your requirements.

   

 

   

Best regards,

   

Pushek

0 Likes
HuEl_264296
Level 5
Level 5
First like given 25 sign-ins First solution authored

I have a python script which generates a .h file like this:

   

#define SVN_REVISION  1644

   

 

   

This is the actual SVN version of the code being compiled. Therefore, when the code is programmed into the PSoC, I can ask the PSoC exactly which code version is has.

   

Actually, a custom build step is very useful for users who have any kind of automatically generated code. E.G. users who are using Flex and Bison.

   

 

   

Hugo

0 Likes
Anonymous
Not applicable

Please see this post under the PSoC Designer Software forum :

   

Using Shared Libraries of Code with Multiple PSoC1 Projects

   

http://www.cypress.com/?app=forum&id=2492&rID=54090

0 Likes
HuEl_264296
Level 5
Level 5
First like given 25 sign-ins First solution authored

 Hi tommoxon,

   

thanks for the reply. However, this is not what I am looking for. I don't just want to include a file from another path, I want to generate a file befor compilation, using a python script.

   

Currently, when I press F6 to build, the following things happen:

   
        
  1. Generating project
  2.     
  3. code generation
  4.     
  5. DRC
  6.     
  7. starting MAKE
  8.     
  9. code is compiled
  10.     
  11. code is linked
  12.    
   

But, what I want is this:

   

   
        
  1. Generating project
  2.     
  3. code generation
  4.     
  5. DRC
  6.     
  7. starting MAKE
  8.     
  9. gen_svn_header.bat is executed
  10.     
  11. code is compiled
  12.     
  13. code is linked
  14.    
   

 

   

gen_svn_header.bat is a batch file which runs a python script which generates a .h file which will be included into my code.

   

Hugo

0 Likes
HuEl_264296
Level 5
Level 5
First like given 25 sign-ins First solution authored

 Do I take it that it's impossible to add a custom build step?

0 Likes
StFa_285751
Level 3
Level 3
25 replies posted 10 replies posted 5 replies posted

 Hi Rocketmagnet,

   

Did you ever get a solution for this? Would like to write the SVN revision number to a header file pre-build.

   

Thanks.

   

Stephen

0 Likes
HuEl_264296
Level 5
Level 5
First like given 25 sign-ins First solution authored

I never saw a solution to this. However, I haven't looked at the recent updates on PSoC creator, so they might have sneaked it in recently.

   

 

   

Hugo

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

One solution would be use of a bootloader approach.

   

 

   

Just a thought.

   

 

   

 

   

http://www.cypress.com/?rID=50230     AN68272 UART BL     PSOC 3, 4, 5LP

   

http://www.cypress.com/?rID=41002     AN60317 I2C BL         PSOC 3, 5LP

   

http://www.cypress.com/?rID=57561     AN73503 USB HID BL with GUI Host     PSOC 3, 5LP

   

http://www.cypress.com/?rID=56014     PSoC® 3, PSoC 4, and PSoC 5LP Introduction To Bootloaders

   

http://www.cypress.com/?rID=83293     AN86526 - PSoC® 4  I2C Bootloader

   

http://www.cypress.com/?rID=50230     AN68272 - PSoC® 3, PSoC 4 and PSoC 5LP UART Bootloader

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

You could use a batch file to call your python script to generate your .h file then compile using the CLI

   

 

   

Check this link about PDCLI:

   

www.cypress.com/

0 Likes
Anonymous
Not applicable

Hmm, I'm disappointed there isn't a hook for triggering a custom command within the build process like some other IDEs, I'm trying to do the same and moving to CLI building isn't much simpler than manually triggering the batch file before building. I created some hooks that tie into TortoiseSVN commits/updates which gets me closer to what I want in the meantime.

0 Likes
PeVo_1249246
Level 3
Level 3
10 replies posted 5 replies posted Welcome!

I will respond late because earlier I had no need for PSOC1. Now I am making some maintenance to old project and am in the same issue. There is a trick. The designer does use GNU Make as the make handler and you can create local.mk. Inside the local.mk you can add a rule for version.h file, then this rule is going to run your custom script. Note that the local.mk seems to be loaded before any rules are defined. Thus I needed to add default rule before the version.h rule and instruct it to build the hex target.

---- local.mk ----

VERSIONCC:=..\PATH\TO\YOURVERSION.BAT

default: version.h output/$(PROJNAME).hex

.PHONY: version.h

version.h:

    $(VERSIONCC) > version.h

0 Likes