Compare commits
2 Commits
master
...
redue_boot
Author | SHA1 | Date | |
---|---|---|---|
![]() |
0f8ddbf982 | ||
![]() |
b2b9b5e0f9 |
@ -122,13 +122,13 @@ bool is_firmware_version_newer_or_equal()
|
|||||||
new_version->major, new_version->minor, new_version->patch, new_version->reserved
|
new_version->major, new_version->minor, new_version->patch, new_version->reserved
|
||||||
);
|
);
|
||||||
|
|
||||||
const bool allowed = is_newer(new_version, ¤t_firmware_version) || current_firmware_version.raw == 0xFFFFFFFF;
|
const bool allowed = is_newer((const version_t *)new_version, (const version_t *)¤t_firmware_version) || current_firmware_version.raw == 0xFFFFFFFF;
|
||||||
if (allowed){
|
if (allowed){
|
||||||
printf1(TAG_BOOT, "Update allowed, setting new firmware version as current.\r\n");
|
printf1(TAG_BOOT, "Update allowed, setting new firmware version as current.\r\n");
|
||||||
// current_firmware_version.raw = new_version.raw;
|
// current_firmware_version.raw = new_version.raw;
|
||||||
uint8_t page[PAGE_SIZE];
|
uint8_t page[PAGE_SIZE];
|
||||||
memmove(page, (uint8_t*)BOOT_VERSION_ADDR, 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");
|
printf1(TAG_BOOT, "Writing\r\n");
|
||||||
flash_erase_page(BOOT_VERSION_PAGE);
|
flash_erase_page(BOOT_VERSION_PAGE);
|
||||||
flash_write(BOOT_VERSION_ADDR, page, PAGE_SIZE);
|
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));
|
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;
|
||||||
|
}
|
@ -410,6 +410,7 @@ void authenticator_write_state(AuthenticatorState * a, int backup)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !defined(IS_BOOTLOADER)
|
||||||
uint32_t ctap_atomic_count(uint32_t amount)
|
uint32_t ctap_atomic_count(uint32_t amount)
|
||||||
{
|
{
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
@ -501,7 +502,7 @@ uint32_t ctap_atomic_count(uint32_t amount)
|
|||||||
|
|
||||||
return lastc;
|
return lastc;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
void device_manage(void)
|
void device_manage(void)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user