<?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>Moving data within Flash</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/4361/moving-data-within-flash</link><description>Hi, 
 Looking at pstorage related code, it appears that it handles data copy from RAM to Flash. 
 Can I use pstorage functions to move data within Flash? I want to implement an array of structures such that if an in between entry is deleted, the subsequent</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 06 Nov 2014 19:46:44 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/4361/moving-data-within-flash" /><item><title>RE: Moving data within Flash</title><link>https://devzone.nordicsemi.com/thread/15504?ContentTypeID=1</link><pubDate>Thu, 06 Nov 2014 19:46:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9ba6a9d7-c198-4f2b-818b-24518b48ca1c</guid><dc:creator>sam wagner</dc:creator><description>&lt;p&gt;Hi Charles,&lt;/p&gt;
&lt;p&gt;Thanks a lot for the information. I agree that moving data within Flash is possible.&lt;/p&gt;
&lt;p&gt;My question is mostly about if/how pstorage functions can be used to achieve that especially if the data size is large (spanning multiple pages)?
If I look at pstorage_update(), it doesn&amp;#39;t seem to consider the possibility of pSrc lying in Flash and of data size spanning multiple pages. If pSrc lies in Flash, the swap page usage could get tricky if pDest and pSrc lie within the same page. In that case, one may need to maintain 2 swap pages for tracking the data source and data destination locations during the copy procedure.&lt;/p&gt;
&lt;p&gt;Is there an easy way to move large chunk of data from one location in Flash to another location within Flash?&lt;/p&gt;
&lt;p&gt;Your insights are most welcome!&lt;/p&gt;
&lt;p&gt;Thanks,
Sam&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Moving data within Flash</title><link>https://devzone.nordicsemi.com/thread/15503?ContentTypeID=1</link><pubDate>Thu, 06 Nov 2014 19:07:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9589ca7b-63ea-49d3-ab7c-4408ce9979ac</guid><dc:creator>Charles Manning</dc:creator><description>&lt;p&gt;I can&amp;#39;t see any reason you cannot copy flash to flash.&lt;/p&gt;
&lt;p&gt;The flash writes stall the CPU, but that does not matter.&lt;/p&gt;
&lt;p&gt;The ARM cores cannot write directly from any memory to any memory, they load the data into a register first.&lt;/p&gt;
&lt;p&gt;ie.&lt;/p&gt;
&lt;p&gt;a = b&lt;/p&gt;
&lt;p&gt;becomes&lt;/p&gt;
&lt;p&gt;load  a into register&lt;/p&gt;
&lt;p&gt;store register into b&lt;/p&gt;
&lt;p&gt;This means all flash writes ultimately become a store command and it really does not matter where the data comes from.&lt;/p&gt;
&lt;p&gt;ie. it should be just the same to store the data from RAM, flash, serial port,...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>