Visual Micro - Arduino for Visual Studio

sixeyes:
But you can use a toolchain of your choosing:

How to change the GCC toolchain used | Atmel studio 7.0

Iain

Thanks for clearing that up :slight_smile:

Slightly off topic but still relevant to the discussion I think. I started playing with my Arduino again after a fairly long holiday from it. I found the USB driver chip was dead (no 3.3 V) and therefore I can't download sketches.

I installed AVR Visual Studio 5 so I could download a sketch using AVRISP MKII using the info in an old forum topic http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1196617535 . I now note the comments that it is not !00% compatible but this might do me until I can get another Arduino.

One thing I noted was the delay function in the simple blink sketch shown above is running too fast, maybe by a factor of 10. It certainly works as increasing the delay() parameter changes behaviour. I thought it might have been the CKDIV8 Clock fuse divider needed setting but I don't think this is delivering the right result. Does the Arduino use an external clock? Any ideas on how to set up the clock correctly?

Any ideas would be appreciated. If not, at least I can confirm an incompatibility to settle the argument.

Finally, can the new Visual Studio environment drive the AVRISP MKII ?

Rod

Rod,

You can do everything that you can do with the Arduino IDE. The plugin uses the Adruino environment and tools. It is just located in the VS2010 IDE. You will have to look at the programmer and board settings in order to use AVRISPMKII

With regard to your timing issue. The Arduino board uses an 16Mhz external clock in the form of a crystal. You have to look at the fuses to start with and then at the F_CPU setting in the tool chain setup of project setup - not sure where. The delay function is very accurate and you should not have to change the way it is intended to be used. delay(100) must give a delay of 100 milli seconds.

My guess is that the fuses are incorrectly selected.

I use a very handy tool called AVR8 Burn-O-Mat. Google will tell. This tool helps to visualize the fuses to some extend and it is easier to keep track.

@Robindengen - Arduino Compatibility and Ease of Use

  1. There are various issues the slightly less experienced users will encounter with libraries outside of arduino or visual studio. If using either of the two products then, when adding a library all of the .h files are automatically added as #includes. I have found users who had manually included just one or two of the header files from the lib folder yet the folder also contained other .h files which contained errors. When we compile in arduino or in visual studio the lib folder is re-scanned and all the other .h files are included in the compile which will then fail if we have an error in a file. Libraries can also have a sub folder called /Utility containing more .h files. It is fiddly to find the names of the .h files each time you want to include a library in a sketch and adding them manually is prone to error. So this makes it easier to use arduino or visual studio to manage libraries than avr studio. Using visual studio will ensure backward compatibility with the arduino ide which is very important when searching the internet for code extensions or trying to diagnose problems

  2. When a board is selected in arduino or in visual studio the proper cpu speed, defines etc are automatically applied for the user. So we don't have to remember or know these settings. When we use a programmer or burn a boot loader all of the settings are again automatically applied. Arduino also supports an additional core per board. The new core is automatically used by both arduino and visual studio

Example: The intellisense in visual studio will immediately show the additional serial ports when changing a board from uno to mega

  1. Both arduino and visual studio do not require users to know avr files names or any arduino core file names

  2. Your simple sketch example will look quite complicated to many users but let's consider a real life project that contains 10 libraries. We would like to be able to add 10 libraries easily by clicking menu items which will automatically insert between 10 and maybe 100 #includes into the source code. We would also like the intellisense to automatically detect where the libs are installed and finally when we compile it is very important that all of the full include paths are mapped correctly. Let's not forget that it is legal for arduino/processing libraries to contain a /utility folder. The utility codes needs to be known to the compile of the related library or things will break.

  3. When we install a new version of the arduino ide we want all of our sketches to automatically use the cores and arduino libraries. we also want to use the same compiler that ships with the ide so that any errors can be resolved via searches on arduino.cc or by logging a problem with arduino.

  4. If we are developing our own libraries then we would like the facility to automatically add all library code to the current project, not just as #includes but as source files. So that we can edit and browse the library codes easily. We want to include the lib codes into our project but for them to be automatically excluded from the primary sketch compile. This feature is only available in visual studio.

  5. We want to download an arduino example from the internet, open the main .pde, select a board and click F5 to compile and upload. As long as the libraries are installed the sketch will compile immediately. In eclipse it might be up to 30 minutes of work to prepare just one example.

Sunmary
There are so many other benefits of the visual studiuo solution that I won't bore you with them. What seems great is having the power and speed of visual studio ide but with the simplicity of the arduino ide

From the horses mouth, and he professes to not have the gift of the gab.

VS2008 report:

Thanks for fixing that "space in the path" bug.

I just installed the latest version (v18?), ran VS2008, created a new project and copied the blink sketch code into it, then hit F5 and the program was compiled and uploaded.

Well done guys, I haven't done anything serious yet but it looks like the IDE is history as far as I'm concerned.


Rob

Rob,
I am happy that you are impressed. I know that I was. Believe me if I tell you that I tried every alternative available and Visual Micro is most probably the simplest and easiest way of doing things.
Please keep testing and should you find any issues, please report them on the Issue Tracker over here. http://visualmicro.codeplex.com/workitem/list/basic

Happy coding man!!

I tried every alternative available

Likewise, my latest environment is Notepad++ and an external makefile, I'm pretty happy with that combination but a fully integrated IDE will be better.


Rob

I have to insist that the Avr Studio 5 does not use avr-gcc but their own compiler.

I don't think so. It's not the same version of the compiler that Arduino is currently using, but it is still gcc.
(I think only gcc for avr32 has "Atmel" code that is not part of the general gcc distribution.)

@Graynomad Great news! Thanks for letting us know

Visual Studio Addin has been tested with arduino 0023, the 1.0 work will be released as soon as Arduino 1.0 is released. 1.0 is not a major change but has a few minor differences and some great improvements. ARM next!

Update

The recent Arduino for Visual Studio versions provide automatic compatibility with Arduino 1.0 and earlier versions. Both new and existing projects are automatically configured based upon the installed Arduino version.

There are a host of other useful updates available in the latest codeplex version. One example being serial echo. Serial echo will be useful if you have two serial devices that normally communicate with each other. Instead, visual studio can sit in the middle, allowing packets to be viewed in visual studio whilst the serial data additonally forwarded to the "other" port. Obviously the arduino serial ports in visual studio are still "upload" aware, meaning they automatically pause and re-start after a compile and upload.

http://www.visualmicro.com/page/Arduino-Visual-Studio-Downloads.aspx

Update: v26 includes enhanced serial tools and the relax patch allowing large programs to be uploaded to the arduino 2560

Update: The Arduino compiler optimisation in Visual Studio has been enhanced.

For those who don't already know, the Visual Studio plugin optimises each compile based upon source code modification dates ensuring that the end result compilation is identical to that produced by the Arduino IDE.

The optimisation means that the plugin “auto detects” changes to files such as libraries, core and code on a board by board basis.

The result is a normal speed first-time compile (of each sketch) with ultra high speed subsequent compilations improving productivity by some magnitude.

An example being a 5 second compilation might be reduced to 0.5 of a second. In the next version it should be a little bit quicker :slight_smile:

http://www.visualmicro.com/page/Arduino-Visual-Studio-Downloads.aspx

Only 1 slight problem... If you don't have the latest and greatest in computers, then Visual Studio 2010 takes all day to get anything done. It is another piece of Microsoft bloatware.(for the record - I am a VB6 and Visual Studio 2000 user) I tried running VS 2010, and AVR Studio 5 and found them both to be agonizingly slow. Visual Studio 2008 isn't much better.

I'm sorry you have to use such slow hardware. I also don't like the fact that every hardware advance is matched by even hungrier software.

On less powerful machines, VS 2010 is slow starting on first use, but then most of the time it opens really fast and other times slowly. In any event, I find VS is faster than Eclipse and the Arduino IDE. Escpecially if you have a lot of sketches in your sketch folder and the serial viewer consumes next to no cpu % whilst Arduino is so heavy it causes my cpu fan to come on.

The best option is to leave VS open (if you can). Once open it works very quickly. I also change my settings not to use the visual studio start page. It seems to connect to the internet to get news etc which slows things down even more.

I guess this plugin is really for more recent office and windows users who seem to find it very useful. The time taken to start vs is compensated some what by the ease and speed of Arduino development inside Visual Studio.

I found AVR Studio especially slow. The plugin has been designed in two parts. The arduino part and the visual studio user interface part. So I always keep a look out for something as functional as VS but faster, that would benefit from the Arduino part :slight_smile:

http://www.visualmicro.com/page/Arduino-Visual-Studio-Downloads.aspx

kf2qd:
Only 1 slight problem... If you don't have the latest and greatest in computers, then Visual Studio 2010 takes all day to get anything done. It is another piece of Microsoft bloatware.(for the record - I am a VB6 and Visual Studio 2000 user) I tried running VS 2010, and AVR Studio 5 and found them both to be agonizingly slow. Visual Studio 2008 isn't much better.

My experience with Visual Studio is that it needs LOTS of RAM.

Years ago when I upgraded from NT4 to Windows 2000 I had to upgrade my laptop's memory from 128MB to 256MB. Windows 2000 took more RAM and Visual Studio 6 no longer had enough memory to fit.

Similarly with Visual Studio 2008 I had to upgrade another laptop, from 1GB to 2GB this time, to prevent swapping and poor performance.

I found a good deal on ebay for second hand memory for my 7 year old laptop :slight_smile:

Perhaps your PC has insufficient RAM to run VS2010?

Iain

Yes I agree with sixeyes, RAM is more important than everything else

Have to say I am liking this!

I have tried other so called plugins to VS before and you end up making all sorts of changes to the config to get it to work. However, I had this up & running in 5 minutes.

I took one of my more complex Arduino 1.0 projects c/w heaps of libraries (some custom written) and it compiled and uploaded first time.

Ian.

Ian, that is good to hear thanks. We have nearly 6000 downloads since October so all functions seem to be working well with Arduino 1.0 and earlier.

For windows users, the serial tools seems to be popular due to their speed and lack of resource hogging, the super fast compile makes development much faster. Personally I like the option to include arduino core and libraries (with auto change detect) in my project(s) and like to develop more than one project within a single IDE.

http://www.visualmicro.com/

It's time for multi-mcu support! Arduino, chipKit, maple etc.

I would appreciate hearing from anyone who has any suggestions for a build.xml that would allow each mcu type to be defined more easily allowing us to support the different flavours.

Example: The xml should describe how to compile for arduino 1.0 and the locations of all 1.0 files, how to compile arduino 0023 and locations, how to compile chipKit and locations etc etc. Obviously we already have 1.0 and 0023- in Visual Studio but this would be a "step up" allowing users to define their own processor types or for the standard product to auto support other processors.

Thanks in advance