Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 8 Replies) Run 'board.txt' Post-build commands on F5, but not on F7? (Read 3036 times)
FrankP
Senior Member
****
Offline


Posts: 251
Joined: Oct 19th, 2011
Run 'board.txt' Post-build commands on F5, but not on F7?
Oct 27th, 2021 at 2:52pm
Print Post  
Hi,

I have my Teensy OTA firmware update script running great now, with one small problem.  It appears that the post-build event is triggered both on the 'compile-only' (F7) operation AND the 'compile-and-upload' (F5) operation.

I normally do a LOT of 'compile-only' cycles between each 'compile-and-upload' cycle, so is there a way of NOT triggering the post-build execution of board.txt commands after a F7 compile-only operation? 

TIA,

Frank
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2695
Joined: Feb 13th, 2019
Re: Run 'board.txt' Post-build commands on F5, but not on F7?
Reply #1 - Oct 27th, 2021 at 3:01pm
Print Post  
You should be able to change the recipe.hooks.postbuild, to use either the recipe.hooks.deploy.preupload, or recipe.hooks.deploy.postupload actions.

Further Info: https://www.visualmicro.com/page/Arduino-Build-Events-and-Hooks.aspx
  
Back to top
IP Logged
 
FrankP
Senior Member
****
Offline


Posts: 251
Joined: Oct 19th, 2011
Re: Run 'board.txt' Post-build commands on F5, but not on F7?
Reply #2 - Oct 31st, 2021 at 12:39am
Print Post  
Simon@Visual Micro wrote on Oct 27th, 2021 at 3:01pm:
You should be able to change the recipe.hooks.postbuild, to use either the recipe.hooks.deploy.preupload, or recipe.hooks.deploy.postupload actions.

Further Info: https://www.visualmicro.com/page/Arduino-Build-Events-and-Hooks.aspx


Thanks for the link to the build events and hooks.  Right now I have a single 'postbuild' command line:

Code (C++)
Select All
recipe.hooks.postbuild.1.pattern=cmd.exe /c "c:\Program Files (x86)\teraterm\ttpmacro.exe" /v "c:\users\Frank\Documents\Arduino\Teensy Projects\TeensyOTADemo\TeensyOTA1.ttl" "{vm.runtime.build.final_output_path}" {serial.port} {build.project_name} 



I would like to skip this line if when I press F7, but run it when I press F5.  I don't see anything in the list of actions that would allow me to know whether I was doing a 'build-with-upload' (F5) or 'build-but-don't-upload' (F7). Am I missing something?

TIA,

Frank
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12186
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Run 'board.txt' Post-build commands on F5, but not on F7?
Reply #3 - Oct 31st, 2021 at 3:00pm
Print Post  
Show cut keys differ depending on the choices you make when installing and running VS for the first time.

It is better to talk about menu items. The menu items have the short cut keys dispayed against them. Whch menu items are you trying to use?

The "Build" menu might be what you are looking for? Showing the info from the yellow box above when you click "F7" would also have helped.
« Last Edit: Oct 31st, 2021 at 3:12pm by Tim@Visual Micro »  
Back to top
IP Logged
 
FrankP
Senior Member
****
Offline


Posts: 251
Joined: Oct 19th, 2011
Re: Run 'board.txt' Post-build commands on F5, but not on F7?
Reply #4 - Oct 31st, 2021 at 3:14pm
Print Post  
Tim,

Menu items are 'Build->Build Solution' (F7) and 'Debug->Start Debugging' (F5).  See screenshots below

  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12186
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Run 'board.txt' Post-build commands on F5, but not on F7?
Reply #5 - Oct 31st, 2021 at 3:24pm
Print Post  
Okay so Simons previous response still stands

Quote:
You should be able to change the recipe.hooks.postbuild, to use either the recipe.hooks.deploy.preupload, or recipe.hooks.deploy.postupload actions.

Further Info: https://www.visualmicro.com/page/Arduino-Build-Events-and-Hooks.aspx
  
Back to top
IP Logged
 
FrankP
Senior Member
****
Offline


Posts: 251
Joined: Oct 19th, 2011
Re: Run 'board.txt' Post-build commands on F5, but not on F7?
Reply #6 - Oct 31st, 2021 at 7:58pm
Print Post  
Tim,

I have looked through the referenced document, but I still don't see how they help me tell if the compile was started as a 'build' (F7) or 'debug' (F5) compile.   

There is obviously something I'm missing here. what can the recipe.hooks.deploy.preupload, or recipe.hooks.deploy.postupload actions do that are relevant?  Please talk slowly and use small words, because I'm denser than the average programmer Wink


TIA,

Frank
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12186
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Run 'board.txt' Post-build commands on F5, but not on F7?
Reply #7 - Oct 31st, 2021 at 9:15pm
Print Post  
You seem to do some quite complex stuff so we will have to think about how the docs can be clearer.

You seem to be asking to use a hook that only runs when you attempt to upload? The preupload event will only run when you upload. Currently you are using a postbuild, that will run after every build.

  
Back to top
IP Logged
 
FrankP
Senior Member
****
Offline


Posts: 251
Joined: Oct 19th, 2011
Re: Run 'board.txt' Post-build commands on F5, but not on F7?
Reply #8 - Oct 31st, 2021 at 10:53pm
Print Post  
Tim,

Ah, I see now.  I didn't make the connection between 'preupload' and 'only runs when you attempt to upload, i.e. F5'.  

OK, I tried it, but it didn't work out quite like I'd hoped.  I replaced:

Code (C++)
Select All
recipe.hooks.postbuild.1.pattern=cmd.exe /c "c:\Program Files (x86)\teraterm\ttpmacro.exe" /v "{build.project_path}\TeensyOTA1.ttl" "{vm.runtime.build.final_output_path}" {serial.port} {build.project_name}
 



with

Code (C++)
Select All
recipe.hooks.deploy.preupload.1.pattern=cmd.exe /c "c:\Program Files (x86)\teraterm\ttpmacro.exe" /v "{build.project_path}\TeensyOTA1.ttl" "{vm.runtime.build.final_output_path}" {serial.port} {build.project_name}
 



Now the command doesn't run on F7 - yay! - but errors out on F5. The error is:

 
Uploading 'T35_WallE3_V1' to 'Teensy 3.5' using 'COM7'
'c:\Program' is not recognized as an internal or external command,
Error running hook: cmd.exe /c "c:\Program Files (x86)\teraterm\ttpmacro.exe" /v "C:\Users\Frank\Documents\Arduino\T35_WallE3_V1\TeensyOTA1.ttl" "C:\Users\Frank\Documents\Arduino\T35_WallE3_V1\Release\" COM7 T35_WallE3_V1.ino
operable program or batch file.
No Teensy boards were found on any USB ports of your computer.
Please press the PROGRAM MODE BUTTON on your Teensy to upload your sketch.
     The upload process has finished.

So, it appears the 'preupload' hook may parse things differently than the 'postbuild' hook?

Thoughts?

Frank



Frank
« Last Edit: Oct 31st, 2021 at 11:06pm by FrankP »  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2695
Joined: Feb 13th, 2019
Re: Run 'board.txt' Post-build commands on F5, but not on F7?
Reply #9 - Nov 1st, 2021 at 2:27pm
Print Post  
As a workaround while we investigate the different behaivour further, adding a wrapping set of double quotes around the cmd.exe params should work.

So:
Code
Select All
recipe.hooks.deploy.preupload.1.pattern=cmd.exe /c "c:\Program Files (x86)\teraterm\ttpmacro.exe" /v "{build.project_path}\TeensyOTA1.ttl" "{vm.runtime.build.final_output_path}" {serial.port} {build.project_name} 



becomes:
Code
Select All
recipe.hooks.deploy.preupload.1.pattern=cmd.exe /c ""c:\Program Files (x86)\teraterm\ttpmacro.exe" /v "{build.project_path}\TeensyOTA1.ttl" "{vm.runtime.build.final_output_path}" {serial.port} {build.project_name}" 

  
Back to top
IP Logged
 
FrankP
Senior Member
****
Offline


Posts: 251
Joined: Oct 19th, 2011
Re: Run 'board.txt' Post-build commands on F5, but not on F7?
Reply #10 - Nov 1st, 2021 at 5:03pm
Print Post  
Simon,

Yep - that did the trick  Smiley

Frank
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint