https://elinux.org/api.php?action=feedcontributions&user=Mattlmassey&feedformat=atomeLinux.org - User contributions [en]2024-03-29T11:16:32ZUser contributionsMediaWiki 1.31.0https://elinux.org/index.php?title=Running_OpenOCD_on_Linux_with_the_Beaglebone&diff=127832Running OpenOCD on Linux with the Beaglebone2012-05-09T04:22:25Z<p>Mattlmassey: /* Installing FTDI Drivers */</p>
<hr />
<div>[[OpenOCD]] provides a command line interface for interacting with embedded devices. To use [[OpenOCD]] you will need to run it from the command line. This guide includes basic information about using the Ubuntu command line interface, the terminal window. If you are already proficient with the command line, you can find information specific to [[OpenOCD]] under the '''Installing FTDI Drivers''' and '''Telnet Connection''' headings.<br />
<br />
This guide was written for the Ubuntu 11.10 release. You may encounter differences on other Linux distributions. The instructions on this page use the Beaglebone as an example embedded chip target. The instructions are otherwise identical to those at [[Running OpenOCD on Linux]], which provides examples for the TinCanTools Hammer.<br />
<br />
<br />
==Initial Setup==<br />
<br />
The following guide assumes that you have followed the instructions in main [[OpenOCD]] page to install the application. You can choose to build OpenOCD from source or download a pre-built package. If you do not build from source, you may still need to download the board and platform specific scripts for the Beaglebone.<br />
<br />
<br />
==Opening the Command Prompt==<br />
<br />
Open the '''Applications''' menu from the menu bar on your desktop, and choose '''Accessories > Terminal.''' Ubuntu should open black window with white text and a prompt.<br />
<br />
<br />
==Command Prompt Basics - Paths and Navigation==<br />
<br />
The command prompt displays your current directory location. You will need to navigate to the [[OpenOCD]] directory to run it. To change directories, type '''cd'' followed by a file path. File paths can be absolute...<br />
<br />
cd /home<br />
cd /usr/local/lib<br />
<br />
...or relative...<br />
<br />
cd lib/mingw<br />
cd TinCanTools/openocd<br />
<br />
Absolute paths are from your root directory, and begin with a slash. Relative paths are from the current directory and do not begin with a slash. File paths are case sensitive.<br />
<br />
If you need to navigate to your home directory, type '''cd''' by itself like this...<br />
<br />
cd<br />
<br />
If you need to go back to the parent of the current directory, you can type...<br />
<br />
cd ..<br />
<br />
You can even use this as part of a longer relative path. For example...<br />
<br />
cd ../../TinCanTools<br />
<br />
...would take you up two levels, and then into a folder called TinCanTools.<br />
<br />
To reach your root directory, you can type:<br />
<br />
cd /<br />
<br />
If you need to include your home directory in a path ('''home/USERNAME''', replacing USERNAME with the name of your account), you can type it out as normal, or you can use the tilde key ('''~''') as shorthand. For example:<br />
<br />
cd /home/USERNAME/TinCanTools<br />
cd ~/TinCanTools<br />
<br />
...both take you to the same place.<br />
<br />
<br />
==Installing FTDI Drivers==<br />
<br />
The Beaglebone is very nice since it provides its JTAG interface directly through the USB so you don't need an external JTAG board. The JTAG support is provided through the FTDI chipset on the Beaglebone. You need to ensure that you have the FTDI drivers installed in your Linux host system.<br />
<br />
You can grab the drivers from FTDI's website (for the FTDI D2XX). http://www.ftdichip.com/Drivers/D2XX.htm<br />
<br />
Read the README in the driver install package for background information on how to install it. You may neeed to install libusb also. To do this, type the following:<br />
<br />
sudo apt-get install libusb<br />
<br />
Once you've installed the drivers, you can run lsusb to check that the FTDI interface is working on your connected Beaglebone:<br />
<br />
~$ lsusb<br />
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub<br />
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub<br />
Bus 002 Device 002: ID 80ee:0021 VirtualBox USB Tablet<br />
Bus 001 Device 002: ID 0403:6010 Future Technology Devices International, Ltd FT2232C Dual USB-UART/FIFO IC<br />
<br />
You should note the USB PID/VID of the FTDI interface is actually 0403:6010 (shown above). This can cause problems later. This is because there was a problem in newer board revisions (A5) that the FTDI chipset reported an incorrect PID/VID. You should copy down the information, since you will need it later.<br />
<br />
==Installing Beaglebone Scripts==<br />
<br />
You will need to download the source for OpenOCD to get the scripts. You can download the source to any directory that you want, since it will be temporary (unless you are building the source). The following example downloads the source to you current directory into a directory called openocd...<br />
<br />
git clone git://openocd.git.sourceforge.net/gitroot/openocd/openocd openocd<br />
<br />
<br />
Once the source is downloaded, you will need to copy the two script files necessary for the Beaglebone to your OpenOCD directories. This assumes you have installed OpenOCD to /usr/share/openocd/. In the following example, replace <Path to git clone openocd> with the path of the downloaded source...<br />
<br />
> sudo cp <path to git clone openocd>/tcl/board/ti_beaglebone.cfg /usr/share/openocd/scripts/board<br />
<br />
> sudo cp <path to git clone openocd>/tcl/target/am335x.cfg /usr/share/openocd/scripts/target<br />
<br />
<br />
==Editing the Beaglebone Script==<br />
<br />
You may need to edit the ti_beaglebone.cfg script file to corret the USB PID/VID issue mentioned above. Edit the file using a text editor such as gedit. (Remember, it should be run as root to have proper permissions)<br />
<br />
> sudo gedit /usr/share/openocd/scripts/board/ti_beaglebone.cfg<br />
<br />
You are looking for the following line in the cfg file:<br />
<br />
ft2232_vid_pid 0x0403 0xa6d0<br />
<br />
If the two hex values do not match the values you wrote when you ran lsusb mentioned in the previous section, you will need to edit it. For the A5 revision, I had to change this to...<br />
<br />
ft2232_vid_pid 0x0403 0x6010<br />
<br />
Once you save the file, you are ready to run OpenOCD. If you did not edit this file, when you ran the application it would complain that there are no available interfaces when the Beaglebone was connected. <br />
<br />
<br />
==Running OpenOCD==<br />
<br />
Navigate to the directory containing your openocd executable. If you have just compiled [[OpenOCD]] according to the instructions on this wiki, the executable is located in '''openocd/src''' or '''openocd-0.4.0/src.''' In that directory, simply type...<br />
<br />
openocd<br />
<br />
To run the program. It won't ''do'' anything though, because you need the appropriate permissions and config files. <br />
To exit openocd, press '''CTRL + C'''.<br />
<br />
<br />
==OpenOCD and Permissions==<br />
<br />
[[OpenOCD]] needs administrator privileges to interact with your USB drivers. Even Linux users with administrator privileges do not typically log on with those privileges active. However, Linux provides commands to run another command as the root user. On Ubuntu, this command is ''sudo''. To run a program as root, type ''sudo'', then a space, then the name of the program. For example...<br />
<br />
openocd<br />
<br />
...runs [[OpenOCD]] with your user permissions, and likely prevents [[OpenOCD]] from interacting with libUSB. However...<br />
<br />
sudo openocd<br />
<br />
...runs [[OpenOCD]] as root, with full permission to access your USB drivers.<br />
<br />
When you use the '''sudo''' command, Linux will prompt you for the root user's password. If you do not have access to this password, contact your system administrator. You can also configure Linux to allow [[OpenOCD]] to access specific hardware devices without ''sudo''. See [[Accessing Devices without Sudo]].<br />
<br />
<br />
==OpenOCD Config Files==<br />
<br />
Each time you use [[OpenOCD]] you will need to configure it by passing it paths to configuration files. In the [[OpenOCD]] 0.5.0 release, these files are found in '''openocd/scripts''' and its subdirectories. From the '''scripts''' directory, the configuration file for the Beaglebone is at '''board/ti_beaglebone.cfg'''. <br />
<br />
When you start [[OpenOCD]], you tell it to use the config files for your hardware with the '''-f''' switch, like this:<br />
<br />
sudo openocd -f path_to/cfg_file [-f path_to/other_cfg_file]<br />
<br />
For the Beaglebone, you would type:<br />
<br />
sudo openocd -f board/ti_beaglebone.cfg<br />
<br />
Be aware that config files may contain paths to other config files. For example '''ti_beagleboard.cfg''', the config file for the Beagleboard, contains this line:<br />
<br />
source [find target/am335x.cfg]<br />
<br />
When you run [[OpenOCD]] with the '''ti_beaglebone.cfg''' file, [[OpenOCD]] searches from the current directory for '''target/am335x.cfg'''. If the current directory does not contain [[OpenOCD]]'s '''target''' directory, it may not find the '''am335x.cfg''' file, or it may find a different '''am335x.cfg''' file elsewhere on your system. For more information, see [[OpenOCD Config File Paths]].<br />
<br />
<br />
==Telnet Connection==<br />
<br />
[[OpenOCD]] runs as a daemon. It accepts connections from other programs, but does not provide any means for you to give it commands directly. Once [[OpenOCD]] is running on your computer you will need to connect to it through another program, such as telnet.<br />
<br />
To run telnet and connect to [[OpenOCD]], open a new command prompt. From any directory, type:<br />
<br />
telnet localhost 4444<br />
<br />
You may need to run telnet as root:<br />
<br />
sudo telnet localhost 4444<br />
<br />
You should see a simple prompt ('''>'''). From this prompt you will be able to send commands to [[OpenOCD]]. To exit the telnet prompt, press '''CTRL + C'''.<br />
<br />
<br />
==JTAG Sticky Errors==<br />
<br />
As of revision 0.5.0 of OpenOCD, there is a bug that causes a number of errors to be shown when running OpenOCD. This will not cause any problems unless you have disconnected and reconnected the Beaglebone. You can read more about this issue at [[OpenOCD Troubleshooting]] <br />
<br />
<br />
[[Category:OpenOCD]]</div>Mattlmasseyhttps://elinux.org/index.php?title=Running_OpenOCD_on_Linux_with_the_Beaglebone&diff=127826Running OpenOCD on Linux with the Beaglebone2012-05-09T04:21:24Z<p>Mattlmassey: </p>
<hr />
<div>[[OpenOCD]] provides a command line interface for interacting with embedded devices. To use [[OpenOCD]] you will need to run it from the command line. This guide includes basic information about using the Ubuntu command line interface, the terminal window. If you are already proficient with the command line, you can find information specific to [[OpenOCD]] under the '''Installing FTDI Drivers''' and '''Telnet Connection''' headings.<br />
<br />
This guide was written for the Ubuntu 11.10 release. You may encounter differences on other Linux distributions. The instructions on this page use the Beaglebone as an example embedded chip target. The instructions are otherwise identical to those at [[Running OpenOCD on Linux]], which provides examples for the TinCanTools Hammer.<br />
<br />
<br />
==Initial Setup==<br />
<br />
The following guide assumes that you have followed the instructions in main [[OpenOCD]] page to install the application. You can choose to build OpenOCD from source or download a pre-built package. If you do not build from source, you may still need to download the board and platform specific scripts for the Beaglebone.<br />
<br />
<br />
==Opening the Command Prompt==<br />
<br />
Open the '''Applications''' menu from the menu bar on your desktop, and choose '''Accessories > Terminal.''' Ubuntu should open black window with white text and a prompt.<br />
<br />
<br />
==Command Prompt Basics - Paths and Navigation==<br />
<br />
The command prompt displays your current directory location. You will need to navigate to the [[OpenOCD]] directory to run it. To change directories, type '''cd'' followed by a file path. File paths can be absolute...<br />
<br />
cd /home<br />
cd /usr/local/lib<br />
<br />
...or relative...<br />
<br />
cd lib/mingw<br />
cd TinCanTools/openocd<br />
<br />
Absolute paths are from your root directory, and begin with a slash. Relative paths are from the current directory and do not begin with a slash. File paths are case sensitive.<br />
<br />
If you need to navigate to your home directory, type '''cd''' by itself like this...<br />
<br />
cd<br />
<br />
If you need to go back to the parent of the current directory, you can type...<br />
<br />
cd ..<br />
<br />
You can even use this as part of a longer relative path. For example...<br />
<br />
cd ../../TinCanTools<br />
<br />
...would take you up two levels, and then into a folder called TinCanTools.<br />
<br />
To reach your root directory, you can type:<br />
<br />
cd /<br />
<br />
If you need to include your home directory in a path ('''home/USERNAME''', replacing USERNAME with the name of your account), you can type it out as normal, or you can use the tilde key ('''~''') as shorthand. For example:<br />
<br />
cd /home/USERNAME/TinCanTools<br />
cd ~/TinCanTools<br />
<br />
...both take you to the same place.<br />
<br />
<br />
==Installing FTDI Drivers==<br />
<br />
The Beaglebone is very nice since it provides its JTAG interface directly through the USB so you don't need an external JTAG board. The JTAG support is provided through the FTDI chipset on the Beaglebone. You need to ensure that you have the FTDI drivers installed in your Linux host system.<br />
<br />
You can grab the drivers from FTDI's website (for the FTDI D2XX). http://www.ftdichip.com/Drivers/D2XX.htm<br />
<br />
Read the README in the driver install package for background information on how to install it. You may neeed to install libusb also. To do this, type the following:<br />
<br />
sudo apt-get install libusb<br />
<br />
Once you've installed the drivers, you can run lsusb to check that the FTDI interface is working on your connected Beaglebone:<br />
<br />
~$ lsusb<br />
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub<br />
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub<br />
Bus 002 Device 002: ID 80ee:0021 VirtualBox USB Tablet<br />
Bus 001 Device 002: ID 0403:6010 Future Technology Devices International, Ltd FT2232C Dual USB-UART/FIFO IC<br />
<br />
You should note the USB PID/VID of the FTDI interface is actually 0403:6010. This caused problems later. This is because there was a problem in newer board revisions (A5) that the FTDI chipset reported an incorrect PID/VID. You should copy down the information, since you will need it later.<br />
<br />
<br />
==Installing Beaglebone Scripts==<br />
<br />
You will need to download the source for OpenOCD to get the scripts. You can download the source to any directory that you want, since it will be temporary (unless you are building the source). The following example downloads the source to you current directory into a directory called openocd...<br />
<br />
git clone git://openocd.git.sourceforge.net/gitroot/openocd/openocd openocd<br />
<br />
<br />
Once the source is downloaded, you will need to copy the two script files necessary for the Beaglebone to your OpenOCD directories. This assumes you have installed OpenOCD to /usr/share/openocd/. In the following example, replace <Path to git clone openocd> with the path of the downloaded source...<br />
<br />
> sudo cp <path to git clone openocd>/tcl/board/ti_beaglebone.cfg /usr/share/openocd/scripts/board<br />
<br />
> sudo cp <path to git clone openocd>/tcl/target/am335x.cfg /usr/share/openocd/scripts/target<br />
<br />
<br />
==Editing the Beaglebone Script==<br />
<br />
You may need to edit the ti_beaglebone.cfg script file to corret the USB PID/VID issue mentioned above. Edit the file using a text editor such as gedit. (Remember, it should be run as root to have proper permissions)<br />
<br />
> sudo gedit /usr/share/openocd/scripts/board/ti_beaglebone.cfg<br />
<br />
You are looking for the following line in the cfg file:<br />
<br />
ft2232_vid_pid 0x0403 0xa6d0<br />
<br />
If the two hex values do not match the values you wrote when you ran lsusb mentioned in the previous section, you will need to edit it. For the A5 revision, I had to change this to...<br />
<br />
ft2232_vid_pid 0x0403 0x6010<br />
<br />
Once you save the file, you are ready to run OpenOCD. If you did not edit this file, when you ran the application it would complain that there are no available interfaces when the Beaglebone was connected. <br />
<br />
<br />
==Running OpenOCD==<br />
<br />
Navigate to the directory containing your openocd executable. If you have just compiled [[OpenOCD]] according to the instructions on this wiki, the executable is located in '''openocd/src''' or '''openocd-0.4.0/src.''' In that directory, simply type...<br />
<br />
openocd<br />
<br />
To run the program. It won't ''do'' anything though, because you need the appropriate permissions and config files. <br />
To exit openocd, press '''CTRL + C'''.<br />
<br />
<br />
==OpenOCD and Permissions==<br />
<br />
[[OpenOCD]] needs administrator privileges to interact with your USB drivers. Even Linux users with administrator privileges do not typically log on with those privileges active. However, Linux provides commands to run another command as the root user. On Ubuntu, this command is ''sudo''. To run a program as root, type ''sudo'', then a space, then the name of the program. For example...<br />
<br />
openocd<br />
<br />
...runs [[OpenOCD]] with your user permissions, and likely prevents [[OpenOCD]] from interacting with libUSB. However...<br />
<br />
sudo openocd<br />
<br />
...runs [[OpenOCD]] as root, with full permission to access your USB drivers.<br />
<br />
When you use the '''sudo''' command, Linux will prompt you for the root user's password. If you do not have access to this password, contact your system administrator. You can also configure Linux to allow [[OpenOCD]] to access specific hardware devices without ''sudo''. See [[Accessing Devices without Sudo]].<br />
<br />
<br />
==OpenOCD Config Files==<br />
<br />
Each time you use [[OpenOCD]] you will need to configure it by passing it paths to configuration files. In the [[OpenOCD]] 0.5.0 release, these files are found in '''openocd/scripts''' and its subdirectories. From the '''scripts''' directory, the configuration file for the Beaglebone is at '''board/ti_beaglebone.cfg'''. <br />
<br />
When you start [[OpenOCD]], you tell it to use the config files for your hardware with the '''-f''' switch, like this:<br />
<br />
sudo openocd -f path_to/cfg_file [-f path_to/other_cfg_file]<br />
<br />
For the Beaglebone, you would type:<br />
<br />
sudo openocd -f board/ti_beaglebone.cfg<br />
<br />
Be aware that config files may contain paths to other config files. For example '''ti_beagleboard.cfg''', the config file for the Beagleboard, contains this line:<br />
<br />
source [find target/am335x.cfg]<br />
<br />
When you run [[OpenOCD]] with the '''ti_beaglebone.cfg''' file, [[OpenOCD]] searches from the current directory for '''target/am335x.cfg'''. If the current directory does not contain [[OpenOCD]]'s '''target''' directory, it may not find the '''am335x.cfg''' file, or it may find a different '''am335x.cfg''' file elsewhere on your system. For more information, see [[OpenOCD Config File Paths]].<br />
<br />
<br />
==Telnet Connection==<br />
<br />
[[OpenOCD]] runs as a daemon. It accepts connections from other programs, but does not provide any means for you to give it commands directly. Once [[OpenOCD]] is running on your computer you will need to connect to it through another program, such as telnet.<br />
<br />
To run telnet and connect to [[OpenOCD]], open a new command prompt. From any directory, type:<br />
<br />
telnet localhost 4444<br />
<br />
You may need to run telnet as root:<br />
<br />
sudo telnet localhost 4444<br />
<br />
You should see a simple prompt ('''>'''). From this prompt you will be able to send commands to [[OpenOCD]]. To exit the telnet prompt, press '''CTRL + C'''.<br />
<br />
<br />
==JTAG Sticky Errors==<br />
<br />
As of revision 0.5.0 of OpenOCD, there is a bug that causes a number of errors to be shown when running OpenOCD. This will not cause any problems unless you have disconnected and reconnected the Beaglebone. You can read more about this issue at [[OpenOCD Troubleshooting]] <br />
<br />
<br />
[[Category:OpenOCD]]</div>Mattlmasseyhttps://elinux.org/index.php?title=Running_OpenOCD_on_Linux_with_the_Beaglebone&diff=127820Running OpenOCD on Linux with the Beaglebone2012-05-09T04:20:28Z<p>Mattlmassey: </p>
<hr />
<div>[[OpenOCD]] provides a command line interface for interacting with embedded devices. To use [[OpenOCD]] you will need to run it from the command line. This guide includes basic information about using the Ubuntu command line interface, the terminal window. If you are already proficient with the command line, you can find information specific to [[OpenOCD]] under the '''OpenOCD Config Files''' and '''Telnet Connection''' headings.<br />
<br />
This guide was written for the Ubuntu 11.10 release. You may encounter differences on other Linux distributions. The instructions on this page use the Beaglebone as an example embedded chip target. The instructions are otherwise identical to those at [[Running OpenOCD on Linux]], which provides examples for the TinCanTools Hammer.<br />
<br />
<br />
==Initial Setup==<br />
<br />
The following guide assumes that you have followed the instructions in main [[OpenOCD]] page to install the application. You can choose to build OpenOCD from source or download a pre-built package. If you do not build from source, you may still need to download the board and platform specific scripts for the Beaglebone.<br />
<br />
<br />
==Opening the Command Prompt==<br />
<br />
Open the '''Applications''' menu from the menu bar on your desktop, and choose '''Accessories > Terminal.''' Ubuntu should open black window with white text and a prompt.<br />
<br />
<br />
==Command Prompt Basics - Paths and Navigation==<br />
<br />
The command prompt displays your current directory location. You will need to navigate to the [[OpenOCD]] directory to run it. To change directories, type '''cd'' followed by a file path. File paths can be absolute...<br />
<br />
cd /home<br />
cd /usr/local/lib<br />
<br />
...or relative...<br />
<br />
cd lib/mingw<br />
cd TinCanTools/openocd<br />
<br />
Absolute paths are from your root directory, and begin with a slash. Relative paths are from the current directory and do not begin with a slash. File paths are case sensitive.<br />
<br />
If you need to navigate to your home directory, type '''cd''' by itself like this...<br />
<br />
cd<br />
<br />
If you need to go back to the parent of the current directory, you can type...<br />
<br />
cd ..<br />
<br />
You can even use this as part of a longer relative path. For example...<br />
<br />
cd ../../TinCanTools<br />
<br />
...would take you up two levels, and then into a folder called TinCanTools.<br />
<br />
To reach your root directory, you can type:<br />
<br />
cd /<br />
<br />
If you need to include your home directory in a path ('''home/USERNAME''', replacing USERNAME with the name of your account), you can type it out as normal, or you can use the tilde key ('''~''') as shorthand. For example:<br />
<br />
cd /home/USERNAME/TinCanTools<br />
cd ~/TinCanTools<br />
<br />
...both take you to the same place.<br />
<br />
<br />
==Installing FTDI Drivers==<br />
<br />
The Beaglebone is very nice since it provides its JTAG interface directly through the USB so you don't need an external JTAG board. The JTAG support is provided through the FTDI chipset on the Beaglebone. You need to ensure that you have the FTDI drivers installed in your Linux host system.<br />
<br />
You can grab the drivers from FTDI's website (for the FTDI D2XX). http://www.ftdichip.com/Drivers/D2XX.htm<br />
<br />
Read the README in the driver install package for background information on how to install it. You may neeed to install libusb also. To do this, type the following:<br />
<br />
sudo apt-get install libusb<br />
<br />
Once you've installed the drivers, you can run lsusb to check that the FTDI interface is working on your connected Beaglebone:<br />
<br />
~$ lsusb<br />
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub<br />
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub<br />
Bus 002 Device 002: ID 80ee:0021 VirtualBox USB Tablet<br />
Bus 001 Device 002: ID 0403:6010 Future Technology Devices International, Ltd FT2232C Dual USB-UART/FIFO IC<br />
<br />
You should note the USB PID/VID of the FTDI interface is actually 0403:6010. This caused problems later. This is because there was a problem in newer board revisions (A5) that the FTDI chipset reported an incorrect PID/VID. You should copy down the information, since you will need it later.<br />
<br />
<br />
==Installing Beaglebone Scripts==<br />
<br />
You will need to download the source for OpenOCD to get the scripts. You can download the source to any directory that you want, since it will be temporary (unless you are building the source). The following example downloads the source to you current directory into a directory called openocd...<br />
<br />
git clone git://openocd.git.sourceforge.net/gitroot/openocd/openocd openocd<br />
<br />
<br />
Once the source is downloaded, you will need to copy the two script files necessary for the Beaglebone to your OpenOCD directories. This assumes you have installed OpenOCD to /usr/share/openocd/. In the following example, replace <Path to git clone openocd> with the path of the downloaded source...<br />
<br />
> sudo cp <path to git clone openocd>/tcl/board/ti_beaglebone.cfg /usr/share/openocd/scripts/board<br />
<br />
> sudo cp <path to git clone openocd>/tcl/target/am335x.cfg /usr/share/openocd/scripts/target<br />
<br />
<br />
==Editing the Beaglebone Script==<br />
<br />
You may need to edit the ti_beaglebone.cfg script file to corret the USB PID/VID issue mentioned above. Edit the file using a text editor such as gedit. (Remember, it should be run as root to have proper permissions)<br />
<br />
> sudo gedit /usr/share/openocd/scripts/board/ti_beaglebone.cfg<br />
<br />
You are looking for the following line in the cfg file:<br />
<br />
ft2232_vid_pid 0x0403 0xa6d0<br />
<br />
If the two hex values do not match the values you wrote when you ran lsusb mentioned in the previous section, you will need to edit it. For the A5 revision, I had to change this to...<br />
<br />
ft2232_vid_pid 0x0403 0x6010<br />
<br />
Once you save the file, you are ready to run OpenOCD. If you did not edit this file, when you ran the application it would complain that there are no available interfaces when the Beaglebone was connected. <br />
<br />
<br />
==Running OpenOCD==<br />
<br />
Navigate to the directory containing your openocd executable. If you have just compiled [[OpenOCD]] according to the instructions on this wiki, the executable is located in '''openocd/src''' or '''openocd-0.4.0/src.''' In that directory, simply type...<br />
<br />
openocd<br />
<br />
To run the program. It won't ''do'' anything though, because you need the appropriate permissions and config files. <br />
To exit openocd, press '''CTRL + C'''.<br />
<br />
<br />
==OpenOCD and Permissions==<br />
<br />
[[OpenOCD]] needs administrator privileges to interact with your USB drivers. Even Linux users with administrator privileges do not typically log on with those privileges active. However, Linux provides commands to run another command as the root user. On Ubuntu, this command is ''sudo''. To run a program as root, type ''sudo'', then a space, then the name of the program. For example...<br />
<br />
openocd<br />
<br />
...runs [[OpenOCD]] with your user permissions, and likely prevents [[OpenOCD]] from interacting with libUSB. However...<br />
<br />
sudo openocd<br />
<br />
...runs [[OpenOCD]] as root, with full permission to access your USB drivers.<br />
<br />
When you use the '''sudo''' command, Linux will prompt you for the root user's password. If you do not have access to this password, contact your system administrator. You can also configure Linux to allow [[OpenOCD]] to access specific hardware devices without ''sudo''. See [[Accessing Devices without Sudo]].<br />
<br />
<br />
==OpenOCD Config Files==<br />
<br />
Each time you use [[OpenOCD]] you will need to configure it by passing it paths to configuration files. In the [[OpenOCD]] 0.5.0 release, these files are found in '''openocd/scripts''' and its subdirectories. From the '''scripts''' directory, the configuration file for the Beaglebone is at '''board/ti_beaglebone.cfg'''. <br />
<br />
When you start [[OpenOCD]], you tell it to use the config files for your hardware with the '''-f''' switch, like this:<br />
<br />
sudo openocd -f path_to/cfg_file [-f path_to/other_cfg_file]<br />
<br />
For the Beaglebone, you would type:<br />
<br />
sudo openocd -f board/ti_beaglebone.cfg<br />
<br />
Be aware that config files may contain paths to other config files. For example '''ti_beagleboard.cfg''', the config file for the Beagleboard, contains this line:<br />
<br />
source [find target/am335x.cfg]<br />
<br />
When you run [[OpenOCD]] with the '''ti_beaglebone.cfg''' file, [[OpenOCD]] searches from the current directory for '''target/am335x.cfg'''. If the current directory does not contain [[OpenOCD]]'s '''target''' directory, it may not find the '''am335x.cfg''' file, or it may find a different '''am335x.cfg''' file elsewhere on your system. For more information, see [[OpenOCD Config File Paths]].<br />
<br />
<br />
==Telnet Connection==<br />
<br />
[[OpenOCD]] runs as a daemon. It accepts connections from other programs, but does not provide any means for you to give it commands directly. Once [[OpenOCD]] is running on your computer you will need to connect to it through another program, such as telnet.<br />
<br />
To run telnet and connect to [[OpenOCD]], open a new command prompt. From any directory, type:<br />
<br />
telnet localhost 4444<br />
<br />
You may need to run telnet as root:<br />
<br />
sudo telnet localhost 4444<br />
<br />
You should see a simple prompt ('''>'''). From this prompt you will be able to send commands to [[OpenOCD]]. To exit the telnet prompt, press '''CTRL + C'''.<br />
<br />
<br />
==JTAG Sticky Errors==<br />
<br />
As of revision 0.5.0 of OpenOCD, there is a bug that causes a number of errors to be shown when running OpenOCD. This will not cause any problems unless you have disconnected and reconnected the Beaglebone. You can read more about this issue at [[OpenOCD Troubleshooting]] <br />
<br />
<br />
[[Category:OpenOCD]]</div>Mattlmasseyhttps://elinux.org/index.php?title=Running_OpenOCD_on_Linux_with_the_Beaglebone&diff=127796Running OpenOCD on Linux with the Beaglebone2012-05-09T03:42:14Z<p>Mattlmassey: Created page with "OpenOCD provides a command line interface for interacting with embedded devices. To use OpenOCD you will need to run it from the command line. This guide includes basic i..."</p>
<hr />
<div>[[OpenOCD]] provides a command line interface for interacting with embedded devices. To use [[OpenOCD]] you will need to run it from the command line. This guide includes basic information about using the Ubuntu command line interface, the terminal window. If you are already proficient with the command line, you can find information specific to [[OpenOCD]] under the '''OpenOCD Config Files''' and '''Telnet Connection''' headings.<br />
<br />
This guide was written for the Ubuntu 10.04 LTS release. You may encounter differences on other Linux distributions. The instructions on this page use the Beagleboard as an example embedded chip target. The instructions are otherwise identical to those at [[Running OpenOCD on Linux]], which provides examples for the TinCanTools Hammer.<br />
<br />
<br />
==Opening the Command Prompt==<br />
<br />
Open the '''Applications''' menu from the menu bar on your desktop, and choose '''Accessories > Terminal.''' Ubuntu should open black window with white text and a prompt.<br />
<br />
<br />
==Command Prompt Basics - Paths and Navigation==<br />
<br />
The command prompt displays your current directory location. You will need to navigate to the [[OpenOCD]] directory to run it. To change directories, type '''cd'' followed by a file path. File paths can be absolute...<br />
<br />
cd /home<br />
cd /usr/local/lib<br />
<br />
...or relative...<br />
<br />
cd lib/mingw<br />
cd TinCanTools/openocd<br />
<br />
Absolute paths are from your root directory, and begin with a slash. Relative paths are from the current directory and do not begin with a slash. File paths are case sensitive.<br />
<br />
If you need to navigate to your home directory, type '''cd''' by itself like this...<br />
<br />
cd<br />
<br />
If you need to go back to the parent of the current directory, you can type...<br />
<br />
cd ..<br />
<br />
You can even use this as part of a longer relative path. For example...<br />
<br />
cd ../../TinCanTools<br />
<br />
...would take you up two levels, and then into a folder called TinCanTools.<br />
<br />
To reach your root directory, you can type:<br />
<br />
cd /<br />
<br />
If you need to include your home directory in a path ('''home/USERNAME''', replacing USERNAME with the name of your account), you can type it out as normal, or you can use the tilde key ('''~''') as shorthand. For example:<br />
<br />
cd /home/USERNAME/TinCanTools<br />
cd ~/TinCanTools<br />
<br />
...both take you to the same place.<br />
<br />
<br />
==Running OpenOCD==<br />
<br />
Navigate to the directory containing your openocd executable. If you have just compiled [[OpenOCD]] according to the instructions on this wiki, the executable is located in '''openocd/src''' or '''openocd-0.4.0/src.''' In that directory, simply type...<br />
<br />
openocd<br />
<br />
To run the program. It won't ''do'' anything though, because you need the appropriate permissions and config files. <br />
To exit openocd, press '''CTRL + C'''.<br />
<br />
<br />
==OpenOCD and Permissions==<br />
<br />
[[OpenOCD]] needs administrator privileges to interact with your USB drivers. Even Linux users with administrator privileges do not typically log on with those privileges active. However, Linux provides commands to run another command as the root user. On Ubuntu, this command is ''sudo''. To run a program as root, type ''sudo'', then a space, then the name of the program. For example...<br />
<br />
openocd<br />
<br />
...runs [[OpenOCD]] with your user permissions, and likely prevents [[OpenOCD]] from interacting with libUSB. However...<br />
<br />
sudo openocd<br />
<br />
...runs [[OpenOCD]] as root, with full permission to access your USB drivers.<br />
<br />
When you use the '''sudo''' command, Linux will prompt you for the root user's password. If you do not have access to this password, contact your system administrator. You can also configure Linux to allow [[OpenOCD]] to access specific hardware devices without ''sudo''. See [[Accessing Devices without Sudo]].<br />
<br />
<br />
==OpenOCD Config Files==<br />
<br />
Each time you use [[OpenOCD]] you will need to configure it by passing it paths to configuration files. In the [[OpenOCD]] 0.4.0 release, these files are found in '''openocd-0.4.0/tcl''' and its subdirectories. From the '''tcl''' directory, the configuration file for the Flyswatter is at '''interface/flyswatter.cfg'''. The file for the Beagleboard is at '''board/ti_beagleboard.cfg'''. If your copy of [[OpenOCD]] includes support for the Flyswatter2, its config file is at '''interface/flyswatter2.cfg'''.<br />
<br />
When you start [[OpenOCD]], you tell it to use the config files for your hardware with the '''-f''' switch, like this:<br />
<br />
sudo openocd -f path_to/cfg_file [-f path_to/other_cfg_file]<br />
<br />
For example, suppose you want to run [[OpenOCD]] for the Flyswatter and the Beagleboard. The current directory contains the [[OpenOCD]] executable and the '''board''', '''interface''', and '''target''' directories provided with the OpenOCD source. You would type:<br />
<br />
sudo openocd -f interface/flyswatter.cfg -f board/ti_beagleboard.cfg<br />
<br />
Be aware that config files may contain paths to other config files. For example '''ti_beagleboard.cfg''', the config file for the Beagleboard, contains this line:<br />
<br />
source [find target/omap3530.cfg]<br />
<br />
When you run [[OpenOCD]] with the '''ti_beagleboard.cfg''' file, [[OpenOCD]] searches from the current directory for '''target/omap3530.cfg'''. If the current directory does not contain [[OpenOCD]]'s '''target''' directory, it may not find the '''omap3530.cfg''' file, or it may find a different '''omap3530.cfg''' file elsewhere on your system. For more information, see [[OpenOCD Config File Paths]].<br />
<br />
If you have compiled OpenOCD yourself, the easiest way to avoid these issues is to copy the '''openocd''' binary from your '''openocd-0.4.0/src''' directory to your '''openocd-0.4.0/tcl''' directory. To run [[OpenOCD]], navigate to '''openocd-0.4.0/tcl''' in the command terminal and run [[OpenOCD]] as above. You can also create a new directory anywhere on your system, and copy the '''openocd''' binary and the contents of '''openocd-0.4.0/tcl''' to the new directory.<br />
<br />
<br />
==Telnet Connection==<br />
<br />
[[OpenOCD]] runs as a daemon. It accepts connections from other programs, but does not provide any means for you to give it commands directly. Once [[OpenOCD]] is running on your computer you will need to connect to it through another program, such as telnet.<br />
<br />
To run telnet and connect to [[OpenOCD]], open a new command prompt. From any directory, type:<br />
<br />
telnet localhost 4444<br />
<br />
You may need to run telnet as root:<br />
<br />
sudo telnet localhost 4444<br />
<br />
You should see a simple prompt ('''>'''). From this prompt you will be able to send commands to [[OpenOCD]]. To exit the telnet prompt, press '''CTRL + C'''.<br />
<br />
[[Category:TinCanTools]]<br />
[[Category:OpenOCD]]</div>Mattlmasseyhttps://elinux.org/index.php?title=OpenOCD&diff=127790OpenOCD2012-05-09T03:41:50Z<p>Mattlmassey: /* Board Specific Instructions */</p>
<hr />
<div>== Introduction ==<br />
This page builds on content from the main [http://openocd.sourceforge.net/ OpenOCD] project site. <br />
<br />
OpenOCD (Open On-Chip Debugger) is open-source software that interfaces with a hardware debugger's [[JTAG]] port. OpenOCD provides debugging and in-system programming for embedded target devices. OpenOCD provides the ability to flash NAND and NOR FLASH memory devices that are attached to the processor on the target system. Flash programming is supported for external CFI compatible flashes (Intel and AMD/Spansion command set) and several internal flashes (LPC2000, AT91SAM7, STR7x, STR9x, LM3 and STM32x).<br />
<br />
OpenOCD was originally developed by Dominic Rath at the University of Applied Sciences Augsburg. The OpenOCD source code is now available through the GNU General Public License (GPL).<br />
<br />
== Supported Cores Types ==<br />
OpenOCD supports the following cores:<br />
<br />
{| class="wikitable"<br />
|-<br />
! CORE TYPE<br />
! EXAMPLE PROCESSORS<br />
|-<br />
| ARM7TDMI<br />
| LPC2148, AT91SAM7<br />
|-<br />
| ARM720T <br />
| LH79520, EP7312<br />
|-<br />
| ARM9TDMI<br />
|<br />
|- <br />
| ARM920T<br />
| S3C2410, S3C2440<br />
|-<br />
| ARM922T<br />
| <br />
|-<br />
| ARM926EJS <br />
| S3C2412, STN8811, STN8815<br />
|-<br />
| ARM966E<br />
| STR91XF<br />
|-<br />
| ARM11<br />
| S3C6400, OMAP2420, MSM7200<br />
|-<br />
| ARM1136<br />
| <br />
|-<br />
| ARM1156<br />
| <br />
|-<br />
| ARM1176<br />
| <br />
|-<br />
| CORTEX-M3<br />
| LM3S series, STM32 series<br />
|-<br />
| CORTEX-A8<br />
| OMAP3530 BeagleBoard<br />
|-<br />
| CORTEX-A8<br />
| DM3730 BeagleBoard-xM<br />
|-<br />
| CORTEX-A9<br />
| OMAP4430 PandaBoard<br />
|-<br />
| XSCALE<br />
| PXA255, PXA270, IXP42X<br />
|-<br />
| MARVEL<br />
| FEROCEON CPU CORE<br />
|-<br />
| MIPS<br />
| M4K<br />
|-<br />
|}<br />
<br />
<br />
<br />
<br />
== Technical Support ==<br />
* [http://groups.google.com/group/openocd-support OpenOCD-Support on GoogleGroups]<br />
* [http://openocd.sourceforge.net/ OpenOCD website]<br />
* [https://lists.sourceforge.net/lists/listinfo/openocd-devel OpenOCD development mailing list]<br />
* [http://forum.sparkfun.com/viewforum.php?f=18 Sparkfun.com OpenOCD forum]<br />
* [http://openocd.sourceforge.net/doc/html/index.html OpenOCD User's Guide]<br />
* #openocd channel on irc.freenode.net<br />
<br />
<br />
==Installing OpenOCD==<br />
<br />
* [[Compiling OpenOCD]]<br />
* [[OpenOCD Ubuntu Package]]<br />
* [[OpenOCD Patches]]<br />
* [[OpenOCD Config Files]]<br />
* [[Libftdi_vs_FTD2XX|libFDTI vs. libFTD2xx]] license and performance comparison<br />
<br />
==Running OpenOCD==<br />
==== General Instructions ====<br />
* [[Running OpenOCD]]<br />
* [[Running OpenOCD on Linux]]<br />
* [[Running OpenOCD on Windows]]<br />
* [[OpenOCD Troubleshooting]]<br />
==== OpenOCD Configuration Files ====<br />
<br />
* [[OpenOCD Configuration Files Overview]]<br />
* [[How To Write an Interface Configuration Script]]<br />
* [[How To Write a Board Configuration Script]]<br />
* [[How To Write a Target Configuration Script]]<br />
<br />
==== Board Specific Instructions ====<br />
* [[Running_OpenOCD_on_Linux_with_the_Beagleboard|BeagleBoard]]<br />
* [[Running_OpenOCD_on_Linux_with_the_Beaglebone|BeagleBone]]<br />
* [[OpenOCD_PandaBoard|PandaBoard]]<br />
* [[OpenOCD_Snowball|Snowball]]<br />
<br />
==External Links==<br />
[http://openocd.sourceforge.net/ OpenOCD] project.<br />
<br />
[http://openocd.git.sourceforge.net/git/gitweb.cgi?p=openocd/openocd;a=summary OpenOCD source]<br />
<br />
[[Category:TinCanTools]]<br />
[[Category:OpenOCD]]</div>Mattlmassey