Repository navigation
Dodo 0.1.6 grows the language with interfaces and dyn references, function
values and closures, tuples, type aliases, async fn and await, inline and
global assembly, interrupt handlers, and placement and inlining attributes.
Firmware reaches the Espressif ESP32-C6 and the Arduino Uno, and the RP2040
and RP2350 gain DMA, PIO, PWM, the ADC, their second core, USB serial ports,
flash storage, and deep sleep. The standard library adds desktop windows, 2D
graphics, and portable GPU compute and rendering on Metal, Vulkan, and OpenGL;
PNG and JPEG XL images; DEFLATE and Brotli compression; cryptography and QUIC;
MQTT; an SQLite-compatible database engine and a PostgreSQL client; and a Lua
5.4 implementation, all written in Dodo. A JetBrains plugin joins the VS Code
extension. The language specification remains version 0.1.
-
JPEG XL in
std/imageloses its documented limitations.
The decoder now handles patches and splines in upsampled frames, upsampled
LF frames, and chroma-subsampled modular and VarDCT frames with upsampling,
Gaborish, EPF and adaptive LF smoothing (subsampled frames with varblocks
larger than 8x8 are invalid and failMalformed, as in libjxl). It reads
up to 4096 extra channels, and the newjxl.extra_channel_count,
extra_channel_info,extra_channel_nameanddecode_extra_channel
return any of them at full size; spot colors are rendered into the color
output asdjxldoes. Scratch now follows the image size instead of the
frame sizes a file declares: frames are decoded over the part that can
reach the output and reference frames keep only what later patches read,
so a small file claiming gigapixel frames no longer asks for gigabytes
(scratch_size<= 64 (W+1100)(H+1100) C + 5 MiB C + 128 MiB, with the
exceptions listed in the guide).info,metadata,frame_infoand
scratch_sizeno longer put a 196 KiB work area on the stack (about
32 KiB now) and decode larger ICC profiles; ICC tag-table checks and
shuffled ICC runs now match libjxl. -
The JPEG XL encoder writes lossy files:
EncodeOptions.lossless = false
(orEncodeOptions.lossy(distance),distance_from_quality(q)) produces
a VarDCT frame in XYB with libjxl's quantizer, adaptive quantization,
inverse Gaborish, chroma-from-luma and varblock search, within a few
percent ofcjxlat equal quality, in at most about 9 MiB of scratch.
Efforts 2 and up tune hybrid integers per cluster and use ANS when it is
smaller, for lossless and lossy output. ICC profiles can be embedded
(Metadata.with_icc,icc_fits,icc_usable,icc_bound) with
libjxl's predictive ICC coding; lossy files convert through the profile's
lookup table, matrix/TRC model or gray curve.std/image's
EncodeOptions.qualityandlosslessnow take effect (plus a new
distance),encode_with_metadataandimage_allockeep ICC profiles
for JPEG XL, andimgtool convertgains--quality,--distanceand
--lossy. -
New
std/compress/brotli, a pure-Dodo RFC 7932 decoder with caller
buffers: one-shotdecompress,decompress_with_workspace, a streaming
Decoderover a caller ring buffer,decompressed_size,window_lenand
workspace_size, with the static dictionary and all 121 transforms.
meta.decodeand the newmeta.decode_with_scratch/meta.scratch_size
decompress JPEG XLbrobmetadata boxes,jxl.metadatareports the
Exif/XMP inside them,std/image_allockeeps their EXIF, and
imgtool infoshows decoded metadata sizes. -
New
std/db/postgres, a PostgreSQL client written in Dodo, with the same
API as the SQLite driver (exec,execute,select,query,prepare,
Rows,Row,@derive(Row)) and thesql.Conninterface. It speaks
protocol 3.0 overstd/net, with TLS for every libpqsslmode(prefer by
default,verify-fullagainst system or caller-supplied roots), SCRAM-SHA-256,
md5 and cleartext passwords, libpq connection URLs, binary transfer of
integer, float, bool and bytea values (text for every other type), a
per-connection cache of server-side prepared statements that re-prepares
after schema changes, PostgreSQL's errors mapped ontodb.ErrorKindwith
the SQLSTATE, message, detail and hint kept, timeouts,postgres.cancel,
and LISTEN/NOTIFY. Like the rest of the library it works in a caller-owned
workspace. The wire protocol, SCRAM included, is the portable package
std/db/postgres/protocol, which imports no sockets, TLS or cryptography
backend. -
New
db.Pool: a fixed set of caller-owned connections that open on first
use, are reset when returned, and can be pinged before reuse;pool.get()
lends one through a lease,acquire/conn/releaseseveral at once. -
std/crypto/openssladdspbkdf2_hmac_sha256andMd5/md5. -
openssl.Config(TLS) addsverify:Verify.Full(the default) as
before, or the explicitVerify.Chain(no name check) andVerify.None
(no authentication) that PostgreSQL'sverify-caandrequiremodes need. -
New board
esp32c6_devkitc, the Espressif ESP32-C6-DevKitC-1, on the new
esp32c6chip: the first RISC-V firmware target (riscv32-unknown-none-elf,
RV32IMAC). The firmware boots through the boot ROM's direct boot, so the
image is the linked program from flash offset 0, with no bootloader or
partition table, and the runtime starts the chip (watchdogs off, DMA's
access to SRAM, flash at 80 MHz dual I/O) and dispatches the 77 interrupt
sources to@interrupt(NAME)handlers, which are ordinary functions on this
chip.dodo runflashes through the boot ROM's serial protocol over the
chip's own USB serial port or a USB serial adapter, with no button and no
external tool, checks the result by MD5, and skips unchanged images.
std/embedded/chip/esp32c6covers clocks (160 MHz from the PLL, set at
every start along with the PMU's active state, which survives resets),
GPIO on any pin through the GPIO matrix, the interrupt matrix, I2C and SPI
as master, polled (hal.I2cPoll,hal.SpiPoll), or target
(i2c_target,spi_target), SPI with the controller's own chip select
(spi_with_select) and by DMA (hal.SpiDma), both UARTs and the USB
serial port withserial.Portandserial.PollPort, CAN on both TWAI
controllers (hal.Can, new driverstd/embedded/peripheral/esp_twai),
I2S audio output and input by DMA (hal.I2sOutput,hal.I2sInput,
std/embedded/chip/esp_i2s), PWM outputs and inputs (hal.PwmInputon
the MCPWM capture unit,esp_capture), the ADC calibrated from eFuse, the
temperature sensor, the system timer's alarms as executor clocks, DMA
copies, and WS2812 LEDs, with new drivers
std/embedded/peripheral/esp_i2c,esp_spi,esp_uart, and
esp_usb_serial. The board contract'srng(the hardware generator, fit
for keys while no analog input is claimed,esp_rng),watchdog(timer
group 0's, withrp_watchdog's interface, reset reasons, and scratch
words,esp_watchdog),rtc(the low-power timer, which keeps counting
through resets, calibrated against the crystal,esp_rtc),flash
(rp_flash's regions above the program, forstd/embedded/storage,
esp_flash), andpower(std/embedded/power: clock gating on the 57
gates of the clock controller, everywfiwith the CPU clock stopped,
deep sleep as clock gating around each wait through a new weak
dodo_wait_for_interrupthook that the compiler calls forwfion
RISC-V, and a dormant state in the PMU's light sleep,esp_power) are all
there.std/embedded/board/esp32c6_devkitcmakes the RGB LED the board's
led. The portable board examples build unchanged,
examples/esp32c6_tasksshows tasks woken by the board's interrupts, and
scripts/test_esp32c6.pyruns a 51-check hardware self-test and, with
--project, 98 more checks of the buses, CAN, I2S, PWM input, system
services, and low power intests/hardware/esp32c6_*, which pass at -O0
to -O3. -
The ESP32-C6 hibernates:
b.power.hibernate(&wake)is the PMU's deep
sleep, which powers down everything but the LP system until the LP timer,
a level on GPIO 0 to 7, or the LP core wakes the chip, which then boots
again;wake_cause()andwake_pins()tell what woke it, and statics
placed with@section(".lp_noinit")keep their values in LP SRAM. The
chip's low-power core runs Dodo too: the new chipesp32c6_lpbuilds a
program for it withstd/embedded/chip/esp32c6_lp(LP IO pins ashal
pins, a delay on the LP timer, shared words, and waking the main core),
the newlp-coresetting (--lp-core) embeds it in an ESP32-C6 firmware,
andb.lp_core(esp32c6.LpCore) runs it once or periodically, also
while the main core hibernates, and reports its wake requests and panics.
tests/hardware/esp32c6_hibernatechecks both on the board across four
boots.take()now also clears the PMU's power-domain overrides, as
ESP-IDF's start-up does, so light and deep sleeps power down what their
states say whatever ran before. -
New driver
std/embedded/peripheral/esp_rmtfor the ESP32-C6's remote
control peripheral (RMT), the chip's counterpart to PIO for pulse trains:
pins.rmt_txandpins.rmt_rxclaim its two transmit and two receive
channels on any pin, with pulse trains asu32codes (esp_rmt.code,
esp_rmt.encode), ticks from 312.5 kHz to 80 MHz, and trains longer than
a channel's memory refilled or emptied while they run, blocking or polled.
Transmitters have a carrier, an idle level, and loops; receivers an idle
threshold, a glitch filter, and carrier demodulation.pins.ws2812keeps
its API but now runs on an RMT transmit channel, so it leaves the other
channels free, and takes chains of any length (more than seven LEDs need
an optimized build).tests/hardware/esp32c6_rmtadds 16 hardware
checks, which loop pulse trains from a transmitter to a receiver through
one pad and pass at -O1 to -O3. -
The ESP32-C6's serial ports receive by DMA:
port.dma(&mut rx, &mut ring)
returns anesp32c6.UartDmathat moves input into a ring buffer through
UHCI0 (new driverstd/embedded/peripheral/esp_uhci), with
available(),ring_size(), andOVERRUNonce the ring has filled, and
sends through the FIFO, as UHCI0's transmit side does not work on the
chip.pins.analog_stream(&channels, rate_hz, &mut dma, &mut buffer)
converts up to eight ADC inputs continuously, each at its own attenuation,
306 to 83 333 conversions a second, by DMA into a ring of samples
calibrated from eFuse (newstd/embedded/chip/esp_adc, on a GDMA
descriptor ring in the newesp_gdma), refusing and refused by one-shot
analog inputs.tests/hardware/esp32c6_dmachecks both on the board (17
checks). -
Functions placed with
@section, such as@section(".ramfunc"), are no
longer inlined into their callers, which would have run their code from the
caller's section instead. -
64-bit integer division in firmware takes one 32-bit division when both
operands fit in 32 bits, instead of 64 shift-and-subtract steps. -
std/gpu renders beyond one blended color target: mipmapped textures
(TextureDescriptor.mipmapped,Region.at_level,
CommandEncoder.generate_mipmaps), samplers with mipmap filtering, level
ranges, anisotropy, border colors and comparisons; depth-only pipelines
(RenderPipelineDescriptor.depth_only,CommandEncoder.depth_pass) with
depth bias, read through the newBindingLayout.comparison_texturefor
shadow maps; 4x multisampled render targets that resolve into ordinary
textures (TextureDescriptor.multisampled,ColorAttachment.with_resolve),
with alpha-to-coverage; several color targets per pass (ColorTarget,
render_pass_targets,Limits.max_color_attachments); and custom blending
(gpu.Blendfactors and operations, write masks,set_blend_constant).
Attachments can bediscard()ed after a pass. See
Textures and samplers and
tests/stdlib/gpu_feature_checks.dodo. -
gpu.wgsl("...")writes a std/gpu shader once in WGSL: the compiler
translates it into SPIR-V, Metal Shading Language and GLSL 4.50 when the
program is built (through thenagacrate, behind the new defaultwgsl
feature), so one source runs on Vulkan, Metal and OpenGL with no shader
tools installed. Mistakes are compile errors pointing into the literal.
Slot N is@group(0) @binding(N), and a sampled texture's sampler is
@group(1) @binding(N). See Shaders in WGSL. -
gpu.Surfacepresents std/gpu frames in std/window windows: a Vulkan
swapchain on Linux and Windows, the view'sCAMetalLayeron macOS, or the
window's own OpenGL context (from the newgpu.Device.open_for_window).
acquire()hands out a frame to render into,present()shows it, with
two or three frames in flight (gpu.SurfaceOptions) andresize()for
window size changes; the newgpu.Error.Outdatedasks for one. See
Surfaces and the new
examples/gpu_window.dodo. -
std/gpu no longer waits for the GPU to write data:
write_buffer,
write_textureandcreate_buffer_with_datacopy into a staging ring and
record the copy into a command buffer submitted ahead of the next
submission, still ordered as before. On Vulkan, buffers and images are
carved out of large memory blocks, buffers live in device memory (mapped on
unified-memory GPUs), and reads come back through host-cached memory.
DODO_GPU_UNMAPPEDmakes the Vulkan backend take the discrete-GPU paths
anywhere, for testing. -
std/gpu derives barriers from how commands use each buffer and texture
instead of placing a full barrier before every pass, copy and dispatch on
Vulkan (where render passes now record into secondary command buffers) or
after every pass and dispatch on OpenGL. Vulkan command pools are reused. -
The std/gpu examples write their shaders once in WGSL.
-
Arduino Uno support:
board = "arduino_uno"(or--board arduino_uno) on
the newatmega328pchip, an 8-bit AVR.dodo runflashes the board
itself through its Optiboot bootloader over the USB serial port, speaking
STK500 version 1 and verifying every page, so avrdude is not needed;
dodo buildwrites an.elfand an Intel HEX.hex.
std/embedded/chip/atmega328pandstd/embedded/board/arduino_unogive the
board contract's pins, timer, serial port (with a 32-byte interrupt-driven
receive buffer), I2C, SPI, PWM on all six PWM pins, the ADC and temperature
sensor, the watchdog, and the EEPROM, and board-generic programs such as
examples/blinkandexamples/serial_console.dodorun unchanged. The
compiler's AVR runtime is LLVM IR like the others: startup, a Timer 0 time
base, libgcc-compatible division and multiplication helpers, atomics, and
correctly roundedf32(native 32-bit code) andf64arithmetic. Panic
messages stay in flash rather than the 2 KiB of SRAM. AVR builds default to
-O 2and optimize for size.scripts/test_arduino_uno.pyruns the
board's self-test. -
Function values on targets whose code has its own address space, such as
AVR, use that address space: function pointers, closures,dynmethod
tables, and@interrupthandlers (which get AVR's signal ABI) compile for
AVR, andcore/cpu's interrupt control andwait_for_interruptwork there. -
std/windowhas the basics desktop programs such as text editors need.
app.set_clipboard_text(text)andapp.clipboard_text()copy and paste
text through the system clipboard (NSPasteboard, the Win32 clipboard,
and the X11 CLIPBOARD selection, which the App serves to other programs
from its event loop, with large texts in both directions and Latin-1
STRINGfrom older programs).win.set_cursor(window.Cursor.Text)and ten
other standard shapes set the pointer over a window.win.set_size,
win.set_min_sizeandwin.set_max_sizeresize a window from code and
limit the sizes the user can give it, andwin.set_fullscreen(on)and
win.is_fullscreen()switch to fullscreen: a fullscreen space on macOS, a
borderless window covering the monitor on Windows, and_NET_WM_STATEon
X11, where a window without a window manager covers the screen itself. See
the Windows guide. -
Global and naked assembly. Top-level
unsafe asm("...")is emitted into
the object file outside any function, for startup code, functions written
entirely in assembly, or tables.@nakedmarks anextern "C"function
whose body is oneunsafe { asm(...) }and which has no prologue or
epilogue, such as a fault handler that reads the stacked frame. Assembly
of every kind takes two new operands:sym namewrites the link symbol
of a function or static into the template (with Mach-O's underscore, and
keeping the definition even when only assembly uses it), andconst value
writes an integer constant expression. See
global assembly
and naked functions. -
Fixed: a struct field named
lenfailed code generation ("is not an
array or slice") because every.lenwas compiled as a collection length.
lenis now the built-in length only on arrays, slices and strings. -
Results with a value (
T!E) and enums with payloads return in registers.
The shared payload storage is now made of integer words instead of bytes.
Byte storage made ani64!Eresult nine separate return values to LLVM,
so it went through a hidden memory slot that the caller reassembled byte
by byte. A loop of 300 million non-inlinedi64!Ecalls runs in 0.36 s
instead of 1.52 s on an M-series Mac. Layout sizes and alignments are
unchanged. -
New database packages.
std/dbholds the shared vocabulary for drivers:
db.Errorwith portabledb.ErrorKinds anddb.Constraints plus the
driver's native code, the borroweddb.Value, anddb.IsolationLevel.
std/db/sqldefines thesql.Conn,sql.Row, andsql.RowSink
interfaces that every SQL driver matches, so generic code
(<C: sql.Conn>) and runtime-selected code (&mut dyn sql.Conn) work with
any of them. -
std/db/sqliteis an SQLite-compatible database engine written entirely in
Dodo, with no native library: it reads and writes SQLite 3 database files
(every page size, overflow pages, freelist, rollback journal with hot-journal
recovery, and SQLite's locking protocol), so the same file can be used by
SQLite itself at the same time. It runs inside a caller-owned workspace and
never allocates. SQL support covers tables, indexes (including SQLite's
automatic indexes), views, joins, subqueries, compound selects, common table
expressions includingWITH RECURSIVE, aggregates,GROUP BY/HAVING,
ORDER BY/LIMIT, UPSERT,RETURNING, constraints with conflict clauses,
AUTOINCREMENT,ALTER TABLE, transactions with statement-level rollback,
common pragmas, and SQLite's core, aggregate, and date/time functions with
its type affinity rules. Differential tests compare results and written
files against SQLite. See the new SQLite guide. -
@derive(Row)maps structs to SQL rows for anystd/db/sqldriver. It
generatesdecode_row<R: sql.Row>(row: &R) -> Self!db.Error, which matches
columns by name and borrows text and blobs from the row without copying, and
params(&self) -> [N]db.Valuefor statement parameters. Fields can be
integers, floats,bool,&str,&[u8],Option<T>for NULL, and custom
column types withdecode_value/encode_valuemethods.@db_name("column")
renames a column and@db_flattendecodes a nested Row struct for joins.
Conversions reportdb.ErrorKind.Typeerrors instead of trapping, and the
same helpers (sql.column,sql.int_in,sql.text, ...) are available
to hand-written decoders. -
Derives now go through a small registry in the compiler:
@deriveaccepts
a list (@derive(Json, Row)), and each derive declares the attributes it
owns, so misplaced or foreign attributes get precise errors. -
fs.File.try_lock_range(start, length, shared)andunlock_rangetake
non-blocking advisory byte-range locks (POSIXfcntlrecord locks through
the fs C adapter,LockFileExon Windows). -
String literals no longer conflict with borrows of
static mutstorage
(for example passing"literal"while holding&mut WORKSPACE[..]). -
.lenand indexing through a reference to a slice or string (such as the
&&[u8]amatch &valuebinds) no longer fail in code generation. -
std/script/luais a complete Lua 5.4 implementation written in Dodo,
for embedding scripts, configuration and plugins in Dodo programs. It
follows PUC Lua 5.4.9, including its error messages and the
LUA_COMPAT_5_3behaviour of a default build, passes the official Lua
5.4.9 test suite (except the parts that need the internalTlibrary),
and loads binary chunks from the referenceluac5.4. All standard
libraries are included;ioandoswrap the target's C library on
Linux, macOS and Windows. The embedding API mirrors the Lua C API: a stack,
native functions (lua.NativeFn) with argument checking, protected calls,
userdata with metatables, coroutines with continuations, Dodo modules for
require(preload_module), memory limits, warnings, hooks and Ctrl-C
interrupts. There is no C API, so C modules cannot be loaded. At-O 2
it runs thebenchmarks/luaset about 18% faster than the reference
interpreter.examples/luabuilds a standaloneluainterpreter
equivalent to the reference one, andexamples/lua_embedshows embedding;
the Lua guide covers both.
tests/lua_corpus.rsruns thetests/luacorpus against output recorded
from the reference interpreter. -
Functions take
@inline,@inline(never)and@coldattributes, which
optimized builds apply. Amatchon integer literals compiles to one LLVM
switch, and an interpreter loop of the shapefor { ...; match <u8> { ... } }
with at least 16 literal arms dispatches through a table of block addresses
(threaded dispatch). -
On Linux, constants that hold addresses (such as a
const NAME: &str)
are placed in.data.rel.rosections. They were in writable.rodata
sections, which GNU ld merged into the code segment, producing a
writable and executable segment and a linker warning. -
GPUs draw straight into
std/windowwindows:win.native_handle()returns awindow.NativeHandle(defined in the
new, dependency-freestd/window/handle):Xcb(connection, window, screen, visual)on Linux,AppKit(window, view)on macOS and
Win32(hwnd, instance)on Windows. On Linux the first call loads
libxcb.so.1at run time and opens a second connection to the X
server, since Vulkan and EGL cannot use std/window's own socket;
programs that never ask still need nothing beyond libc. Every window of
theAppshares that connection, which closes with theApp.window.Options.gpu(title, width, height)opens a window without a
pixel buffer, andOptionsgains thepixel_bufferfield (struct
literals must now set it). Its
canvas()is empty andupdate()fails withUnsupported.
win.has_pixel_buffer()tells the two kinds apart.win.metal_layer()gives a GPU window's view aCAMetalLayeron macOS,
for Metal and Vulkan'sVK_EXT_metal_surface. std/window keeps its
drawable size and contents scale in step with the window.opengl.Context.create_for_window(&native, options)draws into a
window's framebuffer 0 through EGL's XCB platform (or Xlib and EGL's X11
platform), anNSOpenGLContextor WGL, withswap_buffers(),
set_swap_interval()andupdate_surface().examples/opengl_window.dodonow presents its frames directly instead of
reading them back through the CPU, andexamples/vulkan_window.dodoand
examples/metal_window.dododraw a spinning triangle with Vulkan (XCB,
Win32 and Metal surfaces, rebuilding the swapchain on resize) and Metal.
-
std/graphicsstrokes paths:canvas.stroke_path(&path, &style, color)
paints a band of the stroke's width along a path, as borders, chart lines
and icons need. Agraphics.Strokesets the width (in subpixels), miter,
round or bevel joins with a miter limit, butt, round or square caps, and a
dash pattern with an offset, with the defaults of SVG and the HTML canvas.
Open subpaths get caps,closejoins, zero-length subpaths are dots, and a
closed subpath's last dash joins its first. Strokes stay integer-only and
exact like fills: a stroke along pixel edges covers whole pixels, and a
translucent stroke paints each pixel once where it overlaps itself.
stroke_outlinestrokes anygraphics.Outline, TrueType glyphs included,
gradient_stroke_pathandgradient_stroke_outlinepaint with a gradient,
andgraphics.Strokedis a stroke as an outline of its own for coverage
masks. Work follows what is visible: segments, joins, caps and dashes
outside the clip rectangle are skipped, even for strokes far wider than
the canvas. A new golden image covers every join, cap and dash. -
Persistent storage for firmware.
hal.Flashis a device protocol for NOR
flash (erase blocks to0xFF, then write erased bytes once), and
std/embedded/storagebuilds on it:storage.Store, a key-value store
with text keys and byte values (get,set,remove,contains,
len_of,get_u32/set_u32, key listing,clear), and
storage.Region, a window of any flash device. The store is a log over
2 to 64 erase blocks with even wear and compaction; every record has a
CRC-32 and is verified, writes never touch written bytes, and a power cut
at any point loses at most the operation in progress. On the RP2040 and
RP2350,b.flash(std/embedded/chip/rp_flash) reads the flash and hands
out regions above the program, which reflashing keeps: the chip runtimes
erase and program through the boot ROM, from SRAM with execute-in-place
restored by a copy of.boot2on the RP2040 and throughflash_opon the
RP2350, with interrupts masked, and refuse while core 1 runs a task.
fake.Flashchecks the protocol strictly and can cut the power mid-write
for tests, which sweep power cuts over every erase and write of a long run.
examples/boot_counter.dodocounts restarts, and the Pico self-tests check
regions, writes, and a store on the flash. -
std/windowsupports several windows per process, for dialogs, popups
and tool windows. This changes the API: awindow.Appconnects to the
window system and runs the one event loop,app.open(options)opens any
number of windows, andapp.wait_event(),poll_event()and
wait_event_timeout()return the events of all of them. EveryEvent
variant now starts with theWindowIdof its window (win.id(),
window.event_window(&event)); ids are never reused within a process.
Animation asks per window:win.request_frame()delivers one
Event.Frame(id)at that window's next display refresh, with the same
pacing as before, replacingwait_event_until_frame(). Command-Q on macOS
now reports the app-levelEvent.Quitinstead of closing the window.
Windows do not borrow their App, and each owns its pixel buffer, which is
only resized inside the window's own calls.window.openis gone; use
window.App.new()?andapp.open(...).examples/window_palette.dodo
paints with colors picked in a second window. -
Fixed: X11 focus events took their mode from the wrong byte, so focus
changes caused by pointer and keyboard grabs were reported too. -
async fnandawait: an optional concurrency model for firmware on top of
std/embedded/executor. Calling an async fn returns a future, a struct
named after the function (blink→BlinkFuture) whosepollis the
executor's task method, so async and hand-written tasks run side by side;
awaitwaits for another future and yields itsoutput. The compiler
generates the state machine: the body's locals live in the future, so
references between them survive suspensions, and dropping an unfinished
future drops what it holds. Methods and generic functions can be async.
awaitbegins its statement, possibly followed by?,!, oras; a
started future traps if polled after moving, and a future that would hold
itself is rejected. The executor gains the futures async code waits on:
sleep_ms,sleep,sleep_until,yield_now,now,Ticker.tick,
Signal.wait,Signal.next_value, andselectandjoinfor two
futures.examples/async_tasksisexamples/taskswritten with them. -
std/embedded/sync:Mutex<T>shares values between interrupt handlers,
tasks, and cores from a plain static, withoutstatic mutorunsafe.
lock()masks interrupts on this core and returns a guard;with,
set,replace, andtry_lockcover the rest, and locking a mutex this
core already holds traps. All mutexes lock through one nesting
system-wide section,sync.enter(). On the RP2040 and RP2350,
Core1.startinstalls hardware spinlock 31 as its cross-core lock, so
the same mutex also holds off the other core; spinlock 31 is no longer
handed out bySpinlocks.examples/interruptsuses mutexes now. -
The RP2350's doorbells:
b.doorbellson the Pico 2 and Pico 2 W hands out
the eight doorbells between the cores.ring()interrupts the other core,
andset_signalmakes the runtime's newSIO_IRQ_BELLhandler raise an
executor signal there, to wake a task on the other core without the FIFO. -
Random numbers for firmware:
std/embedded/halgains theRng
protocol (fill(bytes)), withrandom_u32,random_u64, and the unbiased
random_below, andhal.SoftRng, a xoshiro128** generator seeded from a
hardware one withfrom_rngor from a fixed seed withnew.
hal/fakegainsfake.Rng. Every board hasb.rng, and the chip packages
Peripherals.rng, from the newstd/embedded/chip/rp_rng: on the RP2040,
rp_rng.Roscsamples the ring oscillator's RANDOMBIT about every 10 us and
debiases it with von Neumann's method, about 3 KB a second and not for
keys; on the RP2350,rp_rng.Trngruns the TRNG with its hardware
debiasing and all health tests on, about 20 KB a second and fit for keys,
restarting it after failed autocorrelation tests and keeping a block's
unused bytes for the next fill. A stopped source reportsTimeoutand
failing health checksBus. Both drivers are generic over
hal.Registersand tested against simulated registers on the desktop. -
std/gpu: portable GPU compute and rendering on Metal, Vulkan and
OpenGL, written in Dodo on top ofstd/gpu/metal,std/gpu/vulkanand
std/gpu/opengl. It follows WebGPU's model: aDevicecreates buffers,
2D textures, samplers and compute and render pipelines; a
CommandEncoderrecords compute passes, render passes and copies;
submit()runs them in order, andwrite_buffer,read_buffer,
write_textureandread_texturemove data in queue order.
Device.openpicks Metal on macOS and Vulkan elsewhere, falling back to
OpenGL 4.5. Shaders come as SPIR-V, MSL and GLSL in oneShaderSource,
with numbered binding slots that mean the same in every language, and
clip space, depth range, winding and texture rows agree on every backend.
Every call is checked (usages, ranges, pipeline layouts and attachment
formats, workgroup limits, and SPIR-V entry points), and resources dropped
while the GPU may still use them are destroyed once it has finished.
Backends implement thestd/gpu/halinterface;std/gpu/hal/native
selects the OS's own API. A fixture runs the same compute, rendering,
depth, sampling, blending, copy and lifetime checks on Metal, on Vulkan
with lavapipe and on OpenGL with llvmpipe, clean under the Vulkan
validation and synchronization layers and Metal's debug layer.
examples/gpu_compute.dodoandexamples/gpu_triangle.dodoshow compute
and a window. The Vulkan guide moved to its own page, and
std/gpu/openglnow declaresdlsymandGetProcAddresswith the
pointer resultsstd/dylibuses, so one program can load both. -
Large values loaded whole and stored after code that may write their
source, such as a big struct returned in aResultwhile locals with
drops are still alive, are now copied aside in memory instead of being
split by LLVM into one operation per byte. Such functions took minutes to
compile at -O1 and above. -
Fixed:
Fifo.set_signaland the FIFO interrupt hook of
std/embedded/chip/rp_multicorewrote 0 toFIFO_STto clear its sticky
WOF and ROE flags, which only a 1 clears. A flag left set, such as the ROE
that core 1's boot ROM leaves while it waits to be launched, kept the FIFO
interrupt raised, so an executor waiting for FIFO words could spin instead
of sleeping. -
CI runs firmware on emulated RP2040 and RP2350 chips: a self-test of the
startup runtime, the integer and floating-point helpers, interrupts,
SysTick, timer alarms, the executor, DMA, PIO, a UART, and the second core
with its FIFOs and spinlocks, at -O0 and -O2.scripts/test_emulator.py
buildstests/emulatorand runs it inemulator/, a runner around the
picoem emulator crates with fixes inemulator/patches; it takes seconds. -
Real-time clocks share one protocol in
std/embedded/hal:hal.Rtcreads
and sets the time as Unix milliseconds andhal.RtcAlarmfires once at a
time, withhal.rtc_now,rtc_set,rtc_alarm_at, andrtc_alarm_in
converting to and fromstd/time'sDateTime. Every board hasb.rtc:
the RP2040's RTC, clocked from the crystal and counting seconds, and the
RP2350's always-on timer, a millisecond counter that keeps counting through
resets. The register-level drivers are instd/embedded/chip/rp_rtc, with
RTC_IRQ and POWMAN_IRQ_TIMER raised by their alarms.
std/embedded/rtc/ds3231drives a battery-backed DS3231 clock chip on I2C
through the same protocols, andfake.Rtctests clock code on a desktop.
The Pico self-tests check the clocks and their alarms on the boards. -
std/embedded/halsettles its device protocols before a second chip
vendor arrives, so drivers written now keep working:- Polling forms of the buses,
hal.I2cPoll,hal.SpiPoll, and, in the
newstd/embedded/hal/serial(which keepshalfree ofstd/io),
serial.PollPort, never wait: each call does what the hardware allows
and returns true once the operation has finished, keeping its state in
the bus rather than in borrowed buffers, so transactions may be any
length and run across an executor task's polls.hal.BlockingI2cand
hal.BlockingSpiturn a polling-only controller into a blocking one, and
hal.SpiDevicekeeps a device selected across polls.serial.Portadds
flushto std/io's streams. - Target sides:
hal.I2cTargetwithhal.I2cTargetEvent, and
hal.SpiTarget. - Pulse measurement:
hal.PwmInputandhal.PulseCapture(period, high
time, frequency, duty). - CAN:
hal.Can,hal.CanFrame(standard, extended, remote, and CAN FD
frames, checked as they are set),hal.CanFilter,hal.CanErrorState,
andhal.can_timing, which computes bit timing within any controller's
limits. - I2S:
hal.I2sOutputandhal.I2sInputwith MSB-alignedi32samples
andhal.I2sFormat. - Background transfers:
hal.DmaBufferandhal.SpiDmafor sessions that
hold a buffer,hal.DmaStream, the DMA-backed session every peripheral
driver needs, written once againsthal.DmaChannel, andhal.dma_copy. - Helpers that wait with a poll limit:
hal.capture,hal.send_frame,
hal.receive_frame,hal.write_samples,hal.read_samples, and
hal.finish_transfer. std/embedded/hal/fakegains a fake for every new protocol, polled
modes forfake.I2c,fake.Spi, andfake.Serial, and
fake.DmaChannel, which runs DMA transfers in host memory.
- Polling forms of the buses,
-
The RP2040 and RP2350 implement the new protocols: the DesignWare I2C
bushal.I2cPollfor transactions of any length (replacing the
FIFO-sizedstart_*/poll_finishmethods), with an interrupt whenever a
poll can make progress; I2C targetshal.I2cTarget(the driver's own
TargetEventis gone); PL022 SPI buseshal.SpiPoll, targets
hal.SpiTarget, andpl022.DmaBushal.SpiDmawithpoll_finishand
abort; serial ports and the USB serial portserial.Portand
serial.PollPortwithpoll_flush. -
pins.pwm_input(pin, window_us)measures pulses on an odd GPIO with a PWM
slice's counting modes, as ahal.PwmInput: the frequency and duty of a
PWM signal, a fan's tachometer, or a servo pulse, to within microseconds. -
std/embedded/chip/rp_i2splays and records I2S audio on PIO, as
hal.I2sOutputandhal.I2sInput: Philips, left- and right-justified
framing, 16 to 32-bit samples, mono or stereo, a fractional clock reported
with its error in ppm, silence instead of swapped channels when the queue
runs dry, and playback by DMA throughhal.DmaStream. -
std/embedded/can/mcp2515drives the MCP2515 CAN controller over any SPI
bus as ahal.Can, so boards without a CAN controller, such as the Pico,
get CAN: bit timing from the crystal, filters mapped onto its masks,
frames sent and received in order, overrun and error states, and its
interrupt pin. -
std/embedded/poweris one low-power layer for every chip: sleep and deep
sleep modes that every wait honours, including timer alarms and the
executor; clock gating withpower.Clockssets; and a dormant state, with
every oscillator stopped, that pins in apower.Wakeend. The RP2040 and
RP2350 implement itsPowerprotocol asPeripherals.power, and every board
hands it out asb.power. The chips name each clock gate
(CLOCK_UART0,ALARM_CLOCKS,ESSENTIAL_CLOCKS, ...).
disable_unused_clocksstops the clocks of unclaimed peripherals, and
claiming a peripheral starts them again.disable_clocksrefuses clocks
the program needs or a claimed peripheral uses.dormantruns from the
crystal, stops the PLL and both oscillators, and restores clk_sys on wake.
fake.Powertests power-aware code on a desktop.
cortex_m.set_deep_sleep,set_sleep_on_exit, andset_event_on_pend
expose the core's SCR. The self-tests gain on-board checks, and
examples/low_power.dodoshows all three levels. -
std/embedded/halgains a shared timer protocol:Counter(now_us), a
free-running microsecond count, andAlarm(now_us,schedule_at_us,
cancel,fired,clear), a one-shot compare that fires at once for a
time already reached.hal.Deadlineandhal.Tickergive drivers
timeouts and drift-free periodic work on any counter, with
elapsed_us,wait_until,schedule_in_us, andwait_for_alarm
helpers. Board timers are counters, and the RP2040 and RP2350 alarms
implement the alarm protocol for times up to 35 minutes ahead, forcing
their interrupt when a time has passed before the alarm was armed.
std/embedded/hal/fakegainsAlarm, andfake.Delayis a counter whose
time is the delays asked of it, so timeouts are tested without waiting. -
Watchdog for the RP2040 and RP2350:
b.watchdogon every board (and
watchdogin the chips'Peripherals) is astd/embedded/chip/rp_watchdog
Watchdog. It is stopped aftertake().start(timeout_ms)makes it reset
the chip unlessfeed()is called in time, from 1 ms up to 8388 ms on the
RP2040 (whose count runs twice per tick, erratum RP2040-E1) or 16777 ms on
the RP2350.stop(),remaining_us(), andrestart()for a deliberate
reset complete it. The reset restarts everything but the oscillators, and
the count pauses while a debugger halts a core.reset_reason()reads
hal.ResetReason.Timeout,Restart, orOther. A Pico SDK-style mark tells
the program's watchdog resets apart from the boot ROM's, so the first run
after flashing readsOther. Twoscratchwords survive the reset.
std/embedded/halgains theWatchdogprotocol (feed), so drivers and
tasks can feed any chip's watchdog. Desktop tests run the driver against a
model of both chips' watchdogs, and the board self-tests gain a watchdog
check. -
std/gpu/openglcreates OpenGL contexts without a window, and
std/gpu/opengl/glbinds the complete OpenGL 4.6 core profile (656
commands, 1364 enums), generated from the Khronos registry by
scripts/generate_opengl.py. Both are pure Dodo with no C runtime: each
OS's interface is opened at run time (EGL on Linux, surfaceless and without
an X server; CGL on macOS; WGL with a hidden window on Windows), so programs
link no graphics library and start on machines without one.
opengl.Targetis an offscreen framebuffer whose pixels read back in
std/graphicsrow order, as RGBA or as the BGRA astd/windowcanvas uses;
examples/opengl_window.dodoshows a shaded triangle in a window. A
fixture renders and reads back a triangle with Mesa's llvmpipe in Linux CI
and with CGL on macOS. -
std/gpu/metalbinds Apple's Metal API on macOS (Apple silicon and Intel)
entirely in Dodo, with no C runtime: each method is anobjc_msgSend
declared with its own signature. It covers devices, command queues,
command buffers, compute, render and blit encoders, buffers, textures,
samplers, shader libraries from source or.metallibdata, compute and render
pipelines, vertex, depth-stencil and render-pass descriptors, fences,
events andCAMetalLayer. Objects release on drop, and compile and
pipeline errors carry Metal's message. Buffer and texture copies check
their ranges, and binding indices are bounds-checked.std/gpu/metal/objc
exposes the Objective-C runtime layer for methods the module lacks. Loading
the package links Metal, QuartzCore, Foundation and libobjc, and importing
it for a non-macOS target is an error. The test suite runs compute,
rendering and readback on the GPU, including x86-64 under Rosetta, and
checks every constant against the SDK headers. -
truetype.GlyphCachekeeps rasterized glyphs in caller-provided storage,
so text drawn again is blended instead of rasterized: about 13 times
faster at 14 pixels and 6 times faster at 96. It draws likeFont.draw
except that glyphs are placed to a quarter pixel, and a full cache evicts
its oldest glyphs.std/graphicsgains the coverage calls it is built on:
outline_bounds,coverage_maskwithCanvas.fill_maskand
gradient_mask, and the run-lengthcoverage_spanswith
Canvas.fill_spansandgradient_spans, all drawing exactly what
fill_outlinedraws. -
std/gpu/vulkan: the Vulkan API in pure Dodo, one to one like Rust's
ash, as the bottom layer for the portablestd/gpu. Constants,
handles, enums, bitmasks, structs and the command tables are generated from
the Khronos registry byscripts/generate_vulkan.pyand cover core Vulkan
1.0 to 1.4, the Xlib, XCB, Wayland, Win32, Metal and headless surfaces,
swapchains, portability (MoltenVK) and debug utils. Nothing is linked:
vk.open()loadslibvulkan.so.1,vulkan-1.dllor the macOS loader or
MoltenVK at run time and resolves every command through
vkGetInstanceProcAddr/vkGetDeviceProcAddrintoextern "C" fnfields
ofEntryFns,InstanceFnsandDeviceFns. Structs have adefault()
withs_typeset, and helpers cover Result checking and names, API
versions, name fields and clear-value unions. All 2,572 struct sizes,
alignments and field offsets match the C headers
(scripts/vulkan_layout_check.py), andexamples/vulkan_compute.dodoruns
a compute shader on Mesa's lavapipe. -
std/dylibopens shared libraries at run time (dlopen on Linux and macOS,
LoadLibrary on Windows) and looks up their symbols; Linux builds that use
it also link libdl for glibc before 2.34. -
&mut Tparameters of Dodo functions, methods and closures arenoalias
in LLVM, as Rust's are, so optimized code no longer reloads fields of
selfafter every store through a slice or pointer it holds. A loop that
fillsself.datanow compiles tomemsetinstead of reloading and
bounds-checking the slice per byte, without the local-subslice workaround.
The flow checker already guarantees exclusivity for safe code. Unsafe code
must not reach storage passed as&mutby another route until the call
returns (spec PTR-ALIAS). Shared references stay unmarked because atomics
may change shared storage, and so do&mut dynpairs, slices and C
functions. -
std/graphicssolid fills and same-format blits are 9–35× faster at -O2
(1280×800clear1.4 ms → 0.06 ms, full-frameblit2.3 ms → 0.07 ms).
Their loops now store through a local row subslice, which the optimizer
turns into vector stores andmemcpy. -
@link_name("symbol")binds anextern "C"prototype to a symbol other
than its own name, and several prototypes may bind one symbol with different
signatures. Each call uses its own declaration's signature, so Objective-C
bindings can declare oneobjc_msgSendper method signature. Without
@link_name, clashing signatures for one symbol are still an error. -
extern "C" fn(A) -> Ris a C function pointer type, for code that uses the
platform C calling convention: pointers fromdlsym,GetProcAddressor
vkGetInstanceProcAddr, COM method tables, and callbacks passed to C. An
extern "C"function used as a value now has this type instead of being
rejected. Calls through one needunsafeand follow the C convention,
including narrow-integer extension, and unsafeasconverts between C
function pointers, raw pointers andusize. The type never converts to or
from Dodo'sfn(..)and closure types, which keep their internal ABI. C
declarations may take and return C function pointers. -
extern "C"functions pass and return@repr(C)structs by value, both
when Dodo calls C and when C calls a Dodoextern "C" fn. The compiler
classifies each struct as the target's C compiler does for x86-64 System V
(Linux, macOS), Windows x64 and AArch64 (Linux, macOS, Windows), so calls
such as Metal'sdispatchThreadgroups:threadsPerThreadgroup:with
MTLSizeneed no C shim. Struct fields must themselves be C types, and
structs with destructors are rejected. Other targets report an error for a
struct by value. A fixture checks every classification case against the
host C compiler, including structs that move to the stack when registers
run out. -
Antialiased drawing, gradients and TrueType text for
std/graphics, still
integer-only, allocation-free and identical on every target, firmware
included. Theaa_canvas calls draw lines, thick round-capped lines,
circles, ellipses, rounded rectangles and polygons with exact
per-pixel coverage, composited over the canvas; axis-aligned ones match
their integer counterparts pixel for pixel.graphics.Pathstores move,
line, quadratic and cubic commands in caller-owned words, and any type
with atrace(&self, pen)method is agraphics.Outlinedrawn without
storage, filled by the nonzero or even-odd rule. The rasterizer's cost
follows a shape's edges rather than its bounding box: an outline is
flattened once, coverage is computed only in pixels an edge crosses, and
interiors are filled as whole spans.graphics.Gradientpaints
linear and radial gradients with up to eight stops, premultiplied
interpolation, pad/repeat/reflect spreads and optional ordered dithering
for RGB565 and monochrome panels.std/graphics/truetypereads.ttfand
.ttcfonts in place and draws them at any size with kerning and subpixel
positioning, decoding glyph outlines straight from the font data (simple
and composite glyphs, cmap formats 0, 4, 6 and 12). Coverage, symmetry,
band rendering and hostile-font fuzzing are checked at-O0and-O3, and
for WebAssembly and Cortex-M0+; new golden images cover the antialiased
shapes, gradients and text from generated test fonts. -
std/graphics/imagereads and writes PNG. The decoder handles every color
type and bit depth (1 to 16 bits), palettes,tRNStransparency and Adam7
interlacing, checks every chunk CRC and the zlib checksum, and ignores
gamma and color profiles.decode_pnganddraw_pngtake caller scratch
ofpng_scratch_sizebytes;decodeanddrawuse 16 KiB of stack.
encode_pngwrites uncompressed 8-bit RGBA of exactlypng_sizebytes,
andencode_png_compressedadds per-row adaptive filters and deflate with
caller storage.examples/poster.dododraws a poster with a TrueType font
and saves it as a PNG. -
Fixed: the deflate encoder wrote wrong codes for literal bytes 144 to 255
in fixed-Huffman blocks, corrupting small compressed outputs that contained
such bytes. -
std/windowopens a desktop window whose drawing area is a
std/graphicscanvas, using only what each system ships: the X11
protocol spoken directly over the display socket on Linux (libc only, no
Xlib), AppKit through the Objective-C runtime on macOS, and user32/gdi32
on Windows.win.canvas()lends out the window's pixel buffer and
update(dirty)shows the part that changed; the window also implements
graphics.Display. Events are polled withwait_event,poll_eventor
wait_event_timeout: close requests, resizes, focus, physical keys named
by their US-layout position, layout-aware text, mouse moves, buttons,
leaving and scrolling. Sizes follow the system scale on high-density
displays, with the canvas in physical pixels andscale()reporting the
factor.std/window/x11holds the protocol encoders and parsers as pure
functions that build for every target.dodo runneeds no flags or
system packages. -
std/windowpaces animation:wait_event_until_frame()returns events as
they arrive andnoneonce per display refresh, so a steady stream of
mouse moves no longer holds frames back, andframe_interval()gives the
refresh period. Frames follow the display where the system reports it: a
CADisplayLinkon macOS 14 and later, DWM's refresh timing on Windows and
the X11 Present extension on Linux, with a timer elsewhere. Animating
programs on macOS are exempt from App Nap until they callwait_event()
again, and Windows waits use a high-resolution timer instead of the
15.6 ms system tick.examples/window.dodouses it and moves the ball by
time, at the same speed on 60 and 120 Hz displays. -
MQTT 3.1.1 packages for both ends of a publish/subscribe system, in the
style of the web packages.std/mqtt/brokerruns a broker in one line,
broker.new().run(b"0.0.0.0:1883"). It serves 16 clients from one thread
with QoS 0 to 2, wildcards, retained messages, wills, keep-alive and session
takeover..password(user, pass)or.authenticate(value)controls who may
connect, and.on(filter, handler)handlers see every published message.
std/mqtt/appis a long-running client:
app.new(id).on(filter, handler).every(ms, task).status(topic).run(url)
subscribes, calls each matching handler with the message and an outbox for
replies, runs timers, keeps a retained online/offline status, and
reconnects with backoff. Both builders check filters before connecting.
Theirbuild()results test handlers and tasks in process with
deliver/publish/tickand chainablemqtt.Deliveryassertions.
std/mqtt/hostedis the step-by-step blocking client underneath
(connect,publish_with,subscribe,receive,poll).std/mqtt
holds the sharedMessage,Outbox,reply/forwardhandlers, packet
encoders and decoders for both sides, and topic matching, and stays
portable to WebAssembly and bare-metal targets. Spec-derived packet vectors,
a scripted loopback broker, raw-socket checks of the Dodo broker, and an app
talking to it check everything at-O0and-O3. TLS (mqtts://) and
MQTT 5 are not supported yet. -
Display panels:
std/embedded/display/st7789drives ST7789 colour panels
(240x240, 240x320, 135x240, 240x280, 172x320 and 170x320, in four
rotations) andstd/embedded/display/ssd1306SSD1306 OLED panels (128x64,
128x32, 96x16, 64x48 and 72x40). Both implementgraphics.Displayand
send only the dirty rectangle, so drawing code tested against
fake.Displayruns unchanged on a panel. They talk through
std/embedded/display'sSpiInterface(an SPI bus with a data/command
pin) orI2cInterface, or any value with thedisplay.Interface
methods.canvas.set_origin(x, y)places a canvas at a point of a larger
screen, andgraphics.Bandsmoves one down the screen band by band, so
frames bigger than RAM are drawn with the same code; displays now accept
canvases that cover part of them and ignore what lies outside. The
thermometer examples show the chip's temperature on an ST7789 panel, and
examples/oled_demo.dodoanimates a 0.96" SSD1306 module on I2C. -
QUIC connections and streams, through OpenSSL 3.5's QUIC stack:
std/quic/opensslbinds aListeneron a UDP socket and connects a
verifiedConnectionto it, each opening and accepting bidirectional and
unidirectional streams that send, receive, conclude with FIN, and reset
with an application code. Every call is nonblocking;waitsleeps until a
datagram or the next protocol timer, andtimeout_mshands that timer to
another poller. Connections require ALPN, verify the server's hostname or
IP, support mutual authentication and an idle timeout, and close with an
application code that the peer reads fromclose_info. Streams also
implement thestd/iopolling contract. The portablestd/quicpackage
holds the error and state types, and compiles for freestanding targets. -
std/graphicsdraws into caller-owned pixel storage on every target,
firmware included, with no allocation, operating system or floating
point: lines, rectangles, rounded rectangles, circles, ellipses and
even-odd polygons, outlined or filled, plus text, canvas-to-canvas copies
with format conversion, and alpha blending. Canvases come in RGBA, BGRA,
big-endian RGB565, 8-bit gray and 1-bit formats, clip every call, and
track the rectangle each call changed, so a display can be sent only what
changed. Rendering is integer-only and gives the same pixels everywhere.
std/graphics/fontadds 6x8 and 8x16 bitmap fonts for ASCII and Latin-1,
std/graphics/imagedecodes PPM/PGM, QOI and BMP and encodes PPM, QOI
and BMP into caller buffers, and thegraphics.Displayprotocol with the
in-memorystd/graphics/fakedisplay lets drawing code be tested under
dodo test. Golden images intests/graphics/golden/pin the output. -
PIO on the RP2040 and RP2350:
std/embedded/chip/rp_piodrives the chips'
programmable I/O blocks, andrp_pio.assembleassembles PIO programs
when the firmware is compiled, from string literals in the language of the
Pico SDK's pioasm, so SDK.pioprograms work unchanged and a mistake is a
compile error at its line. The assembler exists only in firmware for these
chips and checks each program against the chip's PIO version, so the
RP2350's additions (mov pindirs, RX FIFO registers, neighbouring blocks'
IRQ flags,wait jmppin) are errors on the RP2040.pins.pio(n)claims a
block andpins.pio_pinshands it GPIOs; a block loads programs into its
instruction memory, relocating their jumps, and hands out its four state
machines, which are configured from the program's directives, take and
give words through their FIFOs, execute single instructions, and raise
the block's interrupts.examples/ws2812.dododrives WS2812 LEDs, and the
board self-tests gain three PIO checks. -
The RP2040 and RP2350 run code on their second core.
b.core1.start(&mut stack, task)runs a task value'srun(self)method on core 1, with the
task and the stack in memory the program provides, until the returned
handle is dropped or stopped, which holds core 1 in reset again. Tasks are
checked likestd/threadtasks, so they own what they hold and carry no
references. On the RP2350 the stack's bottom is core 1's stack limit, and
core 1 enables its FPU and double-precision coprocessor as core 0 does.
b.fifos.claim()hands out each core's end of the hardware FIFOs between
the cores, andb.spinlocks.claim(n)the hardware spinlocks, whose guard
also masks interrupts on the holding core. On the RP2350, the spinlocks that
erratum RP2350-E2 can unlock are never handed out. Each core can run its own
std/embedded/executor: signals now belong to the core that raises and
takes them, andfifo.set_signal(&signal)wakes a task when the other core
writes, through the chip runtime's default FIFO interrupt handler. The new
cpu.core_id()intrinsic returns the executing core's number:mhartidon
RISC-V, the chip runtime'sdodo_core_idon a Cortex-M, and 0 on hosted
targets.examples/two_cores.dodosearches for primes on core 1 and reports
them from core 0, and the board self-tests gain three checks of core 1, the
FIFOs, and spinlocks. -
New portable compression packages read and write DEFLATE
(std/compress/deflate), zlib (std/compress/zlib), and gzip
(std/compress/gzip) through caller-supplied buffers, without allocating.
encode(input, output, level)compresses at levels 0 through 9 with lazy
LZ77 matching and optimal Huffman codes, choosing the smallest of stored,
fixed, and dynamic blocks; its output matches zlib's size, and
max_encoded_lenbounds it.decodechecks the Adler-32 or CRC-32 and
stops after one stream or gzip member. Each package also has incremental
DecoderandEncodertypes for buffers of any size, gzip headers can
carry a name, comment, and time, andstd/compress/ioadapts all three
formats tostd/ioreaders and writers. -
Records larger than 1 KiB passed, returned, or moved by value compile as
memory copies at every optimization level. Before, LLVM split them into
one operation per element: a 256 KiB struct took minutes and gigabytes of
memory to build at-O 2and needed about 10 MB of stack at-O 0. Root
package public functions now pass such records through memory like other
Dodo functions. -
Ownership is checked on each function's control-flow graph, for every body
the compiler accepts: initialization, moves, borrows, escapes, destructor
order, and Result obligations. The earlier checker that ran beside it, and
covered every body the graph could not yet represent, is gone. Liveness now
follows each binding exactly: a borrow ends at its last use even across
shadowing and loops, and a conflict names the binding that holds the
borrow and points at its next use. Some programs the old checker rejected
because of its approximations now compile, such as a mutable slice
&mut a[..]iterated and written in place. Some errors are reported
differently: type errors come before ownership errors, and a use after a
move into a value block is now reported as one. -
A cryptography package.
std/crypto/randomreads the operating system's
CSPRNG (getrandom,SecRandomCopyBytes,BCryptGenRandom) with no
user-space generator or fallback. It fills buffers, draws unbiased values
below a bound, and providesSystemRandom, a source for
hash.obtain_key.std/crypto/opensslwraps OpenSSL 3.5+ libcrypto:
incremental SHA-1 and SHA-256, HMAC-SHA256 with constant-timeverify,
AES-128-CFB8 encryptors and decryptors for streams split at any byte, and
RSA key generation with PKCS#1 v1.5 encryption and decryption (OpenSSL's
implicit rejection on) plus SubjectPublicKeyInfo DER export and import.
std/cryptoholds the shared error type, constant-timeequaland
wipe, and stays portable. Entropy-only programs link no OpenSSL, and the
libcrypto backend links no libssl. Published FIPS, RFC 4231 and NIST
vectors, plus RSA exchanges in both directions with theopensslcommand,
check it at-O0and-O3. -
Native adapter areas may be nested, as in
std/crypto/openssl/native. -
forbid-unsafe = truein a manifest's[project]table rejects every
unsafekeyword in the project's own sources, including imported local
packages anddodo testdocumentation examples. The standard library and
board and chip packages are exempt. Build, check, run, and test stop with
every location, and the language server reports each one. -
@unsafe_sendand@unsafe_syncnow require the struct to be declared
unsafe(@unsafe_send pub unsafe struct Owner), since they are unchecked
promises;unsafeon a struct without either contract is an error. Add
unsafeto existing annotated structs. -
std/signaldeliversSIGINT,SIGTERMandSIGHUP, and Ctrl-C,
Ctrl-Break and console close on Windows, into a program's poll loop:
signal.listenqueues each selected signal in arrival order instead of
letting it end the process, and the listener registers a wake channel in a
std/net/nativePollSetnext to the program's sockets. A listener is
also a cancellation source, so SIGTERM endsreactor.serve_withwith its
report. The wake channel is a self-pipe on Linux and macOS (signalfd would
block the signals, and child processes would inherit that mask) and a
loopback socket pair on Windows.PollSet.add_rawregisters other
descriptors that a program owns. -
f64arithmetic on the RP2350 runs on its double-precision coprocessor
(DCP), with no change to programs: division takes about 90 cycles instead
of 1300, addition about 45 instead of 260, multiplication about 60 instead
of 200, and conversions betweenf64andf32or 32-bit integers a
third to a tenth of their software time. Results are bit for bit those of
the software helpers, subnormals included: the cases the coprocessor
flushes to zero are computed in software, and NaN results stay the default
NaN. The helpers save and restore the coprocessor's state when one
interrupts another, sof64stays safe in interrupt handlers.
scripts/test_rp2350_float.pycompares them with the software helpers on
a Pico 2 or Pico 2 W, on 1.8 million edge-weighted operands while
interrupts preempt them, and times both. -
DMA on the RP2040 and RP2350:
b.dma.channel()claims one of the chip's
12 or 16 channels,claim(n)a given one, andrelease(channel)gives it
back.channel.copycopies buffers, andchannel.set_signal(&SIGNAL)
wakes executor tasks when a transfer ends, from a defaultDMA_IRQ_0
handler in the chip runtimes. The driver,std/embedded/chip/rp_dma,
finds each peripheral's data request from the register a transfer reads or
writes, and the panic report aborts every claimed channel first. -
std/embedded/halgainsDmaChannel, the protocol through which
peripheral drivers start DMA transfers (DmaTransfer,DmaWidth,
DmaPace,DmaRing), andaddress_offor a buffer's address. -
SPI by DMA:
bus.dma(&mut tx, &mut rx, &mut buffer)returns a
pl022.DmaBuswhosestart_transferandstart_writereturn at once and
run without gaps between frames while the program or other tasks work.
The session lends its buffer out only between transfers, so the borrow
checker keeps the program off memory the channels are moving, and
dropping it aborts a running transfer. -
Serial ports by DMA:
port.dma(&mut rx, &mut ring, &mut tx, &mut output)
returns apl011.DmaPort, astd/ioReader and Writer that receives into
a ring buffer of up to 32 KiB, so input is no longer limited to the
32-byte FIFO between reads, and writes in the background. -
Polled I2C transactions: the DesignWare controller implements
hal.I2cPoll, whosepoll_write,poll_read, andpoll_write_readrun
transactions of any length across polls;listenraises the controller's
interrupt whenever a poll can make progress, andcancelaborts one. -
examples/dma.dodoruns a DMA serial console that polls ten times a
second next to a task streaming SPI frames by DMA. The board self-tests
check DMA copies, SPI and UART loopback by DMA, and queued I2C reads, and
record up to 128 checks. -
The RP2040 and RP2350 boards are USB serial ports on their own USB
connector:b.usb.serial()returns a CDC-ACM port with thestd/ioReader
and Writer protocols, sofmt.printfprints over the USB cable with no
adapter. The port is served fromUSBCTRL_IRQ, so it keeps answering the
host while the program busy-waits. Output written before a terminal opens
the port waits for it, up to 1 KiB, and printing never blocks the program
for long or fails. Newlines go out as CR LF,set_signalwakes executor
tasks on input, and a panic is reported on the port, which the default
panic hook keeps serving after it halts. The driver,
std/embedded/chip/rp_usb, keeps its queues in the controller's own RAM
and runs against a model of the controller and a simulated host in the
desktop tests. -
dodo runno longer needs BOOTSEL for firmware with a USB serial port:
when no bootloader drive is mounted, it finds the board's port on Linux
and macOS, sets it to 1200 baud, which restarts the board into its
bootloader, waits for the drive, and flashes. -
Fix
dodo fmtdropping the space after a compound assignment before a
parenthesis or bracket, which turnedx |= (y)intox |=(y). -
Fix
dodo fmtspacing in array types and lengths:[0u8; 16 * 16]no
longer becomes[0u8; 16 *16],[N - 1]u8no longer becomes[N -1]u8,
[0u8; (N) * 2]keeps the space after;, and[3]&mut Tno longer gains
a space before&. -
Fix
set_break(false)on PL011 serial ports, which waited for the
transmitter to go idle while the break itself kept it busy, and so never
returned. -
Constants and statics get their own ELF sections, as functions already
did, so the linker drops the unused ones: firmware no longer carries every
imported package's public constants once it uses one string constant. -
std/sync/atomicworks on Arm Cortex-M. On cores with exclusive loads and
stores (ARMv7-M, ARMv7E-M, and ARMv8-M, such as the RP2350's Cortex-M33)
every operation lowers to native instructions for 8-, 16-, and 32-bit
integers. ARMv6-M (Cortex-M0 and M0+, as in the RP2040) has atomic loads and
stores only;exchange,fetch_add, andcompare_exchangethere are a
build error naming the reason. An operation a target cannot perform is now
diagnosed only where the program can reach it, so packages that merely
contain one build for every target. -
Atomics in statics are shared without
unsafe:
static TICKS: atomic.Atomic<u32> = atomic.Atomic.new(0u32)is placed in
writable memory, and interrupt handlers, threads, and the main program call
its methods directly, without a critical section. A static initializer may
call a constructor, a safe function whose body only returns a struct
literal of its parameters and constants, with constant arguments. A
constcannot hold an atomic, since each use of a constant is a copy. -
Add PWM and ADC protocols to
std/embedded/hal:PwmOutput(max_duty,
set_duty) withset_duty_percent,set_duty_fraction, and
set_pulse_ushelpers, andAnalogInput(max_value,read) with
read_millivolts.std/embedded/hal/fakegainsPwmandAnalog, so
drivers for LEDs, motors, servos, and analog sensors are tested on a
desktop.examples/dimmer.dodois a potentiometer-controlled LED dimmer,
tested with fakes, andexamples/dimmer_board.dodoruns it on a board. -
The RP2040 and RP2350 chip packages drive PWM and the ADC.
pins.pwm(pin, hz)claims any GPIO as a PWM output at the frequency
closest tohz, with as many duty steps as it allows (up to 65535), and
pins.pwm_divided(pin, divider, top)takes the slice's divider and TOP
instead. The two outputs of a slice share its frequency and write only their
own bits of its registers.pins.analog(pin)claims GPIO 26 to 29 as 12-bit
ADC inputs with polled reads, andpins.temperature()the on-chip
temperature sensor, read withrp_adc.millicelsius. The ADC's 48 MHz clock
runs from PLL_USB while an input is claimed. Both drivers,
std/embedded/chip/rp_pwmandrp_adc, run against simulated blocks in the
desktop tests, and the board self-tests check them with nothing connected. -
Add
std/embedded/executor, a cooperative task executor for firmware.
A task is any value withpoll(&mut self, cx: &mut executor.Context) -> executor.Poll; the executor polls each task only when a time it asked for
(cx.wake_at,executor.Ticker,executor.Timer) arrives or a signal it
took is raised, and sleeps the core in between.executor.Signals,
numbered by the program, are raised safely from interrupt handlers and
tasks, count raises, and carry au32value. Up to 32 tasks and 32
signals; no allocation. The RP2040 and RP2350 timer alarms gainnow_us
andsleep_until, which make an alarm the executor's clock: it sleeps
withwfiuntil its deadline or any interrupt, and needs no handler of
its own.std/embedded/hal/fakegainsClock, a simulated clock that
raises signals as simulated interrupts, so tasks are tested on a desktop,
andSerial.poll_read.examples/tasksruns a blinking LED, a debounced
button, and an interrupt-driven serial console as three tasks. -
RP2040 and RP2350 pins raise
IO_IRQ_BANK0on edges and levels:
pin.listen(chip.RISING_EDGE | chip.FALLING_EDGE),events(),
clear_events(edges),ignore(events), andirq(). -
Add a JetBrains plugin for RustRover, CLion,
and other JetBrains IDEs from 2026.2. It connects tododo lsplike the VS
Code extension and offers the same editing features, with live templates
generated from the extension's snippets. Releases include
dodo-jetbrains-<version>.zip. -
Add
@interrupt(VECTOR)handlers.@interrupt(UART0_IRQ) fn received()
is exported under the vector's name with the target's interrupt-entry
convention (the C ABI on Cortex-M,mreton bare-metal RISC-V), so it
replaces the runtime's default in the vector table. With a board or chip
selected, the compiler checks the name against the chip's vector table and
suggests the closest one, soTIMER_IRQ0is an error instead of a handler
that never runs. Code cannot call a handler or take it as a function value,
a vector has one handler, and no C function may take its symbol. -
Add
@section("name")and@align(N)for functions and statics. A
placed definition is kept even when nothing refers to it. The RP2040 and
RP2350 linker scripts copy.ramfuncsections to SRAM at reset and keep
.noinitstatics in SRAM without loading or zeroing them, so they survive
a reset. -
Add inline assembly:
asm("template", ..., in(reg) value, out(reg) Type, inout("r0") value, clobber("r4"), options(pure, nomem))in unsafe code.
The template names operands{0},{1}, ...; the expression returns
nothing, the output, or a tuple of outputs. Templates are a memory barrier
unlessoptions(nomem), and the assembler's errors are compile errors
instead of aborting the compiler. -
Add
std/embedded/cortex_m: the NVIC (enable,disable,pend,
unpend,set_priority, ...), SysTick, the vector table base, PendSV,
andwfe,sev,dsb,dmb,isb, PRIMASK, and IPSR. The RP2040 and
RP2350 chip packages name every IRQ number after its vector
(rp2040.UART0_IRQ), and their timers hand outAlarms that schedule a
one-shot interrupt. PL011 serial ports gainlisten,ignore,
pending_interrupts, andclear_interruptsfor their receive, receive
timeout, transmit, and error interrupts.examples/interruptsis an
interrupt-driven serial echo for every board. -
Borrowing one static no longer conflicts with reading another static or a
constant:match &mut PORT { some(port) => port.clear_interrupts(pl011.ERROR_INTERRUPTS) ... }
is accepted, and conflicts on the same static name it. -
?converts errors into the enclosing function's error enum. When a
function returningT!AppErrorpropagates anio.Error, andAppError
has exactly one variant whose only payload is anio.Error, such as
Io(io.Error),?returns the error wrapped in that variant. Code that
mixes stream and driver errors declares
enum LogError { Sensor(hal.Error), Output(io.Error) }and uses?on
both instead of matching every call. The conversion calls no function and
moves the error with its ownership and borrows; a missing or ambiguous
variant is reported with the candidates.std/text_alloc,
std/text_shared, andstd/fmt_allocuse it internally. See
examples/sensor_log.dodo. -
Fix
?accepting a propagated error that borrows a local value or a
source outside the function'sfrom(...)contract. The error path is now
checked like an explicitreturn. -
Add function values and closures.
fn(A, B) -> Ris a function pointer
type: a named function, a method (Point.length), an imported function,
or a generic function specialized from the expected type can be stored in
locals, fields, arrays, Options, constants, and statics, and called like a
function. A closure literal,fn(a, b) { a < b }, takes omitted parameter
and result types from where it is passed and may use local variables of the
surrounding code. Closures capture by reference and are checked like
references to what they capture: a closure that only reads its captures is
a copyable&dyn fn(..), one that changes them an exclusive
&mut dyn fn(..), and a closure that captures nothing is a plain function
pointer. While a closure can still be called, its captured variables keep
the matching borrow, so it can never outlive them or alias a mutation.
Function pointers convert to closure references automatically. Calls work
on any callee expression, such as(table[i])(x)andbutton.on_press(x). -
std/collectionsgains closure forms of its algorithms:sort_by,
stable_sort_by,is_sorted_by,binary_search_by,partition_by,
position,any,all,count,for_each,for_each_mut,map, and
fold. -
std/embedded/hal.Handlerholds an interrupt handler chosen at run time:
a vector-table entry point callsrun, and firmware swaps handlers with
setandclearinside a critical section. Statics start empty with
hal.NO_HANDLER. -
Static and constant initializers accept
none, function names, and closures
that capture nothing, and a constant or static holding a function value is
called by name.
Constants with private fields can be used outside their package, since
their initializer is checked where it is declared. -
Add tuples.
(A, B)is a type,(a, b)builds a value, and.0,.1
read and assign elements, so a function can return several values without
declaring a struct:fn divmod(a: u32, b: u32) -> (u32, u32). Tuple
patterns destructure inlet (q, r) = divmod(17, 5),match,if let, and
loops:for (id, score) in scoresborrows each element's fields and
for &(id, score) in scorescopies them. Tuples behave like structs with
public fields0,1, ...: they move, own and destroy their elements, and
borrows of different elements do not conflict. -
Add type aliases.
type Point = (i32, i32),pub type Outcome<T> = T!Error,
andtype Grid<T> = [8][8]Tgive existing types another name; an alias is
interchangeable with its type. An alias of a struct or enum also works in
struct literals and patterns, variant paths, andAlias.new()calls.
Private aliases stay in their package, and a public alias cannot expose a
private type. -
Diagnostics name specialized generic types and tuples in source notation,
Pair<i32, bool>and(i32, bool), instead of internal mangled names; so
do hovers and debugger type names. -
typeis now a reserved word. -
Add interfaces.
interface Name { fn method(&self) -> T }declares method
signatures that any type with matching methods implements; an interface
can include others (interface Sensor: Named). Generic parameters take
bounds,fn read_line<S: io.Reader + io.Writer>(...)and
struct Holder<S: Sensor>, which are checked where the generic is used:
a wrong type is reported at the call, with each missing method or
mismatched signature, instead of inside the specialized body. A struct may
statestruct Uart: io.Reader + io.Writerto have its conformance checked
where it is declared. Bounded generics are still specialized per type, so
they cost nothing at run time. -
Add
dynreferences for run-time dispatch:&dyn Sensorand
&mut dyn Sensorrefer to any value implementingSensortogether with a
constant method table, so different devices fit in one array, a struct
field, or a driver chosen at run time. References convert implicitly where
adynreference is expected (or withas), keep their borrows, and
convert to an interface's first parent.dyntypes satisfy their own
bounds, so one specialization of a bounded generic can serve every type. -
std/iodeclaresReader,Writer, andReadWriter; its helpers
(read_exact,write_all,copy,BufferedReader, ...) are bounded by
them.std/embedded/haldeclaresOutputPin,InputPin,Delay,I2c,
Spi, andRegisters, bounds its helpers andSpiDevice, and the
peripheral drivers declare the interfaces they implement. -
Method calls reborrow through any number of references, so elements of an
array of references call their methods directly. -
Add serial ports (UART) to the
rp2040andrp2350chips, so firmware
can print.pins.uart(tx, rx, baud)validates the pins and the baud rate,
takes the UART once, and returns a port implementing thestd/ioReader
and Writer, sofmt.printf(&mut serial, ...)andio.read_linework on
it unchanged;rxisnonefor a port that only sends. Every board names
its usual pins,UART_TX_PIN(GP0) andUART_RX_PIN(GP1), where the
Raspberry Pi Debug Probe connects. The driver is the new
std/embedded/peripheral/pl011(Arm PL011): 8N1 by default,set_baud
andset_formatfor 5 to 8 data bits, parity, and 1 or 2 stop bits,
pollingpoll_readandpoll_write,flush, internal loopback, and
set_crlf(true)for terminals, which writes\nas CR LF and reads Enter
as\n. Framing, parity, break, and overrun errors fail a read after the
good bytes before them, with the error's bits inio.Error.code.
Waits for output give up withTimedOutafter a poll limit
(set_poll_limit), and reads can be bounded the same way
(set_read_poll_limit).
pins.release_uart(port)gives a port back.examples/serial_console.dodo
is a small command line. -
Report panics on the serial port. The chip runtimes' default panic hook,
dodo_board_panic, now calls a reporter thatstd/embedded/chiplinks
in, which writesdodo: index bounds check failed at main.dodo:41:46, the
line a desktop program prints, to every serial port the program holds
before it halts. Nothing needs configuring, a program's own
dodo_board_panicstill replaces the hook, andboard.report_panic
writes the same report from it. -
I2C reaches 10-bit addresses:
write_ten_bit,read_ten_bit, and
write_read_ten_biton adesignware_i2cbus.probe(address)finds
devices with a one-byte read, since the controller cannot send an address
alone. -
The RP2040 and RP2350 can be I2C and SPI targets (slaves).
pins.i2c_target(sda, scl, address, ten_bit, hz)answers a master at a
7-bit or 10-bit address;pollreports the bytes it writes, its STOPs,
and its reads, which hold the master up untilrespondanswers.
pins.spi_target(clock, tx, rx, select, mode)follows a master's clock
and chip select, with polledqueueandreadand a waitingtransfer. -
SPI frames of 4 to 16 bits (
set_frame_bits, withtransfer_wordsand
write_wordsonu16words above 8 bits), the TI synchronous serial and
National Microwire formats (set_frame_format), and
pins.spi_with_select, which routes the controller's own chip select. -
Serial ports gain hardware flow control:
pins.uart_flow(tx, rx, cts, rts, baud)claims the CTS and RTS pins, and RTS asks the other end to
pause from 24 received bytes on.set_breakholds the line low. On the
RP2350,pins.uartalso takes TX and RX on the UART_AUX pins (GPIO n
with n % 4 of 2 and 3). -
std/embedded/hal/fakegainsfake.Serial, an in-memory serial port for
testing drivers of devices on a serial line. The board self-tests check
the serial port's pins, ownership, timing at 115200 baud and 1 Mbaud,
newline translation, and overruns through the internal loopback, and
desktop tests run the driver against a PL011 model. The self-tests also
cover 10-bit addressing, both targets, 12-bit and TI frames through the
SPI loopback, breaks, and the flow control pins, and the desktop models
gain a DW_apb_i2c target driven by a scripted master. -
The RP2040's and RP2350's ADC samples by itself:
pins.sampler(inputs, rate_hz)returns anrp_adc.AdcSamplerthat converts a set of inputs
(GPIO 26 to 29 and the temperature sensor) round-robin at 733 to 500 000
samples a second into the ADC's FIFO. Polled reads return samples tagged
with their input and a conversion-error flag and report FIFO overruns;
set_signalwakes a task from theADC_IRQ_FIFOinterrupt, whose default
handler the chip runtimes now provide; and by DMA, paced by the ADC's
data request,capturefills a buffer of 12-bit or 8-bit samples,dma
does so in the background, andstreamkeeps filling a ring. Single
pins.analoginputs keep working and areBusywhile a sampler holds
the converter, and the other way round. Seeexamples/adc.dodo. -
RP2040 and RP2350 flash regions erase and write from either core while
the other runs a task:rp_multicore.lockout()parks the other core in
SRAM with its interrupts masked, through a forcedIO_IRQ_QSPIthat the
runtimes' new SRAM handler answers, and reportsTimeoutif it cannot.
Newstd/embedded/flash/spi_nordrives JEDEC SPI NOR flash chips (W25Q,
GD25Q, MX25L, IS25LP, ...) as ahal.Flash, probing them by JEDEC ID and
SFDP, with 4-byte addressing above 16 MiB, protection, deep power-down,
and reset. -
The RP2350B's GPIO 30 to 47:
rp2350.take()reads the package from
SYSINFO, andpins.pin_count()(30 or 48) bounds every claim, so GPIO 30
to 47 work as inputs and outputs, with interrupts, dormant wake-up, and
their I2C, SPI, UART, and PWM functions (slices 8 to 11). Pin masks in
rp_pinsare nowu64. PIO blocks on the RP2350 reach GPIO 16 to 47
throughpio.set_gpio_base(rp_pio.HIGH_GPIO_BASE); pin mappings and
wait gpio(now up to GPIO 47) name absolute GPIOs and are translated
into the block's window. Pin interrupts work on either core:listen,
ignore, andeventsact for the calling core, andlisten_on,
ignore_on, andevents_onname one. -
Deeper low power on the RP2040 and RP2350. A
power.Waketakes a timeout
(wake.after_ms(ms),power.dormant_for), anddormantreports it in
bit 63 (power.BY_TIME,power.by_time;power.MAX_PINSis now 63).
The RP2040 wakes by its RTC onceb.rtc.use_clock_input(&mut b.pins, 20, 32_768)feeds clk_rtc from a GPIO clock; the RP2350 wakes by its
always-on timer, whichb.rtccan also tick from the low-power
oscillator (OTP-calibrated), an external 32 kHz clock, or an external
1 kHz tick.b.power.set_system_hz(hz)runs clk_sys from the crystal or
PLL_SYS at a lower rate and back, refusing while a peripheral whose
divider follows clk_sys is claimed. The RP2350'sb.power.power_down(&wake, retain)switches off the switched core and unkept SRAM through POWMAN
until a pin event or a timeout restarts the chip, after which
woke_from_power_down,power_down_wake,retained, andscratch
report and keep state.fake.Powersimulates timeouts. -
Timers at other rates:
std/embedded/halgainsTickCounter,Compare,
PeriodicTimer, andInputCapture, counting ticks at a rate of their
own, with conversion and wait helpers and a fake of each. On the RP2040
and RP2350 the timer alarms (now on the sharedrp_timer) are compare
channels and drift-free periodic timers that count missed periods; the
RP2350's TIMER1 counts clk_sys or a divided crystal (timer.timer1(hz));
PWM slices are periodic timers and 64-bit tick counters
(pins.pwm_timer), and PWM outputs expose the wrap interrupt; and
rp_capturetimestamps edges on a PIO state machine
(pins.edge_capture).
The compiler still implements a subset of the language design. See the
implementation status and limits
for supported behavior and remaining work.