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

Parents
  • Hello,

    I am not sure what setting that changes this. By searching for it it says that the __CC_ARM is always defined as 1 when using the Keil compiler. How did you determine that it was not?

    Perhaps you can try to compare your project settings with one of the Keil projects found in our SDK and see if you can see anything that differs? If you can't find anything, perhaps you need to ask Keil directly.

    Another option is to take a project that is already set up using Keil from our SDK, and swap it with your files.

    Best regards,

    Edvin

  • I found this in two ways.

    The initial indication is due to the fact that the GUI parses the files behind the scenes and enables code within valid #if .... #else ... clauses.

    The second, more accurate method, was that I edited the specific file and added a statement '#error FIXME' within the code fragment contained inside the #if defined(__GNUC__) .... #else combination and that line triggered that error and failed during the build.

Reply
  • I found this in two ways.

    The initial indication is due to the fact that the GUI parses the files behind the scenes and enables code within valid #if .... #else ... clauses.

    The second, more accurate method, was that I edited the specific file and added a statement '#error FIXME' within the code fragment contained inside the #if defined(__GNUC__) .... #else combination and that line triggered that error and failed during the build.

Children
  • If it helps, starting with version 6.x, the ARM Compiler uses CLANG which is also used by GCC which leads to the side effect (not sure if it was intentional or accidental) that it defines the symbol __GNUC__.

    I did try to use version 5.x of the compiler but that led to a whole slew of other errors SDK, most of which I got rid of when I set the language to use C90 and GNU Extensions.... but I prefer something more recent and robust.

Related