fixed bug in bootloader autoboot timer

This commit is contained in:
stnolting 2020-07-21 21:36:22 +02:00
parent b0d0287773
commit 90c698c76a
2 changed files with 927 additions and 922 deletions

File diff suppressed because it is too large Load diff

View file

@ -242,7 +242,8 @@ int main(void) {
// ------------------------------------------------
neorv32_uart_print("\n\nAutoboot in "xstr(AUTOBOOT_TIMEOUT)"s. Press key to abort.\n");
uint64_t timeout_time = (uint64_t)(AUTOBOOT_TIMEOUT * clock_speed);
uint64_t timeout_time = neorv32_mtime_get_time() + (uint64_t)(AUTOBOOT_TIMEOUT * clock_speed);
while ((UART_DATA & (1 << UART_DATA_AVAIL)) == 0) { // wait for any key to be pressed or timeout
if (neorv32_mtime_get_time() >= timeout_time) { // timeout? start auto boot sequence