foboot
foboot copied to clipboard
sw: Fix RAM boot detection
Up until now, docs said that RAM boot happens, when foboot finds 0x17ab0f23
in first 56 bytes of loaded binary.
That wasn't the case, it was checking only first 12 bytes.
for
loop did at most (max_check/4)-1
iterations, which is equal to 15, because max_check
has the value of rx_buffer
size from usb-dev.c, which is 64 bytes.
15 times 4 byte words results in 60 checked bytes, but there was also division by 4 when accessing items of dfu_buffer
, which reduced number of checks to 3 resulting in 12 bytes checked.
I also corrected the docs from 56 checked bytes to 60.