<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Having trouble using openocd with the nrf52 on OSX</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/36331/having-trouble-using-openocd-with-the-nrf52-on-osx</link><description>Hi all, 
 I&amp;#39;m running into trouble using openocd to flash code onto the nrf52840 and then step through it. I&amp;#39;m running High Sierra (although I doubt that&amp;#39;s important), and using a jlink (from segger) as my debug tool. My config file is very simple, and</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 20 Jul 2020 06:44:14 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/36331/having-trouble-using-openocd-with-the-nrf52-on-osx" /><item><title>RE: Having trouble using openocd with the nrf52 on OSX</title><link>https://devzone.nordicsemi.com/thread/260741?ContentTypeID=1</link><pubDate>Mon, 20 Jul 2020 06:44:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b253b2e8-c2fa-406f-b064-84b50443239a</guid><dc:creator>Stian R&amp;#248;ed Hafskjold</dc:creator><description>&lt;p&gt;Thanks a lot!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Having trouble using openocd with the nrf52 on OSX</title><link>https://devzone.nordicsemi.com/thread/260715?ContentTypeID=1</link><pubDate>Sun, 19 Jul 2020 19:14:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8965546a-64d4-4ed1-9c95-cccc369251f0</guid><dc:creator>tlongeri</dc:creator><description>&lt;p&gt;I know this is an old question, but I had the same &amp;quot;invalid subcommand&amp;quot; problem when flashing so I figured I&amp;#39;d write something.&lt;/p&gt;
&lt;p&gt;The short answer is the solution is to use the latest commit on the &lt;a href="https://sourceforge.net/p/openocd/code/ci/master/tree/"&gt;OpenOCD repo&lt;/a&gt; (as of writing this the latest release is v0.10.0 but it doesn&amp;#39;t have full support for the nRF52). When you asked the question 2 years ago, &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/29029/programming-nrf52-with-openocd/114896"&gt;ubicore&amp;#39;s OpenOCD patch&lt;/a&gt; would&amp;#39;ve probably solved this issue.&lt;/p&gt;
&lt;p&gt;The long answer is that nrf52.cfg is missing the &amp;quot;flash bank&amp;quot; command, which you need to run before running some subcommands like &amp;quot;write_image&amp;quot;. If you look at nrf51.cfg, you will find these lines:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;flash bank $_CHIPNAME.flash nrf51 0x00000000 0 1 1 $_TARGETNAME
flash bank $_CHIPNAME.uicr nrf51 0x10001000 0 1 1 $_TARGETNAME&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Note that one of the parameters is &amp;quot;nrf51&amp;quot; - this is the name of the flash driver. Flash drivers can be found in the repo under src/flash/nor (at least in the latest OpenOCD versions), where you will find C source files that define &amp;quot;flash_driver&amp;quot; structures with a &amp;quot;name&amp;quot; member variable identifying the driver. Unfortunately, in version 0.10.0 and earlier there is no driver for the nRF52 (the &amp;quot;nrf51&amp;quot; driver might work with some limitations, I haven&amp;#39;t tested it). The latest commit has the &amp;quot;nrf5&amp;quot; driver which works with the nRF52.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Having trouble using openocd with the nrf52 on OSX</title><link>https://devzone.nordicsemi.com/thread/140075?ContentTypeID=1</link><pubDate>Fri, 13 Jul 2018 13:44:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:686326ed-25b7-413b-8cb8-c01337008b8a</guid><dc:creator>Maipei</dc:creator><description>&lt;p&gt;So I never found a way to make the above work, but I found that calling openocd as a bare command worked just fine, after which I could jump into the connection with a telnet session and use gdb to do the debugging that I want to do.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>