uint32_t bootloader_dfu_sd_update_continue(void) { uint32_t err_code; if ((dfu_sd_image_validate() == NRF_SUCCESS) && (dfu_bl_image_validate() == NRF_SUCCESS)) { return NRF_SUCCESS; } // Ensure that flash operations are not executed within the first 100 ms seconds to allow // a debugger to be attached. nrf_delay_ms(100); err_code = dfu_sd_image_swap(); APP_ERROR_CHECK(err_code); err_code = dfu_sd_image_validate(); APP_ERROR_CHECK(err_code); err_code = dfu_bl_image_swap(); APP_ERROR_CHECK(err_code); return err_code; }
uint32_t bootloader_dfu_bl_update_continue(void) { uint32_t err_code = NRF_SUCCESS; const bootloader_settings_t * p_bootloader_settings; bootloader_util_settings_get(&p_bootloader_settings); /* Ignore update attempts on invalid src_image_address */ if( (p_bootloader_settings->src_image_address == SRC_IMAGE_ADDRESS_EMPTY) || (p_bootloader_settings->src_image_address == SRC_IMAGE_ADDRESS_INVALID)) { return NRF_SUCCESS; } if( (p_bootloader_settings->bl_image.st.bank == NEW_IMAGE_BANK_0) || (p_bootloader_settings->bl_image.st.bank == NEW_IMAGE_BANK_1)) { debugger_delay(); if (dfu_bl_image_validate() != NRF_SUCCESS) { err_code = dfu_bl_image_swap(); // reset is built in to the mbr bootloader swap } else { /* This is a manual write to flash, non-softdevice managed */ uint32_t address = (uint32_t)p_bootloader_settings + BOOTLOADER_SETTINGS_BL_IMAGE_SIZE_ADR_OFFSET; uint32_t value = p_bootloader_settings->bl_image.all & 0x3FFFFFFF; // clears image bank bits. err_code = blocking_flash_word_write((uint32_t *)address, value); //TODO need to catch verification error } } return err_code; }