Skip to content

Releases: Moddable-OpenSource/moddable

Moddable SDK 5.8.0

12 Jun 02:24
Compare
Choose a tag to compare

Moddable SDK 5.8.0 contains improvements made between May 12, 2025 and June 11, 2025.

Realtime AI

This release sees our Realtime AI support continuing to expand with Deepgram joining our ChatAudioIO architecture. Deepgram's Voice Agent API provides realtime conversational AI support with a focus on enterprise applications.

Deepgram is noteworthy for being the only Realtime AI API using WebSockets to support binary transfer of audio data. This uses 25% less network bandwidth than the Base64 encoding used by everyone else; and requires less memory and CPU power to serialize and parse. Put another way, Deepgram is the lightest realtime AI service, which makes it a great choice for microcontroller projects.

Deepgram joins OpenAI, Google Gemini, ElevenLabs, and Hume AI in our ChatAudioIO. Imagine a single API that lets you easily build interactive voice chatbots with any of five leading AI services and do that efficiently on a low-cost microcontroller. And we're not done yet. Moddable has exciting updates planned. Stay tuned.

ESP-IDF I²C downgrade

Last month, the Moddable SDK's I²C support for ESP32 migrated to Espressif's new i2c_master API. Unfortunately, we have too many reports of issues from this change, including random read and write failures, and crashes when I²C and the JTAG USB connection are used simultaneously. Consequently, we've reverted the changes in this release. We will monitor the Espressif releases for improvements and try to report the issues encountered to Espressif.

Release Details

  • Modules
    • ChatAudioIO - add support for Deepgram AI service
    • WebStorage – return null for missing elements to match HTML5
  • ECMA-419
    • Analog input on ESP32 again works for multiple inputs (reported by @mshioji)
    • httpclient passes response's status text to onHeaders
    • fetch and EventSource use status text provided by httpclient
    • EventSource handles id property and missing options to constructor
    • Revert I²C API migration on ESP32 from previous release
  • Devices
    • M5Atom S3R added (contributed by @kitazaki)
    • M5Atom Echo Base added (contributed by @kitazaki)
  • XS
    • RegExp.escape() now supported. This is part of ES2025.
    • Immutable ArrayBuffer conformance improvements with latest test262
    • Import more math functions from fdlibm (for hosts that cannot use the platform mathlib)
    • String.prototype.fromCharCode conformance fix on integer input
    • Fix obscure marshalling native stack overflow (found by Fuzzilli)
    • Fix await lookahead token for arrow function with expression body (found by oss-fuzz)
    • Check meter on several more Array functions to trigger timeouts (found by oss-fuzz)
  • Examples
    • mini-drag example reports incompatibility with ECMA-419 touch driver
  • Tools
    • New M5Atom S3 simulator for mcsim (contributed by @stc1988)
    • mcconfig path corrected on builds of ESP32 on Linux when USE_USB is 1 (device using TinyUSB for xsbug connection)
  • TypeScript
    • Add typings for Crypto Digest class (contributed by @stc1988)
    • Add optional second argument to Net.get() (contributed by @stc1988)

Contact Us

If you have questions or suggestions about anything here, please reach out:

Moddable SDK 5.7.0

13 May 04:50
Compare
Choose a tag to compare

Moddable SDK 5.7.0 contains improvements made between April 4, 2025 and May 12, 2025.

Realtime AI

Moddable continues to grow and enhance our AI support through our RealTime AI initiative. This month brings new integration of a new service, significant new features in our ConversationalAI application, and a simple new example to get you started adding AI agents to your embedded projects.

Eleven Labs integration

We updated our ChatAudioIO architecture with support for the latest ElevenLabs API, coincidentally named Conversational AI. The Moddable SDK has long supported streaming text-to-speech with ElevenLabs, and we find it has some of the most natural-sounding AI-generated speech out there. With our latest update, you can easily hear it for yourself and effortlessly compare it with the voice from other services. This support comes on the heels of our addition of HumeAI last month.

Choose AI service and voice in ConversationalAI application

Our amazing ConversationalAI application has been enhanced to allow the user to customize each AI agent by selecting an AI service to use (Hume, Google Gemini, OpenAI, or ElevenLabs) and the voice to use. This makes it incredibly easy to choose the service that works best for the agent and pair it with just the right voice. Your choices are saved in preferences, making them persistent across restarts.

To change the voice and service, tap the gear icon on any agent. The list of voices varies by service. For services that provide details about each voice, such as ElevenLabs, the UI shows them as tags, making it easy to find the kind of voice you are looking for.

User selecting AI service and voices in Conversational AI app

New example

Our conversationalAI example app wraps a beautiful, interactive user experience around our ChatAudioIO library. All that UI code makes it difficult to appreciate just how simple it is to add an interactive AI-powered voice chat to your project. To help with that, we have a new example that is about as small as possible. Here's the entire app – notice that most of it is event logging:

const chat = new ChatAudioIO({
	specifier: "humeAIEVI",
	voiceName: "Sunny",
	instructions: "You're a hostile fisherman with a salty sense of humor. You dislike people and care even less for fish.",
	onStateChanged(state) {
		trace(`State: ${ChatAudioIO.states[state]} ${this.error ?? ""}\n`);
	},
	onInputTranscript(text) {
		trace(`User: ${text}\n`);
	},
	onOutputTranscript(text) {
		trace(`Agent: ${text}\n`);
	},
});
chat.connect();

And it works with Hume, Google Gemini, OpenAI, and ElevenLabs.

ESP-IDF I²C upgrade

Espressif has been in the process of migrating to a new I²C API called i2c_master. The previous and new APIs cannot coexist in the same runtime, and the ESP Camera support uses the newer API. Consequently, we have migrated all I²C support to the new i2c_master API, including ECMA-419 I²C and the original pins I²C. The new API has some advantages, particularly when working with multiple devices simultaneously. However, it is not 100% functionally compatible. Of note, its support for stop bit handling and the read and write quick commands is limited. It appears this may be addressed in ESP-IDF v5.5.

We do not expect major issues in the transition; however some incompatibilities are possible given how widely used I²C is and how many variations there are. If you run into issues, please report them.

Node-RED MCU Edition

This release fixes a long-standing bug in the make system that prevented the Node-RED MCU Edition plugin from working with devices connected by native USB to macOS and Linux. This prevented many ESP32-S3 devices from working. This has been resolved.

In addition, fixes to the nRF52 build on Windows will soon allow nRF52-=powered devices to work with Node-RED MCU Edition on Windows as well!

TypeScript upgrade

We've updated our TypeScript support to default to ECMAScript 2024. That allows you to use more recent JavaScript language features, such as resizable ArrayBuffer, in your TypeScript projects. This should not have any compatibility issues, unless you had manually added type defintions for these functions to your project.

ESP-IDF v5.4

Moddable SDK 5.5 migrated ESP32 support to ESP-IDF v5.4 last month. If you develop for the ESP32 family, you'll need to update your ESP-IDF. Instructions are in last month's release notes.

Release Details

  • Contributed
    • conversationalAI
      • Select AI service in UI
      • Select agent voice in UI
  • Modules
    • ChatAudioIO
      • Add support for ElevenLabs service
      • Hume supports selecting voice by name
      • Rename humeAPIKey to humeAIKey for consistency #1481 (reported by @stc1988)
      • Fix sendText
      • sendFunctionResult now requires function name argument too
      • New CONNECTED state to know when service is fully ready to use
      • Gemini Live now supports live output transcription (but not yet input – waiting on Google)
      • Add array of state names at ChatAudioIO.states for debugging / logging
    • Timer
      • Remove obsolete modTimerGetID
      • Timer.clear() never throws, consistent with web platform's clearTimeout (useful for emulating web APIs)
    • Commodetto Outline
      • Handle stroke line weight as number or integer
      • Handle SVG z command
      • transform() method
    • Piu Outline – avoid unnecessary recalculation of outline bounds
    • Web Storage - new module provides WebStorage localStorage using ECMA-419 3rd Edition's embedded_storage/key-value
  • ECMA-419
    • UDP
      • Support multicast (experimental for 4th Edition) on macOS and lwip (ESP32)
      • Eliminates race condition that could stall incoming packets on lwip implementation
      • First argument to write is buffer, not remote address. (reported by @linfan68) #1487
    • HTTP Client now properly handles new request issued from onDone() callback
    • fetch() module supports PATCH method and works with EventSource
    • EventSource module supports body length of 0
    • HTTP Server now handles HTTP 101 response correctly by assuming respond body length of 0. This fixes WebSocket server support. (reported by @cmidgley) #1491
    • Audio In and Out allow repeated start() and stop()
  • Devices
    • ESP32
      • Add support for M5Atom Lite Echo Base, M5Atom S3 Echo Base (contributed by @kitazaki)
      • Add support for M5AtomS3R (contributed by @stc1988)
      • I²C now uses newer i2c_master_* APIs
      • Camera
        • Image controls framework (brightness, contrast, etc) for ESP32 and macOS (experimental for 4th Edition)
        • No longer deactivates I²C (not needed with i2c_master_* APIs)
      • ILI9341_P8 driver provides frameRate getter
      • More fixes for lack of GCC atomics on RISC-V targets
      • fxAbort logs error message on unhandled exception
    • nRF52
  • XS JavaScript Engine
    • New xsmcSetStringX() and xsSetStringX() to eliminate string copies
    • Fix RegExp with empty disfunction #1484 (reported by @gibson042)
    • Use C_* macros consistently
    • Include fx_iterator_from in snapshot table of native functions
    • Fix crash in mutabilites() with huge multibyte function names
    • JSX support now handles - in attribute name
  • TypeScript
    • Bumped to ES2024 (latest available) to get new features like resizable ArrayBuffer
    • Typings for ChatAudioIO
    • Rename embedded:audio typings to be consistent with standard
  • Examples
    • New simple ChatAudioIO app – great starting point for your projects
    • ECMA-419 httpserver example needs to use server.port for EventSource connection
  • Tools
    • cmake files for ESP32 build updated to quiet warnings about minimum version
    • More parallelism in ESP32 build on macOS & Linux
    • Set XSBUG_HOST and XSBUG_PORT on macOS & Linux when launching serial2xsbug on USB-native devices (e.g. ESP32-S3). Fixes Node-RED MCU Edition plugin integration for these devices. (reported by @mshioji)
    • Fix crash in clearTimer in xst (reported by @ChALkeR) #1490
    • Add TypeScript's dst directory to .gitignore list (contributed by @stc1988)
    • Workaround idf.py add_dependency now failing if dependency already exists
    • Add XSBUG_LOG_PORT to allow custom port on xsbug-log (contributed by @cmidgley) #1376

Contact Us

If you have questions or suggestions about anything here, please reach out:

Moddable SDK 5.6.0

04 Apr 21:33
Compare
Choose a tag to compare

Moddable SDK 5.6.0 contains improvements made between March 4, 2025 and April 3, 2025.

Realtime AI

Now with Hume

Hume AI's Empathic Voice Interface (EVI) is the latest addition to Moddable's new architecture for real-time AI launched last month. Hume's EVI joins Google Gemini and OpenAI in providing real-time voice interactions on resource-constrained embedded devices.

Hume's EVI is a bit different. It tries to understand how you are feeling and respond accordingly. It is also much less inhibited than other AI chat services, which makes it more fun to talk with. Give it a try!

Our realtime AI architecture provides a simple API for interactive voice services through a web worker. The API is the same for each AI service – even though Google Gemini, Hume, and OpenAI have dramatically different cloud APIs – so you can easily switch between services in your project.

If you are using Moddable Six, get our new Moddable Microphone for just $4.99 and you are ready to use our realtime AI architecture and Conversational AI app.

Faster than ever

The Conversational AI app inspired us to take a fresh look at optimizations to achieve even faster response times and smoother animations. This release includes many optimizations to our XS JavaScript engine, TLS stack, and network protocol implementations. These benefit all Moddable SDK projects that use these features, not just Conversational AI.

  • Less floating point. We've enhanced several key JavaScript operations to use integer math instead of double precision floating point math without breaking conformance with the language. Because floating point math is much more expensive than integer math on embedded devices, this speeds up common operations such as validating arguments to TypedArray build-ins.
  • TLS. We've optimized the native GCM multiply and moved two crypto utilities from JavaScript to C. The result is lower overhead TLS connections, which is key for our Conversational AI app, which continuously sends or receives audio over TLS.
  • Reduced copies. We've reduced data copying in the network stack to lower peak memory use and eliminate copying overhead.

Optimization tools for you

We always start our optimizations using our Performance Profiler built into our xsbug JavaScript debugger. Read about it in Deliver High-Performance Products with the XS Profiler and see a step-by-step example of boosting performance.

This release adds two new low-level tools that can be helpful for specific optimization.

  1. The floating point log feature in XS show you the location of every floating point operation triggered by your script. This lets you quickly review them to see if they can be eliminated.
  2. The new Poco display list log shows the display list contents for each frame rendered, and shows the overdraw count - the average number of times each pixel was drawn. Some overdrawing is normal, but too much will hurt performance.

These aren't tools you are likely to use every day, but they are invaluable in improving performance. We used both to improve this release!

ESP-IDF v5.4

Moddable SDK 5.5 migrated ESP32 support to ESP-IDF v5.4 last month. If you develop for the ESP32 family, you'll need to update your ESP-IDF. Instructions are in last month's release notes.

Note: We have confirmed that OneWire works correctly with Moddable SDK 5.6.0 using ESP-IDF v5.4.

Coming Attractions

  • More enhancements to Conversational AI
  • A new host dedicated to small embedded Linux devices. Check out the PR from @linfan68.

Release Details

  • Contributed - Conversational AI app
    • Integrate support for Hume's Empathic Voice Interface (EVI).
    • Add detailed readme about configuring, using the app, navigating the code, device compatibility, and using the simulator.
    • Improve rendering frame rates with drawing optimizations to minimize overdrawing
    • More conventional naming for AI service key environment variables (contributed by @stc1988) and comments to clarify SPEAKING and LISTENING
    • Use Math.idiv() in scroller to reduce floating point math overhead
  • Modules
    • chatAudioIO
      • Eliminate excess turns on Gemini worker
      • Reduce peak memory use and data copying when transmitting audio to service
      • Allow skipping initial data in Base64 value using return value of isBase64 to support clean audio playback for Hume, which prepends a WAVE file header to each audio buffer
      • Rename states for improved clarity (motivated by question from @stc1988)
    • Poco renderer
      • Optional display list logging
        • For log on overflows, set POCO_LOGOVERFLOW in "defines" section of manifest.json
        • To log all drawing, set POCO_LOG in "defines" section of manifest.json
      • Small rendering optimizations
      • Adjust display list length on 64-bit platforms to eliminate either overflowing on simulator or over-allocating on device
    • Piu user interface framework
      • Render monochrome bitmaps with mask
    • TLS – optimizations to reduce overhead
      • Native implementations of Bin.comp and Bin.xor functions
      • Optimized native implementation of ghash_mul
    • Web Workers
      • Option to specify stack size of each worker with nativeStack property of creation (motivated by question from @danfinlay)
    • OpenAIStreamer supports optional "instructions" argument (contributed by @stc1988)
  • ECMA-419
    • Audio Out – ESP32
      • Close audio native driver in non-PDM case
    • WebSocket client
      • Update #writable when sending deferred control packet to eliminate occasional failure caused by writing more than network buffer could hold
      • Use Math.irandom() to eliminate unnecessary floating point operations
    • G911 touch driver optimized to do fewer allocations when processing touch input to reduce load on garbage collector
    • Image In camera now uses normative module specifier from 3rd Edition #1479 (reported by @stc1988)
    • Serial – macOS
      • Fix another case of callbacks triggering after close
      • Write supports all Byte Buffers, not just ArrayBuffer
      • Closing from within onReadable callback cancels pending callbacks
  • Devices
    • Moddable Microphone now works with Moddable Two
    • macOS
      • Simulator no longer warns to enable "secure coding" on launch
      • Instrumentation in worker updates once a second
    • ESP32
      • RISC-V ESP32 targets now consistently handle misaligned memory access
      • All variations of the ESP32 silicon family now use the same main.c, to simplify maintenance
      • Device manifest includes preferences module manifest rather than duplicating its contents
  • XS JavaScript engine
    • TypedArray.prototype.set optimization when source and destination are the same kind of Typed Array
    • Optimize validation of arguments to built-in functions to eliminate unnecessary floating point conversions and operations
    • Option to log stack trace of each floating point operation (see mxFloatingPointOp in xsAll.h)
    • Instrumented builds log exception information to console (motivated by question from @linfan68)
    • Divide "stack overflow" abort code into xsNativeStackOverflowExit and xsJavaScriptStackOverflowExit to easily distinguish JavaScript and native stack overflows. This may require updating custom hosts. (motivated by question from @danfinlay)
    • Add function to convert abort code to string to ease adding abort codes in the future
    • Fix demarshall of a detached ArrayBuffer, last known marshalling issue found by fuzzer
  • Documentation
    • Add accessible description to Piu inheritance diagram to help AI crawlers (contributed by @danfinlay)
  • Tools
    • Option to specify size of native stack on main task in creation section of manifest.json
    • Correct example in Git section to "include" instead of "includes"
    • Update .gitignore to ignore node_modules and package-lock.json in all directories, not only xsbug-log
  • TypeScript
    • Add typings for embedded:io/audio/in and embedded:io/audio/out (contributed by @stc1988)

Contact Us

If you have questions or suggestions about anything here, please reach out:

Moddable SDK 5.5.0

06 Mar 00:53
Compare
Choose a tag to compare

Moddable SDK 5.5.0 contains improvements made between January 20, 2025 and March 4, 2025.

Realtime AI

You may have noticed that everyone seems to be either talking about or talking with AI. Moddable is joining the party.

The rapid rise of realtime AI service APIs has created the need for fundamental realtime AI communication services on embedded devices. The goal is to deliver an amazingly interactive experience for users and a streamlined experience for developers. Moddable delivers on both with a new lightweight, low-latency, and high-performance architecture built on industry-standard APIs. Getting this right is tough. It requires balancing network communication, parsing complex service messages efficiently, capturing and playing audio seamlessly, and meeting the demands of a highly interactive user interface. Moddable has implemented that using industry best practices to free developers to focus on what makes their project unique.

A New Architecture

Moddable SDK 5.5.0 introduces our Realtime AI architecture. It works with multiple realtime AI services, and we're launching with support for two of the biggest, OpenAI and Google Gemini. The architecture supports both services with the same JavaScript API. The implementation uses Web Workers to cleanly separate the AI services from the application and keep the UI responsive.

A New Application

To show what our new architecture is capable of, we've created Conversational AI, an application with eighteen voice assistants. The UI is slick and smooth, especially on our own Moddable Six with its high-speed display bus. Conversational AI runs on macOS, Linux, and Windows too, using our simulator, so you can start exploring even before your Moddable Six arrives!

Amazing Results

We're achieving realtime voice chats with latencies that are indistinguishable from desktop, even when combined with a mobile-style user interface. All of that is implemented in modern, standard JavaScript using standard embedded JavaScript APIs from ECMA-419 3rd Edition, running on extraordinarily low-cost hardware.

More to Come

And this is just the first step. We have big plans to enhance the architecture with new features and new services. You can expect cool new applications to show those off.

Microphone for Moddable Hardware

The best way to experience our beautiful new Conversational AI application is on Moddable Six, where the software is fine tuned to get the best performance from every hardware component. You'll need to add a microphone. To make that easy, Moddable just launched a plug-in microphone for just $4.99. This high quality PDM microphone from TDK plugs into Moddable Six and Moddable Display 6. It also works with Moddable Two.

ESP-IDF v5.4

We've migrated to ESP-IDF v5.4.0 from v5.3.1. The update should be transparent to all JavaScript code (and the vast majority of C code). The update is recommended for reliability and security, and to stay current with the latest from Espressif. Updating takes just a couple minutes.

  • If you used xs-dev to install the Moddable SDK, execute xs-dev update --device esp32
  • Otherwise, follow the update instructions for macOS and Linux, or Windows.

NOTE: OneWire support is broken in ESP-IDF v5.4.0, though it worked in ESP-IDF v5.3.*. Moddable has reported this issue to Espressif.

Release Details

  • Examples
    • Added Conversational AI
  • XS JavaScript engine
    • Marshall and demarshall (IPC mechanism used by workers)
      • Enhanced to keep garbage collector enabled when demarshalling. This significantly reduces IPC overhead by eliminating an explicit collection before demarshalling each message received
      • Hardened to safely report errors for unsupported data
      • Detects stack overflows
      • Supports sparse arrays
    • Long-standing warning in BigInt GCC optimization resolved
    • Eliminate unnecessary misaligned opcode retrieval from runloop on ESP32
    • decodeURI and decodeURIComponent detect invalid UTF-8 codepoints #1464 (reported by @ayuan0828)
  • Devices
    • ESP32
      • Divide esp32/m5atom_s3r into esp32/m5atom_s3r_cam and esp32/m5atom_s3r_m12. (Contributed by @stc1988) #1456
      • ESP32-C3 has only one I²C port (reported by @mshioji)
      • Task queue default timeout reduced to 20 ms (from 1000) to detect message queue blocking sooner (can override in manifest with MODDEF_TASK_QUEUEWAIT)
      • Fully initialize ledc_channel_config_t structure (ESP-IDF v5.4.0 compatibility)
      • CONFIG_FREERTOS_HZ no longer required to be 1000 (but 1000 is still recommended). Useful for compatibility with ESP-IDF default of 100 Hz ticks.
      • Web Workers using FreeRTOS task once again behave correctly on all ESP32 family devices
      • Web Workers given lower priority than main task, consistent with other platforms
      • Eliminate memory allocation for small IPC message payloads
  • Modules
    • Piu Port fixed so computed styles are not garbage collected while still in use
  • ECMA-419
    • Digital Bank class on ESP32 supports native onReadable callback
    • TLS socket
      • Reduce memory overhead in packet buffers
      • Reduce allocations in GCM module
      • Validate format when setting
    • ESP32 Camera Image In reliably matches requested image dimensions to available frame sizes
    • TCP socket on macOS no longer invokes pending callbacks after close()
    • HTTP server
      • Properly handles all cases of unknown server response length phoddie/node-red-mcu#129
      • read() works when passed no arguments
    • Audio In on ESP32
      • read on ESP32 returns undefined (instead of 0) when nothing available
      • Option to set PDM slot mask in manifest "defines"
    • Audio Out on ESP32 no longer blocks on write (buffer size calculation improvements)
    • Web Socket Client after connecting frees properties no longer needed to reduce memory
    • File storage modules (POSIX and littlefs) default export reworked to conform with ECMA-419 3rd Edition
    • ESP32 IO modules only preload themselves (previously some preloaded embedded:*)
    • Update module specifiers of new storage modules to match 419 3rd Edition
    • TCP, UDP, and Listener sockets on ESP32 check if network interface is available before invoking lwip (lwip calls abort() when no active network interface)
    • Serial on ESP32 removes interrupt handler on close #1462 (reported by @mauroForlimpopoli)
  • Tools
    • JSON modules supported in manifest preload section
    • xst supports fuzzing of marshall and demarshall
    • xsl
      • Reports details of non-frozen array elements correctly
      • Correct Atomics table when mxFloat16 is defined
    • compileDataView updated to latest with support for float16 (and much more)
    • mcconfig and mcrun can transform JSON files (resolves conflict between Node-RED MCU Edition and ES2025 JSON module support)
  • Testing
    • Add 419 Audio In unit tests
    • Add add Map, Set, and BigInt tests to worker IPC test
    • File storage tests updated to latest ECMA-419 3rd Edition specification
    • Consistently apply naming convention for test fixtures
  • TypeScript
    • Correct type declaration of Bytes in Bluetooth Utilities modules (contributed by @stc1988)

Contact Us

If you have questions or suggestions about anything here, please reach out:

Moddable SDK 5.4.1

31 Jan 00:02
Compare
Choose a tag to compare

Open Source drop, January 30, 2025

Moddable SDK 5.4.0

21 Jan 18:43
Compare
Choose a tag to compare

Moddable SDK 5.4.0 contains improvements made between December 3, 2024 and January 20, 2025. Our goal is to publish our release at the start of the month, but we missed that this month because there's so much in this one. (These notes also include following interim releases of the Moddable SDK: 5.3.1, 5.3.2, and 5.3.3.)

Latest JavaScript Standard (ES2025!) is on Embedded Devices Now

The annual update to the JavaScript language standard is on track to be published in June, but it is already fully implemented and ready for you to use on your embedded devices.

XS 16 is the latest major revision to the XS JavaScript engine. It fully supports the new features added to the language by the ES2025 standard with nearly 100% conformance, according to test262, the official JavaScript test suite.

Here's the rundown on the new ES2025 features available to developers using the latest Moddable SDK:

  • JSON Modules – Modules have always been imported as JavaScript code. The new import attributes feature opens the door to importing other kinds of modules. The first new kind of module is JSON. In the Moddable SDK, this means you can now include JSON files in the modules section of your project's manifest and access them using import. JSON modules work with preload, so they can be parsed during the build and stored in ROM, providing instant access at runtime that uses no RAM, no matter how large the JSON.
  • Float16 – Support has been added for half-precision floating-point values with the Float16Array TypedArray and getFloat16 and setFloat16 methods of DataView. The motivation for adding Float16 to the language is optimizing AI models, but the smaller data size is relevant to IoT too, especially sensor readings, which often have a limited range of values. By using less memory for the values, more data can be stored in device memory and that data can be transmitted more efficiently over BLE and the internet, saving time, bandwidth, and energy.
  • Iterator helpers – This suite of new methods brings powerful operations to JavaScript iterators, including map, filter, take, drop, flatMap, reduce, toArray, forEach, some, every, and find. The V8 team published a great introduction to these and MDN is already up-to-date.
  • Promise.try() – A new Promise helper function that brings a common developer coding pattern into the language. MDN explains it thoroughly.
  • Additional Set methods – A suite of methods has been added to the built-in Set object to perform operations across two sets. The new methods are: intersection, union, difference, symmetricDifference, isSubsetOf, isSupersetOf, isDisjointFrom. For an excellent, illustrated explanation of these new methods, see Set Composition Methods on MDN.
  • Regular Expressions – We don't use regular expressions often in embedded projects, but XS supports them so you can use them in your projects if you want. ES2025 adds two new features to regular expressions, both of which are explained extremely well by Axel Rauschmayer on his 2ality site: pattern modifiers and duplicate named capture groups.
  • Error.isError() – This new helper function isn't part of ES2025, but because it appears poised to be included in ES2026, we've included it in XS 16

We've tested these additions thoroughly with test262 to ensure conformance with the language specification and, therefore, interoperability with other JavaScript engines. We also test with testmc, the Moddable SDK's test suite to ensure compatibility with the many modules in the Moddable SDK. We have also run hundreds of hours (and still counting) of fuzz testing using Fuzzilli to ensure that the changes in XS 16 are memory safe and resilient.

ES2025 Impact on JavaScript Engine Code Size

All of these new language features would cause a significant increase in code size for any other JavaScript engine. XS is different. When building in the Moddable SDK, the build automatically removes many features of the language that it detects are unused. For example, only the new Set methods you use are included in your build; if you don't use Set at all, the entire Set object is excluded. The same is true for Float16 and Iterator Helpers. This strip feature is just one of the many ways that XS helps embedded JavaScript developers make optimal use of their resource-constrained hardware.

Improved ESP32 Debugging Connection

No tool is more important to software developers than their debugger. This release includes a complete reworking of communication for JavaScript debugging across the full ESP32 family of microcontrollers. The original implementation has evolved over the years to support more kinds of communication and more uses on more devices. The result was getting a little messy. That's been restructured, resulting in smaller, more readable, more consistent, and more maintainable code.

As a bonus, debugging over the USB JTAG connection (common on ESP32-S3 devices like Moddable Six) is now faster and more reliable. Check out the updated implementation with separate files for communication using UART, USB CDC over TinyUSB, and USB CDC over JTAG in the new esp32/lib/debugger directory.

These changes also ensure that the selected debugging communication channel is enabled for both debug and instrumentation builds and entirely disabled for release builds. This has always been the intent, but not all devices implemented it consistently.

ECMA-419 Networking for AI and Beyond

The Moddable SDK is migrating to industry standard ECMA-419 APIs everywhere we can. As part of that, we have been taking a hard look at the implementations of the ECMA-419 networking protocols, especially for use with AI cloud services. The recent flurry of "realtime" AI services that run over WebSockets uncovered a few issues, as have some TLS configuration changes by some services. Work on video streaming as part of our recent camera integration identified issues in the HTTP client and server. We've fixed all of these, as well as making improvements to eliminate buffer copies and make more optimal use of available bandwidth. Many thanks to the developers who have shared their findings – in particular, we've seen quite a few from Japan and Europe.

A little help? C compiler support for float16_t

ES2025 adds support for 16-bit floating point values based on IEEE 754 half-precision floating-point values. Unfortunately, support for float16_t is not yet universal in C compilers. This is especially true on embedded systems and Linux distributions, both of which have reasons to take their time in adopting compiler updates. To allow float16 support to work everywhere, the XS JavaScript engine can be configured at build time to use the C compiler's float16 support or to use a built-in implementation. Our preference is to use the C compiler's implementation, as it is likely better optimized for the target silicon. Because there are so many build configurations, it is impossible to test this completely. So, we ask: if you happen to run into a problem building with the latest Moddable SDK, please report it to us immediately, especially if it looks like it is related to float16 support. We want to get that resolved quickly so no one else runs into the same problem. Thanks!

On the Horizon: ESP-IDF v5.4

ESP-IDF v5.4 was released at the start of the New Year, Our initial testing shows that some changes will be required to migrate the Moddable SDK to v5.4. The current recommended ESP-IDF version remains v5.3.1. There is no plan to migrate to v5.3.2 now that v5.4 is available; however, preliminary testing of v5.3.2 did not identify any issues, so it is likely safe to use if it contains improvements your project requires.

What does Moddable think of JS0/JSSugar?

tl;dr: we really like it.

If you are the kind of person who needs to know the details, check out our "Language Evolution" blog post.

Release Details

  • XS JavaScript engine
    • XS 16 fully supports ES2025. See notes above for details.
    • Add Error.isError()
  • Devices
    • Pico
      • Uses gcc-arm-embedded
      • Pico now requires building the pioasm tool to build .pio files
      • Arducam hm01b0 camera supports 16-level (4-bit) grayscale capture
      • DigitalBank now uses the proper API to disable the IRQ
    • ESP32
      • ESP32 Camera
        • Supports 16-level grayscale capture
        • Configurable XCLK_FREQ and JPEG_QUALITY (contributed by @kitazaki...
Read more

Moddable SDK 5.3.3

21 Dec 00:38
Compare
Choose a tag to compare

Interim release:

  • Moddable Four bootloader => 8.2
    • adds a small delay after installation to prevent errors with macOS Sequoia
  • pico builds with the newer compilers
  • pico instructions to build pioasm
  • more

Moddable SDK 5.3.0

06 Dec 19:38
Compare
Choose a tag to compare

Moddable SDK 5.3 contains improvements made between November 13, 2024 and December 3, 2024.

Camera Support for Raspberry Pi Pico

Last month brought the new ECMA-419 Image Input API to the Moddable SDK with implementations for ESP32, macOS, Windows, and Linux. This month extends that support to Raspberry Pi Pico.

High Speed JPEG Decoder for ESP32

We've integrated an all-new high performance JPEG decoder from Espressif for use across the entire family of ESP32 microcontrollers. The new decoder is up to 600% faster, making real-time JPEG decoding practical. To decode a single JPEG frame:

import loadJPEG from "commodetto/loadJPEG";
let bitmap = loadJPEG(new Resource("image.jpg"));

Because the pixel buffer can be quite large, it is convenient to be able to free it immediately rather than waiting for the garbage collector. Bitmaps returned by loadJPEG have a close() method on their pixel buffer that can be invoked to free the pixel buffer immediately:

bitmap.buffer.close();

To use the new JPEG decoder, include $MODDABLE/modules/commodetto/jpeg/manifest.json in your project manifest.

Integrating Git Repositories

It has long been possible to include Git repositories in Moddable SDK project manifests. The build automatically clones the repository, eliminating the need to retrieve it manually. This feature now works for repositories that do not include a Moddable SDK manifest.json file, allowing it to be used in more situations, such as retrieving native driver code for use in JavaScript bindings.

Your project manifest.json can embed the manifest for the imported repository to select the files to build and directories to add to the include path. You can use a local path to a repository which is great when developing. For details see the https://github.com/Moddable-OpenSource/moddable/blob/public/documentation/tools/manifest.md#include-git and check out the Pico hm01b0 camera driver for a working example.

ESP-IDF v5.3.1

We've migrated to ESP-IDF v5.3.1 to from v5.3.0. The update should be transparent to JavaScript code. The update is recommended for reliability and security, and to generally keep up with the latest from Espressif. Updating just takes a couple minutes.

  • If you used xs-dev to install the Moddable SDK, execute xs-dev update --device esp32
  • Otherwise, follow the update instructions for macOS and Linux and Windows.

Just after wrapping up this Moddable SDK release, ESP-IDF v5.3.2 was released. The Moddable SDK hasn't been tested with that, so it is not a recommended update yet.

Coming Soon: ECMAScript 2025

Behind the scenes, we've been working to update our XS JavaScript engine to support the next revision of the JavaScript language, ECMAScript 2025 (ES2025). With the last meeting in 2024 of TC39, the JavaScript language committee, complete the features for ES2025 are finalized. Moddable expects to release ES2025 support for XS in January 2025. The release will also implement the Immutable ArrayBuffers proposal, now at Stage 2, that Moddable is co-championing.

Community News

  • Congratulations to Pocuter for the successful completion of their crowdfunding campaign on Kickstarter for their incredible new Spectra, a maker-friendly smartwatch. A watch this beautiful could only be powered by the Moddable SDK.
  • @ScreamZ has published a Wi-Fi Connection Manager implemented entirely in TypeScript. It provides a persistent Wi-Fi connection, reconnecting as needed.
  • @HipsterBrown has been very active with xs-dev, deploying significant code updates and addressing several issues reported by users
  • If you haven't yet read our  blog post about the "Language Evolution" proposal to improve user security by dividing JavaScript into two parts, check it out.

Release Details

  • Devices
    • Raspberry Pi Pico
    • ESP32
      • Fast JPEG decoder for ESP32 integrated. The implementation is the latest from Espressif via the ESP Component Registry. Performance is excellent – over 600% faster than picojoeg, which is optimized to minimize memory use rather than speed. It is mostly compatible with the Commodetto JPEG reader API.
      • ESP32 build asserts that CONFIG_FREERTOS_HZ is set to 1000 as required by Moddable SDK.
      • ESP-IDF now recommends v5.3.1
  • Ecma-419
    • WebSocket client
      • Payloads of length 127 now properly transmitted
      • Eliminate occasional "would block" exceptions when using WebSocket over TLS
  • Bluetooth
    • The manufacturerSpecific getter for received advertisements no longer returns data beyond the end of the field
  • Tools
    • Git repository import in mcconfig and mcrun have been enhanced to work with repositories that do not contain a Moddable SDK manifest.json. See Including Git Respositories documentation for details. This capability is used for the Pico camera (Ecma-419 image-in) support to import the native camera driver from its Git repository.
  • XS JavaScript engine
    • Overflows in Date parsing of integers sets date to NaN (improves conformance)
    • Object copy helper function checks meter when looping
  • Testing
    • Ecma-419 Update (OTA) unit tests added

Contact Us

If you have questions or suggestions about anything here, please reach out:

Moddable SDK 5.2.0

13 Nov 21:44
Compare
Choose a tag to compare

Moddable SDK 5.2 contains improvements made between October 12, 2024 and November 12, 2024.

Highlights of this release include:

  • Camera – all-new camera module with support for ESP32 and the simulator (macOS, Windows, and Linux)
  • Support for devices with cameras from M5 Stack, Lilygo, and Seeed Studio
  • New storage and flash modules - preview of features from forthcoming ECMA-419 3rd Edition. The storage module will replace the current Preferences module which is widely used in projects.

The JavaScript eco-system is abuzz with discussion about the "Language Evolution" proposal to increase the security and stability of JavaScript by dividing it into two parts. Moddable believes this is be good for the language and especially good for embedded JavaScript developers. Read our latest blog post for all the details.

We are very excited to bring camera support to the Moddable SDK. It is a natural fit with our focus on bringing a modern user experience to low-cost embedded products. As you would expect our camera integration is extremely lightweight, simple to use, and powerful. The camera input isn't limited to a rectangle on the screen. You can fully integrate the camera image into dynamic, animated user interfaces as our new "camera balls" example demonstrates. Read all about the new suite of camera examples and browse the source code here. The "camera balls" example works on macOS, Windows, and Linux with most cameras so you can try it out even before you have an ESP32 device with a camera.

The Moddable SDK now supports directly including ESP-IDF native components from the ESP Component Registry. This is how our new ESP32 camera support has been integrated. Check out our blog post Using the ESP Component Registry with the Moddable SDK to learn more.

Note: ESP-IDF v5.3.1 has been released. Our testing shows that it is compatible with Moddable SDK v5.2. The Moddable SDK will move to ESP-IDF v5.3.1 in the December 2024 release.

Release Details

  • ECMA-419
    • Camera module available for ESP32, macOS, Windows, and Linux.
      • Implementation of the new ImageIn class, derived from the IO class patter
      • Returns uncompressed RGB565LE, uncompressed YUV422, and compressed JPEG images
      • Supports new buffer/disposable format to give JavaScript code direct access to camera driver's internal buffers, reducing memory use and improving performance by eliminating data copies
      • ESP32 implementation based on the ESP32 Camera Driver module from ESP Component Registry
      • Suite of new camera examples available
    • Flash module available for ESP32 and macOS
      • macOS simulator uses memory mapped file as backing store. Available partitions defined in configuration section of manifest
    • Storage module available for ESP32 and macOS
      • ESP32 implementation uses ESP-IDF nvs API for backing store
      • macOS implementation use CFPreferences API for backing store
    • Audio
      • Add audioType to options object of AudioIn and AudioOut constructor and as a read-only property of instances. Currently the only value defined is "LPCM" for linear PCM audio.
      • AudioIn onReadable callback receives second parameter indicating the number of readable samples (first argument remains number of readable bytes)
      • AudioOut onWritable callback receives second parameter indicating the maximum number of writable samples (first argument remains the maximum number of writable bytes)
    • HTTP server
      • Server instance implements port property to allow use of ephemeral ports
      • If content-length not specified for response body and not chunked transfer encoding, the length is indeterminate. Previously incorrectly handled as length of 0 causing connection to drop prematurely.
      • Byte count passed to onWritable callback pins to bytes known to be remaining in response body
    • Network sockets
      • Listener and TCP sockets on Windows correctly sets non-blocking mode #1428
      • TCP socket on Linux and Windows
        • Calls onError when remote endpoint cleanly disconnects #1430
        • Correctly adjust reference count in close() to account for inflight callbacks. Eliminates orphaned socket. #1430
    • Analog input on ESP32 supports MCU-specific options to set attenuation and disable calibration. Details in new readme. Reported by @takkaO) #1431
    • SMBus writeBuffer() method handles views correctly
    • Add support for buffer/disposable format
    • Add minimal implementation of axp2101 driver using ECMA-419 I²C
  • Devices
    • M5 Stack CoreS3
      • Add camera support
      • Uses ECMA-419 drivers for touch, audio, power, and IMU. This eliminates conflicts with the I²C support in the new camera driver.
    • Add new ESP32-S3 devices, all with camera support. For more information see our ESP32 document
      • Lilygo T Camera Plus S3 - platform build target esp32/lilygo_t_camera_plus_s3
      • M5 Atom S3R M12 - platform build target esp32/m5atom_s3r
      • XIAO ESP32S3 Sense - platform build target esp32/xiao_esp32s3_sense
  • Modules
    • Commodetto
      • Bitmap
        • Implements set buffer - experimental and may be removed
        • Stores buffer reference in native code
        • Add YUV422 pixel format (YUYV byte order)
      • Pixel format Converter implements YUV422 to RGB565LE conversion
  • XS
    • TypedArrays implement PreventExtensions to fail on resizable buffer. This tracks a fix in ECMA-262.
    • Fixed Error.prototype.stack memory corruption when function named Symbol.asyncIterator is on the stack and function names are stripped (default on embedded builds) (reported by @cmidgley)
    • Implement Module constructor from Hardened JavaScript draft specification
      • Enabled in xst for testing, disabled by default otherwise. - Define mxModuleStuff=1 to enable
      • Constructor is assigned to the global variable ModuleStuff reflecting its experimental status
  • Testing
    • Add unit tests for ECMA-419 Flash.
    • ECMA-419 Audio out unit tests updated to test new type property
    • ECMA-419 storage tests updated for iterator and missing keys
    • Add remote disconnect test for ECMA-419 TCP socket #1430
  • TypeScript
    • Fix type definition of original AudioIn read() (contributed by @stc1988)
    • Correct Wi-Fi modes (contributed by @cmidgley)
  • Documentation
    • Improve syntax highlighting for code blocks and fix syntax errors in example code in documentation (contributed by @stc1988)
    • Correct licenses link (contributed by @SamuelMarks) #1432
  • Examples

Contact Us

If you have questions or suggestions about anything here, please reach out:

Moddable SDK 5.1.0

16 Oct 19:32
Compare
Choose a tag to compare

Moddable SDK 5.1 contains improvements made between September 14 and October 11, 2024

Highlights of this release include:

  • Raspberry Pi Pico - support for new RP2350 and version 2.0 of the Pico SDK
  • ECMA-419 Audio Input and Audio Output for upcoming 3rd edition
  • Improved error messages throughout XS for better JavaScript debugging

Moddable issued a press release about Moddable Six to share the news of our latest product with the world. Moddable Six is our most advanced display for Embedded JavaScript with unprecedented performance, quality, and ease-of-use. Read the news!

Raspberry Pi Pico developers need to update their pico-sdk, pico-examples, pico-extras and pico-playground repositories to version 2.0 (tag: sdk-2.0.0). That's easily done by reinstalling those repositories following the directions in our Getting Started with Raspberry Pi Pico document.

Work on the 3rd Edition of ECMA-419, the standard for Embedded JavaScript, is making rapid progress. We are adding Moddable's implementations of new modules to the Moddable SDK as they are ready. We are also providing unit tests and/or example apps. These should be considered experimental until ECMA-419 3rd Edition is officially standardized as changes may still be made. They are provided here for member of the committee and the community to try them out and provide feedback prior to standardization.

The Moddable SDK now supports directly including ESP-IDF native components from the ESP Component Registry. Check out our blog post Using the ESP Component Registry with the Moddable SDK to learn more.

Note: ESP-IDF v5.3.1 has been released. Our initial testing shows that it is compatible with Moddable SDK v5.1. We are not requiring an update to ESP-IDF v5.3.1 at this time, as it does not appear to contain any critical changes and there have been quite a few ESP-IDF updates lately.

Release Details

  • Devices
    • Raspberry Pi Pico
      • Updated to Pico SDK 2.0
      • Support for new RP2350 (ARM cores only)
      • New RP2350 device build targets
        • pico/pico_2 for Raspberry Pi Pico 2
        • pico/pico_plus_2 for Pimoroni Pico Plus 2
        • pico/sparkfun_rp2350 for Sparkfun Pro Micro RP2350
      • Use sparkfun-pico library for PSRAM on Sparkfun Pro Micro RP2350
      • test262 and testmc test tools now run on Pico builds
    • Moddable Six builds no longer reserves GPIO 17 for read/write in MIPI display driver (it is not connected to the MCU)
    • Update DEBUGGER_SPEED for M5Stack Core2 based on field experience (Contributed by @stc1988) #1359
  • Documentation
  • ECMA-419
    • Audio input implementations for ESP32, macOS, Linux, and Windows added (3rd edition)
    • Audio output implementations for ESP32, macOS, Linux, and Windows added (3rd edition)
    • Listener socket conformance improvements
    • lwip socket memory corruption fix when no callbacks
    • Listener socket instances provide port property (useful when bound to dynamic port)
    • Use string in place of obsolete string;asii and string;utf8 formats
  • Examples
    • Add wss (secure WebSocket) example for ECMA-419
    • Added Audio Input and Audio Output examples for ECMA-419 (3rd edition)
  • Modules
    • lwip socket implementation
      • Validate host data (fixes use-after-free) #1410
      • Don't call XS in C API from another thread (could happen on dispose)
  • Testing
    • Add $NETWORK.resolve() helper
    • ECMA-419 tests
      • Listener socket unit tests
      • No callback socket tests
      • Audio output tests (3rd Edition)
      • Storage (key-value pair) tests (3rd Edition)
  • Tools
    • New manifest dependency feature for ESP32
      • Supports specifying additional include paths
      • Doesn't emit empty dependencies #1408
    • Update ADPCM-XQ audio compressor to version 0.5 (faster, higher quality)
    • ESP-IDF instrumented builds use CONFIG_ESP_CONSOLE_UART_BAUDRATE for the serial baud rate (contributed by @cmidgley)
  • Typings
    • Add 419 Listener port
    • Add typings union for Socket (contributed by @cmidgley)
    • More complete Worker typings - including full constructor options object
    • HTTP Headers object uses string primitive for map (Contributed by @magenetaan)
  • XS
    • Overhaul of error messages
      • Replaces "is no" with "is not a"
      • Moves name of function where error occurs to the end (in function)
      • Provides full path of function where error occurs when possible
      • Rephrased some error messages to eliminate ambiguities
      • Eliminate some redundancies
    • Fixes
      • Array.from() crash (found by Fuzzilli)
      • TypedArray [[Set]] with receiver. (Reported by @gibson042)
      • Array join() and toLocaleString() methods check meter to eliminate timeout (found by oss-fuzz)

Contact Us

If you have questions or suggestions about anything here, please reach out: