<?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>Problem including ble_advdata.h compiling with gcc</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/8553/problem-including-ble_advdata-h-compiling-with-gcc</link><description>Hi, 
 I&amp;#39;m trying to transition my application from SDK 7.2.0 to SDK_9.0.0 and am having some issues when including ble_advdata.h compiling with gcc: 
 In file included from Nordic/nRF51_SDK_9.0.0_2e23562/components/softdevice/s110/headers/ble_gap.h</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 12 Aug 2015 07:26:08 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/8553/problem-including-ble_advdata-h-compiling-with-gcc" /><item><title>RE: Problem including ble_advdata.h compiling with gcc</title><link>https://devzone.nordicsemi.com/thread/31280?ContentTypeID=1</link><pubDate>Wed, 12 Aug 2015 07:26:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ed9ed250-78d7-43e7-bf3d-d47bd601f6a0</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;The GNU C++ compiler just has a slightly different set of error checks than the C one does, it seems to be pickier about variable types in asm statements, why I don&amp;#39;t really know, in general the C++ one does more type checking all over the place.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem including ble_advdata.h compiling with gcc</title><link>https://devzone.nordicsemi.com/thread/31279?ContentTypeID=1</link><pubDate>Wed, 12 Aug 2015 07:22:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:87a4f398-f3d2-49f6-bbad-d315fca5d497</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;I have created a ticket for the SDK team to investigate this, i am not sure why the cast is needed in C++ (that is because i know C++ very little), can you enlighten me RK.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem including ble_advdata.h compiling with gcc</title><link>https://devzone.nordicsemi.com/thread/31278?ContentTypeID=1</link><pubDate>Wed, 12 Aug 2015 05:05:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b35634d9-d988-4f1a-972e-d944fc81cc4a</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;I think you only get the error when compiling c++, which might explain why Aryan wasn&amp;#39;t seeing it and why  TheBarrelShifter was the first to see it. The cast should be there, I just modified my SDK.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem including ble_advdata.h compiling with gcc</title><link>https://devzone.nordicsemi.com/thread/31277?ContentTypeID=1</link><pubDate>Fri, 07 Aug 2015 11:41:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2acc9db8-85f3-47ee-afb6-4d042c035c8c</guid><dc:creator>TheBarrelShifter</dc:creator><description>&lt;p&gt;Thankyou for the clarification - This explains why I had problems with linking when defining SVCALL_AS_NORMAL_FUNCTION.&lt;/p&gt;
&lt;p&gt;In fact, the name is misleading, it is not possible to call them as normal functions because the implementation only exists for the serialisation case.&lt;/p&gt;
&lt;p&gt;In summary, the softdevice API functions can only be called as SVC calls, and there is no corresponding &amp;#39;normal&amp;#39; function.&lt;/p&gt;
&lt;p&gt;Thanks again.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem including ble_advdata.h compiling with gcc</title><link>https://devzone.nordicsemi.com/thread/31276?ContentTypeID=1</link><pubDate>Fri, 07 Aug 2015 10:00:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2e6bdb40-1e2a-4de3-ae49-c1f9f20826dc</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;This define is used in serialization. Where the nRF_Serialization API has exact same function API like softdevice API. but instead of SVC calls they are normal functions.&lt;/p&gt;
&lt;p&gt;In your case,  All sd_xx translate to a call to &lt;a href="http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0497a/BABBHFJE.html"&gt;SVC&lt;/a&gt; hence you do not see the implementation of sd_xxx calls anywhere. If you define when you define SVCALL_AS_NORMAL_FUNCTION , then the macro&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#define SVCALL(number, return_type, signature) return_type signature. Taking sd_flash_write as example
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;SVCALL(SD_FLASH_WRITE, uint32_t, sd_flash_write(uint32_t * const p_dst, uint32_t const * const p_src, uint32_t size));&lt;/p&gt;
&lt;p&gt;This translate to&lt;/p&gt;
&lt;h2&gt;SVCALL_AS_NORMAL_FUNCTION  not defined&lt;/h2&gt;
&lt;pre&gt;&lt;code&gt;__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; \
); \
&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;SVCALL_AS_NORMAL_FUNCTION  defined&lt;/h2&gt;
&lt;p&gt;uint32_t  sd_flash_write(uint32_t * const p_dst, uint32_t const * const)&lt;/p&gt;
&lt;p&gt;For the former, the compiler is not looking for implementation of functions.
For the later, it needs implementation of the function definition that the macro defined.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem including ble_advdata.h compiling with gcc</title><link>https://devzone.nordicsemi.com/thread/31275?ContentTypeID=1</link><pubDate>Fri, 07 Aug 2015 09:03:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5ecd675a-88cc-41b8-a8f4-c8e5272207d1</guid><dc:creator>TheBarrelShifter</dc:creator><description>&lt;p&gt;OK, yes I understood that bit - I meant whether it would still work correctly, whether there are any caveats to defining them as a normal function.&lt;/p&gt;
&lt;p&gt;Yesterday I managed to get everything to compile with SVCALL_AS_NORMAL_FUNCTION defined, but it would not link. Ultimately I had to fix the problem this post was originally about in nrf_svc.h (by adding the cast) to get a compiled and linked binary. So for me at least, SVCALL_AS_NORMAL_FUNCTION did not achieve what I expected.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem including ble_advdata.h compiling with gcc</title><link>https://devzone.nordicsemi.com/thread/31274?ContentTypeID=1</link><pubDate>Fri, 07 Aug 2015 09:00:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:abbc4e9a-d5b1-491f-a9c7-f5d498174e73</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;If you see in this file you can see that if you define SVCALL_AS_NORMAL_FUNCTION  then SVCALL  is defined as&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#define SVCALL(number, return_type, signature) return_type signature
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This means that the call will be converted to a normal function call and not a SVC call with different exception to the CPU and different priorities.
This will that none of the sd_xxx function will work as this functions wont be able to penetrate into softdevice memory addresses.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem including ble_advdata.h compiling with gcc</title><link>https://devzone.nordicsemi.com/thread/31273?ContentTypeID=1</link><pubDate>Fri, 07 Aug 2015 08:37:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e30b8cbc-7e97-4618-951d-c12610bb45af</guid><dc:creator>TheBarrelShifter</dc:creator><description>&lt;p&gt;Yes, these are good questions, and ones I am unable to answer, but I agree it does seem unlikely I am the first. Also I&amp;#39;d be surprised if Linux gcc doesn&amp;#39;t require the cast too.&lt;/p&gt;
&lt;p&gt;Please could you direct me to information that can explain what the outcome of defining SVCALL_AS_NORMAL_FUNCTION would be?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem including ble_advdata.h compiling with gcc</title><link>https://devzone.nordicsemi.com/thread/31272?ContentTypeID=1</link><pubDate>Fri, 07 Aug 2015 08:34:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:837915cf-911a-4a7e-98f1-071e56527001</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Then it is something that should be looked into, I will redirect this to right people.
I am now wondering why others did not get this error? are you the first one compiling SDK with GCC on MacOS? that seems unlikely.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem including ble_advdata.h compiling with gcc</title><link>https://devzone.nordicsemi.com/thread/31271?ContentTypeID=1</link><pubDate>Fri, 07 Aug 2015 08:31:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:652df963-87f1-45eb-a119-26a884e1f3ca</guid><dc:creator>TheBarrelShifter</dc:creator><description>&lt;p&gt;P.S. - Nothing has changed with gcc on MacOS, I am unable to compile 7.2.0 without the cast using the older gcc 4.9 2014 q4 either.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem including ble_advdata.h compiling with gcc</title><link>https://devzone.nordicsemi.com/thread/31270?ContentTypeID=1</link><pubDate>Fri, 07 Aug 2015 08:12:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b49262c1-3776-41a9-8ebf-e531ed4302b4</guid><dc:creator>TheBarrelShifter</dc:creator><description>&lt;p&gt;You&amp;#39;re right, when I freshly unzip the 7.2.0 SDK it is not there - I must have modified 7.2.0 too and forgotten about it.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m willing to bet that the casting is required for Linux too.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem including ble_advdata.h compiling with gcc</title><link>https://devzone.nordicsemi.com/thread/31267?ContentTypeID=1</link><pubDate>Fri, 07 Aug 2015 07:22:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f1c2191d-1af5-48a5-b320-68ce5156c630</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;I cannot see the casting in 7.2.0 SDK. I wonder what has changed with GCC on Mac OS?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem including ble_advdata.h compiling with gcc</title><link>https://devzone.nordicsemi.com/thread/31269?ContentTypeID=1</link><pubDate>Thu, 06 Aug 2015 16:39:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:881e38c2-dd51-495a-aa52-a22b480abe50</guid><dc:creator>TheBarrelShifter</dc:creator><description>&lt;p&gt;Also seems like it would be better to have the cast, unless there was a reason for removing it?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem including ble_advdata.h compiling with gcc</title><link>https://devzone.nordicsemi.com/thread/31268?ContentTypeID=1</link><pubDate>Thu, 06 Aug 2015 16:02:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4fc4a9b0-4c03-4321-a6fe-cab8f7e381fa</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;seems like :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem including ble_advdata.h compiling with gcc</title><link>https://devzone.nordicsemi.com/thread/31266?ContentTypeID=1</link><pubDate>Thu, 06 Aug 2015 16:01:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5862f564-a331-40b3-98e4-0e8af12fdcd0</guid><dc:creator>TheBarrelShifter</dc:creator><description>&lt;p&gt;Fixed,&lt;/p&gt;
&lt;p&gt;It was missing a cast to uint16_t in the following line:&lt;/p&gt;
&lt;p&gt;&amp;quot;bx r14&amp;quot; : : &amp;quot;I&amp;quot; ((uint16_t)number) : &amp;quot;r0&amp;quot; \&lt;/p&gt;
&lt;p&gt;The cast was present in the 7.2.0 SDK, I replaced it, and it now compiles.&lt;/p&gt;
&lt;p&gt;Perhaps Windows gcc 4.9 is a bit less picky&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem including ble_advdata.h compiling with gcc</title><link>https://devzone.nordicsemi.com/thread/31260?ContentTypeID=1</link><pubDate>Thu, 06 Aug 2015 12:51:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:103b6fb2-2c7e-40e1-b255-0c03b741fc1a</guid><dc:creator>TheBarrelShifter</dc:creator><description>&lt;p&gt;No, I&amp;#39;m running on Mac OS.
Does your Makefile have SVCALL_AS_NORMAL_FUNCTION defined? If so it would explain why. I am using this as a workaround, but am uncertain what the ramifications are - Are you able to enlighten me?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem including ble_advdata.h compiling with gcc</title><link>https://devzone.nordicsemi.com/thread/31265?ContentTypeID=1</link><pubDate>Thu, 06 Aug 2015 12:29:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:65e2ffc1-1bc5-4926-8ee5-bb998610f4bf</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;you are running this on windows?
Why does it not happen on my desk with exactly same gcc version
Have you updated your current path in
nRF51_SDK_9.0.0_2e23562\components\toolchain\gcc\Makefile.windows?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem including ble_advdata.h compiling with gcc</title><link>https://devzone.nordicsemi.com/thread/31264?ContentTypeID=1</link><pubDate>Thu, 06 Aug 2015 12:20:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:01a5ac6b-4c5b-442f-8aa9-997f718fdaca</guid><dc:creator>TheBarrelShifter</dc:creator><description>&lt;p&gt;gcc 4.9 2015 q2 - Don&amp;#39;t think it gets much more recent than that&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem including ble_advdata.h compiling with gcc</title><link>https://devzone.nordicsemi.com/thread/31263?ContentTypeID=1</link><pubDate>Thu, 06 Aug 2015 12:19:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0c5a6339-02e9-409f-b579-02bb55b1fa52</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;which GCC version are you using? if it is old, try upgrading it&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem including ble_advdata.h compiling with gcc</title><link>https://devzone.nordicsemi.com/thread/31262?ContentTypeID=1</link><pubDate>Thu, 06 Aug 2015 12:02:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e932506d-af5f-48ae-ac66-3e0c7e198d47</guid><dc:creator>TheBarrelShifter</dc:creator><description>&lt;p&gt;Doesn&amp;#39;t seem to be, replacing __asm with __ASM there are still problems:&lt;/p&gt;
&lt;p&gt;Nordic/nRF51_SDK_9.0.0_2e23562/components/softdevice/s110/headers/ble.h:427:1: note: in expansion of macro &amp;#39;SVCALL&amp;#39;
SVCALL(SD_BLE_OPT_SET, uint32_t, sd_ble_opt_set(uint32_t opt_id, ble_opt_t const *p_opt));
^
Nordic/nRF51_SDK_9.0.0_2e23562/components/softdevice/s110/headers/ble.h: In function &amp;#39;sd_ble_opt_get&amp;#39;:
Nordic/nRF51_SDK_9.0.0_2e23562/components/softdevice/s110/headers/nrf_svc.h:56:18: error: expected &amp;#39;)&amp;#39; before &amp;#39;:&amp;#39; token
&amp;quot;bx r14&amp;quot; : : &amp;quot;I&amp;quot; (number) : &amp;quot;r0&amp;quot; \&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Problem including ble_advdata.h compiling with gcc</title><link>https://devzone.nordicsemi.com/thread/31261?ContentTypeID=1</link><pubDate>Thu, 06 Aug 2015 09:30:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:127bf484-600a-4e23-b978-176c77bca3f1</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;probably related to &lt;a href="https://devzone.nordicsemi.com/question/47418/problems-including-nrf_delayh-when-compiling-with-gcc/"&gt;this&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>