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) build hooks (Read 1437 times)
robo1
Newbies
*
Offline


Posts: 7
Joined: Apr 25th, 2015
build hooks
Apr 25th, 2015 at 9:53am
Print Post  
When I try to usepre/post build hooks I always get a message file not found.
I tried the line exactly from the announcement;
recipe.hooks.prebuild.0.pattern=echo "Hello {build.source.path}"

and get this result;
recipe.hooks.prebuild.0.pattern
echo "Hello {build.source.path}"
echo "Hello {build.source.path}"
The system cannot find the file specified
     Process: echo "Hello {build.source.path}"

What am I missing?
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12188
Location: United Kingdom
Joined: Apr 10th, 2010
Re: build hooks
Reply #1 - Apr 25th, 2015 at 1:27pm
Print Post  
Thanks for the report. That new board.source.path property had not been added o visual micro

Please try the latest beta which has just been refreshed

Thanks
  
Back to top
IP Logged
 
robo1
Newbies
*
Offline


Posts: 7
Joined: Apr 25th, 2015
Re: build hooks
Reply #2 - Apr 26th, 2015 at 5:27am
Print Post  
Has it been updated since the the 20th as indicated on the web page? I am already running that one. It probably has something to do with me not understanding the entire Arduino build process. Could they have made it any worse?
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12188
Location: United Kingdom
Joined: Apr 10th, 2010
Re: build hooks
Reply #3 - Apr 26th, 2015 at 8:18am
Print Post  
Yes it has been updated
  
Back to top
IP Logged
 
robo1
Newbies
*
Offline


Posts: 7
Joined: Apr 25th, 2015
Re: build hooks
Reply #4 - Apr 28th, 2015 at 8:32pm
Print Post  
Same problem
(SP3 used)

------------
Include Path 'C:\Users\mikep\Documents\Arduino\libraries'
recipe.hooks.prebuild.0.pattern
echo "Hello C:\Users\mikep\Documents\MWPRobotics\Pilot\Pilot\Pilot.ino"
echo "Hello C:\Users\mikep\Documents\MWPRobotics\Pilot\Pilot\Pilot.ino"
The system cannot find the file specified
     Process: echo "Hello C:\Users\mikep\Documents\MWPRobotics\Pilot\Pilot\Pilot.ino"

---------------------------------------------

All I am really trying to do is keep a copy of the finished hex file, if there is some better way to do that, it would serve my needs, although I guess you still might want to know why the given echo example does not work as planned.
« Last Edit: Apr 28th, 2015 at 8:36pm by robo1 »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12188
Location: United Kingdom
Joined: Apr 10th, 2010
Re: build hooks
Reply #5 - Apr 28th, 2015 at 8:39pm
Print Post  
It's not the same problem

Previously you saw the following because the new {build.source.path} was not defined.

Quote:
recipe.hooks.prebuild.0.pattern=echo "Hello {build.source.path}"

and get this result;
recipe.hooks.prebuild.0.pattern
echo "Hello {build.source.path}"
echo "Hello {build.source.path}"
The system cannot find the file specified
     Process: echo "Hello {build.source.path}"


Now, with Sp3 you can see the file is passed correctly to your .exe and your .exe is able to echo it. So your event is working okay.

Quote:
recipe.hooks.prebuild.0.pattern
echo "Hello C:\Users\mikep\Documents\MWPRobotics\Pilot\Pilot\Pilot.ino"
echo "Hello C:\Users\mikep\Documents\MWPRobotics\Pilot\Pilot\Pilot.ino"
The system cannot find the file specified
     Process: echo "Hello C:\Users\mikep\Documents\MWPRobotics\Pilot\Pilot\Pilot.ino"


The question now is what is throwing the final error expecting to find a file? I will check that Visual Micro is ignoring the return value but please also ensure your code is not throwing the error.

Thanks

edit: Just looked at Visual Micro. If it encounters an error running your exe it prints a very obvious message. So at a quick glance it looks like your .exe is outputting the message.
« Last Edit: Apr 28th, 2015 at 8:43pm by Tim@Visual Micro »  
Back to top
IP Logged
 
robo1
Newbies
*
Offline


Posts: 7
Joined: Apr 25th, 2015
Re: build hooks
Reply #6 - Apr 28th, 2015 at 8:54pm
Print Post  
Or it might have something to do with 32 bit vs 64 bit Wink The original post has 2 errors in it. But in any case its the same error, echo is not a command, it is a shell built in function. Trying to execute it as a command is probably not the best thing to do. BTW, the Arduino IDE gets the same error.  Like I said, it is probably a limit that was not considered by Arduino, and will never work, so any other way to just get a copy of the hex file to keep without manually copying it myself every compile would suffice.
« Last Edit: Apr 28th, 2015 at 8:55pm by robo1 »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12188
Location: United Kingdom
Joined: Apr 10th, 2010
Re: build hooks
Reply #7 - Apr 28th, 2015 at 9:05pm
Print Post  
Hi,

Yes I just tried it in the Arduino Ide and get this error

Quote:

Cannot run program "echo": CreateProcess error=2, The system cannot find the file specified


It's not a problem just a misunderstanding of how the pre and post build events work.

Arduino works the same way to run the compile which uses often uses avrdude.exe which is passed information as {paramaters} 

You are expect to create an .exe that accepts as many arguments as you need. 

Something like this for example where you have created a myBuilder.exe and put it in a folder you have created called c:\myevents :-

recipe.hooks.prebuild.0.pattern="c:\myevents\myBuilder.exe" "PreBuild0" "{build.source.path}"

In Visual Studio you can click "File>New>project" and create either a windows console application, windows forms or wpf application all of which compile into a .exe. In this case you would call the project (or set the output to) "myBuilder"

If you use C# you will find a program.cs with a single method called main which is passed an array of args[]

in the above example args[0] will contain "PreBuild0" and args[1] will contains the path of the sketch folder

In VB the file is Program.vb and the args must be accessed using brackets args(1)

Does this make sense?
  
Back to top
IP Logged
 
robo1
Newbies
*
Offline


Posts: 7
Joined: Apr 25th, 2015
Re: build hooks
Reply #8 - Apr 28th, 2015 at 9:27pm
Print Post  
It would had a different example been shown, perhaps that is source of confusion? 

What shell environment variables are used? all of them?  What is the path= at time of execution? I get the same 'file not found' error for a 'copy' command so apparently it is NOT using the OS established path.

modify: copy is also a built in just like echo - so there is no way to copy a file using this mechanism? Guess I can always create a .cmd file to do it.  Where are all the available variables documented?
« Last Edit: Apr 28th, 2015 at 9:43pm by robo1 »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12188
Location: United Kingdom
Joined: Apr 10th, 2010
Re: build hooks
Reply #9 - Apr 28th, 2015 at 9:48pm
Print Post  
Sorry I don't understand.

Create a console application using Visual Studio as described below it's easier and also you don't bump into problem with double quotes. A .net console app is just an exe of your own but the .net language gives you a great deal of power, it makes the cmd prompt look like a kids toy.

If I recall the .net the file copy command is File.Copy(sourcePath,destPath)

All of the pc environment vars are available to your console app. You can show the ui or not it's up to you. You can use std output and std error to pump messages back to visual micro same as the compiler tools.

The sketch path you are already passing in your definition and if you look at boards.txt and more importantly platform.txt you will see more params. 

What is it you want to do?
  
Back to top
IP Logged
 
robo1
Newbies
*
Offline


Posts: 7
Joined: Apr 25th, 2015
Re: build hooks
Reply #10 - Apr 28th, 2015 at 10:04pm
Print Post  
I apologize, we speak different languages. I speak Windows. You speak Linux with experience making Linux programs run under Windows. I do not in any way have that experience, nor do I want it. This will be my last Arduino project, I promise. I may use Atmel in the future, but it will as far removed from Arduino as possible. This was the advice a pro Atmel developer gave me when I started. Now I understand.

The example you gave, copied verbatim into the .txt file does not work. It does not work because echo is not a command .exe file.  You suggest writing my own .exe to copy a file.  Is that how files are copied in Linux also?

One does not have to look far to see Arduino's position on Windows;

"The command line build provided by Arduino is not very Windows friendly"

Given the current market share, if you are teaching a 'make' class in programming, when you tell the class we will be programming with Arduino, you just told 98% of them you do not care about them, you are only interested in the 2%.  It might work, but otherwise, go home.

And I am sure you already know this, (as do I already know how to write a windows program, I have been doing WPF for 10+ years), but it is the outsiders reading we wish to inform.

So anyhow, I have given up at this point. I already mentioned 2 or 3 times what I was trying to do, but I know you get many request for support and do not have time to remember, or re-read every request. I appreciate the effort, but at this point, it is just simply, not worth it my time either.
« Last Edit: Apr 28th, 2015 at 10:08pm by robo1 »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12188
Location: United Kingdom
Joined: Apr 10th, 2010
Re: build hooks
Reply #11 - Apr 28th, 2015 at 10:34pm
Print Post  
Uggh. Please let me explain a few things.

I only use windows and Visual Studio. I have no knowledge of Linux.

I did not know you are using Atmel Studio, most users are using Visual Studio

I provide a free plugin and free forum for Atmel Studio and Visual Studio for people who use Arduino. My software replicates the Arduino build process 100%. The process is designed by Arduino and makes it very simple for people to build their sketches and upload without need for any complexity.

I have clearly described to you how to build windows programs, not Linux programs. The simple fact is that you say you use windows but you have no experience of how to build a windows program.

The pre and post build feature of the Arduino system is again designed by Arduino. Visual Micro is advertised as being 100% arduino compatible to build Arduino programs.

The pre and post build events are new and only in the beta because Arduino also have only just designed and released the feature.

So to recap.

You have jumped in making a seriously strange number of assumptions. Not read anything about what Arduino is. Not followed a simple set of instructions which other people happily work with. Consumed free support time, not read posts properly or answer my questions.

I am sorry you have not achieved what you wanted to achieve but I really have invested time in trying to help you and you really have made many wrong assumptions. I've put a great deal of effort into the software and this forum and fortunately people who really want to use their Arduino's get satisfaction from the software and support.

In this case I feel like you are shooting the messenger. All I have done is educated you and explained how you can make arduino work on windows. I am not Arduino, they are a hardware company that make a lot of money from selling hardware and I am not Atmel, they are the company who asked me to make Visual Micro work in Atmel Studio for free and also a company that makes a lot of money from selling hardware.

So what exactly are you saying to me about Linux? (I suggested writing your command.exe in Visual Studio which is the Microsoft dev environment and suggested build a windows console app or windows form app etc)

Arduino is excellent for most exactly because you don't have to mess with any build events. Doesn't sound like the tool for you at all.

edit: Maybe you thought you needed to use command line but you don't that is simply an option for advanced users.. Please don't shoot the messenger that has tried to help you.


ps: 

I just reread your message. Maybe you are confused about how to build arduino programs. You just pick your board from the tool bar and click debug>start with or without debugging. http://www.visualmicro.com/page/User-Guide.aspx?doc=index

I think this is just a whole bunch of confusion from reading the beta release notes. Please see the compile and upload docs they are designed for students  Smiley
« Last Edit: Apr 28th, 2015 at 10:39pm by Tim@Visual Micro »  
Back to top
IP Logged
 
robo1
Newbies
*
Offline


Posts: 7
Joined: Apr 25th, 2015
Re: build hooks
Reply #12 - May 1st, 2015 at 5:36am
Print Post  
...wasted keystrokes, again
« Last Edit: May 1st, 2015 at 5:41am by robo1 »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12188
Location: United Kingdom
Joined: Apr 10th, 2010
Re: build hooks
Reply #13 - May 1st, 2015 at 2:53pm
Print Post  
This Topic was moved here from Project Guidance [move by] Visual Micro.
  
Back to top
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint