Compare commits

...

2 Commits

Author SHA1 Message Date
Conor Patrick
0f8ddbf982 fix const qualifer warnings 2019-10-08 14:32:21 -04:00
Conor Patrick
b2b9b5e0f9 remove atomic counter from bootloader to save space 2019-10-08 14:26:33 -04:00
2 changed files with 11 additions and 3 deletions

View File

@ -122,13 +122,13 @@ bool is_firmware_version_newer_or_equal()
new_version->major, new_version->minor, new_version->patch, new_version->reserved
);
const bool allowed = is_newer(new_version, &current_firmware_version) || current_firmware_version.raw == 0xFFFFFFFF;
const bool allowed = is_newer((const version_t *)new_version, (const version_t *)&current_firmware_version) || current_firmware_version.raw == 0xFFFFFFFF;
if (allowed){
printf1(TAG_BOOT, "Update allowed, setting new firmware version as current.\r\n");
// current_firmware_version.raw = new_version.raw;
uint8_t page[PAGE_SIZE];
memmove(page, (uint8_t*)BOOT_VERSION_ADDR, PAGE_SIZE);
memmove(page, new_version, 4);
memmove(page, (version_t *)new_version, 4);
printf1(TAG_BOOT, "Writing\r\n");
flash_erase_page(BOOT_VERSION_PAGE);
flash_write(BOOT_VERSION_ADDR, page, PAGE_SIZE);
@ -316,3 +316,10 @@ void bootloader_heartbeat()
led_rgb(((val * g)<<8) | ((val*r) << 16) | (val*b));
}
uint32_t ctap_atomic_count(uint32_t amount)
{
static uint32_t count = 1000;
count += (amount + 1);
return count;
}

View File

@ -410,6 +410,7 @@ void authenticator_write_state(AuthenticatorState * a, int backup)
}
}
#if !defined(IS_BOOTLOADER)
uint32_t ctap_atomic_count(uint32_t amount)
{
int offset = 0;
@ -501,7 +502,7 @@ uint32_t ctap_atomic_count(uint32_t amount)
return lastc;
}
#endif
void device_manage(void)