Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
9 years, 7 months ago.
nRF51822 library not compiling
I've created a small program to test some functions but can't get it to compile. I've include the BLE library as I want the BLE stack running during my tests.
Using all the latest versions of BLE_API, nRF51822, and mbed-src
/* power consumption testing
*/
#include "mbed.h"
#include "BLE.h"
#define LED_INTERVAL 2
BLE ble; //BLE device object
Timeout alertTimer;
DigitalOut led(LED1);
void timeoutCallback(void)
{
led = ~led;
alertTimer.attach(&timeoutCallback, LED_INTERVAL);
}
void disconnectionCallback(const Gap::DisconnectionCallbackParams_t *params)
{
ble.startAdvertising();
}
int main() {
ble.init();
ble.onDisconnection(disconnectionCallback);
ble.startAdvertising();
alertTimer.attach(&timeoutCallback, LED_INTERVAL);
while(1) {
ble.waitForEvent(); // let the library manage power and stuff.
}
}
When I compile the following error appears.
Quote:
Error: Struct "<unnamed>" has no field "NRFFW" in "nRF51822/source/nordic_sdk/components/libraries/fstorage/fstorage_config.h", Line: 85, Col: 49
This is a line in the fstorage_config.h file in the nordic SDK components. Is this possibly a change in the SDK not updated in the mbed library?
Andrew
Hi Andrew,
I could compile your program without error.
I tried three diffrent boards, TY51822r3(Switch Sinence), nRF51822 & Nano(RedBear Lab.).
Those three are fine (only compile not run) for me.
In addtion, I had some experiance to get the error in the past and modified the file as follows.
fstrage_config.h
static __INLINE uint32_t fs_flash_page_end_addr() { #if 0 uint32_t const bootloader_addr = NRF_UICR->NRFFW[0]; #else uint32_t const bootloader_addr = NRF_UICR->BOOTLOADERADDR; #endif return ((bootloader_addr != FS_EMPTY_MASK) ? bootloader_addr : NRF_FICR->CODESIZE * FS_PAGE_SIZE); }NRFFW[0] is same address with BOOTLOADERADDR (Set union structre).
posted by Kenji Arai 08 Mar 2016I also tried the compiling with the RedbearLab nRF51822 target, but got same error. Then I made change as you suggested and error dissappeared, although several warnings about incompatible parameter rypes still remain. I don't understand why this has appeared now, but is not in my other projects using same target.
posted by Andrew Fox 08 Mar 2016