Arduino IDE and GDB for Visual Studio

common links: release notes | next release, alternative download, previous releases and email notifications | Setup | Correct Way to Open Projects | Plotting and Charting | Atmel Studio | Create Project | Create Arduino Library | Share Code Between Projects | Faster Builds | Extend Intellisense | ESP32 | ESP8266 | ESP32 Debugging | Difference between .ino and .cpp | Custom Build Events | Command Line Interface | Custom Debug Output | CLI | Teensy | Arduino Build Hooks | Atmel Studio 7 | Override Build Properties | Debug  | Esp FreeRTOS | Custom Cores | freeRTOS esp-idf on ESP32 | Auto Increment Version (build events)


What is Visual Micro?

Visual Micro is a plugin for Microsoft Visual Studio (with C++ installed). Visual Micro helps you create Arduino compatible cross-platform programs for hundreds of different Arduino compatible micro-controllers. The Visual  Studio and Atmel Studio IDEs are available for free for full time students. Visual Micro also includes multiple serial monitors, simple pre-configured hardware (GDB) and and alternative unique full speed software debugger.

When writing code with Visual Micro, if you adhere to the Arduino.cc rules  then the code you create will remain Arduino IDE compatible. Use the Arduino compatible library and board managers to discover and download hundreds of Arduino compatible boards and libraries. Visual Micro can be installed from within an IDE using the "Extension Manager" of from the Microsoft Gallery. Full control over tool bar visibility (auto/manual) enables uncluttered or easy access modes.


Click to see full size image of Arduino programming in Microsoft Visual Studio 2010.

note: VS2019 tool window uissues? Switch off "Tools>Environment>General>Optimize rendering for screens with different pixel densities". tip: Intellisense and GoTo code definition can be improved without affecting the build by clicking "vMicro>Show Hidden Files".

The free Microsoft Visual Studio Community Edition IDE is fully supported. The Microsoft IDE is free for independant commercial and non-commercial developers, open source projects and students. Visual Micro is free for students (alongside daily nag screen) otherwise starts at $30. A 90 day evaluation of the software is allowed prior to purchase.

Common Build Error Note 1 - Currently Visual Micro applies weak logic to the auto generation of prototypes for functions directly inside .ino code. For example, functions defined inside negative #if conditions will be generated when the should not be. A workaround is to switch off "Prototype Generation" in the right click "Project Properties" tool window. Function prototypes can be added manually if/as required. This issue will be resolved shortly.

Common Build Error Note 2 - Some Arduino projects are designed to override the concept of using .ino code and instead use a .cpp file. The Marlin project is an example of this. For Visual Micro , the .cpp file name must be ProjectName.cpp where as in the Arduino IDE the file name will be ProjectName.ino.cpp. Visual Micro will shortly provide more flexibility and auto detection of the name of the "override" file. In the meantime please keep this in mind. 

File - New Project Wizard

The New project wizard in Visual Studio will include a selection of project types for Arduino. Allowing Arduino projects or libraries or shared code projects to created. Alternatively there is an Open Existing Sketch function that automatically creates a Visual Studio project and solution from existing code

Team capabilities of Visual Micro have been extended in recent versions along with better compatibility with the Arduino 3rd party hardware specificationUsing automatic intellisense path management alongside crosss-platform shared c++ projects, teams can build Arduino compatible programs without treading on other feet!

Arduino code created with Visual Micro can be shared with the windows, linux and mac Arduino community. Visual Micro adheres to the standards created by the various hardware manufacturers, such as arduino.cc. Put simply, this means that newly released hardware can be programmed in Visual Micro without need for a software update from Visual Micro. Visual Micro even uses the same configuration as the Arduino IDE!

Arduino compatible hardware from a wide range of manufacturers is supported. Arduino sketch/project code does not need to change to work in Visual Studio, it remains fully compatible with the Arduino IDE (whichever version you are using). All Arduino examples for installed hardware and libraries can be used without modification.

Easy To Use

New Arduino users are guided to work within the normal Arduino framework, in a similar manner to the Arduino IDE. Advanced Arduino users have a range of options that allow the simple (but restricting) Arduino rules to be broken. The following example demonstrates the IDE in it's simplest form.

Selecting a Board, adding Libraries and Cpp or Ino Code To An Arduino Project

The project tool bar for Arduino provides a simple way to new users to insert libraries, add code, build and upload. Advanced users can make use of the standard Visual Studio commands and keyboard short cuts to perform the same tasks.

The Boards List shows install Arduino Boards grouped by Platform. Boards are automatically added to the Recently Used Boards List.

 

GDB and Other Debugging

 The Debug Options Bar or Menu Provides One-Click Setting Of Debug and Opimization

The various debugging options are shown on the vMicro menu or the debug options tool bar as shown in this picture

Serial/Bluetooth/XBee/WiFi Debugging

Library debugging (new Nov 2018)

arduino-library-debugging_003.png

Visual Micro includes a unique usb/wifi debugger that allows code to be more easily visualized.

The Arduino debugger allows breakpoints and trace messages to be sent conditionally or at regular intervals.

 

Create Charts and Graphs Without Code Modification read more

Plot Multiple Charts

Plot Single Chart

 

Cross Platform Shared Code and Library Editing

Development teams can take advantage of Visual Studio Shared Cross-Platform Projects which allow cross-platform code to be created in smaller projects that are automatically combined with the program code during build. Alternatively teams might elect to develop Arduino libraries which also benefit from Visual Studio shared projects (see image below)

Shared projects and shared libraries can be located in any location which makes source control and version control very easy. Another benefit is that Visual Micro provides varying cross-platform intellisense and build/upload when editing shared code. This is useful because shared cross-platform code does not have a specific architecture, therefore would not normally have platform specific intellisense or build/upload capability.

 

Arduino Compatible Board and Library Manager

The plugin also supports all Arduino library formats, all third party Arduino compatible hardware and, for the more advanced user, all programmer combinations.

April 2015 now includes an automatic Board Downloader and Manager 

The Arduino Boards Manager provides a simple way to download and install the source code and tools for new hardware

and a Library Downloader and Manager

The Arduino Library Manager in Visual Studio provides a simple way to download and install new Arduino libraries. New versions of installed libraries will also appear in the Library Manager


Arduino Reference Help and Examples

Search Arduino IDE references and browse examples. Automatically discovers examples for newly instaleld libraries and hardware. Create a new project from an example.

Arduino IDE reference and help explorer. Open or copy Arduino examples with just a few mouse clicks

 

 

Please see the documentation for more information.  For help, assistance and new release notifications please join the forum

Intellisense Note: Intellisense and build/upload are two seperate functions of Visual Micro. You might see a few invalid intellisense errors (which you should report to the forum). After building a project with substantial code changes intellisense will become more accurate. However for some boards it is only 99% but can easily be extended....  Set the "Errors List" window to "Build Only" and/or "Open Documents Only" if false intellisense errors are annoying you, +report your code + board name to the forum thanks!

Tip: Slow compile times? are caused by some Virus Checkers. The two build folders that Visual Micro uses do not create files windows can run so you might consider them safe (your choice). The build folders can be seen when Verbose build is enabled (see vMicro menu), the folders are usually "c:\users\[name]\appdata\" (vmbuilds and vmbcore sub folders). These folders can be overriden in the options "tools>options>visual micro>compiler"

tip: Project library versioning:  Copy/use shared library projects. Shared library projects are bormal Arduino libraries that can exist in any location, giving control to each project over which library version will be used.