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

buttonless DFU integration in BLE app uart example: compiling problem

I'm trying to integrate buttonless DFU in BLE app uart example. I added the file: ble_dfu.c, ble_dfu_bonded.c, ble_dfu_unbonded.c in the project. I added the following folder:

C:\Nordic_Semi\nRF5_SDK_15.0.0_a53641a\components\libraries\svc

C:\Nordic_Semi\nRF5_SDK_15.0.0_a53641a\components\libraries\bootloader\dfu

C:\Nordic_Semi\nRF5_SDK_15.0.0_a53641a\components\libraries\bootloader

C:\Nordic_Semi\nRF5_SDK_15.0.0_a53641a\components\ble\ble_services\ble_dfu

C:\Nordic_Semi\nRF5_SDK_15.0.0_a53641a\components\libraries\bootloader\ble_dfu

in Preprocessor->User include Directories (in Options of the project). I'm using segger embedded studio.

I've got several compilation errors:

2> C:\Nordic_Semi\nRF5_SDK_15.0.0_a53641a\components\ble\ble_services\ble_dfu\ble_dfu_unbonded.c:61:55: error: unknown type name 'nrf_dfu_set_adv_name_svci_async_t'
2> C:\Nordic_Semi\nRF5_SDK_15.0.0_a53641a\components\ble\ble_services\ble_dfu\ble_dfu_unbonded.c:61:77: error: unknown type name 'nrf_dfu_adv_name_t'
2> c:\nordic_semi\nrf5_sdk_15.0.0_a53641a\components\libraries\svc\nrf_svci_async_function.h:174:35: error: request for member 'sys_evt_handler' in something not a structure or union
2> c:\nordic_semi\nrf5_sdk_15.0.0_a53641a\components\libraries\svc\nrf_svci_async_function.h:174:85: error: request for member 'state' in something not a structure or union
2> c:\nordic_semi\nrf5_sdk_15.0.0_a53641a\components\libraries\svc\nrf_svci_async_function.h:179:36: error: request for member 'async_func' in something not a structure or union
2> c:\nordic_semi\nrf5_sdk_15.0.0_a53641a\components\libraries\svc\nrf_svci_async_function.h:180:32: error: request for member 'sys_evt_handler' in something not a structure or union
2> C:\Nordic_Semi\nRF5_SDK_15.0.0_a53641a\components\ble\ble_services\ble_dfu\ble_dfu_unbonded.c:67:8: error: unknown type name 'nrf_dfu_adv_name_t'
2> C:\Nordic_Semi\nRF5_SDK_15.0.0_a53641a\components\ble\ble_services\ble_dfu\ble_dfu_unbonded.c:78:30: error: unknown type name 'nrf_dfu_adv_name_t'
2> C:\Nordic_Semi\nRF5_SDK_15.0.0_a53641a\components\ble\ble_services\ble_dfu\ble_dfu_unbonded.c:283:34: error: request for member 'name' in something not a structure or union
2> C:\Nordic_Semi\nRF5_SDK_15.0.0_a53641a\components\ble\ble_services\ble_dfu\ble_dfu_unbonded.c:284:27: error: request for member 'len' in something not a structure or union
Build failed

There is a guide or an application note that explains the several steps needed to integrate buttonless DFU to a custom application???

  • Increase the NRF_SDH_BLE_VS_UUID_COUNT from 1 to 2 in sdk_config.h

  • I changed 1 in 2, but now in function:

    ret_code_t nrf_sdh_ble_enable(uint32_t * const p_app_ram_start)
    {
        // Start of RAM, obtained from linker symbol.
        uint32_t const app_ram_start_link = *p_app_ram_start;
    
        ret_code_t ret_code = sd_ble_enable(p_app_ram_start);
        if (*p_app_ram_start > app_ram_start_link)
        {
            NRF_LOG_WARNING("Insufficient RAM allocated for the SoftDevice.");
    
            NRF_LOG_WARNING("Change the RAM start location from 0x%x to 0x%x.",
                            app_ram_start_link, *p_app_ram_start);
            NRF_LOG_WARNING("Maximum RAM size for application is 0x%x.",
                            ram_end_address_get() - (*p_app_ram_start));
        }
        else
        {
            NRF_LOG_DEBUG("RAM starts at 0x%x", app_ram_start_link);
            if (*p_app_ram_start != app_ram_start_link)
            {
                NRF_LOG_DEBUG("RAM start location can be adjusted to 0x%x.", *p_app_ram_start);
    
                NRF_LOG_DEBUG("RAM size for application can be adjusted to 0x%x.",
                              ram_end_address_get() - (*p_app_ram_start));
            }
        }
    
        if (ret_code == NRF_SUCCESS)
        {
            m_stack_is_enabled = true;
        }
        else
        {
            NRF_LOG_ERROR("sd_ble_enable() returned %s.", nrf_strerror_get(ret_code));
        }
    
        return ret_code;
    }
    

    the the execution the execution enters in the block

        if (*p_app_ram_start > app_ram_start_link)
        {
            NRF_LOG_WARNING("Insufficient RAM allocated for the SoftDevice.");
            NRF_LOG_WARNING("Change the RAM start location from 0x%x to 0x%x.",
                            app_ram_start_link, *p_app_ram_start);
            NRF_LOG_WARNING("Maximum RAM size for application is 0x%x.",
                            ram_end_address_get() - (*p_app_ram_start));
        }
  • Yes, you need to increase the RAM allocated to the SoftDevice as stated in the RTT log output.

  • Ok, but please could you tell me how to make it and how much memory to allocate.?

    Thank you for the support

  • That is stated in the p_app_ram_start variable, or more correctly in the variable that p_app_ram_start points to, i.e. *p_app_ram_start . If you add p_app_ram_start to watch and then set a breakpoint after sd_ble_enable() you should be able to see which value points top_app_ram_start.

    Take a look at this  video, it explains how to modify the build settings, including the memory settings.

Related