.embedder/hardware/. Ask Embedder to run these files so provider helpers, bridge routing, validation, capture publishing, and hardware leases all apply.
Do not run a hardware script with plain Python or a shell command. Injected helpers will be missing, and the process will not participate in hardware coordination.
Choose a script location
Use a loose script for one probe:capture2.py or capture_v2.py; stale variants make it unclear which probe produced the evidence.
Keep a durable case note
CASE.md stores one bug across context compaction and later sessions. Use this structure:
.embedder/hardware/cases/spi2-nack/CASE.md
open, resolved, and abandoned. You may also add an updated timestamp. Do not delete a closed case; change its status and keep the evidence.
Update hypothesis verdicts and findings when a probe settles them. Keep the short in-session checklist in the task list instead of duplicating it in the note.
Write against injected helpers
The script runner inspects the file and selects providers from the detected hardware and helper names it uses. Provider preludes inject helpers before your code runs. Examples include:gdb.*,serial_send,serial_read, andserial_read_historyrtt_send,rtt_read, andrtt_read_historyla_*,scope_*,ppk2_*, andjoulescope_*ble_*
la_* interface for Saleae, Digilent, and PicoScope logic capture. Direct Digilent vendor helper calls are rejected.
Most provider libraries must not be imported directly. The J-Trace SDK is the exception: import jtrace in a script when you need its custom API.
Return structured results
Print a final one-line JSON object withsuccess and summary. Add data and metadata when they help the next step.
.embedder/hardware/read_boot.py
asyncio.run. The runner parses the last valid result object from stdout.
Provider publish helpers can add instrument captures to the Logic, Power, or Oscilloscope views. BLE helpers stream scan, GATT, and notification events to the Bluetooth view. Embedder lists each published instrument capture in the script result.
Run tools on the hardware host
Callrun_tool inside a hardware script when you need a flasher or debugger executable:
exit_code, output, and host.
Understand hardware leases
Asking Embedder to run a hardware script requests exclusive access to the connected board.Foreground lease
A foreground script holds the board until the run and provider cleanup finish. Other sessions wait. The default timeout is 60 seconds. You can set a foreground timeout from 1 second through 10 minutes.Background lease
Ask Embedder to run a soak, endurance test, or long capture in the background:Cross-session protection
Embedder queues other sessions behind an active owner. It also prevents a session from running an unchanged script whose latest successful run belongs to another session. Rewrite it for your task or use another filename. When a script programs firmware, Embedder records the load so other sessions know their previous hardware observations may be stale.Wait for or stop a background run
Ask Embedder to wait for the background task to finish. If the wait times out, the script keeps running and the lease remains held. Ask Embedder to stop the task when you need to end it early. Embedder interrupts the script so Python cleanup and provider cleanup can release devices. Do not poll with sleep commands or start a duplicate run while you wait.Review validation before running
File writes return hardware-script diagnostics. Fix them before you execute the script. Validation checks include:- Unknown or vendor-internal helper names
- A provider action used without its connection helper
- Unsafe or unsupported argument combinations
- Direct imports that bypass provider setup
Find existing scripts
The debug-session toolbox lists loose scripts, open cases, closed cases, and each script’s leading docstring..embedder is normally ignored by project search, so open a listed script by its exact path or list .embedder/hardware/ directly.
Ask Embedder to run a path relative to .embedder/hardware:
Fix script problems
The helper is undefined
The helper is undefined
Ask Embedder to run the file as a hardware script, not Python or shell. Confirm that hardware status shows the provider and that the script uses its documented helper name.
No provider is available
No provider is available
Refresh hardware status and follow the provider’s dependency or connection reason before rerunning.
The board is busy
The board is busy
Check active trace sessions and background tasks. Wait for the owner or ask Embedder to stop your session’s task; do not bypass the lease.
A bridge tool cannot see the probe
A bridge tool cannot see the probe
Replace subprocess use with
run_tool so the command runs on the hardware host.The script completed but no result was parsed
The script completed but no result was parsed
Print a final JSON object containing a boolean
success and string summary on one line.Combined workflows
Coordinate several observations in one script.
Debug mode overview
Choose a provider for the next probe.

