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
  • It looks like there are two reasons you could get that error calling ble_bondmgr_init:

    1. If the pointer to the error_handler in the initialization structure you pass ble_bondmgr_init is NULL.

    2. If pstorage_register determines your block size is not a multiple of 4 bytes in size.

    So, you need to determine which of these failures you are encountering and then you can focus on why that particular case is occurring.

Reply
  • It looks like there are two reasons you could get that error calling ble_bondmgr_init:

    1. If the pointer to the error_handler in the initialization structure you pass ble_bondmgr_init is NULL.

    2. If pstorage_register determines your block size is not a multiple of 4 bytes in size.

    So, you need to determine which of these failures you are encountering and then you can focus on why that particular case is occurring.

Children
No Data
Related