The Arduino ecosystem has continued to evolve as it finds its way into increasingly-sophisticated applications. This evolution is especially apparent in the development tools which Arduino and other vendors have recently introduced. In this article, we'll look at Arduino's latest development environment. We'll also look at how Atmel, Microchip, and other MCU makers have made their integrated development environments (IDEs) interoperable with the Arduino platform.
It's Not Your Dad's Arduino
Originally created as a basic tool for creating simple embedded computing projects, Arduino's Java-based IDE is lightweight, easy to use and designed to support any board/MCU combination which follows the platform's programming conventions. But the simplicity and flexibility came at a cost. While the IDE's simple user interface made writing and editing code a very straightforward task, it lacked the ability to set breakpoints, inspect register or memory contents, as well as most of the other debug capabilities you'd expect of a modern development suite.
The absence of debug features was due in large part to the fact that the Arduino boards themselves lacked the hardware required to take charge of the MCU for debug operations. This changed with the introduction of the Arduino M0, a 32-bit extension of the Arduino UNO platform, powered by an Atmel SAMD21 MCU. Atmel’s Embedded Debugger (EDBG) is integrated into the M0 Pro board, providing a full debug interface without any additional hardware. Data and programs are uploaded to the target system via a virtual COM port. A second channel, known as a Data Gateway Interface (DGI), streams system status and debug command data between the target MCU and a PC.
Atmel's EDBG functions can be accessed using Atmel's Studio 7 IDE (more about that shortly) or from within Arduino Studio, a newly-developed advanced IDE that can run either as a cloud-based tool, a PC-based development system, or even as an on-board embedded editor that runs directly on your target platform. Invoking Arduino Studio's Debug suite allows you set breakpoints which halt a sketch, inspect the MCU's registers and memory contents, and step through the code on a line-by-line basis (Fig.2). Arduino's Studio IDE also supports several other advanced features which include code completion and an in-line quick language reference guide.
3rd Party Tools Abound
Since Arduino has now become a de facto standard development platform, many silicon vendors, including Atmel, Infineon, Microchip and STMicro provide Arduino-based evaluation kits for many of their new products. Recently, this trend has taken a new turn as several MCU vendors have begun to include Arduino-friendly features within their own software development tools.
Since the Arduino was originally based on Atmel's AVR MCUs, it's not surprising that they've taken the lead in making Arduino users welcome within their development ecosystem. The latest edition of the Atmel Studio 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. Studio 7 is designed to work directly with the embedded debug chip featured on the Arduino Zero and M0 Pro, giving Makers the ability to set breakpoints, monitor memory and register values and configure the MCU's power modes.
Arduino users also have access to Studio 7's enhanced, context-sensitive help system which takes into account the specific device you’re working with. If, for example, you need more information on the nature of a particular register, then clicking that register in the Atmel Studio 7 IDE and then hitting F1 will take you into the specific datasheet page with the information you need.
Studio 7 brings several additional capabilities to developers, including data visualization and cycle-by-cycle power analysis. The Data Visualizer feature is a software-based logic analyzer, which allows you to monitor individual I/O and hardware events and correlate them to code executions or other events. It even has an Oscilloscope View mode which allows you to monitor application behavior, display data and interact with running applications. The Visualizer can also capture power consumption data while debugging, with real-time power graphs and a new feature which enables you to track power levels as a function of hardware or software states.
Microchip Technology's involvement with Arduino began when it collaborated with Digilent to produce Arduino compatible chipKIT boards based on the company's powerful PIC32MCUs (Fig.4). Microchip provides development support for the ChipKITs with its free MPLAB X Integrated Development Environment (IDE). The MPLAB X environment can directly import Arduino sketches and provides an easy way for chipKIT board owners to take their skills to the next level with capabilities like a Call Graph to assist in navigating complex code. Other advanced features include live parsing, live code templates and support for multiple configurations of a single project.
Arduino's popularity has also attracted the attention of several 3rd-party software tool vendors, including Visual Micro, which offers a complete Arduino development environment (with optional debugger/pro pack) which runs within Atmel's Studio 7's IDE. The Visual Micro's IDE shares the same look and feel of the Arduino environment. This allows Arduino developers to work within a familiar environment while having access to many of the Atmel Studio's powerful features.
Visual Micro offers its basic Arduino IDE for download at no charge and a Pro version which must be purchased. The Pro version includes many other features such as Board Manager, Library Manager, Library Downloader and a USB debugger. Visual Micro also includes an optional (not free) Arduino software debugger.
The debugger is unique and for the first time enables Arduino developers to monitor a running Arduino by simply clicking the code they want to monitor. In addition to being able to add break or trace points, the debugger can transparently inject special (known protocol) Arduino 'Serial' instructions during compilation without altering the developers' original source code. Visual Micro's debugger listens for the special debug Serial messages and populates the various debugger status windows to reflect what is happening on the Arduino. When required, for break points that pause and wait, the 'Serial' is also used by the Arduino to listen for the F5 Continue command.
Despite the fact that it's a software-only tool, the debugger supports many features found in hardware debug tools, such as conditional breakpoints, hit counters and update of variables without need to re-compile. There is also a few features not found in other debug tools such as timed break points and trace points (ie: every x milliseconds).
Originally conceived as a tool to enable non-engineers to access embedded computing technology, the Arduino platform is also finding wide acceptance among professional developers. The hardware and software tools we've explored in this article represent a sampling of the products which are emerging to bridge the gap between the Maker/DIY world and the world of the professional developer. As we've seen, this is a 2-way bridge which is putting new capabilities into the hands of the increasingly savvy Maker community.