nRF8001 BLE Example Compile Error -Ubuntu

For other supported Arduino products from Adafruit: Shields, accessories, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
modernman
 
Posts: 9
Joined: Mon Dec 09, 2013 3:30 pm

nRF8001 BLE Example Compile Error -Ubuntu

Post by modernman »

Hello,

Help welcomed solving compile errors on Adafruit nRF8001 examples using Ubuntu 13.10 and Arduino IDE 1:1.05. I have not been clever enough to figure out the fix so reaching out for help.

I am using the latest Adafruit nRF8001 repo from Github . https://github.com/adafruit/Adafruit_nRF8001 with same results.

The Adafruit nRF8001 examples compile fine on OSX however fail compiling on Ubuntu (stricter compiler?)

Here is the compile error received when compiling (Examples/Adafruit_nRF8001/echoDemo)on Linux:

/home/myName/sketchbook/libraries/Adafruit_nRF8001/Adafruit_BLE_UART.cpp:39:53: error: variable ‘setup_msgs’ must be const in order to be put into read-only section by means of ‘__attribute__((progmem))’


tia,
brycej

User avatar
adafruit_support_mike
 
Posts: 67485
Joined: Thu Feb 11, 2010 2:51 pm

Re: nRF8001 BLE Example Compile Error -Ubuntu

Post by adafruit_support_mike »

More recent versions of the Arduino IDE have gotten really strict about type checking, and the versions for different machines do seem to have different quirks.

In this case, open the library's .cpp file and on line 39 change this:

Code: Select all

static hal_aci_data_t setup_msgs[NB_SETUP_MESSAGES] PROGMEM = SETUP_MESSAGES_CONTENT;
to this:

Code: Select all

static const hal_aci_data_t setup_msgs[NB_SETUP_MESSAGES] PROGMEM = SETUP_MESSAGES_CONTENT;
Basically the compiler is saying that the data will be stored in Flash memory, so you can't change it while the program is running. That's pretty obvious at the human-programmer level, but the compiler wants it hardcoded as a type constraint.

User avatar
modernman
 
Posts: 9
Joined: Mon Dec 09, 2013 3:30 pm

Re: nRF8001 BLE Example Compile Error -Ubuntu

Post by modernman »

Thank you for the timely response.

I attempted the modification you detailed prior to my initial post and not met with success. It has done the trick in the past and after chasing the type change thru the Adafruit_BLE_UART.cpp code without success I wrote.

The change results in the following compile errors.

Code: Select all

../libraries/Adafruit_nRF8001/Adafruit_BLE_UART.cpp: In member function ‘bool Adafruit_BLE_UART::begin(uint16_t, uint16_t)’:
../libraries/Adafruit_nRF8001/Adafruit_BLE_UART.cpp:429:49: error: invalid conversion from ‘const hal_aci_data_t*’ to ‘hal_aci_data_t*’ [-fpermissive]
I suspect this is relevant to anyone attempting to use the nRF8001 examples (libraries) on Ubuntu. I have observed this behavior on both 32 & 64 bit Ubuntu. OSX does not exhibit this issue (I have been loading any sketches that use the nRF8001 BLE with OSX as a workaround but like to get the library sorted out for use on Ubuntu/ Linux.)

Thank you for your time.

User avatar
adafruit_support_mike
 
Posts: 67485
Joined: Thu Feb 11, 2010 2:51 pm

Re: nRF8001 BLE Example Compile Error -Ubuntu

Post by adafruit_support_mike »

Hoboy.. this is why strict type checking can be more trouble than it's worth. As a matter of fact, that level of strictness breaks one of the important uses of consts in C++.

Try changing line 429 in the library from this:

Code: Select all

  aci_state.aci_setup_info.setup_msgs         = setup_msgs;
to this:

Code: Select all

  aci_state.aci_setup_info.setup_msgs         = (hal_aci_data_t*)setup_msgs;

User avatar
modernman
 
Posts: 9
Joined: Mon Dec 09, 2013 3:30 pm

Re: nRF8001 BLE Example Compile Error -Ubuntu

Post by modernman »

Yes, that corrected issue in the library file and nRF8001 BLE sketches now compile fine on Ubuntu.

Thank you very much.

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Arduino products from Adafruit”