This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

SVCALL warning messages

I'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 was a quick way to clean them up.

1> c:....\s110\headers\nrf_soc.h: In function 'sd_mutex_new': 1> c:....\s110\headers\nrf_soc.h:374:59: warning: unused parameter 'p_mutex' [-Wunused-parameter] 1> c:....\s110\headers\nrf_svc.h:52:45: note: in definition of macro 'SVCALL' 1> c:....\s110\headers\nrf_soc.h: In function 'sd_mutex_acquire': 1> c:....\s110\headers\nrf_soc.h:383:67: warning: unused parameter 'p_mutex' [-Wunused-parameter] 1> c:....\s110\headers\nrf_svc.h:52:45: note: in definition of macro 'SVCALL' 1> c:....\s110\headers\nrf_soc.h: In function 'sd_mutex_release':

The code line in question is

SVCALL(SD_BLE_ENABLE, uint32_t, sd_ble_enable(ble_enable_params_t * p_ble_enable_params));

and SVCALL is linked to this

#define SVCALL(number, return_type, signature) \
  _Pragma("GCC diagnostic ignored \"-Wunused-function\"") \
  _Pragma("GCC diagnostic push") \
  _Pragma("GCC diagnostic ignored \"-Wreturn-type\"") \
  __attribute__((naked)) static return_type signature \
  { \
    __asm( \
        "svc %0\n" \
        "bx r14" : : "I" (number) : "r0" \
    ); \
  }    \
  _Pragma("GCC diagnostic pop")

All the SVCALL's produce the same warning messages. like 1300 warnings from the Nordic SDK.

I've tried adding the preprocessor define SVCALL_AS_NORMAL_FUNCTION, but now my various calls that were inside a SVCALL, "don't exist" any longer. which I assume is because they are in the softdevice.

Some direction would be great. Thanks

Parents
  • This change should stop the warnings from coming up.
    Credit to this answer.
    Cast number as uint16_t, and ignore -Wunused-parameter
    Note: it doesn't actually fix the unused parameter warnings just masks them

    #define SVCALL(number, return_type, signature) \
      _Pragma("GCC diagnostic ignored \"-Wunused-function\"") \
      _Pragma("GCC diagnostic ignored \"-Wunused-parameter\"") \
      _Pragma("GCC diagnostic push") \
      _Pragma("GCC diagnostic ignored \"-Wreturn-type\"") \
      __attribute__((naked)) static return_type signature \
      { \
        __asm( \
            "svc %0\n" \
            "bx r14" : : "I" ((uint16_t)number) : "r0" \
        ); \
      }    \
      _Pragma("GCC diagnostic pop")
    
Reply
  • This change should stop the warnings from coming up.
    Credit to this answer.
    Cast number as uint16_t, and ignore -Wunused-parameter
    Note: it doesn't actually fix the unused parameter warnings just masks them

    #define SVCALL(number, return_type, signature) \
      _Pragma("GCC diagnostic ignored \"-Wunused-function\"") \
      _Pragma("GCC diagnostic ignored \"-Wunused-parameter\"") \
      _Pragma("GCC diagnostic push") \
      _Pragma("GCC diagnostic ignored \"-Wreturn-type\"") \
      __attribute__((naked)) static return_type signature \
      { \
        __asm( \
            "svc %0\n" \
            "bx r14" : : "I" ((uint16_t)number) : "r0" \
        ); \
      }    \
      _Pragma("GCC diagnostic pop")
    
Children
No Data
Related