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

Unable to build nRF51 Bluetooth Driver 0.5.0

I'm trying to build BLE driver 0.5.0 for 64bits.

I've downloaded:

  • MinGW 4.8.2 64bits
  • boost 1.56 and compiled it using address-model=64
  • CMake 3.4.1
  • Python 2.7.11
  • Swig 2.0.12
  • Microsoft Visual C++ Compiler for Python

Now, Im' getting this error upon compilation:

b:/nrfdriver/sdk/nRF51_SDK_8.1.0_b6ed55f/components/device/nrf51.h:119:0, from b:/nrfdriver/sdk/nRF51_SDK_8.1.0_b6ed55f/components/softdevice/s130/headers/nrf_soc.h:50, from b:/nrfdriver/pc-ble-driver-0.5.0/driver/inc_override/nrf_soc.h:21, from b:/nrfdriver/pc-ble-driver-0.5.0/driver/inc_override/app_util_platform.h:26, from b:/nrfdriver/sdk/nRF51_SDK_8.1.0_b6ed55f/components/drivers_nrf/uart/app_uart.h:27, from b:\nrfdriver\pc-ble-driver-0.5.0\driver\src\app_uart_pc.c:13: C:/MinGW/mingw64/lib/gcc/x86_64-w64-mingw32/4.8.2/include/xmmintrin.h: In function 'void _mm_setcsr(unsigned int)': b:/nrfdriver/sdk/nRF51_SDK_8.1.0_b6ed55f/components/toolchain/gcc/core_cm0.h:164:21: error: expected primary-expression before 'volatile' #define __I volatile /*!< Defines 'read only' permissions */ ^ driver\CMakeFiles\s130_nrf51_ble_driver.dir\build.make:297: recipe for target 'driver/CMakeFiles/s130_nrf51_ble_driver.dir/src/app_uart_pc.c .obj' failed

Apparently, it's because core_cm0.h defines #define __I volatile and, later xmmintrin.h from gcc include directory does _mm_setcsr (unsigned int __I) and this fails.

Am I doing something wrong? I don't think this could be caused by the fact that I'm trying to compile 64bits.

Parents
  • I finally got it compile and work. If one needs to do that, here are the steps to follow:

    1- Get driver sources from github.com/.../v0.5.0

    2- Download and install all dependencies as requested by README.md, except for MinGW (proposed version does not support x64)

    3- Get w64 MinGW installer and install the version coresponding to the one referenced by README.md: 4.8.2, thread posix

    4- Build boost as documented (README.md), but with additional b2 parameter: address-model=64

    5- From driver's script folder, replace i386 by X64 in msvc_def_to_lib.bat.in file (else, you'll get a x64 .dll but a x86 .lib....)

    6- Run build.py command (as documented by README.md) once (to have SDK be downloaded), it will fail with error error: expected primary-expression before 'volatile' #define __I volatile. This is because Nordic's __I variable conflicts with a MinGW 64bits variable.

    7- Go to the SDK folder and replace all __I by __NRF_I to resolve the conflict (there should be 251 instances in components\toolchain\gcc\core_cm0.h and components\device\nrf51.h)

    8- Run build.py script again. .dll and .lib will be generated for x64 target!

Reply
  • I finally got it compile and work. If one needs to do that, here are the steps to follow:

    1- Get driver sources from github.com/.../v0.5.0

    2- Download and install all dependencies as requested by README.md, except for MinGW (proposed version does not support x64)

    3- Get w64 MinGW installer and install the version coresponding to the one referenced by README.md: 4.8.2, thread posix

    4- Build boost as documented (README.md), but with additional b2 parameter: address-model=64

    5- From driver's script folder, replace i386 by X64 in msvc_def_to_lib.bat.in file (else, you'll get a x64 .dll but a x86 .lib....)

    6- Run build.py command (as documented by README.md) once (to have SDK be downloaded), it will fail with error error: expected primary-expression before 'volatile' #define __I volatile. This is because Nordic's __I variable conflicts with a MinGW 64bits variable.

    7- Go to the SDK folder and replace all __I by __NRF_I to resolve the conflict (there should be 251 instances in components\toolchain\gcc\core_cm0.h and components\device\nrf51.h)

    8- Run build.py script again. .dll and .lib will be generated for x64 target!

Children
Related