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

nrf_svci.h does not compile with gcc, SDK 12.1.0

I'm getting the following compilation error when trying to build the DFU bootloader example, using gcc 4.9.3 (4_9-2015q3) on Mac.

In file included from /Users/Eliot/dev/nRF5_SDK_12.1.0_0d23e2a/components/libraries/crypto/nrf_crypto.h:17:0,
                 from dfu_req_handling.c:35:
/Users/Eliot/dev/nRF5_SDK_12.1.0_0d23e2a/components/libraries/svc/nrf_svci.h:69:93: error: expected declaration specifiers or '...' before ')' token
                                                                                  __VA_ARGS__)           \

Here's the context from nrf_svci.h:

#elif defined (__GNUC__)

        #ifdef __cplusplus
                #define GCC_CAST_CPP (uint8_t)
        #else
                #define GCC_CAST_CPP
        #endif

        #define SVCI_DECL(svci_num, return_type, function_name, ...)   \
                _Pragma("GCC diagnostic push")                          \
                _Pragma("GCC diagnostic ignored \"-Wreturn-type\"")     \
                __attribute__((naked, unused))                          \
                static return_type function_name(uint32_t svci_num,  \
                                                                                 __VA_ARGS__)           \
                {                                                       \
                        __asm __volatile (                                  \
                                "mov r12, %1\n\t"                               \
                                "svc %0\n\t"                                    \
                                "bx r14\n\t"                                    \
                                : /* no output */                               \
                                : "I" (GCC_CAST_CPP NRF_SVCI_SVC_NUM), "r" (svci_num)  \
                                : "r12" /* do we need to clobber? */            \
                        );                                                  \
                }                                                       \
                _Pragma("GCC diagnostic pop")

I guess this has something to do with the use of var args within a macro, but I don't know what exactly.

Parents Reply Children
No Data
Related