<?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>SVCALL warning messages</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/10793/svcall-warning-messages</link><description>I&amp;#39;ve recently upgraded my IDE to use Crossworks v3.6.2 which uses a GCC ARM Embedded 4.9-2015-q3-update compiler. it has by default many of the code clean up featues turned on.
it has found a great many warning messages, and I was wondering if there</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 19 Oct 2017 11:45:54 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/10793/svcall-warning-messages" /><item><title>RE: SVCALL warning messages</title><link>https://devzone.nordicsemi.com/thread/40333?ContentTypeID=1</link><pubDate>Thu, 19 Oct 2017 11:45:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9e8b8d95-3829-4a19-8a85-c5fcf69f3d09</guid><dc:creator>Austin</dc:creator><description>&lt;p&gt;This error occurs with GCC when -Wunused-parameter is enabled (either directly or both other options such as -Wextra).  It seems that using GCC pragmas to turn off unused parameter warnings does not work; the GCC &amp;#39;unused&amp;#39; attribute must be attached directly to the unused parameter.&lt;/p&gt;
&lt;p&gt;A tedious workaround for this problem is to modify nrf_svc.h as follows by adding SVC_PARAM macro:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#ifdef SVCALL_AS_NORMAL_FUNCTION
#define SVCALL(number, return_type, signature) return_type signature
#define SVC_PARAM(x)  x
#else


#if defined (__GNUC__)
#define SVC_PARAM(x)  SVC_PARAM_ ## x __attribute__((__unused__))
#else
#define SVC_PARAM(x)  x
#endif    
...
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In each of the instances where the SVCALL() macro is used, modify each call as follows, replacing the parameter name X with SVC_PARAM(X).  This will apply the unused GCC attribute directly to the parameter when the SoftDevice is compiled using SVC instructions.&lt;/p&gt;
&lt;p&gt;Before:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;SVCALL(SD_RAND_APPLICATION_VECTOR_GET, uint32_t, sd_rand_application_vector_get(uint8_t * p_buff, uint8_t length));
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;After:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; SVCALL(SD_MUTEX_NEW, uint32_t, sd_mutex_new(nrf_mutex_t * SVC_PARAM(p_mutex)));
SVCALL(SD_RAND_APPLICATION_VECTOR_GET, uint32_t, sd_rand_application_vector_get(uint8_t * SVC_PARAM(p_buff), uint8_t SVC_PARAM(length)));
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;@nordicdevs Is there any chance that a change to the SoftDevice source could be made to accommodate removal of unused parameter warnings on GCC?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SVCALL warning messages</title><link>https://devzone.nordicsemi.com/thread/40332?ContentTypeID=1</link><pubDate>Fri, 20 May 2016 19:03:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bf95eeeb-0dc6-4a4d-ac65-418167121ed5</guid><dc:creator>kane</dc:creator><description>&lt;p&gt;This change should stop the warnings from coming up.&lt;br /&gt;
Credit to &lt;a href="https://devzone.nordicsemi.com/question/6950/upgrading-to-sdk-520-breaks-build/"&gt;this answer&lt;/a&gt;.&lt;br /&gt;
Cast number as uint16_t, and ignore -Wunused-parameter&lt;br /&gt;
Note: it doesn&amp;#39;t actually fix the unused parameter warnings just masks them&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#define SVCALL(number, return_type, signature) \
  _Pragma(&amp;quot;GCC diagnostic ignored \&amp;quot;-Wunused-function\&amp;quot;&amp;quot;) \
  _Pragma(&amp;quot;GCC diagnostic ignored \&amp;quot;-Wunused-parameter\&amp;quot;&amp;quot;) \
  _Pragma(&amp;quot;GCC diagnostic push&amp;quot;) \
  _Pragma(&amp;quot;GCC diagnostic ignored \&amp;quot;-Wreturn-type\&amp;quot;&amp;quot;) \
  __attribute__((naked)) static return_type signature \
  { \
    __asm( \
        &amp;quot;svc %0\n&amp;quot; \
        &amp;quot;bx r14&amp;quot; : : &amp;quot;I&amp;quot; ((uint16_t)number) : &amp;quot;r0&amp;quot; \
    ); \
  }    \
  _Pragma(&amp;quot;GCC diagnostic pop&amp;quot;)
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>