<?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>Can&amp;#39;t read from flash beyond 0x10000</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/2674/can-t-read-from-flash-beyond-0x10000</link><description>I have a large array of uint16_t data to use as a lookup table, which is defined in flash. It&amp;#39;s 4002 bytes in size, and I can set where in flash it is saved. I&amp;#39;m accessing it both as value = array[index]; and as pointer_to_array += index; value = *pointer_to_array;</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 03 Jun 2014 14:01:56 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/2674/can-t-read-from-flash-beyond-0x10000" /><item><title>RE: Can't read from flash beyond 0x10000</title><link>https://devzone.nordicsemi.com/thread/10498?ContentTypeID=1</link><pubDate>Tue, 03 Jun 2014 14:01:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6b40e54b-a35e-4c40-ac38-442b5c1e702a</guid><dc:creator>John</dc:creator><description>&lt;p&gt;You can re-enable your data storage by converting it to use the pstorage API so the stack manages the flash writes for you.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can't read from flash beyond 0x10000</title><link>https://devzone.nordicsemi.com/thread/10496?ContentTypeID=1</link><pubDate>Tue, 03 Jun 2014 13:15:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6faeeab1-ffed-4342-a86a-643d55ae296c</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Since you&amp;#39;re not accessing addresses by de-referencing the pointer to the address, I would assume that the compiler does some magic :-)&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Could you try accessing the data by de-referencing a pointer to that specific address?
uint32_t test = *(uint32_t *) 0x10000;
Does it give you the correct value?&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Could you attach a simplified version of the project so I can have a look?&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can't read from flash beyond 0x10000</title><link>https://devzone.nordicsemi.com/thread/10497?ContentTypeID=1</link><pubDate>Tue, 03 Jun 2014 13:04:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:989f8586-4d35-44f3-a19d-eb27e71e9913</guid><dc:creator>Rory Morrison</dc:creator><description>&lt;p&gt;Turns out this was my own stupid fault: we have data storage code which can optionally write to flash. The writing to flash is disabled, as the soft device interferes with the NVMC, but it was still being initialised, which means it was erasing all flash pages from, you guessed it, 0x10000 onwards.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m still not sure why a) this didn&amp;#39;t show up in the Memory display, and b) how single stepping through the code still returned the &amp;#39;right&amp;#39; (i.e. non-erased) value, though...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can't read from flash beyond 0x10000</title><link>https://devzone.nordicsemi.com/thread/10493?ContentTypeID=1</link><pubDate>Tue, 03 Jun 2014 12:23:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:54da5264-6f3f-4cc9-81b1-8ad11b4eea9d</guid><dc:creator>Rory Morrison</dc:creator><description>&lt;p&gt;One more thing: if I step through the code in keil, the reads are fine. If I run to the next breakpoint, they come back as 0xFFFF. Could it be something to do with NRF_MPU-&amp;gt;DISABLEINDEBUG?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can't read from flash beyond 0x10000</title><link>https://devzone.nordicsemi.com/thread/10495?ContentTypeID=1</link><pubDate>Tue, 03 Jun 2014 11:44:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bff4789c-3127-4249-9314-3bab18505936</guid><dc:creator>Rory Morrison</dc:creator><description>&lt;p&gt;I don&amp;#39;t think it can be that. I don&amp;#39;t end up in the hard fault handler, I just get a value of 0xFFFF.&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve currently got the array starting at 0xF400, so that the last ~kB is past 0x10000. I can read back the correct values for the first 3 kB, but as soon as I try to read from 0x10000 I get 0xFFFF. Up to that point I&amp;#39;m reading uint16_ts, so presumably I am doing non-word-aligned reads perfectly fine (which in itself might be worrying).&lt;/p&gt;
&lt;p&gt;I did try making everything uint32_t, but the only difference was I read back 0xFFFFFFFF.&lt;/p&gt;
&lt;p&gt;Is there some reason non-aligned reads are allowed below 0x10000 but not above?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can't read from flash beyond 0x10000</title><link>https://devzone.nordicsemi.com/thread/10494?ContentTypeID=1</link><pubDate>Tue, 03 Jun 2014 07:55:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1252895e-3103-403f-a463-30718691f518</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Are you ending up in the hard fault handler?
If so, I believe this is caused by a non-word aligned pointer accessing flash area.&lt;/p&gt;
&lt;p&gt;Doing like this will not be allowed:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;uint8_t my_var = *(uint8_t *) 0x10000001;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Same goes for:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;uint16_t my_var = *(uint16_t *) 0x10000002;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Valid read:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;uint32_t my_var = *(uint32_t *) 0x10000000;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;-H&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>