Add Windows support to xmosdfu

Needs WinUSB drivers installed on interface 0.
This commit is contained in:
Oscar Bailey
2018-12-12 15:37:31 +00:00
parent 21c18c0599
commit 4ff0713e59
5 changed files with 2079 additions and 2 deletions

View File

@@ -0,0 +1,28 @@
# Build tested with Visual Studio 2017 command prompt
#
# Run: nmake /f Makefile.Win32
COMMON_FLAGS = \
/D BECLEAR_HOST=1 \
/I libusb\Win32 \
/nologo \
/W4 \
/WX- \
/O2 \
/EHa \
/D _CRT_SECURE_NO_WARNINGS \
xmosdfu.cpp \
all: xmosdfu
xmosdfu:
if not exist bin mkdir bin
CL.exe \
$(COMMON_FLAGS) \
/Fe"bin\xmosdfu.exe" \
/link "libusb\Win32\libusb-1.0.lib""
copy libusb-1.0.dll bin
del *.obj
clean:
rmdir /s /q bin

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@@ -2,6 +2,16 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef _WIN32
#include <windows.h>
#else
#include <unistd.h>
void Sleep(unsigned milliseconds) {
usleep(milliseconds * 1000);
}
#endif
#include "libusb.h"
/* the device's vendor and product id */
@@ -501,7 +511,7 @@ int main(int argc, char **argv)
printf("Waiting for device to restart and enter DFU mode...\n");
// Wait for device to enter dfu mode and restart
system("sleep 20");
Sleep(20 * 1000);
#endif
// NOW IN DFU APPLICATION MODE
@@ -556,7 +566,7 @@ int main(int argc, char **argv)
printf("... Reverting device to factory image\n");
xmos_dfu_revertfactory();
// Give device time to revert firmware
system("sleep 2");
Sleep(2 * 1000);
xmos_dfu_resetfromdfu(XMOS_DFU_IF);
}
else