fix(core/bootloader): correctly handle images smaller than one chunk

pull/2965/head
matejcik 1 year ago committed by matejcik
parent 056ac9d70a
commit dd4d020a76

@ -0,0 +1 @@
Fix installation of images smaller than 128kB.

@ -597,7 +597,10 @@ int process_msg_FirmwareUpload(uint8_t iface_num, uint32_t msg_size,
// request the rest of the first chunk
MSG_SEND_INIT(FirmwareRequest);
chunk_requested = IMAGE_CHUNK_SIZE - read_offset;
uint32_t chunk_limit = (firmware_remaining > IMAGE_CHUNK_SIZE)
? IMAGE_CHUNK_SIZE
: firmware_remaining;
chunk_requested = chunk_limit - read_offset;
MSG_SEND_ASSIGN_REQUIRED_VALUE(offset, read_offset);
MSG_SEND_ASSIGN_REQUIRED_VALUE(length, chunk_requested);
MSG_SEND(FirmwareRequest);

Loading…
Cancel
Save