Skip to content

MicroCS 1.15.0 — Radio-enabled releases, Bluetooth LE and Studio reliability

Choose a tag to compare

@github-actions github-actions released this 16 Oct 12:25
ba12729

Try it without installing anything: MicroCS Studio in Chrome or Edge, connected to a board flashed with one of the files below.

Board File How to flash
Raspberry Pi Pico / Pico 2 / Pico W / Pico 2 W / RP2040-Zero microcs-1.15.0-<board>.uf2 hold BOOTSEL, plug in, copy the file to the RPI-RP2 drive (pico_w / pico2_w files: Wi-Fi, sockets, HTTP client + server, WebSocket)
ESP32 / S2 / S3 / C2 / C3 / C5 / C6 / C61 / H2 / P4 microcs-1.15.0-<chip>.bin esptool.py --chip <chip> write_flash 0 microcs-1.15.0-<chip>.bin
STM32 Nucleo-F401RE / F411RE / F446RE / G474RE / L476RG / H743ZI microcs-1.15.0-nucleo_<board>.bin copy the file to the NOD_xxx drive of the Nucleo's ST-LINK (or STM32CubeProgrammer, .hex keeps your files); the console is the ST-LINK virtual COM port
STM32 Black Pill (F411CE) microcs-1.15.0-blackpill_f411ce.bin USB DFU (hold BOOT0, reset): dfu-util -a 0 -s 0x08000000:leave -D microcs-1.15.0-blackpill_f411ce.bin, or ST-LINK; console = USART1 (PA9 TX, PA10 RX) via a USB-serial adapter
Linux x64 mcs-1.15.0-<os>.tar.gz compiler, REPL and simulator: ./mcs --repl --sim
Threads Pico / Pico 2 / RP2040-Zero and ESP32 files run FreeRTOS (SMP on dual cores): Thread.RunOn(1, …) and jobs.cfg jobs use real threads; STM32 files are bare-metal
Radios ESP32: Wi-Fi + ESP-NOW and BLE where the chip supports them. S2: Wi-Fi + ESP-NOW only; H2: BLE only; P4: neither onboard radio. Pico W / Pico 2 W: Wi-Fi. Radios start when used by a script (or saved Wi-Fi autoconnect).
ESP32 storage migration Radio-enabled images use a larger app partition than the old no-Wi-Fi releases. Back up scripts before flashing: the storage partition moves and old files are not preserved.
ESP32-C2 note built for a 40 MHz crystal (ESP-IDF default); boards with a 26 MHz ESP8684 need a rebuild with CONFIG_XTAL_FREQ_26=y
Arduino IDE MicroCS-1.15.0.zip Sketch → Include Library → Add .ZIP Library
  • Release firmware — Wi-Fi + ESP-NOW and NimBLE on all supported ESP32-family
    targets according to their onboard radios, including S2, H2, P4, C5 and C61;
    explicit Wi-Fi on Pico W / Pico 2 W. Builds check requested radio configuration
    and linked backend symbols before publishing. Back up scripts before upgrading
    ESP32: the larger app partition moves storage from older no-Wi-Fi releases.

  • Release capability detection — the 1.14.0 release predates the shell caps
    report, while Studio now requires it for peripheral templates. This new version
    produces fresh firmware with capability reporting instead of reusing the old
    release. No hardware is guessed from board names or feature bits.

  • Studio upload responsiveness — save, upload and Run Selection stop a running
    foreground script before entering its occupied operation queue, with a bounded
    wait and an actionable failure instead of an indefinitely queued transfer.

  • RP2 USB output — raw block writes replace byte-by-byte TinyUSB writes, avoiding
    a USB write/task/flush cycle per output byte; binary output is unchanged.

  • Templates — the two-display OLED example requires U8g2 and gets an OLED tag.
    CPU benchmark collection workloads fit fixed 96 / 128 KB release pools, with
    accurate labels and preallocated list capacity rather than a 4,000-entry list
    whose growth needs old and new tagged-value buffers at once.

  • Studio console input — machine-mode Console.ReadLine no longer echoes input
    a second time; raw REPL echo is preserved. Studio forwards trailing spaces in script
    input unchanged, with echo-on/off, multiple-prompt and runtime regressions.

  • Cortex-M flash budget — shared capability lookup / direct peripheral predicates;
    LTO on the 256 KB Cortex-M0 reference targets and benchmark preserves configured
    features while accommodating GCC/newlib size differences.

  • Capability-aware templates — allocation-free shell caps and expanded Hal.Has,
    explicit requires: metadata for every template, connected-board filtering with offline
    browsing and conservative older-firmware fallback. Radio examples check Wi-Fi / BLE /
    ESP-NOW and required roles before referencing optional classes. Software/configuration
    flags and peripheral subfeatures are checked separately; bus support is not device detection.

  • BLE API v2 and examples — backend option read/write discovery without starting the
    radio, configurable scan interval/window (including ESP menuconfig), operation-level role
    flags and Ble.Reset for clean reruns without erasing bonds. Added seven BLE templates
    and matching standalone examples. Fixed lost/ignored passkey writes and misleading no-op
    MTU/PHY/security setters. NimBLE role reports honor the configured roles. BLE remains opt-in in custom builds.

  • Web templates / foreground network lifecycle — moved the raw HTTP example into
    Web server and WebSocket; servers now run until Stop rather than two seconds and use
    port 80. Raw TCP listeners share the host privileged-port fallback used by HttpServer.
    Close sockets, listeners, DNS servers and WebSockets at foreground run exit
    (normal, error or abort), preserving earlier interactive resources. Native server
    loops service idle work and Stop even with busy/stalled clients; propagate cancellation
    through native tail calls and nested route callbacks. Added shell lifecycle regressions.

  • Studio C# highlighting — balanced interpolated/verbatim strings ($@" and @$"),
    including multiline HTML, nested quoted expressions, escaped braces and comments;
    added a dedicated highlighter regression suite.

  • ESP BLE menuconfig — discoverable BLE submenu with prerequisite hints, device name,
    queue / GATT / scan / discovery limits, subscriptions, timeouts and UART buffer. The
    front-end connection limit follows NimBLE (C2 supports at most two); the BLE overlay uses
    two connections. Added BLE builds for C2 / C6 / H2 and IDF 5.5.2 builds for C5 / C61,
    plus non-BLE S2 / P4 checks. Guarded legacy CAN on CAN-FD-only chips (IDF omits
    the legacy TWAI driver there), fixing C5 firmware link failures. C5 / C61 target defaults
    use a 2.5 MB app slot; older chips retain their existing flash layout. Corrected TX-power clamping on C6 / C61 (minimum -15 dBm)
    and the +20 dBm readback on newer controllers. BLE remains opt-in, absent from release builds.

  • HTTP client diagnostics / framing — distinguish a server closing before its status
    line from truncated headers, body or chunks; reject invalid / overflowing chunk lengths,
    invalid chunk terminators, incomplete trailers and overlong response lines. Added local
    wire-format regressions. The basic HTTP GET template no longer depends on a public time
    API and prints a web page instead.

  • Bluetooth LE (docs/BLE.md) — opt-in (MCS_ENABLE_BLE), not in any release
    firmware. C# Ble (radio, name, TX power, MTU, PHY, events), BleAdvertisement (name, UUIDs,
    manufacturer / service data, iBeacon, Eddystone-URL / -UID, raw data), scanning into
    BleDevice (parsed AD fields, beacons), a GATT server (BleService, BleCharacteristic,
    BleDescriptor: read / write / notify / indicate, OnWrite, OnSubscribe, encrypted /
    authenticated permissions), BleConnection in both roles (MTU, RSSI, parameters, pairing), a
    GATT client (BleRemoteService / Characteristic / Descriptor: discovery, long reads and
    writes, subscriptions), security (IO capabilities, passkeys, Secure Connections, bonds),
    BleUart (Nordic UART Service) and BleUuid. Backends: ESP-IDF NimBLE
    (ports/esp32/example/sdkconfig.ble), Pico W / Pico 2 W BTstack (-DMICROCS_BLE=ON, with or
    without FreeRTOS / Wi-Fi), Zephyr Bluetooth host (overlay-ble.conf; the west manifest now
    fetches mbedtls), ArduinoBLE (tools/make_arduino.py --ble; no central / security), and a
    simulated radio with peers for the PC (make mcs-ble, CMake -DMICROCS_BLE=ON, --sim).
    make ble-test (in make check) and CI builds for every backend.

  • Fixed: Pico W / Pico 2 W filesystem — the Wi-Fi firmware (~1.1 MB with the CYW43 blob)
    overlapped the filesystem, which started at 1 MB, so the board silently fell back to a RAM
    disk. Builds with the radio now keep 1.5 MB for the firmware (MCS_RP2_FW_RESERVE) and put
    the filesystem after it.

  • Templates are plain files — tools/studio/templates/<nn-category>/ holds one .cs
    (or .cfg) file per template and a templates.txt that names and describes every file of
    the folder (how to add one). tools/studio/gen_templates.py
    bundles them into templates.js (Studio still runs from file://); --check runs in CI and
    make docs-check, and fails on undescribed, missing or duplicate files. Snippets moved to
    tools/studio/snippets.js.

  • Templates dialog — search matches every word and ranks name hits first, with
    highlighting; Recent category; tags derived from the code (Wi-Fi, OLED, files,
    jobs, threads, DMA, input); line count, copy button and a link to the source file;
    PgUp/PgDn/Home/End, Ctrl+Enter = insert at cursor, Esc clears the search first;
    a link to search all categories when the current one has no hit; narrow-window layout.
    Arrow keys no longer re-render the whole dialog.

  • Fixes — saving a new file (e.g. a template as main.cs) over an existing file on the
    device now asks before replacing it; added templates get a name no open tab uses
    (hello-2.cs); Add / Insert at cursor are disabled without a selection (and Insert
    for read-only tabs); the save dialog selects the name without the extension for any
    extension (it assumed .cs) and accepts a relative path. The Wi-Fi and networking folder
    is 28-wifi-and-networking; test_templates.js fails on a template without source or
    description.

  • Robustness pass (ASan/UBSan, source + shell-protocol fuzzing of tests, examples and
    templates):

    • array / list / buffer allocations check count * element size for overflow — on 32-bit
      MCUs new int[int.MaxValue] wrapped to a tiny block and then overflowed the heap; it now
      fails with an out-of-memory error like any other too-large allocation;
    • StringComparison is honored by IndexOf, LastIndexOf, Contains, StartsWith,
      EndsWith, Replace, Equals, string.Equals and string.Compare (before,
      IndexOf("x", StringComparison.Ordinal) took the enum for a start index and
      string.Compare(a, b, StringComparison.Ordinal) ignored case);
      added CurrentCulture / InvariantCulture; StartsWith / EndsWith(v, ignoreCase, culture);
    • IndexOf(value, start, count) honors count; LastIndexOf(value, startIndex[, count])
      searches backwards from startIndex (both ignored the extra arguments);
    • Math.Round(x, digits) returns huge values unchanged (Math.Round(1e300, 15) was
      infinity);
    • StringBuilder.Remove / ToString(start, length), LedStrip.Fill and u8g2 rounded boxes
      no longer overflow int in their range checks;
    • --sim-virtual: the virtual clock advances on every Hal.Micros read, so
      GPIO.PulseIn and other busy-waits no longer spin forever; RAM filesystem reads/writes
      of 0 bytes no longer pass a null pointer to memcpy;
    • compiler: an unterminated string or char literal ending in \ (or in an interpolation
      hole) no longer moves the lexer past the end of the source (which then tried to allocate
      gigabytes for the token array); void.X in an expression is a syntax error instead of a
      null-pointer strlen; mcs -c prints each compile error once (it printed the last one twice).
    • native GC roots beyond MCS_MAX_ROOTS spill to the heap: recursion through LINQ
      callbacks (or Sort comparers ...) ended the script with an uncatchable
      fatal: too many temporary roots; it now reaches the normal, catchable
      StackOverflowException. A panic also restores the root count (in the REPL every later
      native call failed after one such error);
    • Json.Parse no longer roots every open object (16 nested objects were fatal); nesting
      deeper than 32 is a FormatException as documented;
    • Enumerable.Range(start, count) throws when start + count - 1 overflows int;
    • tools/fuzz.py (run in CI) also mutates the examples and every Studio template, and
      alternates --sim / --sim-virtual runs with compile-only runs.
  • .NET semantics (tests/t27_dotnet_semantics.cs):

    • int.MinValue / -1 and int.MinValue % -1 (and Math.DivRem) throw OverflowException
      like .NET instead of returning MinValue / 0; the compiler no longer folds such constants;
    • foreach over a List<T> throws InvalidOperationException Collection was modified;
      enumeration operation may not execute.
      when the loop body changed the list (Add,
      Insert, Remove*, Clear, Sort, Reverse, an indexer store …); over a Dictionary
      when a key was added. Removing entries or clearing the dictionary during foreach (allowed
      in .NET 8) no longer skips the entry after a removed one. Arrays never throw, as in .NET.
      t27 runs in the .NET 8 parity job, so its output is checked against the real runtime;
    • bytecode images are version 4: the checked FOR_ITER form marks its slot byte with
      bit 7 and uses two more hidden locals. Version 1–3 images still load and run their loops
      unchecked; older VMs reject v4 images, so recompile .mcsb files for them.
  • min profile uses switch dispatch (MCS_COMPUTED_GOTO=0): ~1 KB less Thumb-1 code for
    ~3 % more instructions, so the m0-64k firmware keeps ~1 KB of its 64 KB flash free (it had
    264 B left with the CI toolchain).