This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Programming nrf51x22 with Keil in C++

Hi All,

I was wondering if it was possible to program the nrf51x22 in c++? I am using Keil and I'm trying to convert the examples in the SDK to CPP by adding --cpp to the compiler string and

#ifdef __cplusplus
extern "C" {
#endif

...

#ifdef __cplusplus
}
#endif

to the headers but I cant seem to compile these targets. Could someone tell me how to configure Keil to use either the ARM or the GCC compiler for this? When switching to GCC I keep getting the error target CPU does not support ARM mode.

Regards,

Alex

  • Hi Nguyen,

    I'm not sure why but I can't compile the CMSIS... Is all the code needed for that on the git page?

    Regards,

    Alex

  • It should be. What error did you get ?

  • Turns out "${workspace_loc:/nrf51_sdk/nrf51822/Include/sdk}" is not possible in windows (kepler) so "${workspace_loc}/nrf51_sdk/nrf51822/Include/sdk" worked. Now I have CMSIS compiled (using internal CDT, make didnt work). EHAT however has an include in your user folder which I don't have. the errors are: Info

    : Internal Builder is used for build
    arm-none-eabi-gcc -mcpu=cortex-m0 -mthumb -O0 -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -Wall -g3 "-IC:\\NRF\\dev_root\\ARM\\Nordic\\nRF51/nrf51_sdk/nrf51822/Include/ble/ble_services" "-IC:\\NRF\\dev_root\\ARM\\Nordic\\nRF51/nrf51_sdk/nrf51822/Include/sd_common" "-IC:\\NRF\\dev_root\\ARM\\Nordic\\nRF51/nrf51_sdk/nrf51822/Include/ble" "-IC:\\NRF\\dev_root\\ARM\\Nordic\\nRF51/nrf51_sdk/nrf51822/Include/s110" "-IC:\\NRF\\dev_root\\ARM\\Nordic\\nRF51/nrf51_sdk/nrf51822/Include/app_common" "-IC:\\NRF\\dev_root\\ARM\\Nordic\\nRF51/nrf51_sdk/nrf51822/Include/gcc" "-IC:\\NRF\\dev_root\\ARM\\Nordic\\nRF51/nrf51_sdk/nrf51822/Include" -I/Users/hoan/I-SYST/swdev/fwdev/include "-IC:\\NRF\\dev_root\\ARM\\Nordic\\nRF51/EHAL/include" -std=gnu99 -c -o "src\\ledmx.o" "..\\..\\..\\..\\..\\src\\ledmx.c" 
    ..\..\..\..\..\src\ledmx.c:38:21: fatal error: istddef.h: No such file or directory
     #include "istddef.h"
                         ^
    compilation terminated.
    
  • it's in include folder at the top of the tree where all common sources are located. It's a multi-platform working tree. The project should have all the require path for it. I see there is one that was not a relative path and that was the one. The include path for that should be "${workspace_loc:}/../../../include"

Related