Ostiole can now use SEGGER J-Link probes directly over USB. Its
J-Link package finds
the probe’s application interface, reads its firmware and capabilities, configures
SWD, and sends raw bit streams. Building it meant reconstructing enough of the USB
protocol to know not only which bytes to send, but exactly how many to expect
back.
The protocol is simple in a way that is not especially forgiving. Each request
starts with a one-byte operation code followed by whatever data that operation
needs. The reply contains only that operation’s response: no common header,
transaction number, length, checksum, or error envelope. Read the wrong number of
bytes once and the leftovers can look like the answer to the next request.
One documented RTCK measurement made the risk unusually concrete. On my J-Link EDU
Mini V2, the request went out, no reply came back, and the probe stayed wedged
after I closed it and reset the USB device. It recovered only after I unplugged
and reconnected it.
The complete reconstruction is now this Trace. Ostiole uses it for the J-Link
support that exists today, and there is enough protocol in it for another
implementation to start without first reconstructing the same conversation from
old clients and a probe on the bench.
From Jordan Matelsky, on the first step in pen-plotter holography:
It was a truly bizarre experience deliberately smearing my fingers with oil and
then touching my phone screen. Try it! Rules are made up!
I spent longer than warranted looking at the old CD jewel cases in Matelsky’s
photos, partly out of nostalgia and partly because they turn out to be the medium.
Matelsky turns the highlights moving across a greasy fingerprint into curves for a
pen plotter to scratch into the plastic, creating an image whose apparent depth
comes into view under a point light as you move your head.
Matelsky puts a pen plotter and old CD jewel cases back to work together, a
delightfully useless collision of dead technologies for the pure fun of making
holograms.
I’ve been working on a Go library called ostiole—a little door into the inner
workings of chips. At the moment, the door opens onto one very specific path. It
starts with native USB on Linux or macOS, passes through an FTDI H-series adapter
and SWD, and reaches just far enough into Arm’s debug architecture to identify a
Cortex-M. That isn’t debugging, but it is enough to get a sense of the project’s
layers. They’re separate, composable libraries that anyone comfortable with Go can
use to build their own hardware tools.
Hardware-debugging tools are happy to do exactly what I asked instead of what I
intended, then hand me enough hexadecimal rope to hang myself trying to work out
what happened. An AI gets the same two chances. It can hallucinate the script and
the result.
I want to optimize for a different target, one where AIs compose exactly the tools
they need. Ostiole’s libraries should have small jobs and clear boundaries. The
simulators should let an AI try them without a bench. The documentation should
point it at the library that already owns an operation before it goes rummaging
through the whole repository.
Eventually, I expect Ostiole to inspect, control, and program whole systems, with
debugger and MCP interfaces using the same libraries instead of growing their own
hardware stacks. That is a long way from reading a Cortex-M identity, but building
it is the fun part—and somewhere along the way an AI will use Ostiole to debug a
chip as part of doing something genuinely useful.
Rands, asking why he writes:
I write because I like the mental state created by writing. It calms and quiets
me, but that is not why I write.
I read this while getting jon.dev ready to launch, so it seemed apropos. Rands has
an answer. His post helped me think about mine.
jon.dev is where I’ll publish things that are, to me, both technical and
interesting. That has long meant systems programming, firmware, and low-level
electronics. More recently, it has also meant some AI.
The format here owes Daring Fireball an
obvious debt. John
credits Jason Kottke
with the idea of mixing link posts and full articles in one chronological stream.
He shamelessly copied it. I’m shamelessly copying him.
I don’t know exactly what this will turn into. I’m glad you’re here to find out
with me.