VS Arduino
>> >> Build Events - differences between VM and Arduino IDE
https://www.visualmicro.com/forums/YaBB.pl?num=1433402007

Message started by jcgperry on Jun 4th, 2015 at 7:13am

Title: Build Events - differences between VM and Arduino IDE
Post by jcgperry on Jun 4th, 2015 at 7:13am
This is mainly for information. I've been playing with the prebuild and postbuild hooks and discovered a couple of differences in behaviour between Visual Micro's implementation and the Arduino IDE implementation:
a) In the Arduino IDE, {build.source.path} gets passed as the Source DIRECTORY to any build hook, e.g. "c:\User\blah\blah\blah\Arduino\Blink".
whereas in Visual Micro {build.source.path} it is the source FILE which gets passed i.e. "c:\User\blah\blah\blah\Arduino\Blink\Blink.ino".
b) The Arduino IDE echoes any build command AND correctly redirects any output from a build hook executable to the output window, whereas Visual Micro echoes the command (twice!) but does not redirect the executable output.

A simple Batch Script (PreBuildEvent.bat) is enough to demonstrate this:

@echo off
echo %1

This is invoked from platform.local.txt
with the line:
recipe.hooks.prebuild.0.pattern="C:\Users\blah\blah\PreBuildEvent.bat" "{build.source.path}"

Neither of these are a deal breaker as I have coded around issue a) and put up with issue b)!

This is all using:
Arduino IDE v1.6.4
Visual Micro v1505.19 Sp4
Visual Studio 2013 Community
Windows 8.1

Not tried VM 1505.19 Sp6 yet but I assume there has been no changes in this area.

Sorry for the long post - hope this helps others.

Title: Re: Build Events - differences between VM and Arduino IDE
Post by Visual Micro on Jun 4th, 2015 at 12:04pm
Thanks for the info. Hopefully can resolve those items in the next release.

Title: Re: Build Events - differences between VM and Arduino IDE
Post by jcgperry on Jun 4th, 2015 at 6:16pm
Thanks Tim, keep up the great work and unsurpassed support.

After further digging around and playing with Build Events, I took a peek inside platform.txt to see what other parameters might be useful to pass to a build event hook. Below are some of the results when invoked from VM:

{build.source.path} = "C:\Users\xxxx\Documents\blah\blah\Arduino\Blink\Blink.ino"
{build.path} = C:\Users\xxxx\AppData\Local\Temp\build1285779512254750367.tmp
{build.project_name}  = Blink.cpp
{build.board} = AVR_NANO or = AVR_UNO or = to whatever, not tested any others!
{build.arch} = AVR or some other, again not tested
{compiler.cpp.flags}  = "-c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD"
{runtime.ide.version} = 10604
{build.f_cpu} = 16000000L

That's all folks, hope it is of use to some!

Title: Re: Build Events - differences between VM and Arduino IDE
Post by Visual Micro on Jun 4th, 2015 at 8:20pm
You can also switch on "tools>options>visual micro>compiler>show build properties" and "verbose" to see more info.

I am not sure how early the "pre" event happens. If any required properties are unavailable then pls let me know.

VS Arduino » Powered by YaBB 2.6.12!
YaBB Forum Software © 2000-2024. All Rights Reserved.