Updater: Fix updating code

This commit is contained in:
Mario Hüttel 2021-04-08 22:03:38 +02:00
parent 1a76a69b6d
commit 8309cef5ec
1 changed files with 6 additions and 1 deletions

View File

@ -108,7 +108,7 @@ int write_flash_from_buffer(const char *buffer, uint32_t len, uint32_t addr)
}
/* Verify the write */
for (i = 0; i < len; i++) {
for (i = 0; i < len; i++, verify_ptr++) {
if (*verify_ptr != buffer[i]) {
uart_send_string("Error verifying written data!\r\n");
return -2;
@ -238,6 +238,11 @@ int ram_code_main(void)
uart_send_string(" checked successfully.\r\n");
uart_send_string("Starting updater...\r\n");
/* disable the ART caches */
FLASH->ACR &= ~FLASH_ACR_DCEN;
FLASH->ACR &= ~FLASH_ACR_ICEN;
FLASH->ACR |= FLASH_ACR_DCRST | FLASH_ACR_ICRST;
do {
uart_send_string("Erasing chip...");
flash_writer_perform_mass_erase();