Releases: Moddable-OpenSource/moddable
Moddable SDK 3.7.0
This release contains changes to the Moddable SDK made between January 2, 2023 and February 1, 2023.
Highlights of this release include:
- New sensor drivers for ADPS-9960 (ambient light and proximity), PZEM-004T (energy), and AMG88xx (GridEYE) infrared temperature sensor
- ESP32 built-in Ethernet support
- Faster builds on Windows
February Community Call
The monthly Moddable Community Call is this Thursday, February 9th at 4:00 PM PST. Join us live on Zoom to learn more about this month's release, hear about our experience to the FOSDEM open source conference in Belgium, and chat with the Moddable team.
Release details
- ECMA-419
- New APDS-9960 sensor driver (Ambient Light Sensor, Proximity, Gesture)
- New PZEM-004T energy monitor sensor driver with two example apps - command line and GUI
- New AMG88xx (GridEYE) infrared array temperature sensor
- lwip versions of
TCPandUDPsockets use task-safe API wrappers for greater reliability (based on issue reported by @mshioji) - lwip
TCPdefers error report until pending data read (matches macOS and Linux behavior) - TCP write failures due to disconnected socket trigger onError rather than throwing (consistent error handling for client code)
- HTTP, MQTT, and WebSocket clients report error when TCP constructor throws (based on issue reported by @ralphwetzel)
- MQTT client
- timeout when connecting (reported by @mshioji)
- invokes onError if connection acknowledgment fails (invalid password)
- defaults to port 1883 (was using 80)
- HTTP Client
readwithout argument reads all available- If error occurs, invoke callback on pending requests
- Report completion of current request before error that only impacts pending requests
onCloserenamed toonErrorfor consistency.onDoneuses ECMA-419 completion callback semantics to report success and failure
- TLS client invokes
onErroron remote disconnect - I2C
readreturn value when reading into a buffer is now number of bytes read (conforms to specification) on ESP8266, ESP32, and Pico - Update first argument to callbacks in async I2C and SMBus to be
nullorErrorinstance to match ECMA-419 spec (which matches Node.js) - SPI constructor on ESP8266 and ESP32 throws if
portis undefined #1005 - PulseWidth input property names updated to match Digital names where possible
- PulseCount on ESP32 now initializes
triggeredfield to eliminate occasional zombie instances - GT911 and FT6206 touch drivers conformance fixes - return empty array on last touch up event and
undefineduntil next touch down - BMP180 and BMP280 sensors conformance fixes to improve error handling (reported by @kitazaki)
- BMP280 sensor driver provides useful default configuration (reported by @mshioji)
- BMP280 sensor driver update to work with I2C read conformance fix
- TMP102 temperature sensor conformance fixes and don't orphan I2C instance on error
- LIS3DH accelerometer sensor error handling fix to avoid orphaning I2C instance
- HC-SR04
- proximity sensor conformance fixes
- trigger pin optional
- add example using multiple HC-SR04 sensors
- SMBus based sensor drivers updated to eliminate use of deprecated SMBus function names
- Updated sensor summary document (contributed by @Sineos)
- Modules
- Network
- Ping - update implementation to use private fields to eliminate unintended interactions with client code, better error handling, pass packet identifier to callback, ignore non-ping packets instead of failing
- TCP socket on macOS reference count fix if error during resolve
- Remove experimental HTTP suspend support (use ECMA-419 HTTPClient instead)
- MQTT client
- Will fix (incorrect length)
- No callbacks after close
- WebSocket client
- No callbacks after close
- Report errors (e.g. Protocol Upgrade fail) through error callback rather than throwing (so client code can recover)
- Neopixels driver allows runtime override of build-time configuration
- Network
- Tools
- Parallel execution of
clfor faster Windows builds - Optional parallel processing of NMAKE files in Windows Moddable SDK tools build using
parallel_build.bat. See the Windows Getting Started Guide for details. - Fix calculations whenwav2maudupsamples to avoid generating invalid file mcrunsupports-xoption to redirect xsbug connection- Enable metering in xst for oss-fuzz to catch runaway tests (contributed by @raphdev)
- Free up system memory in testmc by reducing number of keys (original value based on test262, which needs far more)
serial2xsbugon Linux now reliably initializes serial connection to fix intermittent xsbug connection failures (contributed by @tve)- Use
MACOS_ARCHenvironment variable to support building universal tool binaries - Consistently set minimum macOS version to 10.7
- Fix Windows build of
xst
- Parallel execution of
- Devices
- ESP32-C3 build updates to work with ESP-IDF changes for RISC-V #975 & #996
- ESP32
- Built-in Ethernet support #844
- Wi-Fi and Ethernet co-existence
- Support for WT32-ETH01 development board, platform identifier
esp32/wt32_eth01 - Fix ESP32-S2 build by adding Pulse Width Input stub (not supported by hardware)
- Pico
- Remove
portfrom I2C constructor options (can be inferred from pins)
- Remove
- XS
- Fixes for issues found with fuzz testing using Fuzzilli and oss-fuzz. Thank you to @Agoric for their ongoing assistance with this effort.
- Weak references are garbage collected sooner
- Add metering macros to xs.h
- Fix integer overflow in TypedArray constructor (caused by undefined behavior in release builds only)
ArrayBuffer.prototype.sliceconformance fixes to eliminate vulnerability with buffer size- Fix garbage collector trashing behavior
- Fix buffer overflow in host's
fxFindModuleimplementations with long module paths
- Tests
- In-depth tests for original networking modules
- SNTP client
- HTTP client
- DNS resolver
- WebSocket client
- MQTT client
- Ping client
- In-depth tests for original networking modules
- TypeScript
- Add blank text/index.d.ts file to quiet Visual Studio warning (contributed by @tve)
Contact Us
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.
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
EventSourceAPI
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)
fetchAPI 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
sensorinstead ofi2cto match all other sensors
- Tools
- Project manifests may now include remote Git repositories. The repository is automatically cloned by
mcconfigandmcrunwhen building. Details and examples in the Manifest documentation. - Option to redirect debug console output to the terminal rather than to xsbug. See documentation on
-loption for set-up instructions. Supported on builds for simulator and ESP32 builds on all platforms. - ESP8266 build on Windows build supports
-xoption (@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/dashto avoid issues with echo newline interpretation in other shells #979 (reported by @tve) - Check for ESP-IDF install by looking for
idf.pyinstead 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
AudioOutandMixerclasses provide properties to getsamplerate,streams,bitPerSampleandnumChannelsAudioOuton 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.parseandJSON.stringifyfor 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
RegExpparser 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
xsIsCallableandxsmcIsCallableAPIs 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.shnow 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
WavReaderclass fromwav2maudtool 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
getPixelAPI
- 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
readfunction 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
WavStreamermodule - SBC compressed streaming using
SBCStreamermodule - 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
resetReasonmodule 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
CanvasPathno-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
deepEqualandstructuredClone(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
URLmodule - 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 beenmcsimfor 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
onReadablecallback - UDP socket on macOS and Linux implement
portproperty - HTTP server updated to allow
detachto be called fromonDonecallback to support WebSocket server exploration WebSocketClientandWebSocketconstructors support attaching to existing socket- Sensor driver for MPU6886 IMU
- Modules
- MCU-optimized implementation of HTML standard
URLclass 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.
modTimerRemoveon Linux doesn't crash onNULLtimer- Add
manifest.jsonfor 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.jsonfor CRC module for consistency and to simplify builds #938 structuredClonefix 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
structuredClonefunction optimized for microcontrollers. ComplementsdeepEqualadded 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 beenmcsimfor 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
Compartmentimplementation (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
structuredClonenow 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
Socketto improve reliability when Wi-Fi connection dropped unexpectedly - Original MQTT client properly parses topics of more than 255 bytes
SNTPclient update to clean-up implementation and handle failures reliably- Start of MCU-optimized implementation of HTML standard
URLclass 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
fetchand 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
Listenerimplementation 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
Serialon 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
*.mjssource files, and show correct cursor over non-linkable log lines. Contributed by @cmidgley. #909 - New
mcprintskitool 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
test262andtestmc - XS Linker no longer strips async iterator when async generator is used
nodered2mcutool to support Node-RED MCU Edition initiative. Optimizes flows by compiling portions to JavaScript.- M5Paper simulator updated to work with
Compartmentupdates that blocked access toMODELglobal. 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
rssiand properties in advertisements. testmcallows tests to extendassert(convenient for test fixtures)testmctimes 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
deepEqualmodule that provides deep equality comparison of objects emulating the behavior of Node.js - A new
littlefsfile 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
deepEqualmodule 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_textreturning NULL - Socket on iOS no longer reports error on
writeof 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
writeof 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
pingandclosereplies are deferred to allowonWritableto be called with updated count to eliminate client buffer overflowsbinaryis set correctly on received messages whenmoreis 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-SHA256cipher suite) - TLS client now verifies certificates signed with ECDSA-SHA*
- Fix heap corruption caused by
BigInthelper functions (mod_square, mod_mul, mont_square) when called withrandaarguments 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
Timermodule 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.sortandWeakSetcrashes 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
TextureSkinDictionaryaccepts an array of colors. (contributed by @meganetaaan) - Rename
PixelsOuttyping 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
mcconfigto 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, &StringObject.hasOwn()RegExpMatch IndicesErrorcause
- 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
dummypadding field - Fix test262
Promisefailures on ARM Linux targets (reported by @warner) - Fix ancient memory leak in
dtoa(rarely happened) - Implement memory optimization for
Promiseproposed by @mhofman
- XS now supports the ECMAScript 2022 standard which adds the following features:
- TLS (
SecureSocket)- Certificate transforms
- PEM to DER
PrivateKeytoPrivateKeyInfo- (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
ArrayBufferwhen encoding - Fix atring decoding
- SSL Streams
- Uses resizable
ArrayBufferfor 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
fetchimplementation 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
mcconfignow 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
DNSresolver implementation using UDP. Matches current draft specification. - ECMA-419
TCPimplementation on macOS no longer drives CPU use to 100% when there is unread data - ECMA-419 HTTP client
writereturns updated writable count, consistent with ECMA-419 MQTT and WebSocket clients - ECMA-419 TCP instances have
remoteAddressandremotePortproperties consistent with Node.js sockets. - ECMA-419 WebSocket client no longer gets confused when receiving a
0tag byte
- New ECMA-419
- Preloaded objects
Proxyconstructor andProxy.revocablenow work when passed host function primitives. Reported by @cmidgley.- Adding object in read-only memory (flash / ROM) to a
WeakMaporWeakSetthrows instead of crashing. Reported by @cmidgley. JSON.stringifythrows "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
Hexmodule (converts between hexadecimal string and binary buffer)InflateandDeflate(zlib)QRCode
- Fixes
- Calling
Timer.clear()on a one-shot timer after it fired would crash. Reported by @cmidgley. InflateandDeflatefixes 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
mainmodule of a Moddable SDK project. Enable by definingMAIN_ASYNCin project manifest. Reported by @dtex to support J5e examples.
- Calling
- More general buffer support
- DNS parser uses
xsmcGetBufferReadableto support more kinds of buffers Logicaloperations module usesxsmcGetBufferReadableto 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 toDateconstructor) - 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 andfxRenewChunkcouldn't resize the output block
- Calling
- Fuzzing support
- Fix
fxRenewChunkwhenmxNoChunksdiagnostic 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
stackproperty ofErrorinstances. Reported by @Agoric.
- Fixed a subtle memory leak in
WeakMapby 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.fromArrayBuffernow also acceptsSharedArrayBufferand 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
onDataandonEndcallbacks - ECMA-419
TCPprotocol examples updated to usedevice.network.[protocol]inconfig.jsfile. 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
Hexmodule 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.fromBigIntwith negative minBytes argument - Fix "Out-of-bounds Read in fxUint8Getter" vulnerability. Reported by @Q1IQ and @P1umer. #896
- Fix vulnerability caused by
RegExpengine not initializing capture reference name in one code path - Fix garbage collector triggered vulnerabilities
String.prototype.normalizeString.prototype.indexOfString.prototype.lastIndexOfCompartmentconstructorPromiseconstructor- 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
lockdownwhenDatehas 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.bindto work with proxies - Snapshots
- Properly reload tagged templates
- Zero unused trailing chunk bytes to support deterministic snapshots
mxNoChunksoption 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
DigitalBankfor ESP32 only callsgpio_isr_handler_removefor pins for which it previously calledgpio_isr_handler_add
- Graphics and UI
- BMP writer now supports writing 32-bit BMP images.
png2bmpcan 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
evalcode. Faster and more scalable for long test runs. - When building
xston 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