diff --git a/src/main.c b/src/main.c index a6bc4bd..a97cb1b 100644 --- a/src/main.c +++ b/src/main.c @@ -307,7 +307,7 @@ uint32_t softdev_teardown(void) int main(void) { // SD is already Initialized in case of BOOTLOADER_DFU_OTA_MAGIC - bool sd_inited = (NRF_POWER->GPREGRET == BOOTLOADER_DFU_OTA_MAGIC); + bool const sd_inited = (NRF_POWER->GPREGRET == BOOTLOADER_DFU_OTA_MAGIC); // Start Bootloader in BLE OTA mode _ota_update = (NRF_POWER->GPREGRET == BOOTLOADER_DFU_OTA_MAGIC) || @@ -322,8 +322,7 @@ int main(void) // Save bootloader version to pre-defined register, retrieved by application BOOTLOADER_VERSION_REGISTER = (MK_BOOTLOADER_VERSION); - // This check ensures that the defined fields in the bootloader corresponds with actual - // setting in the chip. + // This check ensures that the defined fields in the bootloader corresponds with actual setting in the chip. APP_ERROR_CHECK_BOOL(*((uint32_t *)NRF_UICR_BOOT_START_ADDRESS) == BOOTLOADER_REGION_START); board_init(); diff --git a/src/usb/uf2/ghostfat.c b/src/usb/uf2/ghostfat.c index 52245d9..4081c16 100644 --- a/src/usb/uf2/ghostfat.c +++ b/src/usb/uf2/ghostfat.c @@ -155,24 +155,6 @@ static uint32_t get_flash_size(void) return flash_sz; } -#if 0 -void uf2_timer(void *p_context) { - UNUSED_PARAMETER(p_context); - if (hadWrite) { - flushFlash(); - s_dfu_settings.bank_0.bank_code = NRF_DFU_BANK_VALID_APP; - int32_t start = SD_MAGIC_OK() ? MAIN_APPLICATION_START_ADDR : MBR_SIZE; - int32_t sz = s_dfu_settings.bank_0.image_size - start; - if (sz > 0) - s_dfu_settings.bank_0.image_size = sz; - nrf_dfu_settings_write(NULL); - } - NVIC_SystemReset(); -} - -void uf2_timer_start(int ms); -#endif - void padded_memcpy(char *dst, const char *src, int len) { for (int i = 0; i < len; ++i) { if (*src) @@ -375,8 +357,6 @@ int write_block(uint32_t block_no, uint8_t *data, bool quiet/*, WriteState *stat // flash_write cause a flush to write previous cached data, this write data is not consumed yet if ( _is_flashing ) return 0; -// bool isSet = false; - if (state && bl->numBlocks) { if (state->numBlocks != bl->numBlocks) { if (bl->numBlocks >= MAX_BLOCKS || state->numBlocks) @@ -396,8 +376,7 @@ int write_block(uint32_t block_no, uint8_t *data, bool quiet/*, WriteState *stat // wait a little bit before resetting, to avoid Windows transmit error // https://github.com/Microsoft/uf2-samd21/issues/11 if (!quiet) { - // uf2_timer_start(30); - // isSet = true; + } // flush last blocks @@ -405,16 +384,14 @@ int write_block(uint32_t block_no, uint8_t *data, bool quiet/*, WriteState *stat // no flashing due to last blocks is the same to contents on the flash already // complete the write - if (!_is_flashing) uf2_write_complete(); + if (!_is_flashing) { + uf2_write_complete(); + } } } NRF_LOG_DEBUG("wr %d=%d (of %d)", state->numWritten, bl->blockNo, bl->numBlocks); } -// if (!isSet && !quiet) { -// // uf2_timer_start(500); -// } - return 512; }