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???

Parents
  • I solved the compilation problems. I changed the function "services_init(void)" of project app_uart_example in:

    static void services_init(void)
    {
        uint32_t           err_code;
        ble_nus_init_t     nus_init;
        nrf_ble_qwr_init_t qwr_init = {0};
        ble_dfu_buttonless_init_t dfus_init = {0};
    
        // Initialize Queued Write Module.
        qwr_init.error_handler = nrf_qwr_error_handler;
    
        err_code = nrf_ble_qwr_init(&m_qwr, &qwr_init);
        APP_ERROR_CHECK(err_code);
    
        // Initialize NUS.
        memset(&nus_init, 0, sizeof(nus_init));
    
        nus_init.data_handler = nus_data_handler;
    
        err_code = ble_nus_init(&m_nus, &nus_init);
        APP_ERROR_CHECK(err_code);
    
    //***** buttonless DFU *****
    
        // Initialize the async SVCI interface to bootloader.
        err_code = ble_dfu_buttonless_async_svci_init();
        APP_ERROR_CHECK(err_code);
    
        dfus_init.evt_handler = ble_dfu_evt_handler;
    
        err_code = ble_dfu_buttonless_init(&dfus_init);
        APP_ERROR_CHECK(err_code);
    
    //**************************
    
    
    }

    but in executio I've got error " NRF_BREAKPOINT_COND;" in function "__WEAK void app_error_fault_handler(uint32_t id, uint32_t pc, uint32_t info)"

    There are news regarding official documentation about integration of buttonless DFU to a custom application?

  • : We do not have an official guide on how to add the DFU service to a custom application. 

    If you're entering the app_error_fault_handler function then there is probably a APP_ERROR_CHECK(err_code) check that is asserting. Could you place a breakpoint in app_error_handler_bare() in app_error.c and take a look at the call stack to see which function that caused the assert?

    Bjørn 

  • I can't place a breakpoint app_error_handler_bare(), the IDE tell me "no code for breakpoint".

    In debugging I've got "NRF_ERROR_NO_MEM" form function "sd_ble_uuid_vs_add(&nordic_base_uuid, &m_dfu.uuid_type);" in "uint32_t ble_dfu_buttonless_init(const ble_dfu_buttonless_init_t * p_dfu_init)"

  • 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));
        }
Reply
  • 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));
        }
Children
Related