<?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>Main not called</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/28140/main-not-called</link><description>I&amp;#39;m trying to get a stripped down, simple LED blinking sample to work (like blinky) when building with GCC however main() is never called. I&amp;#39;m guessing I&amp;#39;m either using the wrong startup file or missing a compiler/linker setting? I know the hex file produced</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 30 Nov 2018 00:02:35 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/28140/main-not-called" /><item><title>RE: Main not called</title><link>https://devzone.nordicsemi.com/thread/159640?ContentTypeID=1</link><pubDate>Fri, 30 Nov 2018 00:02:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:11bfad6e-7617-4b19-a4f1-4bda9c0d1bec</guid><dc:creator>montymintypie</dc:creator><description>&lt;p&gt;I know this is an old bump but I just ran into the same problem and this post is first on my google search.&lt;/p&gt;
&lt;p&gt;For my case, I was &lt;em&gt;compiling&lt;/em&gt; with -mthumb, but not &lt;em&gt;linking&lt;/em&gt; with -mthumb. As a result, the linker was bringing in the ARM CRT, not the THUMB CRT, which failed to call main.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Main not called</title><link>https://devzone.nordicsemi.com/thread/111100?ContentTypeID=1</link><pubDate>Mon, 11 Dec 2017 11:35:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3ba3d1f0-0ffb-43c2-aa52-e5a50e7f06b6</guid><dc:creator>YYZ</dc:creator><description>&lt;p&gt;Thanks for the suggestion. It turns out the problem was the IDE I am using (EmBitz) silently adding a couple library paths to the link line causing the linker to pick up one wrong startup file. Now my app starts up as expected and calls main without me having to supply any hacks.&lt;/p&gt;
&lt;p&gt;Thanks for your help.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Main not called</title><link>https://devzone.nordicsemi.com/thread/111099?ContentTypeID=1</link><pubDate>Mon, 11 Dec 2017 10:32:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d3452616-b063-4487-9915-8f4d2655ebe6</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi, recommend that you copy the linker and compiler flags from our example. We use the pre-compiled crt0 library in our examples (included in toolchain release - &lt;a href="https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads)."&gt;developer.arm.com/.../downloads).&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Main not called</title><link>https://devzone.nordicsemi.com/thread/111098?ContentTypeID=1</link><pubDate>Tue, 05 Dec 2017 12:04:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:79c840d7-ed47-495d-916d-551e910dc6a7</guid><dc:creator>YYZ</dc:creator><description>&lt;p&gt;Only by using the workaround I posted as a comment and I&amp;#39;ve yet to prove if that is still valid for a more complex example that includes a soft device. It &lt;strong&gt;appears&lt;/strong&gt; that the tools that work out of the box have a modified toolchain and/or include a custom version of crt0.s.
I&amp;#39;m curious though how this works with GCC 4.9.3 which is supposed to be supported according to the SDK release notes?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Main not called</title><link>https://devzone.nordicsemi.com/thread/111097?ContentTypeID=1</link><pubDate>Tue, 05 Dec 2017 10:16:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2064635f-8f4e-42b3-bb59-4f2018d60e4b</guid><dc:creator>Bj&amp;#248;rn Kvaale</dc:creator><description>&lt;p&gt;So did you find the solution to your problem then? Did you know that segger embedded studio (ses) is free for Nordic SDK users? The Blinky example is available in SDK 14.2 under the ble_peripheral folder/ble_app_blinky. Then, just choose your dev kit folder, choose the softdevice folder &amp;amp; open the ses folder. There, you can open the ses file (e.g. examples/ble_peripheral/ble_app_blinky/pca10040/s132/ses/ble_app_blinky_pca10040_s132). If you do decide to use ses, there is a great introductory playlist to getting started with ses on &lt;a href="https://www.youtube.com/watch?v=YZouRE_Ol8g&amp;amp;list=PLx_tBuQ_KSqGHmzdEL2GWEOeix-S5rgTV"&gt;Nordic&amp;#39;s Youtube channel&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Main not called</title><link>https://devzone.nordicsemi.com/thread/111096?ContentTypeID=1</link><pubDate>Fri, 01 Dec 2017 16:28:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e230f079-1411-46d4-86f4-9a2a16328646</guid><dc:creator>YYZ</dc:creator><description>&lt;p&gt;I&amp;#39;ve worked around this by adding the following compiler/linker options to bypass _start and instead call my main():&lt;/p&gt;
&lt;p&gt;-nostartfiles
-D__START=main
-D__STARTUP_CLEAR_BSS&lt;/p&gt;
&lt;p&gt;This bypasses _start provided by crt0 - I do not know if this will cause problems later on though.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>