Releases: Moddable-OpenSource/moddable
Moddable SDK 3.6.0
This release contains changes to the Moddable SDK made between December 1, 2022 and January 2, 2023
Highlights of this release include:
- Git repositories may now be included directly in project manifests – no more manually cloning repositories
- View debug traces in your development terminal instead of xsbug – great for headless development
- New development boards – M5Atom S3 and Adafruit ESP32-S3 TFT Feather
- New sensors – APDS9301 (ambient light), VL6180 (proximity and ambient light), HC-SR04 (proximity)
- ECMA-419 TLS client
- Server Sent Events support using standard Web
EventSource
API
If you have questions or suggestions about anything here, drop by our Gitter to chat, start a new Discussion on our GitHub repository, or contact us on Twitter at @moddabletech.
Preview of New Tool to Manage Moddable SDK Set-up
We've been working with the xs-dev project to make it easier to install and update the Moddable SDK. xs-dev automates the install and update of the Moddable SDK and embedded toolchains, so you don't have to follow the instructions yourself. It saves a lot of time and eliminates potential mistakes.
We hope to soon recommend xs-dev as the best way to manage your Moddable SDK set-up. Before we do that, we'd like some more developers to give it a try. We're interested in hearing about what worked, what could be easier to understand, and anything that went wrong. If you have a few minutes, take a look and give it a try. We're particularly interested in set-up on machines that have never had the Moddable SDK installed before. Thank you!
- ECMA-419
- New APDS9301 Ambient Light sensor driver and examples for use with interrupt and polling.
- New VL6180 time-of-flight Proximity and Ambient Light sensor driver and example. (Requested by @mshioji who provided initial testing and debugging help. Thank you.)
- New HC-SR04 ultrasonic Proximity sensor driver and example
- TLS client socket implementation
- HTTPS client socket implementation (combines TLS and HTTP clients)
fetch
API implementation supports HTTPS- Experimental new Pulse Width input I/O class. Implemented on ESP32 for use by HC-SR04 ultrasonic range sensor
- Implementation of Web EventSource API to receive Server Sent Events using ECMA-419 HTTP & HTTPS
- FT6206 constructor uses
sensor
instead ofi2c
to match all other sensors
- Tools
- Project manifests may now include remote Git repositories. The repository is automatically cloned by
mcconfig
andmcrun
when building. Details and examples in the Manifest documentation. - Option to redirect debug console output to the terminal rather than to xsbug. See documentation on
-l
option for set-up instructions. Supported on builds for simulator and ESP32 builds on all platforms. - ESP8266 build on Windows build supports
-x
option (@ralphwetzel) - First run of xsbug on Linux doesn't throw on missing preferences file #981 (reported by @tve)
- Don't filter in xsbug's "find lost file" dialog on Linux #988 (reported by @tve)
- Output more version information on ESP32 build for diagnostics (#996)
- Linux build sets the shell to
/bin/dash
to avoid issues with echo newline interpretation in other shells #979 (reported by @tve) - Check for ESP-IDF install by looking for
idf.py
instead of an environment variable (more reliable). (Reported by @ralphwetzel)
- Project manifests may now include remote Git repositories. The repository is automatically cloned by
- Devices
- Support for Adafruit ESP32-S3 TFT Feather
- Support for M5Atom S3 with new atoms3-imu example (contributed by @kitazaki)
- ESP32 port updated to use latest ESP-IDF defines for watchdog
- Modules
AudioOut
andMixer
classes provide properties to getsamplerate
,streams
,bitPerSample
andnumChannels
AudioOut
on ESP32 clears output on stop to avoid glitch on restart- Optimize BLE client GATT dispatch and look-up; reduce GC impact
- Fix OneWire build on ESP32-C3 (#996)
- Correct st127x driver name to sx127x #990 (reported by @tve)
- Allow version 13 in sx127x driver #990 (reported by @tve)
- XS
- Fixes for issues found with fuzzing (thank you @Agoric)
- xst optimizations to improve fuzzing performance
- Simplify memory management
JSON.parse
andJSON.stringify
for easier clean-up on exception
- Examples
- Audio Streaming example now streams SBC compressed audio in addition to WAVE
- New audio playback example from resource, using Audio Streaming API. (contributed by @meganetaaan)
- CLI example updates for ESP32
- Dueling light sensors example, to compare readings from two different light sensors
- Documentation
- Add list of supported ESP32-S3 development boards (contributed by @stc1988)
- Table of all sensors and drivers, with links to data sheets. (contributed by @Sineos)
- Correct errors in tools examples #997 (reported by @nickthiru)
- Update URLs for tools download to use GitHub links to support xs-dev
Moddable SDK 3.5.0
This release is version 3.5.0 of the Moddable SDK. It contains changes to the Moddable SDK made between November 1, 2022 and December 1, 2022
Highlights of this release include:
- All new JavasScript profiler to quickly identify performance bottlenecks in scripts
- Early support for ESP32 family boards with only USB ports including Adafruit QT Py ESP32-S3
- Asynchronous I²C using ECMA-419 IO for ESP32
- Improvements to tools for more reliable builds and updates
- New streaming audio modules with example
- Support for M5Atom U and M5StickC PLUS
This month we are particularly interested in hearing about your experience using our new JavaScript profiler in xsbug. If you have questions or suggestions about anything here start a new Discussion on our GitHub repository, drop by our Gitter to chat, or contact us on Twitter at @moddabletech.
About Version Numbers
The Moddable SDK has never had a version number before this release. Instead, each release has had a git tag based on the date (OS221101
). We are switching to a Semantic Versioning style version to make it easier for developers to track Moddable SDK updates.
In switching from date-based tags to version numbers, we had to choose an initial version number. The choice is somewhat arbitrary. The Moddable SDK has been used in large-scale commercial deployments for many years, so the version number should be at least 1.0 to reflect that it is production-ready. The team decided 3.5.0 was a good place to start.
Our XS JavaScript engine has always had a version number (currently 13.2.0) which uses Semantic Versioning style. This version number is embedded in byte-code binaries, for example, to ensure the byte-code is only executed with a compatible version of the XS engine. XS will continue to have its own version number. Other parts of the Moddable SDK may have their own version numbers moving forward.
This release also adds a version number to the suite of Moddable SDK tools. This version number is now used by the Moddable SDK build system to detect when the binary tools build is out of sync with the Moddable SDK sources. if a version mismatch is detected when building a Moddable SDK project with mcconfig
or mcrun
, the binary tools are automatically rebuilt and any intermediate build results are removed.
Our goal in this work on version numbers is to improve the developer experience. We welcome your feedback on the changes and suggestions for further improvements.
Release Details
- XS
- New sampling profiler for JavaScript
- Identifies functions using the most time
- Integrated into xsbug
- Results displayed in realtime
- Always available - no special build option needed
- Supported in simulators and ESP8266, ESP32, and Pico device builds
- Documentation explains how to interpret results
- Fixes for issues found with fuzz testing
- Several issues found by Fuzzilli in testing by @Agoric. For the curious, here's a small script that crashed prior to this release.
const v5 = "".matchAll(); const v6 = v5.next(); v6[0] = true; new Int16Array(v5);
- Out-of-bounds stack write in the
RegExp
parser found by Google's oss-fuzz
- Names for more functions shown in xsbug stack traces and profiles
- Anonymous functions are numbered so they can be distinguished
- Simulators now extract native function names for more functions
- New
xsIsCallable
andxsmcIsCallable
APIs so C code can easily determine if an object may be called as a function - Removed
FinializationRegister.prototype.cleanupSome
. XS implemented it before it was removed from the final language standard
- New sampling profiler for JavaScript
- Tools
- xst
- Profiling support
- Option to parse input file as JSON for testing (useful for fuzzing)
- Smaller initial VM allocation when fuzzing to reduce ASAN overhead
- Screen test, the original simulator in the Moddable SDK, has been completely removed. All projects should now be using mcsim.
- Tools now detect mismatch between binary and sources and automatically rebuild when needed
- ESP32 builds in environments that have not sourced
$IDF_PATH/exports.sh
now automatically source it - ESP32 builds now report any mismatch between current and recommended ESP-IDF version
- ESP8266 builds now report error if expected tools not found
- Pico builds now report error if expected tools not found
- xst
- Devices
- Experimental support for developing with ESP32 family boards that have only USB ports, including Adafruit QT Py ESP32-S3. See the discussion thread to learn how to try this out.
- Added support for M5Atom U devices (contributed by @stc1988)
- M5StickC PLUS - additional examples, mod support, and documentation (contributed by @stc1988)
- ESP-IDF 4.4.3 now recommended for ESP32 builds
- Accessing LED on Pico W target no longer crashes when Wi-Fi is uninitialized (reported by @rei-vilo)
- Neopixel on ESP32
- Warning of deprecated API fixed
- Creates pixels as data buffer (following best practices)
- Modules
- Timers on Windows
- Fix for code that reschedules time in their own script callbacks #955 (reported by @brenocastrocardoso)
- Now implemented using multimedia timers, allowing for millisecond precision to better match other platforms. This limits the number of simultaneously active timers in the Windows simulator to 15, which should be enough for most projects.
- CRC module now correctly handles calculations split across multiple buffers #956 (reported by @ralphwetzel)
- Fetch module now uses standard URL module
- ECMA-419 sensor drivers all updated to use standard SMBus function names
- Piu scroller option to center target when revealing hidden content
WavReader
class fromwav2maud
tool now available as standalone module for projects that need to parse WAVE file headers.- AudioOut
- Fixes for Windows
- Supports a separate callback function for each stream (instead of a single callback function used for all streams)
- SNTP client recognizes and handles version 3 NTP packets (there are still public servers in use returning version 3 packets)
- Neopixel
getPixel
API
- Timers on Windows
- ECMA-419, ECMAScript® Embedded Systems API Standard
- HTTP Server implements routes consistent with latest TC53 consensus. Routes are a lightweight plug-in mechanism for the server
- WebSocket server extension
- Server Sent Events server extension
- Web Page server extension
- Asynchronous I²C and SMBus implementations for ESP32. Implements full draft spec, entirely non-blocking using a dedicated FreeRTOS task.
- Implementation of FT6206 touch driver using asynchronous SMBus. Experiment to apply asynchronous I²C in Sensor Class Pattern.
- Some SMBus function names were based on an early draft of ECMA-419 1st Edition and were changed in the final draft. These have been corrected. Compatibility shims are in place temporarily to ease the transition.
- Separate manifest for DNS resolver to allow it to be easily included by other manifests
- HTTP client
read
function supports passing in existing buffer to read into (in addition to a number specifying the requested bytes to read)- Fix for exception if callback closed instance
- WebSocket client
- Sends optional HTTP request headers
- Correctly handles receiving 0 length messages
- HTTP Server implements routes consistent with latest TC53 consensus. Routes are a lightweight plug-in mechanism for the server
- Examples
- New audio streaming example
- Streams over HTTP using ECMA-419 HTTP client
- Low memory and CPU overhead
- Recover from network stalls
- WAVE file streaming using
WavStreamer
module - SBC compressed streaming using
SBCStreamer
module - Mix with other audio sources
- See documentation for details
- Piu Wi-Fi config example no longer throws exception #967 (reported by @rei-vilo)
- New audio streaming example
- Documentation
- Added ESP32-S3 and ESP32-C3 to ESP32 document.
- Secure Socket (TLS) documentation updated with
clientKey
&clientCertificates
, fix toapplicationLayerProtocolNegotiation
, new section on secure MQTT connections, and note on PEM/DER conversions. Inspired by discussion thread started by @nickthiru about using AWS with the Moddable SDK - Audio output documentation updated with recently added features (suggested by @meganetaaan)
- TypeScript Typings
- Improvements to typings, mostly Commodetto. Eliminates all warnings about Moddable typings from Visual Studio. (contributed by @Templarian...
November 1, 2022
This release contains changes to the Moddable SDK made between October 1, 2022 and November 1, 2022
Highlights of this release include:
- Support for seven more Raspberry Pi Pico dev boards
- ECMA-419 I/O for Raspberry Pi Pico
- Enhanced support for ESP32-C3 and ESP32-S3
- Faster builds
If you have questions or suggestions about anything here, drop by our Gitter to chat, start a new Discussion on our GitHub repository, or contact us on Twitter at @moddabletech.
- Devices
- Raspberry Pi Pico
- Build targets for seven more Pico development boards
- Adafruit ItsyBitsy RP2040
- Adafruit QT Py
- LILYGO T-Display RP240
- Pimoroni PicoSystem
- Pimoroni Tiny 2040
- Seeed Studio XIAO RP2040
- Sparkfun Pro Micro RP2040
- Neopixel support
- Raspberry Pi Pico W LED (resides on Wi-Fi controller) available as Digital pin 32
- Build targets for seven more Pico development boards
- ESP32
- M5StickC Plus device support added (contributed by @kitazaki)
- AI Thinker ESP32 C3-32S-Kit build target – supports 2 MB flash and LEDs
- SPI support for ESP32-C3
- ESP32S3 runs at 240 MHz now by default
- New
resetReason
module to retrieve the value ofesp_reset_reason()
- Raspberry Pi Pico
- Ecma-419
- Modules
- Audio Output
- Fixes for buffer validation
- Mixer option to output to existing buffer
- Guard against invalid host data
- Networking
- TLS (SecureSocket) now queries the native socket to determine space available to write. Avoids write failures due to overflow and under-utilization of available space
- HTTP client supports URL and HTTP headers of arbitrary length
- Wi-Fi accepts WPA PSK on both ESP32 & ESP8266. #870 (Suggested by @MKGaru)
- Outline rendering of arcs with
CanvasPath
no-longer overflow buffer - XPT2046 touch driver supports flipping X & Y axis
- Audio Output
- XS JavaScript engine
- Fixes for stability issues found by fuzz testing
- Yes...
- ...this was an unusually quiet month for XS
- We're hard at work on a very cool new feature that will debut later this month
- Stay tuned!
- Tools
- Faster ESP32 builds on macOS by running tools in parallel
- Faster macOS tools builds by runnings tools in parallel
- Instrumentation in xsbug now shows "turns" for ESP32 and ESP8266, the number of times per second the event loop runs
- TypeScript
- Type definitions added for
deepEqual
andstructuredClone
(contributed by @meganetaaan)
- Type definitions added for
- Documentation
- Added new Raspberry Pi Pico devices
- Tests
- Piu Sound tests added
- audioOut tests fixed to eliminate out-of-memory errors
- HTTP large headers test added
- BLE client tests for scanning and whitelist
October 1, 2022
This release contains changes to the Moddable SDK made between September 1, 2022 and October 1, 2022
Highlights of this release include:
- Raspberry Pi Pico W support!
- HTML standard
URL
module - XS virtual machines on ESP32 can now be over twice as large
- Preloading of regular expressions
- New tests for BLE server and audio output
Note: The original simulator in the Moddable SDK,
screentest
, will be removed from the Moddable SDK in October. The default simulator has beenmcsim
for several months. If you haven't already transitioned tomcsim
, now is the time.
If you have questions or suggestions about anything here, drop by our Gitter to chat about it, start a new Discussion on our GitHub repository, or contact us on Twitter at @moddabletech.
- XS
- Regular Expressions can now be preloaded! This allows regular expressions to be used in more projects by reducing their RAM footprint and moving their initialization from runtime to build-time. Read more about the tiny, but full-featured, regular expression engine in XS, in our blog.
- The XS memory allocator for microcontrollers has been enhanced to support discontiguous allocations. This allows a single virtual machine on ESP32 to allocate unlimited internal ESP32 memory, increasing the maximum VM size to nearly 300 KB from about 128 KB for devices with no PSRAM. Details are in the manifest documentation.
- Fix mistake in operation order in
WeakRef.prototype.deref
- Fixes to snapshot generation to eliminate divergences
- Fixes for several obscure crashes found with Fuzzilli fuzz testing
- Ecma-419
- Initial support for ESP32-C3: Digital, DigitalBank, I²C, SMBus, Serial
- Initial support for Raspberry Pi Pico and Raspberry Pi Pico W – Digital, DigitalBank
- TCP Socket Listener for Linux
- UDP socket for lwip doesn't require
onReadable
callback - UDP socket on macOS and Linux implement
port
property - HTTP server updated to allow
detach
to be called fromonDone
callback to support WebSocket server exploration WebSocketClient
andWebSocket
constructors support attaching to existing socket- Sensor driver for MPU6886 IMU
- Modules
- MCU-optimized implementation of HTML standard
URL
class together with tests. The implementation fully conforms to the standard with two exceptions: Punycode and - IDNA support are unimplemented. These are used primarily for the display and safe handling of user-entered URLs in browsers, which are not generally a concern on embedded systems. With some effort (and increase in code size), the implementation could support both.
modTimerRemove
on Linux doesn't crash onNULL
timer- Add
manifest.json
for AudioOut module for consistency and to simplify builds - AudioOut fixes
- Sample accurate mixing
- Accurate tone generator frequency
- Allow multiple compressed formats on a single channel
- Fix crash on close in NimBLE BLE client if connection never completed
- Add
manifest.json
for CRC module for consistency and to simplify builds #938 structuredClone
fix to reject host objects
- MCU-optimized implementation of HTML standard
- Devices
- Raspberry Pi Pico W support added – Wi-Fi works
- Analog pin support for ESP32-C3
- I²C build fix for ESP32-C3 to account for fewer I²C ports compared to other ESP32 models
- Keeping up with ESP-IDF audio changes
- PDM audio output option for ESP32
- Tests
- Add BLE server module tests
- BLE test client (to support server tests)
- Complete URL module tests
- Add audio output tests for mixer and playback
September 1, 2022
This release contains changes to the Moddable SDK made between August 5, 2022 and September 1, 2022
Highlights of this release include:
- Deep cloning objects with the standard web
structuredClone
function optimized for microcontrollers. ComplementsdeepEqual
added last month. - Big progress on implementation of the ECMA-419 standard: RTC, sensors, HTTP server, TypeScript typings for I/O, and more
- Networking enhancements including TLS certificates updates and improved reliability for dropped Wi-Fi connections
- Detailed documentation on writing unit tests to run on microcontrollers using
testmc
Note: The original simulator in the Moddable SDK,
screentest
, will be removed from the Moddable SDK later this month. The default simulator has beenmcsim
for several months. If you haven't already transitioned tomcsim
, now is the time.
If you have questions or suggestions about anything here, drop by our Gitter to chat about it, start a new Discussion on our GitHub repository, or contact us on Twitter at @moddabletech.
-
XS JavaScript Engine
- Updated
Compartment
implementation (for Secure ECMAScript / Hardened JavaScript) to match the latest proposal discussed in TC39. See the XS Compartments document for details and a link to the proposal. - Fix memory leak when writing XS snapshot
- Updated
-
Modules
- littefs reports detailed error messages for exceptions in debug builds and error code number in instrumented and release builds
- File systems on macOS and ESP32 support read/write of more kinds of buffers
structuredClone
now available! See "Going Deep with XS: deepEqual and structuredClone" for details.- Updated built-in TLS certificates to replace expired certificates and add newer certificates. Reported by @stc1988. #828
- Piu idle handling optimization eliminates frequent calls from C to JavaScript
- Fixes to lwip
Socket
to improve reliability when Wi-Fi connection dropped unexpectedly - Original MQTT client properly parses topics of more than 255 bytes
SNTP
client update to clean-up implementation and handle failures reliably- Start of MCU-optimized implementation of HTML standard
URL
class together with tests. Expected to completed in September 2022.
-
ECMA-419
- First draft of proposed ECMA-419 HTTP Server with example.
- First draft of high-level async-generator based HTTP server inspired by
fetch
and Deno built on proposed ECMA-419 HTTP server with example. - Sensor driver implementations updated to match draft ECMA-419 2nd Edition sensor classes
- CCS811 - environment
- BMP180 - pressure and temperature
- BMP280 - pressure and temperature
- Capacitive moisture
- Qwiic soil moisture
- AK8963 - magnetometer
- HMC5883 - magnetometer
- RTC (Real-Time Clock) driver implementations updated to match draft ECMA-419 2nd Edition RTC peripheral
- DS1307
- DS3231
- MCP7940
- PCF85063
- PCF8523
- PCF8563
- RV3028
- Updated RTC examples and hosts using RTC to latest API
- ECMA-419
Listener
implementation for macOS
-
Devices
- Update to ESP-IDF v4.4.2 for ESP32 builds (previously using v4.3)
- Re-enable stop bit control in I²C APIs, now that underlying issue is fixed in ESP-IDF v4.4.2 #929
- ECMA-419
Serial
on ESP32 has fewer dependencies on ESP-IDF serial driver after being broken by ESP-DF v4.2.2 update. Reported by @meganetaaan. #931 - Pico LCD 1.3 device now supported. Contributed by @stc1988. #905
-
TypeScript
- Type declarations (aka typings) for most ECMA-419 I/O classes:
Digital
,DigitalBank
,PWM
,I²C
,Serial
,PulseCount
,SMBus
,SPI
,TCP
,Listener
, andUDP
. Contributed by @meganetaaan. #928
- Type declarations (aka typings) for most ECMA-419 I/O classes:
-
Tools
- xsbug options to color traces to console log and show/hide exceptions, colorize TypeScript and
*.mjs
source files, and show correct cursor over non-linkable log lines. Contributed by @cmidgley. #909 - New
mcprintski
tool to regenerate TLS certificate index (macOS only) - xsbug resolves symbolic links so Moddable SDK tests no longer need to be copied to test262 directory to be used with
test262
andtestmc
- XS Linker no longer strips async iterator when async generator is used
nodered2mcu
tool to support Node-RED MCU Edition initiative. Optimizes flows by compiling portions to JavaScript.- M5Paper simulator updated to work with
Compartment
updates that blocked access toMODEL
global. Reported by @gingerbeardman in #933.
- xsbug options to color traces to console log and show/hide exceptions, colorize TypeScript and
-
Documentation
- New documentation on "Writing Tests for the Moddable SDK" to get developers started writing unit tests to run with
testmc
. - Correct documentation on unscheduling a
Timer
- Update Files documentation to describe use of iterator to enumerate directory contents
- New documentation on "Writing Tests for the Moddable SDK" to get developers started writing unit tests to run with
-
Testing
- test262-style tests added for
Compartment
- New BLE client tests for
rssi
and properties in advertisements. testmc
allows tests to extendassert
(convenient for test fixtures)testmc
times out when attempting to connect to unavailable Wi-Fi access point
- test262-style tests added for
August 5, 2022
This release contains changes to the Moddable SDK made between June 28, 2022 and August 5, 2022.
Highlights of this release include:
- A new
deepEqual
module that provides deep equality comparison of objects emulating the behavior of Node.js - A new
littlefs
file system that provides a full-featured file system for even the smallest microcontrollers - Raspberry Pi support is back! Build, run in the simulator, debug with xsbug, and even try out network protocol implementations based on proposals for Ecma-419 2nd edition.
If you have questions or suggestions about anything here, drop by our Gitter to chat about it, start a new Discussion on our GitHub repository, or contact us on Twitter at @moddabletech.
- Modules
- New
deepEqual
module implements deep object comparison emulating the behavior ofassert.deepEqual()
andassert.deepStrictEqual()
from Node.js. Implementation is in C using XS internals, so it is both small and fast enough to be practical on microcontrollers. More details in documentation and the deepEqual tests (adapted from the excellent tests by @ljharb in his is-equal module). - New littlefs file system module. The littlefs module provides a true hierarchical file system with long file names. It has full resilience to power-loss and wear leveling support while using almost no RAM (under 1 KB in many cases). The implementation is API compatible with the Moddable SDK File module. Supported on ESP32, ESP8266, and simulators. Details in the documentation.
- Added driver for PCF85063 Real-time Clock (RTC) based on PCF8563
Hex.toString()
refreshes write pointer after garbage collector may have moved memory- Piu text field on Linux correctly handles
gtk_entry_get_text
returning NULL - Socket on iOS no longer reports error on
write
of 0 bytes
- New
- Ecma-419
- TCP socket now available on Linux
- UDP socket now available on Linux
- TCP socket for macOS no longer reports error on
write
of 0 bytes - TCP socket for lwip (ESP32, ESP8266) no longer invokes callbacks after being closed
- DNS UDP resolver handles "localhost" and IPv4 addresses
- WebSocket client
- No longer stalls when receiving zero length payloads
ping
andclose
replies are deferred to allowonWritable
to be called with updated count to eliminate client buffer overflowsbinary
is set correctly on received messages whenmore
is true
- HTTP and WebSocket clients handle empty strings for the path
- TLS
- TLS handshake supports ECDHE_RSA key exchange on certificate verify message for compatibility with AWS IoT (
ECDHE-ECDSA-AES128-GCM-SHA256
cipher suite) - TLS client now verifies certificates signed with ECDSA-SHA*
- Fix heap corruption caused by
BigInt
helper functions (mod_square, mod_mul, mont_square) when called withr
anda
arguments using the same pointer. This caused intermittent crashes during the TLS handshake with certain cipher suites. - Crypt digest functions defend against possible memory moving due to garbage collection
- TLS handshake supports ECDHE_RSA key exchange on certificate verify message for compatibility with AWS IoT (
- Devices
Timer
module updated to work correctly on Linux- Several fixes so Moddable SDK builds on Raspberry Pi works reliably again
- Remove unnecessary configuration in esp32_thing manifest (contributed by @Templarian)
- M5Stack Core2 virtual buttons supported (reported by @jorge-aqp-23)
- XS
- Snapshots significantly reworked so that creating a snapshot of a virtual machine does not cause changes to future snapshots on the same instantiation of that virtual machine
- Fixes for JavaScript parser issues found by ClusterFuzz (OSS-Fuzz) by Google
- Fixes to
Array.prototype.sort
andWeakSet
crashes discovered through fuzz testing with Fuzzilli performed by @Agoric - Small optimization to JavaScript parser to reduce memory use
- JSON parser correctly handles empty strings stored in ROM
- TypeScript
- Add typing for
Net.get("dns")
- Update typings to reflect that Piu
TextureSkinDictionary
accepts an array of colors. (contributed by @meganetaaan) - Rename
PixelsOut
typing to work on case sensitive file systems
- Add typing for
- Documentation
- Tests
- New BLE client tests that use new BLE server test app
- Examples
- ls013b4dn04 example needed to include CFE (Commodetto Font Engine) (reported by @Templarian)
- wificonnection example initializes the Wi-Fi mode rather than depending on host to do so
- Tools
- Experimental option to
mcconfig
to specify xsbug connectionmcconfig -d -m -x localhost:5004
(requested by @ralphwetzel) - When the XS linker (
xsl
) encounters an error during preload, the full stack trace is displayed to make pinpointing failures easier (implemented using recently added Error stack feature) - Updated builds of tool binaries to correct path issues
- Build binaries include instructions for use when delivered as a download
- Experimental option to
June 28, 2022
This release contains changes to the Moddable SDK from June 1 through June 28, 2022.
Highlights of this release include:
- Our XS JavaScript engine now supports the latest version of JavaScript, ECMAScript 2022
- We've added a large suite of tests to validate the Moddable SDK and XS
- The ESP32-C3 MCU is supported by a new port, our first to RISC-V(!)
- Binaries for all Moddable SDK tools provided for macOS (x86 and ARM), Windows (x86 and ARM), and Linux (x86)
- Binaries for
xst
(the XS test tool) are provided for use by jsvu and es-host.
If you have questions or suggestions about anything here, drop by our Gitter to chat about it or start a new Discussion on our GitHub repository.
- XS
- XS now supports the ECMAScript 2022 standard which adds the following features:
- Class fields
- Private fields
- Top-level await
- Class static block
- Ergonomic brand check for private fields
.at()
onArray
,TypedArray
, &String
Object.hasOwn()
RegExp
Match IndicesError
cause
- Note that "Ergonomic brand checks for private fields" is often misunderstood. This post by Axel Rauschmayer explains the feature well.
- xst and xsbug (test support) now enable these test262 tests
- Object.hasOwn
- class-fields-private-in
- class-static-block
- error-cause
- xst and xsbug (test support) disable test262 tests for unimplemented stage 3 features
- array-grouping
- decorators
- regexp-v-flag
- Conformance issue report fixes
- XS appears to incorrectly ignore comma at end-of-line. #899 (reported by @gibson042)
- "modulo signed zero incorrect?" #895 (reported by @devsnek)
- "incorrectly interprets zero when used as a multiplication factor" #335 (reported by @jugglinmike)
- "(,) is incorrectly treated as valid" #726 (reported by @gibson042)
- "Maps and sets incorrectly distinguish NaN values" #888 (reported by @gibson042)
- Fuzz testing
- Fixes for runtime issues found by Fuzzilli testing by @Agoric and @moddabletech
- Fixes for parser issues found by ClusterFuzz (OSS-Fuzz) by Google.
- Uninitialized data in XS snapshot by initializing unused
dummy
padding field - Fix test262
Promise
failures on ARM Linux targets (reported by @warner) - Fix ancient memory leak in
dtoa
(rarely happened) - Implement memory optimization for
Promise
proposed by @mhofman
- XS now supports the ECMAScript 2022 standard which adds the following features:
- TLS (
SecureSocket
)- Certificate transforms
- PEM to DER
PrivateKey
toPrivateKeyInfo
- (transforms support on-device AWS provisioning)
- Application Layer Protocol Negotiation (ALPN)
- Fixed exception caused by use of
const
#916 (reported by @barianand7) - Support binary and UTF-8 protocol names
- Fixed exception caused by use of
- BER/DER support
- Encoding now outputs all integers in canonical format
- OID encoding fixed
- Use resizable
ArrayBuffer
when encoding - Fix atring decoding
- SSL Streams
- Uses resizable
ArrayBuffer
for more efficient writes - Correct output of all UTF-8 data (previously only handled ASCII correctly)
- Uses resizable
- Remove unused Base64 support from crypt/bin module (data/base64 is preferred)
- Certificate transforms
- Device porting
- ESP32-C3 is now supported. This is the first Moddable SDK port to RISC-V!! Thank you to @LokiMetaSmith for making this happen.
- BLE now supported on the ESP32-S3 port
- ECMA-419
- Provide manifests for network protocol implementations to make it easier to include them in projects
fetch
implementation can now be preloaded to reduce RAM use
- Tests
- Over 500 test files containing thousands of individual tests are now part of the release. These cover many of the modules in the Moddable SDK and areas of XS not covered by test262.
- Documentation
- New document: Testing the Moddable SDK
- Fix broken links
- Make formatting more consistent across documents
- Add
Timer.unschedule
- Add note about Preference key and value size limits varying by host
- Updated XS conformance document with latest results
- Added documentation for TLS certificate transforms
- Tools
- Simulator now gracefully handles situation where a device cannot be found
mcconfig
now correctly handles stand-alone string values in the platform section of a manifest platforms (previously only arrays of strings worked)
June 1, 2022
This release contains changes to the Moddable SDK from May 2 to June 1, 2022.
Highlights of this release include:
- Two new MQTT client classes, including one that is API compatible with the widely used MQTT.js package
- Updates to many ECMA-419 modules, mostly focused on validating features in-progress for 2nd Edition
- Several fixes for operations on preloaded objects
- Lots of bug fixes based on unit test, user reports, and fuzz testing
Thank you to everyone who contributed to this release with a PR or an issue report. Especially thank you to Agoric for continuing their amazing support of our fuzzing efforts. The results are making XS more secure, reliable, and conformant on all devices.
If you have questions or suggestions about anything here, drop by our Gitter to chat about it or start a new Discussion on our GitHub repository.
- Runtime
- MQTT client
- New ECMA-419 MQTT Client implementation
- New MQTT.js compatible implementation built on ECMA-419 MQTT Client
- ECMA-419
- New ECMA-419
DNS
resolver implementation using UDP. Matches current draft specification. - ECMA-419
TCP
implementation on macOS no longer drives CPU use to 100% when there is unread data - ECMA-419 HTTP client
write
returns updated writable count, consistent with ECMA-419 MQTT and WebSocket clients - ECMA-419 TCP instances have
remoteAddress
andremotePort
properties consistent with Node.js sockets. - ECMA-419 WebSocket client no longer gets confused when receiving a
0
tag byte
- New ECMA-419
- Preloaded objects
Proxy
constructor andProxy.revocable
now work when passed host function primitives. Reported by @cmidgley.- Adding object in read-only memory (flash / ROM) to a
WeakMap
orWeakSet
throws instead of crashing. Reported by @cmidgley. JSON.stringify
throws "read-only value" instead of misleading "cyclic value" when trying to serialize objects in read-only memory (flash / ROM). #340. Reported by @takeru.
- Improved input parameter validation
- ECMA-419 SPI for ESP8266 and ESP32
Hex
module (converts between hexadecimal string and binary buffer)Inflate
andDeflate
(zlib)QRCode
- Fixes
- Calling
Timer.clear()
on a one-shot timer after it fired would crash. Reported by @cmidgley. Inflate
andDeflate
fixes to work reliably when streaming- Piu Text objects no longer crash when trying to render if there is no style set. #887. Reported by @tony-abraham.
- Top-level await now optionally supported for
main
module of a Moddable SDK project. Enable by definingMAIN_ASYNC
in project manifest. Reported by @dtex to support J5e examples.
- Calling
- More general buffer support
- DNS parser uses
xsmcGetBufferReadable
to support more kinds of buffers Logical
operations module usesxsmcGetBufferReadable
to support more kinds of buffers
- DNS parser uses
- Devices
- M5Stack Core2 – don't throw exception at start-up if MPU6886 not found
- ESP8266 and ESP32 hosts no longer crash if the root virtual machine cannot be cloned because of insufficient memory. Instead, a debug build traces
can't clone: no memory
. - ESP32 CPU load instrumentation fixes (as a result of reports by @LokiMetaSmith)
- Don't get idle task for second core on single core targets
- Rework native timer callback to work on all ESP-IDF targets
- MQTT client
- XS
- Fixes for at least 15 crashes found by fuzz testing with Fuzzilli. These generally only occurred in unusual situations that normal JavaScript code would not encounter. A few examples:
- Calling
Symbol()
recursively created duplicate symbols and corrupt the global symbol table, eventually causing a crash - Fix crashes in
lockdown()
when environment was in unanticipated states (indexed property added toDate
constructor) - Fix crash in RegExp parser
String.prototype.toUpperCase()
andString.prototype.toLowerCase()
would crash if the converted string required more bytes to store than the original string andfxRenewChunk
couldn't resize the output block
- Calling
- Fuzzing support
- Fix
fxRenewChunk
whenmxNoChunks
diagnostic mode is enabled to re-use block when shrinking - Fix memory leak of script buffer when fuzzing. Reported by @arirubinstein.
- Add entry point for Google's OSS-Fuzz. Contributed by @arirubinstein.
- Option to initialize data buffers to pseudo-random data
- Fix
- Snapshots
- Initialize padding bytes to 0 to generate deterministic output
- Save and restore
stack
property ofError
instances. Reported by @Agoric.
- Fixed a subtle memory leak in
WeakMap
by changing visitation order ofdelete
. Reported by @mhofman. - Migrated Secure ECMAScript / Hardened JavaScript built-ins from the xsnap application to xsLockdown.c for wider use
String.fromArrayBuffer
now also acceptsSharedArrayBuffer
and host buffers as input. Requested by @cmidgley. Thanks to @HipsterBrown for reporting the Windows build failure.
- Fixes for at least 15 crashes found by fuzz testing with Fuzzilli. These generally only occurred in unusual situations that normal JavaScript code would not encounter. A few examples:
- Tools
- Examples
- ePaper Photos example is now available on M5Paper
- Fix typo in font name of Commodetto Fonts example
- Inflate example demonstrates how to stream using
onData
andonEnd
callbacks - ECMA-419
TCP
protocol examples updated to usedevice.network.[protocol]
inconfig.js
file. Eventually this will migrate to the network protocol implementations.
- Documentation
- Remove Git Bash-based Windows instructions and assume Git Command Prompt integration instead. #510, #632, #897
- Update documentation on
Hex
module to describe all arguments
May 2, 2022
This release contains changes to the Moddable SDK from April 2 to May 2, 2022. There are two major areas of focus in this release:
- Hardening XS. There has been a great deal of work recently to improve the robustness of our XS JavaScript engine. This work has been done together with Agoric and independent researchers. The majority of issues have been uncovered using the Fuzzilli fuzzing engine with customizations to target specific details of XS. Most of vulnerabilities found are extremely difficult to trigger in normal operation and none have been demonstrated to be exploitable. All have been fixed. The majority of issues were found using a special build of
xst
, the XS test tool. Check out the Hardening XS page for more information. - Ecma-419 networking. Work is well underway on the 2nd Edition of Ecma-419, the ECMAScript Embedded Systems API Specification. One of the key goals of 2nd Edition is to specify standard APIs for common network protocols. There are now proposals in place for HTTP, WebSocket, and MQTT. The Moddable SDK contains implementations for each of those, together with high level implementations of Fetch and WebSockets from HTML, and the MQTT module use with Node. These bring APIs familiar to web developers to embedded. See below for details.
The following is a summary of the changes. Thank you to everyone who contributed!
- XS
- Vulnerabilities
- Fix vulnerability in
ArrayBuffer.fromBigInt
with negative minBytes argument - Fix "Out-of-bounds Read in fxUint8Getter" vulnerability. Reported by @Q1IQ and @P1umer. #896
- Fix vulnerability caused by
RegExp
engine not initializing capture reference name in one code path - Fix garbage collector triggered vulnerabilities
String.prototype.normalize
String.prototype.indexOf
String.prototype.lastIndexOf
Compartment
constructorPromise
constructor- Accessing
arguments
- Fix vulnerabilities reported by @arirubinstein of Agoric
- "AddressSanitizer: memcpy-param-overlap (libclang_rt.asan_osx_dynamic.dylib:arm64e+0x3db88) in __asan_memcpy+0xbc" #889
- "AddressSanitizer: global-buffer-overflow xsBigInt.c:936 in fxBigInt_ffs" #890
- "AddressSanitizer: heap-buffer-overflow (libclang_rt.asan_osx_dynamic.dylib:arm64e+0x3dc70) in __asan_memcpy+0x1a4" #891
- "AddressSanitizer: stack-overflow xsLexical.c in fxGetNextCode" #892
- Fix vulnerability in
- Fix
lockdown
whenDate
has index property - Fix obscure case where colors of objects in ROM were confused with instance alias
- Fix "Built-in function %ThrowTypeError% is incorrectly recognized as a constructor" conformance issue. Reported by @gibson042. #903
- Fix
Function.prototype.bind
to work with proxies - Snapshots
- Properly reload tagged templates
- Zero unused trailing chunk bytes to support deterministic snapshots
mxNoChunks
option now works with over-allocated arrays- Migrate Hardened JavaScript (also known as Secure ECMAScript) functions from xsnap to xs/xsLockdown.c to be able to use more widely
- Vulnerabilities
- Runtime
- Ecma-419
- Ecma-419 implementation of Display class for ILI9341. Poco and Piu updated to support (conditionally compiled, not yet default).
- Ecma-419 implementation of TCP for macOS
- Ecma-419 implementation of UDP for macOS
- Ecma-419
DigitalBank
for ESP32 only callsgpio_isr_handler_remove
for pins for which it previously calledgpio_isr_handler_add
- Graphics and UI
- BMP writer now supports writing 32-bit BMP images.
png2bmp
can now output 32-bit BMP images from PNG with alpha. - Optimize redraw of centered content in Piu by correctly checking that it is constrained
- BMP writer now supports writing 32-bit BMP images.
- Fix analog audio output on ESP-IDF 4.4 (broken by API changes in ESP-IDF)
- Update to more recent commit on ESP-IDF 4.4 to get analog audio fixes
- xsbug connection was incorrectly marked as verified on ESP32, ESP8266, and Pico
- Build changes to allow xsbug to work with ESP32-S3 board. Reported by @liurenqiu520. #902
- Ecma-419
- Tools
- Resolve xsbug crash when null character received from debug target
- Fix memory leak in Piu PC which caused xsbug to exhaust memory after running for a long time
- xsbug uses Maps instead of object properties to maintain list of paths for cached
eval
code. Faster and more scalable for long test runs. - When building
xst
on macOS, use a much bigger margin to check for pending stack overflows to account for unexpectedly huge stack frame of XS run loop (fxRunID
) in debug builds (nearly 90 KB on 64-bit ARM!) - TypeScript type declaration files for BLE and HID peripherals. Contributed by @chigix. #901
- Documentation
March 30, 2022
This is the first release in a little while. These release notes cover February 28, 2022 to April 1, 2022. Moving forward, the goal is to provide release notes at least once a month.
There's a lot of great work in this release – new features, updates to existing features, and the inevitable bug fixes. The release notes contain extensive links to make it convenient for you to explore the changes.
Thank you to everyone who reported an issue or contributed a PR. We appreciate you sharing your time and expertise.
-
Tools
- Simulator
mcsim
is now the default simulator in the Moddable SDK on macOS, Windows, and Linux. The original simulator, Screen Test, is still available but not recommended and will eventually be removed.mcsim
simulator updates instrumentation dynamically when stepping, consistent withscreen test
- Add M5StickC target to
mcsim
simulator. Contributed by @wilberforce. - Dark mode now available in
xsbug
andmcsim
mcsim
now callssetup/*
modules in the same way as device targets. Contributed by @FWeinb.- M5Paper simulator now shows power-pin status. Contributed by @FWeinb.
mcsim
has simulators for Pico Display and Pico Display 2
- The compileDataView tool has been integrated into the Moddable SDK. This tool simplifies working with binary data structures in JavaScript. It converts C language data structures to JavaScript implementations. The js/views example shows how to use compileDataView in a project manifest to share a C header between JavaScript and C source code.
- Fix duplicate path problem building TypeScript modules. Reported by @MKGaru. #869.
xst
(XS Test Tool) now contains support for fuzzing XS with Fuzzilli. Based on contribution by @jessysaurusrex. #817- Improvements to test262 tool to avoid buffer overflows when transferring test script source code to target
- Simulator
-
Devices
- Raspberry Pi Pico is now a supported platform! Check out the Pico documentation for supported features, set-up instructions, and a list of supported device targets.
- Added support for Wemos OLED Lolin32 (based on Heltec WiFi Kit 32 port). Contributed by @costa-victor.
-
Examples
- New collection of BLE HID (Human Interface Device) peripheral examples for building BLE keyboards and media controllers. Read the blog post by @andycarle for demos and details.
- New
httpbridge
example that demonstrates a new architecture bringing together Wi-Fi hotspot support, HTTP server, WebSocket server, and a very efficient use of ZIP files to deliver an embedded web site. Lots of cool techniques and useful code. Contributed by @wilberforce. - New Commodetto fireworks example. Created to show off the Pico Display, it works on any device with a display.
- New Piu QRCode example in response to a request from @wilberforce.
- Update xsuse example to eliminate device dependency on instrumentation indices and to calculate slot size at runtime for compatibility with 64-bit platforms
-
XS
- Fix JavaScript language conformance issues reported by @gibson042
- Fix crash in Compartment Function eval after lockdown
- Unhandled
Promise
rejection now reports reason - Fix stack overflow in degenerate Array sort cases
-
Runtime
- Network
- Add implementation of proposed Ecma-419 standard WebSocket client, with example.
- Add implementation of HTML5 WebSocket class built on Ecma-419 standard WebSocket client, with example. Tested on macOS, ESP32, and ESP8266.
- WebSocket server now supports creating a server from an existing socket. This allows one listener to be shared by HTTP and WebSocket servers. #755
Socket
implementation on Windows supports reading outside of the callback, as on other platforms.#755SecureSocket
now propagates error state to client- Socket implementation on macOS, Linux, and Windows now detects receive error correctly to avoid infinite loop. Reported by @michaelfig.
- Ecma-419 TCP implementation for lwip (ESP32 and ESP8266) now clears all native callbacks when socket is closed or disconnected
- Base
Timer.clear
may now be passedundefined
without throwing an exceptionTimer
module times now correctly schedule when millisecond wraps 32-bit value. Reported by @Arorar3. #875- WebWorker instrumentation now guarded by semaphore to prevent debugger cross-talk with multiple threads
- Merge updates to File module type declarations from @cmidgley
- File module
rename
function handles slashes consistently across flat and hierarchical file systems. #878 Flash
module updated to accept any kind of buffer forwrite
- Fix Outline module compilation on Windows
- Ecma-419 provider for Moddable One had SPI in and out pins reversed
- Network
-
Documentation
- CRC8 and CRC16 classes added to Data reference documentation.
- Fix mix-up with
PICO_SDK_DIR
in Raspberry Pi Pico docs. By @HipsterBrown.