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

KEIL build with SDK 16.0.0 fails

I am trying to port my build from Eclipse (based on the GCC tool chain) to a KEIL uVision build system.

I am using KEIL ARM Compiler version 6.15. Most of the files compile fine except for the file:
'nrf_svci_async_function.h' (and its dependencies).

I have isolated at least one thing that is a bit worrisome and that is that (for reasons unknown to me at this time) the ARM Compiler defines the symbol __GNUC__ and NOT the symbo __CC_ARM. This results in a whole bunch of incorrect preprocessor symbols being picked up in the build.

Other than hacking the header files deep within the Nordic SDK, is there any other option to convince the KEIL build system to not define __GNUC__ so that the correct code fragment is used.

Cheers
RMV

  • The SDK Release Notes say what versions of tools they work with

  • The release note says that one needs to 'download a previous version of the MDK' from another website, and not to mention that it only works with KEIL compiler version 5.x

    My question was if there was a version that will build with KEIL compiler version 6.x

    But I am not getting an answer to that question.

  • If it helps Nordic to fix the SDK, here is the offending piece of code from the file 'nrf_svci.h' in SDK 16.0.0, starting from line 123.

    The problem is in the assembler command at line 133:    " ldr r12, = %0        \n"
    The =%0 gets translated to, in my specific case, as   '=#3' and that is invalid ARM assembly command.

    #if defined (__GNUC__)
    
        #define SVCI_DECL_0(svci_num, return_type, function_name)           \
            _Pragma("GCC diagnostic push")                                  \
            _Pragma("GCC diagnostic ignored \"-Wreturn-type\"")             \
            __attribute__((naked, unused))                                  \
            static return_type svci_ ## function_name(void)                 \
            {                                                               \
                /* Do the SuperVisor call by using svc instruction with     \
                   R12 containing the SVCI number */                        \
                __ASM __volatile                                            \
                (                                                           \
                    "  ldr r12, =%0       \n"                               \
                    "  svc %1             \n"                               \
                    "  bx lr              \n"                               \
                    "  .ltorg"                                              \
                    : /* output */                                          \
                    : /* input */                                           \
                        "X"(svci_num),                                      \
                        "I"(GCC_CAST_CPP NRF_SVCI_SVC_NUM)                  \
                    : /* clobbers */                                        \
                        "r12"                                               \
                );                                                          \
            }                                                               \
            _Pragma("GCC diagnostic pop")    
        
        #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 svci_ ## function_name(__VA_ARGS__)          \
            {                                                               \
                /* Do the SuperVisor call by using svc instruction with     \
                   R12 containing the SVCI number */                        \
                __ASM __volatile                                            \
                (                                                           \
                    "  ldr.w r12, =%0     \n"                               \
                    "  svc %1             \n"                               \
                    "  bx lr              \n"                               \
                    "  .ltorg"                                              \
                    : /* output */                                          \
                    : /* input */                                           \
                        "X"(svci_num),                                      \
                        "I"(GCC_CAST_CPP NRF_SVCI_SVC_NUM)                  \
                    : /* clobbers */                                        \
                        "r12"                                               \
                );                                                          \
            }                                                               \
            _Pragma("GCC diagnostic pop")
    

  • This is like pulling teeth here....


    Maybe I should send an email to my Nordic FAE/Sales Rep and ask them when they will be releasing a version that is compatible with ARM KEIL compiler versions 6.x

Related