Skip to content

v0.1.0a4 (alpha 4)

Pre-release
Pre-release

Choose a tag to compare

@begeistert begeistert released this 02 Aug 05:07
4d08657

PyMCU v0.1.0a4 — fourth alpha. A quality-and-finish release: the rough edges alpha 3 shipped with are gone, firmware got a lot smaller, and the documentation was rebuilt from the ground up at docs.pymcu.org.

Fixed — things that silently didn't work

  • pymcu flash now works end to end on the Raspberry Pi Pico / Pico 2: builds pack a firmware.uf2, the driver picks the right artifact per target and dispatches to the backend's programmer (the legacy [tool.pymcu.programmer] section still works, with a deprecation warning).
  • async/await on AVR actually waits: asyncio.ticks() now reads a real Timer0 microsecond clock (4 µs resolution). On PIC / RISC-V / ATtiny — which have no timebase yet — await is a clear compile error instead of an infinite hang.
  • Register writes that compiled to nothing: REG = x on a ptr[T] alias silently rebound the name (this had broken Timer.set_compare, tone on the 32U4 and the servo helper in the stdlib itself). All fixed with .value, and the compiler now rejects the bare form with an error naming both correct spellings.
  • ARM critical sections: operand-less asm() clobbers memory (LLVM could hoist loads across cpsid i), and enable/disable_interrupts() emit real cpsie/cpsid on RP2040/RP2350.
  • pymcu new scaffolds the config flash actually reads and the real clock per board (Pico 125 MHz, Pico 2 150 MHz); MAX7219 strobes the configured chip-select; BMP280/NeoPixel fail honestly on unsupported targets.

Smaller firmware

  • Region outlining: duplicated inline expansions with internal control flow now share one subroutine when it is provably safe (never across error-signaling or calibrated timing loops). The 60 AVR examples shrink 23% overall — FFI examples up to −74%, sensor-dashboard −53%.
  • Constant-delay outlining: repeated delay_ms busy loops share a subroutine per iteration count — lcd −51%, blink 56 → 44 bytes — with the delay guaranteed never shorter.

Language & tooling

  • Tuple return annotations: -> (uint8, uint16) and -> tuple[...] both parse, validate arity at the definition, the call site and every return, and size the result slots (fixes a silent width truncation).
  • New diagnostics: dict/set comprehensions, reflection (getattr/eval/…), compat modules without their flavor enabled (the error tells you the exact stdlib = [...] line to add), and bare register assignment.
  • IDE surface: pymcu boards --json, pymcu stubs (PEP 561 stub generation) and pymcu lint --json.
  • py.typed ships in pymcu-stdlib, and pymcu.types.ptr finally documents its compiled semantics — access forms, the volatility guarantee, and address arithmetic — right where IDE hovers show it.
  • MicroPython compat grows the wireless flavors (network, rp2, umqtt) as installable packages.

Documentation

docs.pymcu.org is a new site: 54 pages audited against the code, synced MicroPython | CircuitPython | native-HAL tabs on every runnable example, 8 language guides (generators, async, exceptions, f-strings, dicts, zero-cost classes, C interop, inline asm), full driver and peripheral references, and a troubleshooting page.

Quality

All suites green at release: 416 unit + 89 driver + 1063 AVR + 70 ARM + 81 PIC.

Companion releases: pymcu-avr v0.1.0a4 · pymcu-arm v0.1.0a4

Install: pip install --pre "pymcu-compiler[all]"