From a70ed34eaf8223eaac6ea033e0ff59dfed6baad2 Mon Sep 17 00:00:00 2001 From: Ozan Durgut Date: Sun, 16 Aug 2026 15:26:35 +0200 Subject: [PATCH] OpenOCDDriver: disable default server ports OpenOCD starts GDB, telnet, and TCL servers on fixed default ports. When multiple boards on the same exporter bootstrap concurrently, the second OpenOCD instance fails to bind these ports. Disable the server ports before loading OpenOCD configuration files. OpenOCDDriver does not provide a lifecycle for using or stopping these servers, while disabling them allows parallel bootstrap operations. Signed-off-by: Ozan Durgut --- doc/configuration.rst | 6 ++++++ labgrid/driver/openocddriver.py | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/doc/configuration.rst b/doc/configuration.rst index 72ac124fd..fb0c94ff3 100644 --- a/doc/configuration.rst +++ b/doc/configuration.rst @@ -2318,6 +2318,12 @@ OpenOCDDriver An :any:`OpenOCDDriver` controls *OpenOCD* to bootstrap a target with a bootloader. +The driver disables OpenOCD's GDB, telnet and TCL server ports. It does not +provide a lifecycle to expose or stop these server interfaces, and disabling +them allows multiple bootstrap operations to run concurrently on one exporter. +Configurations which require a server interface can re-enable it with an +appropriate command before ``init``. + Note that OpenOCD supports specifying USB paths since `a1b308ab `_ which was released with v0.11. The OpenOCDDriver passes the resource's USB path. diff --git a/labgrid/driver/openocddriver.py b/labgrid/driver/openocddriver.py index 02440f4cf..60ae48ed9 100644 --- a/labgrid/driver/openocddriver.py +++ b/labgrid/driver/openocddriver.py @@ -55,6 +55,14 @@ def _run_commands(self, commands: list): cmd = [self.tool] cmd += chain.from_iterable(("--search", path) for path in self.search) cmd += self._get_usb_path_cmd() + cmd += [ + "--command", + "gdb_port disabled", + "--command", + "telnet_port disabled", + "--command", + "tcl_port disabled", + ] managed_configs = [] for config in self.config: