Upgrade: Download needs to set the address.

This commit is contained in:
Uwe Bonnes 2019-05-26 15:39:32 +02:00
parent 1c5ee1f11f
commit 8f6b266c54
3 changed files with 8 additions and 3 deletions

View File

@ -157,7 +157,7 @@ retry:
printf("Progress: %d%%\r", (offset*100)/bindatalen);
fflush(stdout);
assert(stm32_mem_erase(handle, iface, LOAD_ADDRESS + offset) == 0);
stm32_mem_write(handle, iface, (void*)&bindata[offset], 1024);
stm32_mem_write(handle, iface, (void*)&bindata[offset], 1024, LOAD_ADDRESS + offset);
}
stm32_mem_manifest(handle, iface);

View File

@ -69,8 +69,13 @@ int stm32_mem_erase(usb_dev_handle *dev, uint16_t iface, uint32_t addr)
return stm32_download(dev, iface, 0, request, sizeof(request));
}
int stm32_mem_write(usb_dev_handle *dev, uint16_t iface, void *data, int size)
int stm32_mem_write(usb_dev_handle *dev, uint16_t iface, void *data, int size, uint32_t addr)
{
uint8_t request[5];
request[0] = STM32_CMD_SETADDRESSPOINTER;
memcpy(request+1, &addr, sizeof(addr));
stm32_download(dev, iface, 0, request, sizeof(request));
return stm32_download(dev, iface, 2, data, size);
}

View File

@ -27,7 +27,7 @@
#endif
int stm32_mem_erase(usb_dev_handle *dev, uint16_t iface, uint32_t addr);
int stm32_mem_write(usb_dev_handle *dev, uint16_t iface, void *data, int size);
int stm32_mem_write(usb_dev_handle *dev, uint16_t iface, void *data, int size, uint32_t addr);
int stm32_mem_manifest(usb_dev_handle *dev, uint16_t iface);
#endif