add need_erase for flash_nrf5x. Only uf2 erase when flush, dfu serial (uart and cdc) will prepare erase in advance.

This commit is contained in:
hathach
2018-10-02 18:57:50 +07:00
parent 51411ff85d
commit cb1ae6d947
5 changed files with 24 additions and 22 deletions

View File

@ -433,7 +433,7 @@ uint32_t dfu_data_pkt_handle(dfu_update_packet_t * p_packet)
}
else
{
flash_nrf5x_write(DFU_BANK_0_REGION_START+m_data_received, p_data, data_length);
flash_nrf5x_write(DFU_BANK_0_REGION_START + m_data_received, p_data, data_length, false);
pstorage_callback_handler(mp_storage_handle_active, PSTORAGE_STORE_OP_CODE, NRF_SUCCESS, (uint8_t *) p_data, data_length);
}
@ -446,7 +446,7 @@ uint32_t dfu_data_pkt_handle(dfu_update_packet_t * p_packet)
}
else
{
if ( !is_ota() ) flash_nrf5x_flush();
if ( !is_ota() ) flash_nrf5x_flush(false);
// The entire image has been received. Return NRF_SUCCESS.
err_code = NRF_SUCCESS;