<?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>What is -fdata-sections in gcc?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/48438/what-is--fdata-sections-in-gcc</link><description>Hello, my old question: https://devzone.nordicsemi.com/f/nordic-q-a/48087/nrf51822-s130-hardfault-error 
 I found something. 
 After removing -fdata-sections in makefile, Hardfault error in my old question never occur. 
 What is role of data-sections</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 13 Jun 2019 10:37:17 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/48438/what-is--fdata-sections-in-gcc" /><item><title>RE: What is -fdata-sections in gcc?</title><link>https://devzone.nordicsemi.com/thread/192634?ContentTypeID=1</link><pubDate>Thu, 13 Jun 2019 10:37:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:68bb860f-f06d-4ec9-a294-3dead0f5b5c1</guid><dc:creator>_maibi</dc:creator><description>&lt;p&gt;This is what happens when I try to access the wrong handler address.&lt;/p&gt;
&lt;p&gt;my actual handler address is 0x200010 (example).&amp;nbsp;&lt;/p&gt;
&lt;p&gt;and compare value of variable containing handler address in another module.&lt;/p&gt;
&lt;p&gt;it is contaminated partially.&lt;/p&gt;
&lt;p&gt;(gdb) print actual_handler&lt;/p&gt;
&lt;p&gt;&lt;span&gt;0x200010&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;(gdb) print m_evt_handler ( in another module)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;0x2000ff&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;so I try to debugging upper&amp;nbsp;m_evt_handler address.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;(gdb) x/256b (m_evt_handler address-0x80)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;0x20004a58 &amp;lt;m_read_buf&amp;gt;:&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0xff&amp;nbsp; &amp;nbsp; 0xff&amp;nbsp; &amp;nbsp; 0xff&amp;nbsp; &amp;nbsp; 0xff&amp;nbsp; &amp;nbsp; &lt;span&gt;0xff&lt;/span&gt; &amp;nbsp; &lt;span&gt;0xff&lt;/span&gt;&amp;nbsp; &amp;nbsp; &lt;span&gt;0xff&lt;/span&gt; &amp;nbsp; &lt;span&gt;0xff&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;....&amp;nbsp;&lt;/p&gt;
&lt;p&gt;0x20004aXX &amp;lt;m_read_buf&amp;gt;:&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0xff&amp;nbsp; &amp;nbsp; 0xff&amp;nbsp; &amp;nbsp; 0xff&amp;nbsp; &amp;nbsp; 0xff&amp;nbsp; &amp;nbsp;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;0xff&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;0xff&lt;/span&gt;&amp;nbsp; &amp;nbsp;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;0xff&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;0xff&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;0x20004aXX &amp;lt;m_read_buf&amp;gt;:&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0xff&amp;nbsp; &amp;nbsp; 0xff&amp;nbsp; &amp;nbsp; 0xff&amp;nbsp; &amp;nbsp; 0xff&amp;nbsp; &amp;nbsp;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;0xff&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;0xff&lt;/span&gt;&amp;nbsp; &amp;nbsp;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;0xff&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;0xff&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;0x20004aXX &amp;lt;m_read_buf&amp;gt;:&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0xff&amp;nbsp; &amp;nbsp; 0xff&amp;nbsp; &amp;nbsp; 0xff&amp;nbsp; &amp;nbsp; 0xff&amp;nbsp; &amp;nbsp;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;0xff&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;0xff&lt;/span&gt;&amp;nbsp; &amp;nbsp;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;0xff&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&amp;nbsp;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;0xff&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;0x20004aXX &amp;lt;m_evt_handler&amp;gt;:&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0xff&amp;nbsp; &amp;nbsp; 0x00&amp;nbsp; &amp;nbsp; 0x20&amp;nbsp; &amp;nbsp;&amp;nbsp;....&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;and I check the usage of&amp;nbsp;m_read_buf in my code. and I found overrun bug.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is -fdata-sections in gcc?</title><link>https://devzone.nordicsemi.com/thread/192625?ContentTypeID=1</link><pubDate>Thu, 13 Jun 2019 10:13:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:43200505-3aed-4a27-826e-4c3481fcd522</guid><dc:creator>awneil</dc:creator><description>[quote userid="72896" url="~/f/nordic-q-a/48438/what-is--fdata-sections-in-gcc/192624"]finally&amp;nbsp;I found the bug![/quote]
&lt;p&gt;For the benefit of other readers who may come along with similar problems, please describe what was the bug.&lt;/p&gt;
&lt;p&gt;And how did you find it?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is -fdata-sections in gcc?</title><link>https://devzone.nordicsemi.com/thread/192624?ContentTypeID=1</link><pubDate>Thu, 13 Jun 2019 10:11:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9e51d40b-f81c-4f00-8050-7a927b2795a1</guid><dc:creator>_maibi</dc:creator><description>&lt;p&gt;as your mention, I concentrate debugging overriding memory,&amp;nbsp;finally&amp;nbsp;I found the bug!! thank your advice!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is -fdata-sections in gcc?</title><link>https://devzone.nordicsemi.com/thread/192345?ContentTypeID=1</link><pubDate>Wed, 12 Jun 2019 11:58:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:191af7c7-f364-4737-a4f4-ff139703f302</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Yes, verify that the function pointer stays the same by using the if check you had earlier (&lt;span&gt;m_conn_params_config.evt_handler). The event number is invalid which may be a sign of a buffer overrun.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is -fdata-sections in gcc?</title><link>https://devzone.nordicsemi.com/thread/192306?ContentTypeID=1</link><pubDate>Wed, 12 Jun 2019 09:47:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ec61694d-f7cb-4122-aede-00e378afe88b</guid><dc:creator>_maibi</dc:creator><description>&lt;p&gt;hi! thanks for response, I checked that this was not a flag problem.&lt;/p&gt;
&lt;p&gt;same stack trace occur... I just modified my code a little and compiled it.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img height="287" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1560332585008v1.png" width="346" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img height="284" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1560332595623v2.png" width="502" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;what should I do next step for debugging?&amp;nbsp;It&amp;#39;s really hard to me.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is -fdata-sections in gcc?</title><link>https://devzone.nordicsemi.com/thread/192278?ContentTypeID=1</link><pubDate>Wed, 12 Jun 2019 09:01:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5f5c2b13-e745-45b3-9d72-fee11ec28171</guid><dc:creator>awneil</dc:creator><description>[quote userid="72896" url="~/f/nordic-q-a/48438/what-is--fdata-sections-in-gcc/192018"]Is this flag related on memory alignment[/quote][quote userid="4240" url="~/f/nordic-q-a/48438/what-is--fdata-sections-in-gcc/192275"]No, not directly at least[/quote]
&lt;p&gt;Indeed.&lt;/p&gt;
&lt;p&gt;I think it is possible to specify the alignment for a Section - but there&amp;#39;s no&amp;nbsp;inherent relation.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is -fdata-sections in gcc?</title><link>https://devzone.nordicsemi.com/thread/192275?ContentTypeID=1</link><pubDate>Wed, 12 Jun 2019 08:57:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f1a6c387-42da-4df6-89d3-7bb2e6c3bdc1</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;No, not directly at least. Do you still get the same stack trace that you posted in the other thread? It did not indicate an aligment issue.&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is -fdata-sections in gcc?</title><link>https://devzone.nordicsemi.com/thread/192018?ContentTypeID=1</link><pubDate>Tue, 11 Jun 2019 11:06:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:834784b0-99d9-49bf-9f55-84d34fa19274</guid><dc:creator>_maibi</dc:creator><description>&lt;p&gt;Is this flag related on memory alignment?&lt;/p&gt;
&lt;p&gt;if so, Is it possible that Hardfault I suffered is related on m0 memory unalignment?&lt;/p&gt;
&lt;p&gt;if it make sense, how I can debug where this error occur?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is -fdata-sections in gcc?</title><link>https://devzone.nordicsemi.com/thread/192001?ContentTypeID=1</link><pubDate>Tue, 11 Jun 2019 10:04:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:291af5a5-b0f0-4669-bf90-d36d853c7693</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;It&amp;#39;s just a way of collecting data together in memory&lt;/p&gt;
&lt;p&gt;&lt;a href="https://gcc.gnu.org/onlinedocs/gcc-6.1.0/gccint/Sections.html"&gt;https://gcc.gnu.org/onlinedocs/gcc-6.1.0/gccint/Sections.html&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>