OpenSDA is a serial and debug adapter that is built into the entire Freedom board lineup, and can also be found on other embedded boards. It provides a bridge between your computer (or other USB host) and the embedded target processor, which can be used for debugging, flash programming, and serial communication, all over a simple USB cable. The OpenSDA hardware consists of a circuit featuring a Freescale Kinetis K20 microcontroller (MCU) with an integrated USB controller. On the software side, it implements a mass storage device bootloader which offers a quick and easy way to load OpenSDA applications such as flash programmers, run-control debug interfaces, serial to USB converters, and more.
Open-standard Serial Debug Adapter
- Supports SWD and JTAG debug protocols
- UART serial interface for virtual serial port
- Mass-storage bootloader used to load new applications into the OpenSDA
2. OpenSDA Hardware
OpenSDA is controlled by a Kinetis K20 MCU built on the ARM® Cortex™-M4 core. The Kinetis K20 includes an integrated USB controller and can operate at clock rates up to 50MHz. The OpenSDA circuit includes, at a minimum, a status LED and a pushbutton. The pushbutton asserts the Reset signal to the target processor (e.g. a microcontroller, digital signal controller, or a microprocessor) and can also be used to put OpenSDA into Bootloader mode. Signal connections are available for a UART serial channel. SPI and GPIO signals provide an interface to either a JTAG or an SWD debug port on a target processor. The OpenSDA circuit is powered when plugged into a USB Host. In some designs, the OpenSDA can also control the power supply of the target processor.
3. OpenSDA Software
OpenSDA software includes a flash-resident USB mass-storage device (MSD) bootloader and a collection of applications. The MSD Bootloader is consistent across all implementations of OpenSDA, but the available applications may vary from one hardware system to another. The following sections describe the MSD Bootloader and the applications which are generally supported by most Freescale evaluation hardware systems.
3.1. MSD Bootloader
The OpenSDA MSD Bootloader provides a simple interface for loading OpenSDA Applications. The Bootloader appears as a removable drive with a volume label of “BOOTLOADER” in the Host operating system. It runs when reset is held down as the USB cable is plugged in. An area of flash memory is reserved for one OpenSDA Application. Programming a new application is performed by copying an SDA file (s-record or raw binary file) to the BOOTLOADER drive, which implements a pseudo-FAT16 file system. Status information is provided through text files. The Bootloader can also be used to do a firmware upgrade on the bootloader itself.
- Flash resident bootloader
- Mass-storage USB device—no custom host drivers required
- Simple copy/paste or drag/drop interface for programming an Application binary file into the flash of the OpenSDA MCU.
- Bootloader runs if there is no Application installed or if forced by user (Reset button pressed during power on) or host-side software (method depending on Application implementation)
3.2. OpenSDA Applications
There are several different applications that can be run on the OpenSDA circuit.
3.2.1. Mass Storage Device Flash Programmer Application
The Mass-Storage Device (MSD) Flash Programmer offers a very easy and convenient flash programming utility for programming applications into the flash of the target processor. Like the MSD Bootloader, the MSD Flash Programming Application emulates a FAT16 file system and enumerates as a mass-storage device. It appears as a removable drive in the Host operating system with a volume label that matches the board name (e.g. FRDM-KL25Z). Raw binary and Motorola S-Record files that are copied to the drive are programmed directly into the target memory device. This is most often the flash of the target microcontroller, but it could also be another memory device such as a serial flash depending on the specific implementation.
The MSD Flash Programmer also provides a USB CDC device that bridges serial communications between the USB Host and a UART serial interface on the target processor. The drivers required to install this USB CDC device on a Windows operating system are embedded within the pseudo file system of the MSD Flash Programmer itself. Therefore, there are no drivers to install. If Windows fails to find the drivers on its own, simple point the OS to the newly installed removable drive and the drivers will be copied from there. Board and flash programming operation status are also available in text files on the removable drive. The same files that are accessible in the MSD Bootloader are also presented in the MSD Flash Programming Application.
Note: Starting in version 1.14, the MSD Flash Programmer and P&E Debug (see below) applications have been combined to provide flashing, debug, and serial in a single OpenSDA application.
- Closed source proprietary application
- Controls the serial and debug interfaces to the target MCU
- Mass-storage USB device providing a simple target MCU flash programmer and a virtual serial port (composite device)
- Simple interface for serial communications and reprogramming of the target MCU. Perfect for quick programming of example applications.
- Can be used to program off-board devices within the same product family as the on-board Target MCU
3.2.2. P&E Debug Application
The P&E Debug Application is a run-control debug interface that controls the JTAG or SWD debug interface to the target controller/processor. It also provides a virtual serial port bridging a USB CDC device to a UART serial interface on the target device. Thus, it provides debugging and a serial port all in one application. Host drivers for this application are provided with several IDE toolchains such as CodeWarrior for Microcontrollers, IAR Embedded Workbench, and Keil MDK. Drivers are also available for download from P&E Microcomputer Systems at http://www.pemicro.com/opensda.
Note: Starting in version 1.14, the MSD Flash Programmer (see above) and P&E Debug applications have been combined to provide flashing, debug, and serial in a single OpenSDA application.
- Controls the serial and debug interfaces to the target MCU
- P&E Multilink compatible debug interface with CDC virtual serial port (composite device)
- Transparently supported by the P&E’s UNIT library
- Supported by P&Es GDB Server
- Supported by P&Es NGS layer (used by IAR, Keil, Atollic, etc.)
- Traditional run-control debug interface that is supported by Freescale and Ecosystem Partner IDE tools.
3.2.3. CMSIS-DAP Debug Application
The CMSIS-DAP Debug Application provides a CMSIS-DAP debug interface used by many IDEs for debugging. The debugger running on the computer communicates with the CMSIS-DAP interface running on OpenSDA, which then controls the JTAG or SWD lines connected to the target microprocessor. CMSIS-DAP supports a standardized way to access the Debug Access Port (DAP) on ARM Cortex devices, and was created by ARM to reduce debugger implementation fragmentation.
- CMSIS (Cortex Microcontroller Software Interface Standard) enables consistent and simple software interfaces to the processor and the peripherals.
- The CMSIS layer provides different components such as :
- CMSIS-CORE: provides a consistent interface to Cortex-M processors
- CMSIS-DSP: suite of common signal processing functions for use on Cortex-M processors
- CMSIS-RTOS: standardized API for RTOS (Real-Time Operating Systems)
- Recently ARM introduced a new component in the CMSIS layer: CMSIS-DAP.
- It provides a standardized way to access the Debug Access Port (DAP) of a target. CMSIS-DAP is implemented on an Interface Chip. This Interface Chip is connected over USB to a debugger running on a host computer and over JTAG (Joint Test Action Group) or SWD (Serial Wire Debug) to the target device. JTAG and SWD are two common ways to debug a target.
Why the need for CMSIS-DAP ?
- There are several reasons concerning the introduction of CMSIS-DAP
- Before the CMSIS-DAP standard, a lot of USB wigglers was implementing their own protocol. With this configuration the host debugger has to be aware of all these different protocols and has to implement all of them. This introduced a lot of fragmentation. CMSIS-DAP provides a standardized interface for debuggers
- With the new CMSIS-DAP layer, the host debugger can debug targets over SWD or JTAG without the need to implement these two protocols
- The USB connection uses the HID driver class. As HID drivers are built-in in every Operating Systems, there is no need for a specific driver to be installed on the host computer
How CMSIS-DAP can be integrated ?
- As mentionned earlier, CMSIS-DAP has to be implemented on an Interface Chip.
- This chip does the link between the host computer (over USB for instance) and the target that has to be debugged (over SWD or JTAG).
Overview of the CMSIS-DAP standard
- Packets are exchanged between the host debugger and the Interface Chip. Basically, the host sends a command and the debug unit sends the response of the command.
- Different types of commands can be issued by the host
- General Commands: request information and control the debug unit. Also used to connect/disconnect the debug unit.
- Common SWD/JTAG commands: used for instance to set the clock speed
- SWD specific commands: configure the parameters for SWD mode
- JTAG specific commands: configure the JTAG device chain
- Transfer Commands: read/write CoreSight registers. These commands are independent of the transport (SWD or JTAG)
- CMSIS-DAP provides a standardized interface for debuggers. It will probably become the de-facto stantard which debuggers and debug units will implement.
- For instance IAR, Keil MDK-ARM, ARM DS-5, and Coocox CoIDE (which combine an IDE, debugger and simulation environment) already support CMSIS-DAP. It is also the basis of the debugger interface for mbed (see below).
If you need more information concerning the CMSIS-DAP Debug interface or just looking for a simple demo to start evaluate this feature of the Freescale Freedom Development Platform, please read this application note: Keil MTB (Micro Trace Buffer) with OpenSDA (CMSIS-DAP) using the Freedom KL25Z.
Source code can be found on the ARM CMSIS-DAP website (registration required) but pre-compiled binaries for loading onto OpenSDA are found in the Quick Start Packages for all the Freedom boards.
3.2.4. mbed Cloud Computing Application
The mbed Cloud Computing Application is the fastest way to evaluate and build some prototypes with the Freescale Freedom Development Platform.
The mbed platform provides free software libraries, hardware designs and online tools for professional rapid prototyping of products based on ARM microcontrollers.
The platform includes a standards-based C/C++ SDK, a microcontroller HDK and supported Freescale Freedom Development Boards, an online compiler and online developer collaboration tools. The mbed SDK rely on the CMSIS layer in order to have a common API across different processors.
The project is being developed by ARM, its Partners and the contributions of the global mbed Developer Community.
Here are some details of what you'll get for basing your next ARM microcontroller powered product on the mbed platform:
Software Development Kit (SDK)
- The mbed Software Development Kit (SDK) is an open source C/C++ microcontroller software platform relied upon by tens of thousands of developers to build projects fast. We've worried about creating and testing startup code, C runtime, libraries and peripheral APIs, so you can worry about coding the smarts of your next product.
- The SDK is licensed under the permissive Apache 2.0 licence, so you can use it in both commercial and personal projects with confidence.
- The mbed SDK has been designed to provide enough hardware abstraction to be intuitive and concise, yet powerful enough to build complex projects. It is built on the low-level ARM CMSIS APIs, allowing you to code down to the metal if needed. In addition to RTOS, USB and Networking libraries, a cookbook of hundreds of reusable peripheral and module libraries have been built on top of the SDK by the mbed Developer Community.
Free Online Development Tools
- The mbed Compiler is a powerful online IDE that is free for use with hardware implementing the mbed HDK, and tightly integrated with the mbed SDK and Developer Website. Under the hood, it relies on the industry standard ARM professional C/C++ compiler, pre-configured and tested to generate fast, efficient code without fuss.
- Login anywhere to get instant access to your development environment, on Windows, Mac, Linux. You can even work from tablets!
- Whilst the mbed Compiler provides you your own private workspace, it is also fully integrated with the mbed.org Developer Website so you can easily import libraries and examples. If you choose to, publishing your own code and collaborating with other mbed users is just a few clicks too. The mbed Compiler also supports full export to different toolchains, in case your project demands it as you go to production.
Hardware Development Kit (HDK)
- The mbed Hardware Development Kit (HDK) provides full microcontroller sub-system design files and firmware for building development boards and custom products that benefit from the native support of the mbed SDK and free mbed Online Compiler and mbed Developer Platform.
- The HDK specifies all support components and circuits including the mbed Onboard Interface design that provides simple USB drag-n-drop programming and CMSIS-DAP debug interface for the target microcontroller.
- Development boards that are already based on the HDK are the quickest way to get started with the mbed platform. We manufacture official mbed Microcontroller modules that are specifically optimised for flexible rapid prototyping, and are available from distributors worldwide. Our partners are now also creating mbed-enabled hardware such as ultra low-cost ARM evaluation boards in the popular Arduino form-factor.
Worldwide Developer Community
- Using mbed means a huge shared context with other developers, and that means when you have a question, there is less pre-amble, less explanation and less time reproducing issues, and more time getting answers. We're proud that this has helped us grow an active and friendly community of skilled developers that are collectively helping get prototypes made even faster.
- But where it really gets interesting is with code. Our developers are sharing thousands of open source repositories and building an extensive cookbook of recipes that you can reuse to build your products.
- We've also made contributing back is easy; you can publish a library to mbed.org with a few clicks in the IDE, and let others build on your hard work. In fact, this is how some of our users end up collaborating on hard problems, and even getting contract work.
If you need more information concerning the mbed platform or just looking for a simple demo to start evaluate this feature of the Freescale Freedom Development Platform, please read the mbed FRDM KL25Z Getting Started Guide.
OpenSDA is a very flexible hardware and software platform for debugging, flashing, and more. For more information on OpenSDA, get the latest OpenSDA firmware, and to download OpenSDA apps, see the OpenSDA website. For more information on the many inexpensive Freescale Freedom development boards available, or to find more information on Kinetis devices, visit the element14 Freescale Freedom information page.