{"id":1015,"date":"2017-10-07T12:25:39","date_gmt":"2017-10-07T19:25:39","guid":{"rendered":"http:\/\/tre.ucsd.edu\/wordpress\/?p=1015"},"modified":"2017-10-10T10:17:26","modified_gmt":"2017-10-10T17:17:26","slug":"mus177-267","status":"publish","type":"post","link":"https:\/\/tre.ucsd.edu\/wordpress\/?p=1015","title":{"rendered":"MUS177-267 OpenOCD (update)"},"content":{"rendered":"<h2>Installing OpenOCD<\/h2>\n<p>I have edited this document to put preferred methods of installation on the top. Also note that openocd 0.10 is required to program STM32F7 family chips.<\/p>\n<h2>macOS &#8211; Preferred method &#8211; homebrew<\/h2>\n<ul>\n<li>install Xcode and Xcode command line tools<\/li>\n<li>install homebrew using \u00a0this command in the Terminal:\n<pre><code id=\"selectable\">\/usr\/bin\/ruby -e \"$(curl -fsSL https:\/\/raw.githubusercontent.com\/Homebrew\/install\/master\/install)\"<\/code><\/pre>\n<\/li>\n<li>install openocd using this in the\u00a0Terminal:\n<pre>brew install --HEAD openocd<\/pre>\n<\/li>\n<li>run openocd -f board\/stm32f4discovery.cfg from the Terminal<\/li>\n<\/ul>\n<h2>Windows &#8211; Preferred method &#8211; Freddie Chopin<\/h2>\n<ul>\n<li>Download from\u00a0<a href=\"http:\/\/www.freddiechopin.info\/en\/download\/category\/4-openocd\">http:\/\/www.freddiechopin.info\/en\/download\/category\/4-openocd<\/a><\/li>\n<li>You will need a .7z unpacker to open the archive.<\/li>\n<li>Place in your STMToolchain folder (not strictly necessary)<\/li>\n<li>run openocd with options -f &#8220;board\\stm32f4discovery.cfg&#8221; from Eclipse. You can do this from the Command Line, but you will need to set the MSDOS search path.<\/li>\n<\/ul>\n<h2>Common Bug &#8211; If you are &#8220;bounced&#8221; by openocd and have an STM32F4Discovery board<\/h2>\n<ul>\n<li>You probably have version\u00a0<strong>MB997E\u00a0<\/strong>of the board<\/li>\n<li>Edit the file\u00a0board\/stm32f4discovery.cfg (in the openocd scripts folder) with Eclipse. If on macOS, you will have to first type\u00a0<strong>Command-Shift-G<\/strong> in the file open box and enter\u00a0<strong>\/usr\/local\/share\/openocd\/scripts<\/strong><\/li>\n<li>Change the line that reads\n<pre>source [find interface\/stlink-v2.cfg]<\/pre>\n<p>to<\/p>\n<pre>source [find interface\/stlink-v2-1.cfg]<\/pre>\n<\/li>\n<li>Save the file and try openocd again<\/li>\n<\/ul>\n<h2>Common Bug &#8211; If you are &#8220;bounced&#8221; by openocd and you are running Windows<\/h2>\n<ul>\n<li>Install the STLink USB driver from\u00a0<a href=\"http:\/\/www.st.com\/content\/st_com\/en\/products\/development-tools\/software-development-tools\/stm32-software-development-tools\/stm32-utilities\/stsw-link009.html\">http:\/\/www.st.com\/content\/st_com\/en\/products\/development-tools\/software-development-tools\/stm32-software-development-tools\/stm32-utilities\/stsw-link009.html<\/a>\u00a0.<\/li>\n<li>Plug in your STM32 board again and restart openocd.<\/li>\n<li>If this doesn&#8217;t work, install the STLink utility\u00a0<a href=\"http:\/\/www.st.com\/content\/st_com\/en\/products\/development-tools\/software-development-tools\/stm32-software-development-tools\/stm32-programmers\/stsw-link004.html\">http:\/\/www.st.com\/content\/st_com\/en\/products\/development-tools\/software-development-tools\/stm32-software-development-tools\/stm32-programmers\/stsw-link004.html<\/a>\u00a0and see if this can connect to your STM32 board.<\/li>\n<li>Again, plug in your STM32 board again and restart openocd.<\/li>\n<li><\/li>\n<li>If all fails, schedule office hours with me.<\/li>\n<\/ul>\n<h2>Testing &#8211; Check Telnet Connection to OpenOCD<\/h2>\n<p>You will be able to connect to openocd with &#8220;telnet localhost 4444&#8221;. Windows users may need to enable the Telnet Client<\/p>\n<h2>Other methods to install OpenOCD (not all will work on all hosts)<\/h2>\n<h2>\u00a0Windows &amp; macOS (precompiled OpenOCD &#8211;\u00a0latest for STM32F7)<\/h2>\n<ul>\n<li>Download from <a href=\"https:\/\/github.com\/gnu-mcu-eclipse\/openocd\/releases\">https:\/\/github.com\/gnu-mcu-eclipse\/openocd\/releases<\/a><\/li>\n<li>To run from command line &#8211; add bin directory to search path. macOS example &#8211; edit .bashrc:\n<pre> export PATH=$PATH:\/Applications\/GNU\\ MCU\\ Eclipse\/OpenOCD\/0.10.0-3-20170826-1813-dev\/bin<\/pre>\n<\/li>\n<li>Windows example &#8211; edit Control Panel:System:Advanced:Environment:Path. Append to end of path text:\n<pre>;C:\\Program Files\\GNU MCU Eclipse\\OpenOCD\\0.10.0-3-20170826-1813-dev\/bin<\/pre>\n<\/li>\n<li>Run from Terminal (macOS) or Command Prompt (Windows)<br \/>\nWindows<\/p>\n<pre>openocd -s \"C:\\Program Files\\GNU MCU Eclipse\\OpenOCD\\0.10.0-3-20170826-1813-dev\\scripts\" -f \"board\\stm32f4discovery.cfg\"<\/pre>\n<p>macOS<\/p>\n<pre>openocd -s \/Applications\/GNU\\ MCU\\ Eclipse\/OpenOCD\/0.10.0-3-20170826-1813-dev\/scripts -f stm32f4discovery.cfg<\/pre>\n<\/li>\n<\/ul>\n<h2>Windows(MSYS2 precompiled method)<\/h2>\n<ul>\n<li>Install MSYS2 from <a href=\"http:\/\/www.msys2.org\">www.msys2.org<\/a><\/li>\n<li>Install OpenOCD binary for 64:\u00a0<span class=\"crayon-v\">pacman<\/span> <span class=\"crayon-o\">&#8211;<\/span><span class=\"crayon-i\">S<\/span> <span class=\"crayon-v\">mingw<\/span><span class=\"crayon-o\">&#8211;<\/span><span class=\"crayon-v\">w64<\/span><span class=\"crayon-o\">&#8211;<\/span><span class=\"crayon-v\">x86_64<\/span><span class=\"crayon-o\">&#8211;<\/span><span class=\"crayon-v\">openocd<\/span><span class=\"crayon-o\">&#8211;<\/span><span class=\"crayon-v\">git<\/span><\/li>\n<li>-or- for 32 bit:\u00a0<span class=\"crayon-v\">pacman<\/span> <span class=\"crayon-o\">&#8211;<\/span><span class=\"crayon-i\">S<\/span> <span class=\"crayon-v\">mingw<\/span><span class=\"crayon-o\">&#8211;<\/span><span class=\"crayon-v\">w64<\/span><span class=\"crayon-o\">&#8211;<\/span><span class=\"crayon-v\">i686<\/span><span class=\"crayon-o\">&#8211;<\/span><span class=\"crayon-v\">openocd<\/span><span class=\"crayon-o\">&#8211;<\/span><span class=\"crayon-v\">git<\/span><\/li>\n<li>Restart MSYS2<\/li>\n<li>Enter openocd -s &#8220;\/mingw64\/share\/openocd\/scripts&#8221; -f &#8220;board\/stm32f4discovery.cfg&#8221;<\/li>\n<li>You can now connect via &#8220;telnet localhost 4444&#8221; from another MSYS2 window<\/li>\n<li>Connection from Eclipse uses port 3333 rather than 4444<\/li>\n<\/ul>\n<h2><\/h2>\n","protected":false},"excerpt":{"rendered":"<p>Installing OpenOCD I have edited this document to put preferred methods of installation on the top. Also note that openocd 0.10 is required to program STM32F7 family chips. macOS &#8211; Preferred method &#8211; homebrew install Xcode and Xcode command line &hellip; <a href=\"https:\/\/tre.ucsd.edu\/wordpress\/?p=1015\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[21],"tags":[],"_links":{"self":[{"href":"https:\/\/tre.ucsd.edu\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1015"}],"collection":[{"href":"https:\/\/tre.ucsd.edu\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tre.ucsd.edu\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tre.ucsd.edu\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tre.ucsd.edu\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1015"}],"version-history":[{"count":12,"href":"https:\/\/tre.ucsd.edu\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1015\/revisions"}],"predecessor-version":[{"id":1040,"href":"https:\/\/tre.ucsd.edu\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1015\/revisions\/1040"}],"wp:attachment":[{"href":"https:\/\/tre.ucsd.edu\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1015"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tre.ucsd.edu\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1015"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tre.ucsd.edu\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1015"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}