<?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>Adding a memory section causes linker to generate oversized file even with proper memory alignment</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/32046/adding-a-memory-section-causes-linker-to-generate-oversized-file-even-with-proper-memory-alignment</link><description>I&amp;#39;m currently working on a board diagnostic firmware and an accompanying Windows console app. The Win part of the project is supposed to monitor the diagnostic firmware&amp;#39;s progress through shared RAM locations (effectively, fixed-memory-address registers</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 15 Mar 2018 09:36:03 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/32046/adding-a-memory-section-causes-linker-to-generate-oversized-file-even-with-proper-memory-alignment" /><item><title>RE: Adding a memory section causes linker to generate oversized file even with proper memory alignment</title><link>https://devzone.nordicsemi.com/thread/124534?ContentTypeID=1</link><pubDate>Thu, 15 Mar 2018 09:36:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3f82c974-b884-48ba-95ff-3f6f1d027226</guid><dc:creator>Boris Matešin</dc:creator><description>&lt;p&gt;Hi, H&amp;aring;kon,&lt;br /&gt;&lt;br /&gt;thank you for your guidance, I added the (NOLOAD) directive to the section as you suggested.&lt;br /&gt;After compiling with optimization level -O2 (our standard for release versions):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;the resulting hex file was the proper size (220 kB)&lt;/li&gt;
&lt;li&gt;the MAP file showed the share_data section located at 0x2000ff80&lt;/li&gt;
&lt;li&gt;the settings file was generated within 3 seconds and nrfutil did not use too much memory&lt;/li&gt;
&lt;li&gt;the firmware performed as expected&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Since the optimization level was unchanged since the last version and everything worked, I might add the __attributed__((used)) later on, if necessary.&lt;br /&gt;&lt;br /&gt;Marking as resolved. Thank you!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding a memory section causes linker to generate oversized file even with proper memory alignment</title><link>https://devzone.nordicsemi.com/thread/124284?ContentTypeID=1</link><pubDate>Wed, 14 Mar 2018 07:55:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fb53e6bd-eac6-4fa8-9b39-f3b12109cd53</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Try adding &lt;a href="https://ftp.gnu.org/old-gnu/Manuals/ld-2.9.1/html_node/ld_21.html"&gt;(NOLOAD)&lt;/a&gt; around your section.&lt;/p&gt;
&lt;p&gt;.share_data(NOLOAD) :&lt;br /&gt; {&lt;br /&gt;&amp;nbsp; PROVIDE(__start_share_data = .);&lt;br /&gt;&amp;nbsp; KEEP(*(.share_data))&lt;br /&gt;&amp;nbsp; PROVIDE(__stop_share_data = .);&lt;br /&gt; } &amp;gt; RAM_SHARE&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;PS: I recommend that you declare your type with &amp;quot;type_t name __attribute__((used))&amp;quot; in case you change optimization settings and the compiler/linker finds out it can dump this section.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Cheers,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>