fix: 'mem load' - wrong offset when uploading

This commit is contained in:
iceman1001 2018-05-03 16:10:38 +02:00
commit e50fef6607
3 changed files with 12 additions and 13 deletions

View file

@ -124,14 +124,14 @@ int CmdFlashMemLoad(const char *Cmd){
//Send to device
uint32_t bytes_sent = 0;
uint32_t bytes_remaining = bytes_read;
uint32_t bytes_remaining = bytes_read;
while (bytes_remaining > 0){
uint32_t bytes_in_packet = MIN(FLASH_MEM_BLOCK_SIZE, bytes_remaining);
UsbCommand c = {CMD_WRITE_FLASH_MEM, {start_index + bytes_sent, bytes_in_packet, 0}};
memcpy(c.d.asBytes, dump + start_index + bytes_sent, bytes_in_packet);
memcpy(c.d.asBytes, dump + bytes_sent, bytes_in_packet);
clearCommandBuffer();
SendCommand(&c);