<?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>Programmatically accessing flash_placement.xml</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/34689/programmatically-accessing-flash_placement-xml</link><description>Hi 
 I am writing a bootloader and am trying to get the start locations of the different memory segments e.g. the FLASH start segment from the flash_placement file. 
 On a different manufacturer&amp;#39;s micro on a Rowley IDE I used: 
 int ramEnd = (int)(&amp;amp;__FLASH_segment_start__</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 25 May 2018 07:48:05 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/34689/programmatically-accessing-flash_placement-xml" /><item><title>RE: Programmatically accessing flash_placement.xml</title><link>https://devzone.nordicsemi.com/thread/133356?ContentTypeID=1</link><pubDate>Fri, 25 May 2018 07:48:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f6d1cb87-4b0e-40ca-a0c7-f6b003c04a84</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;well you always need a declaration of a variable just to tell the compiler &amp;#39;this exists somewhere and this is what type it is&amp;#39; so it can compile, then it&amp;#39;s the linker&amp;#39;s job to actually find and resolve it. If you just put the thing in the linker file (which is what flash_placement.xml really is) then nothing at compile time has a clue it&amp;#39;s even there. Hence the need for an external.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I think for the Rowley standard symbols they define them in some of the top level header files so that&amp;#39;s why you can use them. If the original poster clicks on __FLASH_segment_start__ and asks the IDE to go to the definition he&amp;#39;ll probably find where it was defined.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Programmatically accessing flash_placement.xml</title><link>https://devzone.nordicsemi.com/thread/133337?ContentTypeID=1</link><pubDate>Fri, 25 May 2018 06:39:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d1669788-161f-4ac7-bdc2-62cb1f421b6e</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi Nick,&lt;/p&gt;
&lt;p&gt;Looks like you must use &amp;#39;extern&amp;#39; to link in user defined symbols. Didn&amp;#39;t think it was necessary since you were able to use the __FLASH_segment_start__ symbol.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;E.g.,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;    extern uint32_t  __app_flash_start__;
    uint32_t const * const m_flash_start = &amp;amp;__app_flash_start__;&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Programmatically accessing flash_placement.xml</title><link>https://devzone.nordicsemi.com/thread/133294?ContentTypeID=1</link><pubDate>Thu, 24 May 2018 15:37:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:295166b8-9069-43ce-a0e5-740f0c346d17</guid><dc:creator>Farsley</dc:creator><description>&lt;p&gt;Hi Vidar&lt;/p&gt;
&lt;p&gt;I have added into the flash placement file:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;ProgramSection alignment=&amp;quot;4&amp;quot; load=&amp;quot;Yes&amp;quot; name=&amp;quot;.textBootCall&amp;quot; start = &amp;quot;$(FLASH_CALL_START)&amp;quot; size = &amp;quot;$(FLASH_CALL_SIZE)&amp;quot; address_symbol=&amp;quot;__app_flash_start__&amp;quot; /&amp;gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color:transparent;color:#000000;float:none;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;font-style:normal;font-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:normal;"&gt;But still am unsure how to access it in code. The compiler gives:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color:transparent;color:#000000;float:none;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;font-style:normal;font-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:normal;"&gt;&amp;#39;__app_flash_start__&amp;#39; undeclared (first use in this function); did you mean &amp;#39;app_timer_start&amp;#39;?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color:transparent;color:#000000;float:none;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;font-style:normal;font-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:normal;"&gt;Is there an include file I need to reference?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color:transparent;color:#000000;float:none;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;font-style:normal;font-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:normal;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color:transparent;color:#000000;float:none;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;font-style:normal;font-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:normal;"&gt;Thank you&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color:transparent;color:#000000;float:none;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;font-style:normal;font-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:normal;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color:transparent;color:#000000;float:none;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;font-style:normal;font-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:normal;"&gt;Nick&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color:transparent;color:#000000;float:none;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;font-style:normal;font-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:normal;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Programmatically accessing flash_placement.xml</title><link>https://devzone.nordicsemi.com/thread/133186?ContentTypeID=1</link><pubDate>Thu, 24 May 2018 09:56:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9b5b45cb-984d-4e3a-8e68-2ceeabad01ea</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The flash_placement files provided with the SDK examples are written so that FLASH segment covers the entire address range from 0x0 to 0x80000. This is defined by the FLASH_PH_*&amp;nbsp; placement macros under common linker configurations.&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-e741df3928a64ec1a748227bc1fd9de2/pastedimage1527152745606v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;I should work if you change the&amp;nbsp;FLASH_PH_ to only cover the bootloader&amp;#39;s address range, but I think it might be better to define your own linker symbols in the xml file. That way you don&amp;#39;t have to change the default configuration.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;lt;!DOCTYPE Linker_Placement_File&amp;gt;&lt;br /&gt;&amp;lt;Root name=&amp;quot;Flash Section Placement&amp;quot;&amp;gt;&lt;br /&gt; &amp;lt;MemorySegment name=&amp;quot;FLASH&amp;quot; start=&amp;quot;$(FLASH_PH_START)&amp;quot; size=&amp;quot;$(FLASH_PH_SIZE)&amp;quot;&amp;gt;&lt;br /&gt; &amp;lt;ProgramSection load=&amp;quot;no&amp;quot; name=&amp;quot;.reserved_flash&amp;quot; start=&amp;quot;$(FLASH_PH_START)&amp;quot; size=&amp;quot;$(FLASH_START)-$(FLASH_PH_START)&amp;quot; /&amp;gt;&lt;br /&gt; &amp;lt;ProgramSection alignment=&amp;quot;0x100&amp;quot; load=&amp;quot;Yes&amp;quot; name=&amp;quot;.vectors&amp;quot; start=&amp;quot;$(FLASH_START)&amp;quot;&lt;strong&gt; address_symbol=&amp;quot;__app_flash_start__&lt;/strong&gt;&amp;quot; /&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>