<?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>how to flash nRF52832 using ST-link v2 in ubuntu 16.04 ??</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/28099/how-to-flash-nrf52832-using-st-link-v2-in-ubuntu-16-04</link><description>devzone.nordicsemi.com/.../ 
 Using this link I&amp;#39;m able to build sample code in nRF52 SDK in Ubuntu. 
 I&amp;#39;ve customized board based on nrf52832 (Bluey Board) &amp;amp; ST-link v2. As per my understanding we can program nRF52832 using ST-link V2 since it is cortex</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 10 Oct 2017 14:54:16 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/28099/how-to-flash-nrf52832-using-st-link-v2-in-ubuntu-16-04" /><item><title>RE: how to flash nRF52832 using ST-link v2 in ubuntu 16.04 ??</title><link>https://devzone.nordicsemi.com/thread/110784?ContentTypeID=1</link><pubDate>Tue, 10 Oct 2017 14:54:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c572bf89-95f5-4c54-a017-435affbdadfb</guid><dc:creator>vikrant8051</dc:creator><description>&lt;p&gt;&lt;a href="https://primalcortex.wordpress.com/2017/06/10/setting-up-openocd-for-programming-the-nordic-nrf52832-chip/"&gt;primalcortex.wordpress.com/.../&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;This link solved my own issue.&lt;/p&gt;
&lt;p&gt;step 1:
git clone git://git.code.sf.net/p/openocd/code openocd-code&lt;/p&gt;
&lt;p&gt;step 2:
cd openocd-code&lt;/p&gt;
&lt;p&gt;step 3:
git pull &lt;a href="http://openocd.zylin.com/openocd"&gt;openocd.zylin.com/openocd&lt;/a&gt; refs/changes/15/3215/2&lt;/p&gt;
&lt;p&gt;setp 4:
After this we have three conflicting files that have changes that we must deal manually.&lt;/p&gt;
&lt;p&gt;4.1
Replace src/flash/nor/drivers.c with file on this link &lt;a href="https://pastebin.com/5X4e9QC2"&gt;https://pastebin.com/5X4e9QC2&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;And remove or comment line no. 49,50,54,55,105,106,110,111&lt;/p&gt;
&lt;p&gt;4.2
Replace src/flash/nor/Makefile.am with file on this link &lt;a href="https://pastebin.com/WaJrKete"&gt;https://pastebin.com/WaJrKete&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;4.3&lt;/p&gt;
&lt;p&gt;Edit tcl/target/nrf52.cfg as&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#---------------------------------------------------------------------------------------------------------------------------------
#
# Nordic nRF52 series: ARM Cortex-M4 @ 64 MHz
#

source [find target/swj-dp.tcl]

if { [info exists CHIPNAME] } {
        set _CHIPNAME $CHIPNAME
} else {
        set _CHIPNAME nrf52
}

# Work-area is a space in RAM used for flash programming
# By default use 16kB
if { [info exists WORKAREASIZE] } {
   set _WORKAREASIZE $WORKAREASIZE
} else {
   set _WORKAREASIZE 0x4000
}

if { [info exists CPUTAPID] } {
        set _CPUTAPID $CPUTAPID
} else {
        set _CPUTAPID 0x2ba01477
}

# Work-area is a space in RAM used for flash programming
# By default use 16kB
if { [info exists WORKAREASIZE] } {
   set _WORKAREASIZE $WORKAREASIZE
} else {
   set _WORKAREASIZE 0x4000
}

swj_newdap $_CHIPNAME cpu -expected-id $_CPUTAPID

set _TARGETNAME $_CHIPNAME.cpu
target create $_TARGETNAME cortex_m -chain-position $_TARGETNAME


adapter_khz 1000

$_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size $_WORKAREASIZE -work-area-backup 0

flash bank $_CHIPNAME.flash nrf52 0x00000000 0 1 1 $_TARGETNAME
flash bank $_CHIPNAME.uicr nrf52 0x10001000 0 1 1 $_TARGETNAME

if { ![using_hla] } {
        cortex_m reset_config sysresetreq
}

#---------------------------------------------------------------------------------------------------------------------------------
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;4.4
create empty file src/flash/nor/nrf51.c&lt;/p&gt;
&lt;p&gt;step 5:
Edit openocd-code/src/flash/nor/nrf52.c as per &lt;a href="https://primalcortex.wordpress.com/2017/06/10/setting-up-openocd-for-programming-the-nordic-nrf52832-chip/"&gt;primalcortex.wordpress.com/.../&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;step 6:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;./bootstrap
./configure
make 
make install
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;step 7:
create nrf52832.cfg file &amp;amp; add following lines in it&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#nRF52832 Target
source [find interface/stlink-v2.cfg]

transport select hla_swd

source [find target/nrf52.cfg]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;step 8:
execute&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;openocd -d2 -f nrf52832.cfg 
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;step 9:
Open another terminal &amp;amp; execute -&amp;gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;telnet localhosta 4444 
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;then&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;gt; reset
&amp;gt; reset halt
&amp;gt; nrf52 mass_erase
&amp;gt; program demo.hex verify
&amp;gt; reset
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This will load the code into nRF52832 flash.&lt;/p&gt;
&lt;p&gt;Hope this will help.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to flash nRF52832 using ST-link v2 in ubuntu 16.04 ??</title><link>https://devzone.nordicsemi.com/thread/110783?ContentTypeID=1</link><pubDate>Tue, 10 Oct 2017 08:27:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ecef1d45-d3a7-43f6-a859-e332939bd1fb</guid><dc:creator>vikrant8051</dc:creator><description>&lt;p&gt;I&amp;#39;ve already gone through with this link...not useful....patch to openOCD is weired thing which always give some error.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to flash nRF52832 using ST-link v2 in ubuntu 16.04 ??</title><link>https://devzone.nordicsemi.com/thread/110782?ContentTypeID=1</link><pubDate>Mon, 09 Oct 2017 18:18:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:441621e3-cbac-4294-a1cd-bcda998826a8</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;nrfjprog won&amp;#39;t work, as this is built on top of the J-Link driver and only support Segger J-Link debuggers. You can try &lt;a href="https://pcbreflux.blogspot.com/2016/09/nrf52832-first-steps-with-st-link-v2.html"&gt;this tutorial&lt;/a&gt;, which seems to describe what you are looking for.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>