2
votes

Atmel stated in their website:

Atmel Studio 7 features seamless one-click import of projects created in the Arduino development environment. Your sketch, including any libraries it references, will be imported into Studio 7 as a C++ project. Once imported, you can leverage the full capabilities of Studio 7 to fine-tune and debug your design. Atmel Studio 7 fully supports the powerful embedded debugger on the Arduino Zero board. For other Arduino boards, shield-adapters that expose debug connectors are available, or switch to one of the many available Xplained-Mini/PRO boards to fully leverage the Atmel HW eco-system. Regardless of what you choose, you will surely make something amazing.

I wonder how it works? Is it just a plug-in (visual-micro) meaning that we still have to install Arduino software? Or do they have their own compiler and debugger?

2
Atmel Studio is based on the VS isolated shell, which means yes, they have their own compiler, debugger, intellisense, etc.Cameron
You don't need to install Arduino to use the Visual Micro plugin. It's optional.Visual Micro

2 Answers

1
votes

Arduino code is just plain C++ code (including some C++ libraries).

The difference is that in the Arduino IDE, you don't see all the code. For example, main() is hidden and compiled behind the scenes.

In an Arduino sketch, only setup() and loop() are visible, but those are called from the hidden main() (which calls loop() repeatedly).

So, it should be no problem for the Atmel C++ compiler to compile a sketch created in the Arduino IDE since it's a full C++ project already.

1
votes

To complete Danny_ds answer :

The "standard" Atmel compiler for Arduino (and 8-bit AVR) is nowaday avr-gcc, GCC standing for GNU Compiler Collection (so, a free software tool).

It is the toolchain used by Arduino IDE, as well as Atmel Studio. Note that Atmel Studio is configurable, it can use another toolchains/compilers (someone told me that it exist at least 8 AVR compilers).

To understand how importing an Arduino sketche in Atmel Studio is possible, better to understand what an arduino is :

  • A "breadboard" powered by an Atmega328 chip
  • A library (API imported when #include <Arduino.h> formerly Program.h IIRC)
  • An IDE, that do all the editor and "makefile" job

Let's pop the stack :

First, you can wipe out the Arduino IDE by using your own editor and makefiles. See Arduino Makefile on github for easy switching to this. Doing this, you may have to add the Arduino.h inclusion in your sketche. But you have full control of the source tree processing. That was my motivation, when quit Arduino IDE early, because by that time it was impossible to use 2 libraries in the same sketche, what Arduino-Makefile allowed.

Secondly, if you don't plan to use the Serial class (driving the UART/USB interface for console text communication with the Duino), it comes a temptation to remove the dependencies... I made the try, and i come to the conclusion that rewriting functions like setMode(), digitalRead() and write, etc... is just THE obvious : just open the PDF datasheet side by side with your code and set the bits accordingly.

ADC convertion, timer/counter management, eeprom read/write and even UART connexion driving, are all more tricky, as they imply to drive AVR I/O registers directly, and understanding the subsystem you're interacting with... But not impossible !!

Further, it is more than likely that (free) libraries are available, other than Arduino, to drive those jobs.

After this step, your source tree can be imported AS IT IS in Studio, and (assuming your compiler is still set on GCC, and Atmel Studio knows about your dependencies), it will compile seamlessly.

So Atmel Studio has just to import the Arduino Library in the project (and maybe adding some header inclusion as we have to do by hand) to compile it as a native project.

NOTE that inserting some existing files and particularily whole existing directories is a pain-in-the-ass with Studio.