From f14aebba1dfc2e3671acbd3488159023c13f69ab Mon Sep 17 00:00:00 2001 From: hathach Date: Fri, 28 Sep 2018 23:45:27 +0700 Subject: [PATCH] rename flash_ to flash_nrf5x_ --- .../libraries/bootloader_dfu/bootloader.c | 4 ++-- .../libraries/bootloader_dfu/dfu_single_bank.c | 15 ++++++++++----- src/flash_nrf5x.c | 8 ++++---- src/flash_nrf5x.h | 4 ++-- src/usb/uf2/ghostfat.c | 4 ++-- 5 files changed, 20 insertions(+), 15 deletions(-) diff --git a/lib/sdk11/components/libraries/bootloader_dfu/bootloader.c b/lib/sdk11/components/libraries/bootloader_dfu/bootloader.c index c1351b7..265e55b 100644 --- a/lib/sdk11/components/libraries/bootloader_dfu/bootloader.c +++ b/lib/sdk11/components/libraries/bootloader_dfu/bootloader.c @@ -185,8 +185,8 @@ static void bootloader_settings_save(bootloader_settings_t * p_settings) } else { - flash_write(BOOTLOADER_SETTINGS_ADDRESS, p_settings, sizeof(bootloader_settings_t)); - flash_flush(); + flash_nrf5x_write(BOOTLOADER_SETTINGS_ADDRESS, p_settings, sizeof(bootloader_settings_t)); + flash_nrf5x_flush(); pstorage_callback_handler(&m_bootsettings_handle, PSTORAGE_STORE_OP_CODE, NRF_SUCCESS, (uint8_t *) p_settings, sizeof(bootloader_settings_t)); } diff --git a/lib/sdk11/components/libraries/bootloader_dfu/dfu_single_bank.c b/lib/sdk11/components/libraries/bootloader_dfu/dfu_single_bank.c index 57d1295..d37cf45 100644 --- a/lib/sdk11/components/libraries/bootloader_dfu/dfu_single_bank.c +++ b/lib/sdk11/components/libraries/bootloader_dfu/dfu_single_bank.c @@ -146,7 +146,13 @@ static void dfu_prepare_func_app_erase(uint32_t image_size) } else { - flash_erase(DFU_BANK_0_REGION_START, m_image_size); + uint32_t page_count = m_image_size/CODE_PAGE_SIZE; + if ( m_image_size%CODE_PAGE_SIZE ) page_count++; + + for(uint32_t i=0; itargetAddr, bl->data, bl->payloadSize); + flash_nrf5x_write(bl->targetAddr, bl->data, bl->payloadSize); } if (state && bl->numBlocks) { @@ -307,7 +307,7 @@ int write_block(uint32_t block_no, uint8_t *data, bool quiet/*, WriteState *stat } if (state->numWritten >= state->numBlocks) { // flush last blocks - flash_flush(); + flash_nrf5x_flush(); uf2_write_complete(state->numBlocks); }