> For the complete documentation index, see [llms.txt](https://dev.solid-run.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dev.solid-run.com/nxp/imx8/sbc-platform/imx8m-other-articles/building-openocd-for-imx-platforms.md).

# Building OpenOCD for i.MX Platforms

### Compiling OpenOCD For SolidRun iMX\* Based Products

The purpose of this document is to cover compiling OpenOCD directly on the developer board specifically for using OpenOCD to flash connected devices via the imx\_gpio interface. We will use Debian as the base for the instructions, however the general procedure should work with slight modification on most distributions. Cross-compiling is possible but is currently not in the scope of this document.

### Prepare Debian for compiling

Start by making sure Debian is updated to the latest version.

Next, run the following command to install all the tools needed to build OpenOCD from source

```
sudo apt install build-essential git autoconf libtool make pkg-config libusb-1.0-0 libusb-1.0-0-dev
```

### Get the Source and Compile OpenOCD

Once that has finished clone the SolidRun github repository, as it has patches to mainline OpenOCD specifically for the new iMX8M AARCH64 architecture. Then bootstrap, configure and build the source.

```
git clone https://github.com/SolidRun/openocd.git
cd openocd
./bootstrap
./configure --prefix=/usr --sysconfdir=/etc --enable-imx_gpio --enable-sysfsgpio --disable-stlink --disable-ti-icdi --disable-ulink --disable-usb-blaster-2 --disable-vsllink --disable-xds110 --disable-osbdm --disable-opendous --disable-aice --disable-usbprog --disable-rlink --disable-armjtagew --disable-cmsis-dap --disable-kitprog --disable-usb-blaster --disable-presto --disable-openjtag --disable-jlink
make
```

This configures and builds OpenOCD for a very limited purpose built build mainly targeted at using the imx\_gpio interface.

Finally install the source

```
sudo make install
```

Great now OpenOCD is ready to use.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://dev.solid-run.com/nxp/imx8/sbc-platform/imx8m-other-articles/building-openocd-for-imx-platforms.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
