Documentation
¶
Overview ¶
Package device finds connected boards and talks to them over serial.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrLost = errors.New("connection lost")
ErrLost reports that the port went away while monitoring (board unplugged or reset into a different USB identity).
Functions ¶
func Monitor ¶
Monitor reads lines from port until ctx is cancelled or the port goes away, calling opened once the port is open and line for each line. DTR and RTS stay de-asserted: asserting them holds many ESP32 boards in reset through the auto-reset circuit.
Types ¶
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
Decoder turns the code addresses in ESP-IDF panic output (backtraces, "abort() was called at PC", the register dump's PC) into functions and source lines with addr2line against the app's ELF. (The register dump's PC is not decoded: it repeats the backtrace's first frame.) Generated C carries #line directives, so Volt code decodes to main.volt lines.
func NewDecoder ¶
NewDecoder returns nil when the ELF or addr2line is missing.
func (*Decoder) Line ¶
Line inspects one monitor line. ESP-IDF's panic handler prints the running app's ELF hash after the backtrace, so decoded frames are held until that line: they are returned if the hash matches the ELF, dropped with a warning if not (the frames would name the wrong code). A reboot or halt line without a hash releases them unverified.
type Frame ¶
type Frame struct {
PC string `json:"pc"`
Func string `json:"func"`
File string `json:"file,omitempty"`
Line int `json:"line,omitempty"`
Inlined bool `json:"inlined,omitempty"` // inlined into the frame above
Resolved bool `json:"resolved"`
}
Frame is one decoded code address.
type Port ¶
type Port struct {
Port string `json:"port"` // serial device, or mount path when bootsel
Chip string `json:"chip"` // ESP32, ESP32-S3, RP2040, RP2350, STM32, Unknown
Desc string `json:"desc"`
VendorID string `json:"vendorId"`
ProductID string `json:"productId"`
Serial string `json:"serialNumber,omitempty"`
State string `json:"state"` // running (serial) or bootsel (mass storage)
Probe string `json:"probe,omitempty"` // ESP only, with --probe: verified or silent
}
Port is one connected board. The JSON shape matches the IDE's scan_devices entries.