<?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>Wrong initialization value in static variables</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/30335/wrong-initialization-value-in-static-variables</link><description>Hi, 
 I&amp;#39;m developing a node based on the nRF52840-QIAA rev. B. 
 I&amp;#39;m using Eclipse Neon and GCC-toolchain for coding. Softdevice is S140 5.0.0.2 alpha and SDK is V14.2. 
 For Debugging I&amp;#39;m using an PCA10056 (nRF52840 PDK). 
 
 I&amp;#39;m always running into</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 19 Feb 2018 09:50:46 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/30335/wrong-initialization-value-in-static-variables" /><item><title>RE: Wrong initialization value in static variables</title><link>https://devzone.nordicsemi.com/thread/121217?ContentTypeID=1</link><pubDate>Mon, 19 Feb 2018 09:50:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4053b3aa-c2b2-4a08-9700-d46ee1b33472</guid><dc:creator>Loosli</dc:creator><description>&lt;p&gt;Thank you for your fast answer!&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I tried Splitting the linker script in two parts, like in an old one that already worked and the initalisation works now fine.&lt;/p&gt;
&lt;p&gt;The bss-sections are getting erased and the Reset_Handler is called as it should.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Values of the static variables are now as they should be.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Problem with enabling the Softdevice stil exists, but I think this should be questioned in an other thread, as it has nothing to do with static variables...&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thank you for your Support!&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I&amp;#39;ll mark your answer as solution.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Dominic&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Wrong initialization value in static variables</title><link>https://devzone.nordicsemi.com/thread/121216?ContentTypeID=1</link><pubDate>Mon, 19 Feb 2018 09:44:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:593bb069-ca43-43ad-a66a-3dbb643db558</guid><dc:creator>ekrashtan</dc:creator><description>&lt;p&gt;Ok, just try to add symbol&amp;nbsp;__STARTUP_CLEAR_BSS to your build and check again. Probably you use some library which already has .bss&amp;nbsp;initialization on startup, but with different bss&amp;nbsp;address, and this symbol will enable additional clean-up of your bss.&lt;br /&gt;Also, check if your gcc_startup_nrf52.S compiled and linked.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Wrong initialization value in static variables</title><link>https://devzone.nordicsemi.com/thread/121193?ContentTypeID=1</link><pubDate>Mon, 19 Feb 2018 07:54:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1c3e80c3-6459-49da-b54a-45329c6010b0</guid><dc:creator>Loosli</dc:creator><description>&lt;p&gt;If desired, I can provide full linkerscript, .map-file, startup-code and makefile...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Wrong initialization value in static variables</title><link>https://devzone.nordicsemi.com/thread/121192?ContentTypeID=1</link><pubDate>Mon, 19 Feb 2018 07:52:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5f882e55-2a2d-4b06-a021-d8ec3f5fa116</guid><dc:creator>Loosli</dc:creator><description>&lt;p&gt;Hi ekrashtan,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I tried to check your hints but when I set a breakpoint in the startup-file at the very beginning of the Reset_Handler, then this Breakpoint is never hit.&lt;/p&gt;
&lt;p&gt;Some lines below the Reset_Handler I saw this comment in the startup code:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;/* Call _start function provided by libraries.
 * If those libraries are not accessible, define __START as your entry point.
 */&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Could this be a Problem, if i don&amp;#39;t set this correctly?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;__bss_start__ is at 0x200021fc&lt;/p&gt;
&lt;p&gt;__bss_end__ is at 0x200035dc&lt;/p&gt;
&lt;p&gt;m_nrf_sdh_enabled is at 0x20003368&lt;/p&gt;
&lt;p&gt;So this variable is located between bss_start and bss_end.&lt;/p&gt;
&lt;p&gt;RAM ORIGIN is set to 0x20002088 in linkerscript, as the correct address could only be known after the first enable of the softdevice as far as i know. This setting is made according to the ble_app_template from the sdk.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Dominic&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Wrong initialization value in static variables</title><link>https://devzone.nordicsemi.com/thread/120930?ContentTypeID=1</link><pubDate>Thu, 15 Feb 2018 07:53:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:917c9cc9-6a52-4980-8f8d-25c059d8c8bb</guid><dc:creator>ekrashtan</dc:creator><description>&lt;p&gt;All static variables are located in .bss&amp;nbsp;segment. By default in startup code you should erase .bss&amp;nbsp;section of RAM before code start.&lt;/p&gt;
&lt;p&gt;FALSE value equal to 0, so I suppose your startup code has wrong init sequence. Please set the breakpoint at Reset_Handler address and check if _bss_start__ and __bss_end__ have the correct value. Also in .map file address of&amp;nbsp;&lt;strong&gt;&lt;span&gt;m_nrf_sdh_enabled&amp;nbsp;&lt;/span&gt;&lt;/strong&gt;&lt;span&gt;shoul be between these values.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Wrong initialization value in static variables</title><link>https://devzone.nordicsemi.com/thread/120922?ContentTypeID=1</link><pubDate>Thu, 15 Feb 2018 06:46:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:35dca4a1-5769-4eb0-a86a-db690a1bbd09</guid><dc:creator>Loosli</dc:creator><description>&lt;p&gt;Does anyone else have some hints or recommendations?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Wrong initialization value in static variables</title><link>https://devzone.nordicsemi.com/thread/120271?ContentTypeID=1</link><pubDate>Thu, 08 Feb 2018 13:02:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3d29ba7c-3acc-43f3-89ce-bad2c0cd0936</guid><dc:creator>Loosli</dc:creator><description>&lt;p&gt;Hi Kenneth,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Toolchain and Debugging are working fine with my Eclipse setup.&lt;/p&gt;
&lt;p&gt;I have some code which is executed before interfacing with the softdevice and this part is running fine and can be debugged without any Problems.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks for the hint about SES. I&amp;#39;ll check this out as soon as possible. But I would still prefer to get the code working within Eclipse, as this IDE is used also for other Projects in our Company.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Dominic&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Wrong initialization value in static variables</title><link>https://devzone.nordicsemi.com/thread/120268?ContentTypeID=1</link><pubDate>Thu, 08 Feb 2018 12:53:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3f60d4df-4c70-4930-9ae6-f7eba9eb171b</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I do not have a solution for you problem, but&amp;nbsp;hopefully&amp;nbsp;someone here&amp;nbsp;in the open forum have experienced the same and may help you.&lt;/p&gt;
&lt;p&gt;I would like to make a recommendation in general, because I see many issues using Eclipse, such as:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Issues to integrate toolchain in&amp;nbsp;Eclipse&lt;/li&gt;
&lt;li&gt;Issues setup debugging in Eclipse&lt;/li&gt;
&lt;li&gt;Issues setup project settings in Eclipse&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Most of issues are caused by Eclipse is not natively support in nRF5&amp;nbsp;SDK, and there is no plan to do so.&lt;/p&gt;
&lt;p&gt;So instead, have you considered using SEGGER Embedded Studio (SES) for development?&lt;/p&gt;
&lt;p&gt;Latest nRF5 SDK releases do support SES and some of the advantages using SES are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;SDK examples are setup with SES projects ready to compile and run&lt;/li&gt;
&lt;li&gt;Debugger is integrated&lt;/li&gt;
&lt;li&gt;GCC compiler&lt;/li&gt;
&lt;li&gt;Multi-platform (Linux, Windows, OSX)&lt;/li&gt;
&lt;li&gt;No code limitations using nRF devices for development&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For more information, also check out: &lt;a href="https://www.segger.com/products/development-tools/embedded-studio/"&gt;https://www.segger.com/products/development-tools/embedded-studio/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Best regards, &lt;br /&gt; Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>