Copyright 2017-2020 Moddable Tech, Inc.
Revised: December 4, 2020
Modern software development for microcontrollers
The Moddable SDK is a combination of development tools and runtime software to create applications for microcontrollers.
Microcontrollers are highly constrained devices compared to modern computers and mobile devices. A typical microcontroller used with the Moddable SDK has about 45 KB of free memory, 1 MB of Flash ROM, and runs at 80 MHz. The Moddable SDK uses many different techniques, both at build time and at run time, to work efficiently on these devices.
A significant part of building efficient software for microcontrollers occurs at build time. The Moddable SDK contains many tools and options for the build process. Take time to learn about these to get the best results.
The Moddable SDK implements network sockets and a variety of standard, secure networking protocols built on sockets including HTTP/HTTPS, WebSockets, MQTT, mDNS, DNS, SNTP, and telnet.
There is also Bluetooth Low Energy (BLE) protocol support for both BLE peripheral and central device development.
Two APIs for building modern user interfaces are available:
- Commodetto, a bitmap graphics library that provides a 2D graphics API. Commodetto includes the lightweight Poco rendering engine, a display list renderer able to efficiently render a single scanline at a time, saving considerable memory by eliminating the need for a frame buffer.
- Piu, a user interface framework built on top of Commodetto. Piu is an object-based framework that makes it easier to create complex, responsive layouts.
The Moddable SDK also includes command line tools for image format conversion, image compression, image rotation, font compression, localization, and more. The build system automatically makes use of these tools.
The Moddable SDK implements a variety of hardware protocols including digital (GPIO), analog, PWM, and I2C. A number of drivers for common off-the-shelf sensors and corresponding example apps are also available.
Source level debugger
Similar to other debuggers,
xsbug supports setting breakpoints, browsing source code, and inspection of the call stack and variables. The
xsbug debugger additionally provides real-time instrumentation to track memory usage and profile application and resource consumption.
See also: xsbug documentation
To do anything with the Moddable SDK, you have to install it on your computer. This involves downloading this repository, installing some development tools, configuring settings over the command line, and building the Moddable SDK tools.
The Getting Started Guide in the
documentationdirectory walks you through the whole process of installing the Moddable SDK.
With the Moddable SDK installed, you can build and run apps on hardware simulators.
To develop for a particular device, you need to install additional tools and SDKs for that device. The setup process for each device is different, but usually involves installing some additional SDKs, drivers, and development tools.
The SDKs and tools for a particular device are not created or maintained by Moddable, but we do provide detailed instructions to help you install them and get started developing for them with the Moddable SDK. The section below provides links to the setup instructions/developer guides for some of the devices we support.
The Moddable SDK includes simulators that run on macOS, Linux, and Windows. These are a great way to get started, and are invaluable as development accelerators.
To use the simulator, you simply need to install the Moddable SDK.
ESP8266 by Espressif
To use the Moddable SDK with ESP8266-based devices, you need to:
The Moddable SDK supports many devices built on ESP8266, including the devices shown below.
Node MCU ESP8266
ESP32 by Espressif
To use the Moddable SDK with ESP32-based devices, you need to:
The Moddable SDK supports many devices built on ESP32, including the devices shown below.
Node MCU ESP32
Gecko by Silicon Labs
To use the Moddable SDK with Gecko devices, you need to:
The following developer resources are also available:
- Silicon Labs Gecko support in Moddable SDK blog post
- Bluetooth Low Energy Support Now Available in Moddable SDK blog post
The Moddable SDK supports four Gecko boards, shown below.
Thunderboard Sense 2
QCA4020 by Qualcomm
To use the Moddable SDK with the QCA4020, you need to:
The following developer resources are also available:
- Qualcomm QCA4020 Now Supported by Moddable SDK blog post by Moddable
- QCA4020 Getting Started with the Moddable SDK blog post on the Qualcomm Developer Network
- QCA4020 Modern UI Application Development with the Moddable SDK blog post on the Qualcomm Developer Network
WebAssembly is supported in modern web browsers, both on computers and mobile devices. The Wasm support in the Moddable SDK is compatible with Safari, FireFox, and Chrome browsers.
To use the Moddable SDK with WebAssembly, you need to:
We have tested a variety of SPI displays with the ESP8266 and ESP32. Video demonstrations of these displays are on our website. Wiring guides are available in the documentation/displays directory. The source code for the corresponding display and touch drivers is available in the modules/drivers directory.
The Moddable SDK repository contains the following top level directories:
- build: Files required for specific microcontroller targets, the simulator, and make files for build tools in the
- contributed: Unofficial projects and modules that show useful techniques for working with the Moddable API.
- documentation: All the documentation for the Moddable SDK. Documentation is provided in markdown format.
- examples: Example applications for many of the capabilities of the Moddable SDK. The readme.md document provides a guide to building the examples and information to help you find the types of examples you are looking for.
- license: The license agreements for the software provided in the Moddable SDK. The Contributor License Agreements are here as well.
- tools: Tools to build applications using the Moddable SDK. These include command line tools for image format conversion, image compression, image rotation, font compression, processing localization strings, compiling resources, and building applications from JSON manifest files. In addition, xsbug, the XS source level debugger, is here.
See the readme document in that directory for an overview of the API documents.
In addition to the documentation and examples in this repository, we have several resources for developers.
|Our Gitter chatroom is a great place to ask questions and discuss the Moddable SDK with members of the Moddable team and other developers.|
|Detailed release notes for updates to the Moddable SDK are posted regularly on GitHub.|
|The Moddable SDK build tools have support TypeScript, so you can use build-time type checking in your embedded code. Details on the blog.|
The Moddable SDK is provided under a combination of licenses that includes GPL 3.0, LGPL 3.0, Apache 2.0, and Creative Commons Attribution 4.0 Licenses. The license directory contains additional information on the licenses used and licensing options. The licensing article on the Moddable web site describes additional background and a commercial licensing option.
We work to ensure that there are no security holes in the Moddable SDK. Still, it is nearly impossible to eliminate them all. Security researchers who identify potential security issues with our software are encouraged to open an open an issue. We will respond to these as quickly as we can. If you prefer, you may instead report security issues by email.
Questions? We're here to help
If you're an independent developer, we recommend you open an issue or join us in our Gitter chatroom. We'll respond as quickly as practical, and other developers can benefit from the answers to your questions.
To learn more about Moddable, see our website.
You can also reach out to us on Twitter (@moddabletech). Following us on Twitter is the best way to keep up with what we’re doing—we post announcements about new blog posts there, along with other Moddable news.
You can contact us directly by e-mail at firstname.lastname@example.org.