<?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>Failed to write to nrf5 flash when flash bootloader with openocd and cmsis dap link</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/83963/failed-to-write-to-nrf5-flash-when-flash-bootloader-with-openocd-and-cmsis-dap-link</link><description>I&amp;#39;m building a nrfmicro bluetooth keyboard controller which uses an ebyte E73-2G4M08S1C nrf52840. My programmer is cmsis dap link. Openocd verson is 0.11.0. 
 Unlock is fine using command nrf52.dap apreg 1 0x04 0x01 
 
 When flash nrf bootloader according</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 24 Jan 2022 10:47:07 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/83963/failed-to-write-to-nrf5-flash-when-flash-bootloader-with-openocd-and-cmsis-dap-link" /><item><title>RE: Failed to write to nrf5 flash when flash bootloader with openocd and cmsis dap link</title><link>https://devzone.nordicsemi.com/thread/349197?ContentTypeID=1</link><pubDate>Mon, 24 Jan 2022 10:47:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7989e728-67e6-4884-8999-50b969f2aaca</guid><dc:creator>yejianfengblue</dc:creator><description>&lt;p&gt;Add &lt;code&gt;set WORKARESIZE 0&lt;/code&gt; to to top of&amp;nbsp;&lt;span&gt;/usr/share/openocd/scripts/target/nrf52.cfg&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#
# Nordic nRF52 series: ARM Cortex-M4 @ 64 MHz
#
set WORKAREASIZE 0

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
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;500kb hex file tooks minutes. Slow but seems work.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;openocd -d2 -f interface/cmsis-dap.cfg -f target/nrf52.cfg -c &amp;quot;init&amp;quot; -c &amp;quot;program ./bootloader.hex verify reset exit&amp;quot;

Open On-Chip Debugger 0.11.0
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
debug_level: 2

Info : auto-selecting first available session transport &amp;quot;swd&amp;quot;. To override use &amp;#39;transport select &amp;lt;transport&amp;gt;&amp;#39;.
Info : CMSIS-DAP: SWD  Supported
Info : CMSIS-DAP: FW Version = 2.0.0
Info : CMSIS-DAP: Serial# = 205526554555
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 0 TDO = 0 nTRST = 0 nRESET = 1
Info : CMSIS-DAP: Interface ready
Info : clock speed 1000 kHz
Info : SWD DPIDR 0x2ba01477
Info : nrf52.cpu: hardware has 6 breakpoints, 4 watchpoints
Error: nrf52.cpu -- clearing lockup after double fault
Polling target nrf52.cpu failed, trying to reexamine
Info : nrf52.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : starting gdb server for nrf52.cpu on 3333
Info : Listening on port 3333 for gdb connections
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0xfffffffe msp: 0xfffffffc
** Programming Started **
Info : nRF52840-xxAA(build code: D0) 1024kB Flash, 256kB RAM
Info : Padding image section 0 at 0x00000b00 with 1280 bytes
Info : Flash write discontinued at 0x00025de8, next section at 0x000f4000
Warn : Adding extra erase range, 0x00025de8 .. 0x00025fff
Warn : not enough working area available(requested 34)
Warn : no working area available, falling back to slow memory writes
Info : Padding image section 2 at 0x000fca9c with 3428 bytes
Warn : Adding extra erase range, 0x000fd858 .. 0x000fdfff
Warn : not enough working area available(requested 34)
Warn : no working area available, falling back to slow memory writes
Warn : Adding extra erase range, 0x10001000 .. 0x10001013
Warn : Adding extra erase range, 0x1000101c .. 0x10001fff
Warn : not enough working area available(requested 34)
Warn : no working area available, falling back to slow memory writes
** Programming Finished **
** Verify Started **
Warn : not enough working area available(requested 52)
Warn : not enough working area available(requested 52)
Warn : not enough working area available(requested 52)
Warn : not enough working area available(requested 52)
Warn : not enough working area available(requested 52)
** Verified OK **
** Resetting Target **
shutdown command invoked
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>