How To Install openocd on Ubuntu 22.04

In this tutorial we learn how to install openocd on Ubuntu 22.04. openocd is Open on-chip JTAG/SWD debug solution for embedded target devices

Introduction

In this tutorial we learn how to install openocd on Ubuntu 22.04.

What is openocd

openocd is:

OpenOCD aims to provide debugging, in-system programming and boundary-scan testing for embedded target devices.

The debugger uses an IEEE 1149-1 compliant JTAG TAP bus master to access on-chip debug functionality available on ARM based microcontrollers or system-on-chip solutions. For MIPS systems the EJTAG interface is supported. Additionally there is support for eSi-RISC, Intel, OpenRISC, RISC-V and ARC controllers.

User interaction is realized through a telnet command line interface, a gdb (the GNU debugger) remote protocol server, and a simplified RPC connection that can be used to interface with OpenOCD’s Jim Tcl engine.

OpenOCD supports many different types of JTAG interfaces/programmers.

There are three methods to install openocd on Ubuntu 22.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install openocd Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install openocd using apt-get by running the following command:

sudo apt-get -y install openocd

Install openocd Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install openocd using apt by running the following command:

sudo apt -y install openocd

Install openocd Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install openocd using aptitude by running the following command:

sudo aptitude -y install openocd

How To Uninstall openocd on Ubuntu 22.04

To uninstall only the openocd package we can use the following command:

sudo apt-get remove openocd

Uninstall openocd And Its Dependencies

To uninstall openocd and its dependencies that are no longer needed by Ubuntu 22.04, we can use the command below:

sudo apt-get -y autoremove openocd

Remove openocd Configurations and Data

To remove openocd configuration and data from Ubuntu 22.04 we can use the following command:

sudo apt-get -y purge openocd

Remove openocd configuration, data, and all of its dependencies

We can use the following command to remove openocd configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge openocd

References

Summary

In this tutorial we learn how to install openocd package on Ubuntu 22.04 using different package management tools: apt, apt-get and aptitude.