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 Reply Children
  • In main.c you have to add the service for buttonless dfu:

    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};
        ble_dis_init_t     dis_init;
    
        // 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);
    
    #if defined(NDEBUG)
    //***** 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);
    
    //**************************
    #endif
    
    //************ Battery Service *********************
        ble_bas_init_t bas_init;
        memset(&bas_init, 0, sizeof(bas_init));
        BLE_GAP_CONN_SEC_MODE_SET_OPEN(&bas_init.battery_level_char_attr_md.cccd_write_perm);
        BLE_GAP_CONN_SEC_MODE_SET_OPEN(&bas_init.battery_level_char_attr_md.read_perm);
        BLE_GAP_CONN_SEC_MODE_SET_NO_ACCESS(&bas_init.battery_level_char_attr_md.write_perm);
    
        BLE_GAP_CONN_SEC_MODE_SET_OPEN(&bas_init.battery_level_report_read_perm);
    
        bas_init.evt_handler = NULL;
        bas_init.support_notification = true;
        bas_init.p_report_ref = NULL;
        bas_init.initial_batt_level = 100;
    
        err_code = ble_bas_init(&m_bas,&bas_init);
        APP_ERROR_CHECK(err_code);
     //****************************************************
    
     //********** Initialize Device Information Service *************
        memset(&dis_init, 0, sizeof(dis_init));
    
        ble_srv_ascii_to_utf8(&dis_init.manufact_name_str, (char *)MANUFACTURER_NAME);
        ble_srv_ascii_to_utf8(&dis_init.fw_rev_str, (char *)SW_REV);
        ble_srv_ascii_to_utf8(&dis_init.sw_rev_str, (char *)SW_REV);
    
        BLE_GAP_CONN_SEC_MODE_SET_OPEN(&dis_init.dis_attr_md.read_perm);
        BLE_GAP_CONN_SEC_MODE_SET_NO_ACCESS(&dis_init.dis_attr_md.write_perm);
    
        err_code = ble_dis_init(&dis_init);
        APP_ERROR_CHECK(err_code);
     //**************************************************************
    
    }

    What is the specific problem?

    Best regards

Related