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
Normal Topic Test Outside of Arduino (Read 5461 times)
James Brown
Junior Member
**
Offline


Posts: 46
Location: Near San Diego
Joined: Jul 31st, 2012
Test Outside of Arduino
Sep 27th, 2012 at 2:14pm
Print Post  
I have some code that must eventually run on Arduino but can be more easily tested under a standard VS 2012 setup (C++ or C#).  Is this possible?  Any example to get started?
  
Back to top
IP Logged
 
Marius
Developer
****
Offline


Posts: 204
Location: Centurion RSA
Joined: Sep 7th, 2011
Re: Test Outside of Arduino
Reply #1 - Sep 27th, 2012 at 2:41pm
Print Post  
Why dont you just compile the code for the arduino under VS2012. The compiler for the Arduino is not the same as the Standard windows stuff anyway and might cause problems later.

Dont you have an Arduino to use?
  
Back to top
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Test Outside of Arduino
Reply #2 - Sep 27th, 2012 at 2:52pm
Print Post  
I agree with Marius, it is a lot easier to just build in VS 2012 as Arduino to see if it compiles okay.

It is also true to say that standard C++ will not combine multiple pde/ino files correctly so we must assume you have only 1 of these source files in your project?

If you have your std C++ setup already working then you might try the following, however it hasn't been tested since the recent changes for the debug tool.

1) Optionally, create a new Win32 Solution Configuration called any name such as "Arduino"

2) Add the new configuration name to "Tools>Options>Visual Micro>Compiler>Release Configuration". Or if you didn;t create a new config in 1) above then set this option "Release"

After doing this you should be able to select any configuration than specified in 2) for a std. win32 compile.
« Last Edit: Sep 27th, 2012 at 8:41pm by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Test Outside of Arduino
Reply #3 - Sep 27th, 2012 at 8:41pm
Print Post  
If you really need to do this I have thought of another way. I don't think C# would be very easy because it uses namespaces and quite different syntax. 

However, you could create a new C++ project and map all the files from the Arduino sketch to your project. The rules for a C++ project are more relaxed than the Arduino rules so including files from other locations is very easy. 

This allows you to leave the Arduino configuration as standard (ignoring my message below) yet having complete build control in your C++ project.

Good luck, it sounds like hard work  Smiley
  
Back to top
WWW  
IP Logged
 
James Brown
Junior Member
**
Offline


Posts: 46
Location: Near San Diego
Joined: Jul 31st, 2012
Re: Test Outside of Arduino
Reply #4 - Sep 28th, 2012 at 5:01am
Print Post  
Thanks for the hints.  I'll give them a try.
I'm writing some code that is fairly complex but does not need an interface to outside hardware so I thought It would be easer to simply write it in 'C' using VS 2012 where I could single step it and have full control of the debug process.  Then, when it runs correctly, I could cut it into the code that must run on the Arduino and complete the debug process using Visual Micro.
I did try C# and quickly ran into the namespace problem and many differences in syntax so I gave that idea up.
  
Back to top
IP Logged
 
Marius
Developer
****
Offline


Posts: 204
Location: Centurion RSA
Joined: Sep 7th, 2011
Re: Test Outside of Arduino
Reply #5 - Sep 28th, 2012 at 5:25am
Print Post  
James,
That is the whole idea with the Visual Micro plugin. You can debug arduino C or CPP code as you are in Visual Studio and you have extensive debug tools. I write complex code from time to time and there is no need not to debug on the chip. I own ISP's that will allow me to do single step debugging in Atmel Studio but I prefer to use the VM plugin in Visual Studio. You have the same debug features in both worlds. The only time I use the ISP's now is when I have a custom design that does not have a comm port.
  
Back to top
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint