<?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/"><channel><title>Using Nordic&amp;#39;s SDKs with the GNU G++ Compiler</title><link>/nordic/nordic-blog/b/blog/posts/using-nordics-sdks-with-the-gnu-g-compiler</link><description>A persistant problem that people using the C++ compiler from the &amp;quot;GNU Tools for ARM Embedded Processors&amp;quot; toolchain has been the way that G++ handles the inline-assembly for the SVC instruction.
Specifically, you get an impossible constrain...</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><item><title>RE: Using Nordic&amp;#39;s SDKs with the GNU G++ Compiler</title><link>https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/using-nordics-sdks-with-the-gnu-g-compiler</link><pubDate>Tue, 15 Dec 2015 23:04:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b7ec14cd-b454-4090-b776-c6a6c6bcdc66</guid><dc:creator>davide</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;I got through all this and the application compiles and can be downloaded.
BUT, when I use g++ to compile the application, the bootloader (compiled by gcc or Keil) starts and it appears that the application never gets to line 1 of main().
When I simply switch to gcc and add -std=gnu99, compile, download, it downloads, and the bootloader starts, and  then vectors nicely to the app which runs.&lt;/p&gt;
&lt;p&gt;Why would simply changing gcc to g++ cause the app to not run? It compiles just fine (and yes, I did a few things to get compile success such as reorder some initializers and the stuff above). To be clear, the same exact code compiles fine on both g++, gcc, and Keil, but will not run when compiled by g++.&lt;/p&gt;
&lt;p&gt;BTW, I&amp;#39;m using the hrs_with_dfu example app.&lt;/p&gt;
&lt;img src="https://devzone.nordicsemi.com/aggbug?PostID=785&amp;AppID=4&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: Using Nordic&amp;#39;s SDKs with the GNU G++ Compiler</title><link>https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/using-nordics-sdks-with-the-gnu-g-compiler</link><pubDate>Fri, 29 May 2015 05:14:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b7ec14cd-b454-4090-b776-c6a6c6bcdc66</guid><dc:creator>Marcel Mulder</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;Hi Andrew,&lt;/p&gt;
&lt;p&gt;I changed the line:&lt;/p&gt;
&lt;pre&gt;	&amp;quot;bx r14&amp;quot; : : &amp;quot;I&amp;quot; (number) : &amp;quot;r0&amp;quot; \
&lt;/pre&gt;
&lt;p&gt;into:&lt;/p&gt;
&lt;pre&gt;	&amp;quot;bx r14&amp;quot; : : &amp;quot;I&amp;quot; (static_cast&amp;lt;int&amp;gt;(number)) : &amp;quot;r0&amp;quot; \
&lt;/pre&gt;
&lt;p&gt;with an #ifdef __cplusplus around it.&lt;/p&gt;
&lt;p&gt;Cheers, Marcel&lt;/p&gt;
&lt;img src="https://devzone.nordicsemi.com/aggbug?PostID=785&amp;AppID=4&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: Using Nordic&amp;#39;s SDKs with the GNU G++ Compiler</title><link>https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/using-nordics-sdks-with-the-gnu-g-compiler</link><pubDate>Tue, 14 Apr 2015 16:25:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b7ec14cd-b454-4090-b776-c6a6c6bcdc66</guid><dc:creator>Andrew Fernandes</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;Hi, Carles!&lt;/p&gt;
&lt;p&gt;I&amp;#39;m sorry that I didn&amp;#39;t reply earlier, but I did not get mail notification that your comment was here!&lt;/p&gt;
&lt;p&gt;The issue is only with the SVC enumerations due to the way the SVC call is defined in the nrf_svc.h header file. Specifically, it has something to do with the __asm( &amp;quot;svc %0\n&amp;quot; &amp;quot;bx r14&amp;quot; : : &amp;quot;I&amp;quot; (number) : &amp;quot;r0&amp;quot; ); call.&lt;/p&gt;
&lt;p&gt;The &amp;quot;I&amp;quot; (number) constraint requires a compile-time integer constant. In C, enums are just aliases to integers, the compiler has no problem with it. However, C++ does &lt;strong&gt;not&lt;/strong&gt; equate integers with enums; they are a distinct type, even under C++03. You &lt;em&gt;can&lt;/em&gt; technically set a typed enum storage class in C++11 via the enum name_t : short { ... syntax, but this does not work for some reason.&lt;/p&gt;
&lt;p&gt;I am not sure if this is a gcc bug or not; I suspect that inline assembly always plays poorly with standards.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m using the official arm-none-eabi-gcc distribution on launchpad, BTW.&lt;/p&gt;
&lt;p&gt;Cheers,
-Andrew.&lt;/p&gt;
&lt;p&gt;(BTW, enums that are not used in the SVC calls compile without issue, so the problem is only with enums passed to the inline assembler.)&lt;/p&gt;
&lt;img src="https://devzone.nordicsemi.com/aggbug?PostID=785&amp;AppID=4&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item><item><title>RE: Using Nordic&amp;#39;s SDKs with the GNU G++ Compiler</title><link>https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/using-nordics-sdks-with-the-gnu-g-compiler</link><pubDate>Wed, 04 Feb 2015 12:45:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b7ec14cd-b454-4090-b776-c6a6c6bcdc66</guid><dc:creator>Carles</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;Hi Andrew,&lt;/p&gt;
&lt;p&gt;Thanks for the great tool. Is this an issue only for SVC enumerations, or is it also a problem with the rest of enums present in SoftDevice header files? (i.e. events, options, etc)&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;
&lt;img src="https://devzone.nordicsemi.com/aggbug?PostID=785&amp;AppID=4&amp;AppType=Weblog&amp;ContentType=0" width="1" height="1"&gt;</description></item></channel></rss>