Skip to content

Commit 08e484f

Browse files
michalek-nonvlsianpu
authored andcommitted
[nrf noup] boot: boot_serial: fix WAIT_FOR_DFU
loop is spinning to fast for ms measurements Signed-off-by: Mateusz Michalek <mateusz.michalek@nordicsemi.no>
1 parent ec9a064 commit 08e484f

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

boot/boot_serial/src/boot_serial.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1528,7 +1528,10 @@ boot_serial_read_console(const struct boot_uart_funcs *f,int timeout_in_ms)
15281528
max_input = sizeof(in_buf);
15291529

15301530
off = 0;
1531-
while (timeout_in_ms > 0 || bs_entry) {
1531+
#ifdef MCUBOOT_SERIAL_WAIT_FOR_DFU
1532+
uint32_t start = k_uptime_get_32();
1533+
#endif
1534+
while (timeout_in_ms > elapsed_in_ms || bs_entry) {
15321535
/*
15331536
* Don't enter CPU idle state here if timeout based serial recovery is
15341537
* used as otherwise the boot process hangs forever, waiting for input
@@ -1541,9 +1544,6 @@ boot_serial_read_console(const struct boot_uart_funcs *f,int timeout_in_ms)
15411544
}
15421545
#endif
15431546
MCUBOOT_WATCHDOG_FEED();
1544-
#ifdef MCUBOOT_SERIAL_WAIT_FOR_DFU
1545-
uint32_t start = k_uptime_get_32();
1546-
#endif
15471547
rc = f->read(in_buf + off, sizeof(in_buf) - off, &full_line);
15481548
if (rc <= 0 && !full_line) {
15491549
#ifndef MCUBOOT_SERIAL_WAIT_FOR_DFU
@@ -1580,7 +1580,6 @@ boot_serial_read_console(const struct boot_uart_funcs *f,int timeout_in_ms)
15801580
#ifdef MCUBOOT_SERIAL_WAIT_FOR_DFU
15811581
elapsed_in_ms = (k_uptime_get_32() - start);
15821582
#endif
1583-
timeout_in_ms -= elapsed_in_ms;
15841583
}
15851584
}
15861585

0 commit comments

Comments
 (0)