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

Bond manager error when porting code from Keil to gcc

I have been working on porting my code from Keil to gcc because it has grown larger than the 32K limit that the free version of Keil allows. I am using the s110 softdevice. I have used the example makefiles and linker files as templates with the same read-only and read-write addresses that I specified in Keil. The code will compile, link and flash, but when I initialize the bond manager (ble_bondmngr_init), the error returned is NRF_ERROR_INVALID_DATA. This code runs fine when built using Keil. I have no idea where to begin. Any help would be greatly appreciated.

EDIT: It appears that ble_bondmngr_init is not null, and the blocks are word aligned. It appears that it is returning this error from crc_extract in ble_bondmngr:

    static uint32_t crc_extract(uint32_t header, uint16_t * p_crc)
{
    if ((header & 0xFFFF0000U) == BOND_MANAGER_DATA_SIGNATURE)
    {
        *p_crc = (uint16_t)(header & 0x0000FFFFU);

        return NRF_SUCCESS;
    }
    else if (header == 0xFFFFFFFFU)
    {
        return NRF_ERROR_NOT_FOUND;
    }
    else
    {

        return NRF_ERROR_INVALID_DATA;                     <- RIGHT HERE

    }
}

My header value = 0x20003330 and BOND_MANAGER_DATA_SIGNATURE = 0x53240000 as defined by ble_bondmngr. I am not sure why my header value is so different from the expected value.

Parents
  • I did some more digging and found that with gcc, my code is much larger. I was initially using the eval kit with the QFAA (256K flash) version of the chip. I switched to the QFAB (128K flash) version without realizing it and kept the same settings in Keil (configured for the QFAA) which were fine since my code was smaller in Keil. When I switched to gcc, my code was too large for 128K, but I wasn't getting an error since I was configured for 256K. So obviously the pstorage module was throwing an error since memory that should have been uninitialized actually contained data.

Reply
  • I did some more digging and found that with gcc, my code is much larger. I was initially using the eval kit with the QFAA (256K flash) version of the chip. I switched to the QFAB (128K flash) version without realizing it and kept the same settings in Keil (configured for the QFAA) which were fine since my code was smaller in Keil. When I switched to gcc, my code was too large for 128K, but I wasn't getting an error since I was configured for 256K. So obviously the pstorage module was throwing an error since memory that should have been uninitialized actually contained data.

Children
No Data
Related