<?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>Flash and RAM access</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/72339/flash-and-ram-access</link><description>Hello, 
 This is more of a C question and I am new to Embedded C programming, I have this question. 
 I want to know how to access the flash memory without fds or fstorage snd by using pointers. 
 For example, if I use snippet like below, 
 
 #define</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 04 Mar 2021 09:24:48 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/72339/flash-and-ram-access" /><item><title>RE: Flash and RAM access</title><link>https://devzone.nordicsemi.com/thread/297711?ContentTypeID=1</link><pubDate>Thu, 04 Mar 2021 09:24:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a4041507-0d8a-4c8d-81e1-453dd7eac3ca</guid><dc:creator>awneil</dc:creator><description>[quote userid="6462" url="~/f/nordic-q-a/72339/flash-and-ram-access/297689#297689"]If you want &amp;quot;STORAGE_ADR&amp;quot; to be an &lt;em&gt;address&lt;/em&gt;, it would be better to define it so that it is an address[/quote][quote userid="101728" url="~/f/nordic-q-a/72339/flash-and-ram-access/297702#297702"]&lt;p&gt;Why is that?&amp;nbsp;&lt;/p&gt;
&lt;div class="quote-header"&gt;&lt;/div&gt;&lt;blockquote class="quote"&gt;&lt;div class="quote-user"&gt;&lt;/div&gt;&lt;/blockquote&gt;[/quote]
&lt;p&gt;A fundamental principle of good software design is that the names you give to things should be descriptive, accurate, etc.&lt;/p&gt;
&lt;p&gt;So, if you give some a name like &amp;quot;&lt;span&gt;STORAGE_ADR&amp;quot; - which suggests that it is an address - then it really should &lt;em&gt;&lt;strong&gt;be&lt;/strong&gt; &lt;/em&gt;an address.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Also, if you&amp;#39;re going to have a definition like that, why not make it complete? Why have to keep remembering to prefix it with (uint8_t*) ?&lt;/span&gt;&lt;/p&gt;
[quote userid="101728" url="~/f/nordic-q-a/72339/flash-and-ram-access/297702#297702"]Just wanted to know whether it&amp;#39;s possible[/quote]
&lt;p&gt;Possible, yes - advisable, no!&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f609.svg" title="Wink"&gt;&amp;#x1f609;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash and RAM access</title><link>https://devzone.nordicsemi.com/thread/297702?ContentTypeID=1</link><pubDate>Thu, 04 Mar 2021 09:09:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8afb1943-a3ad-4642-8fc6-f27b251526b2</guid><dc:creator>GOAA</dc:creator><description>&lt;p&gt;Thank you for your response,&lt;/p&gt;
[quote userid="6462" url="~/f/nordic-q-a/72339/flash-and-ram-access/297689#297689"]it would be better to define it so that it is an address[/quote]
&lt;p&gt;Why is that?&amp;nbsp;&lt;/p&gt;
[quote userid="6462" url="~/f/nordic-q-a/72339/flash-and-ram-access/297689#297689"]&lt;p&gt;Why?&lt;/p&gt;
&lt;p&gt;The whole point of having named variables is exactly so that you don&amp;#39;t have to keep dealing directly with magic number addresses!&lt;/p&gt;[/quote]
&lt;p&gt;I am just trying to experiment simply. I have previously used C but want to get into a more lower level context, that&amp;#39;s why I am trying to do this. Just wanted to know whether it&amp;#39;s possible or not xD&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash and RAM access</title><link>https://devzone.nordicsemi.com/thread/297689?ContentTypeID=1</link><pubDate>Thu, 04 Mar 2021 08:47:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6fd64234-49ba-407a-9252-4a41c4ca7c5b</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;If you want &amp;quot;STORAGE_ADR&amp;quot; to be an &lt;em&gt;address&lt;/em&gt;, it would be better to define it so that it is an address; eg,&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#define STORAGE_ADR (uint8_t*)STORAGE_ADR&lt;/pre&gt;&lt;/p&gt;
[quote userid="101728" url="~/f/nordic-q-a/72339/flash-and-ram-access"]Or should the hexadecimal be converted into decimal before I feed it into the pointer[/quote]
&lt;p&gt;The number base is immaterial - the&amp;nbsp;value is the same whether you write it in hex, decimal, or octal.&lt;/p&gt;
[quote userid="101728" url="~/f/nordic-q-a/72339/flash-and-ram-access"]I am going to use pointers to write in RAM as well[/quote]
&lt;p&gt;Why?&lt;/p&gt;
&lt;p&gt;The whole point of having named variables is exactly so that you don&amp;#39;t have to keep dealing directly with magic number addresses!&lt;/p&gt;
&lt;p&gt;This is the compiler&amp;#39;s job.&lt;/p&gt;
[quote userid="101728" url="~/f/nordic-q-a/72339/flash-and-ram-access"]I am new to Embedded C programming[/quote]
&lt;p&gt;Do you have any experience with C in any other context(s) ?&lt;/p&gt;
&lt;p&gt;If not, I would strongly recommend that you don&amp;#39;t try to learn the language on a microcontroller: you will have a far more comfortable learning experience on a PC - away from all the added complications &amp;amp; restrictions of embedded microcontrollers.&lt;/p&gt;
&lt;p&gt;I would especially not recommend learning on an nRF (or any other) radio SoC - as that adds a whole bunch of other complications!&lt;/p&gt;
&lt;p&gt;&lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f62e.svg" title="Open mouth"&gt;&amp;#x1f62e;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Here are some &amp;#39;C&amp;#39; learning &amp;amp; reference materials for you:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://blog.antronics.co.uk/2011/08/08/so-youre-thinking-of-starting-with-c/"&gt;https://blog.antronics.co.uk/2011/08/08/so-youre-thinking-of-starting-with-c/&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>