What you need
Embedder looks for OpenOCD in this order:
- Embedder’s own copy, if it has already downloaded one.
-
openocdonPATH, or in a common install folder: - A new download of Embedder’s own copy. This starts in the background when you open a project and no OpenOCD is found, or when a debug session needs one.
Prepare
- Connect and power the target and debug adapter. Install any drivers or USB permissions the adapter needs.
- Identify the OpenOCD interface and target configurations for the board (see the table below).
- Build the firmware ELF with symbols. To attach, use the ELF that matches the firmware on the board.
- Run
/debugand ask Embedder to check OpenOCD and GDB readiness.
In EMBEDDER.md, set
Debug Interface = st-link or Debug Interface = cmsis-dap, along with the exact MCU and verified debug command. Without an interface setting, Embedder assumes ST-Link. When the target can’t be detected reliably, give the target configuration explicitly.
Connect and inspect
build/app.elf with your build output. Embedder asks you to approve before it connects, unless your approval settings already allow it. A normal connection programs the ELF and tries to stop at main. From there, ask for breakpoints, stepping, variables, registers, or memory, as described in GDB debugging.
Script the connection
For a repeatable check, a hardware script can open the connection itself. This example applies only to a board verified to use ST-Link and thestm32f4x target configuration:
.embedder/hardware/, replace the artifact and configuration values, and ask Embedder to run it. This example programs the target. The debugger connection closes when the script ends.
Preserve an existing run
Ask for attach-only to load symbols without programming or running tomain. Add no-halt when execution should continue. In a script, use attach=True and no_halt=True.
These options don’t make every OpenOCD configuration nonintrusive. Startup commands in the configuration can still affect the target. No-halt without attach-only still programs the ELF, then resets and halts the target. Read the attachment precautions before investigating a live fault.
Observe output
Use ITM/SWO when the MCU, probe, wiring, and firmware support it. Supply the correct CPU and SWO frequencies. Ordinary GDB debugging doesn’t need SWO.Flash a bridge board
OpenOCD also programs boards on a remote hardware bridge that have an OpenOCD target and interface but no chip name. Install OpenOCD on the bridge host, then see Flash through a bridge.Troubleshoot
- No target configuration matches: verify the MCU and check the target files in the OpenOCD installation in use. Don’t substitute a nearby family.
- No target could be determined: add the platform to the project, or give the target configuration name.
- Adapter or USB access fails: check drivers, device permissions, wiring, target power, and competing applications.
- Transport mismatch: confirm whether the target needs SWD or JTAG and that the interface and target configurations support it.
- Download of Embedder’s OpenOCD fails, or your host isn’t supported: use the reported error to fix the network or host setup, or install OpenOCD yourself, for example with
brew install openocdorapt install openocd. - Port already in use: another debug server is running. Stop it, then retry.
- Probe busy after switching tools: stop the previous debugger or monitor before retrying. Starting OpenOCD closes other OpenOCD processes that use the same executable.