forked from PAWPAW-Mirror/lib_xua
Add Windows support to xmosdfu
Needs WinUSB drivers installed on interface 0.
This commit is contained in:
28
lib_xua/host/xmosdfu/Makefile.Win32
Normal file
28
lib_xua/host/xmosdfu/Makefile.Win32
Normal 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
|
||||||
BIN
lib_xua/host/xmosdfu/libusb-1.0.dll
Normal file
BIN
lib_xua/host/xmosdfu/libusb-1.0.dll
Normal file
Binary file not shown.
BIN
lib_xua/host/xmosdfu/libusb/Win32/libusb-1.0.lib
Normal file
BIN
lib_xua/host/xmosdfu/libusb/Win32/libusb-1.0.lib
Normal file
Binary file not shown.
2039
lib_xua/host/xmosdfu/libusb/Win32/libusb.h
Normal file
2039
lib_xua/host/xmosdfu/libusb/Win32/libusb.h
Normal file
File diff suppressed because it is too large
Load Diff
@@ -2,6 +2,16 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include <windows.h>
|
||||||
|
#else
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
void Sleep(unsigned milliseconds) {
|
||||||
|
usleep(milliseconds * 1000);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "libusb.h"
|
#include "libusb.h"
|
||||||
|
|
||||||
/* the device's vendor and product id */
|
/* 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");
|
printf("Waiting for device to restart and enter DFU mode...\n");
|
||||||
|
|
||||||
// Wait for device to enter dfu mode and restart
|
// Wait for device to enter dfu mode and restart
|
||||||
system("sleep 20");
|
Sleep(20 * 1000);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// NOW IN DFU APPLICATION MODE
|
// NOW IN DFU APPLICATION MODE
|
||||||
@@ -556,7 +566,7 @@ int main(int argc, char **argv)
|
|||||||
printf("... Reverting device to factory image\n");
|
printf("... Reverting device to factory image\n");
|
||||||
xmos_dfu_revertfactory();
|
xmos_dfu_revertfactory();
|
||||||
// Give device time to revert firmware
|
// Give device time to revert firmware
|
||||||
system("sleep 2");
|
Sleep(2 * 1000);
|
||||||
xmos_dfu_resetfromdfu(XMOS_DFU_IF);
|
xmos_dfu_resetfromdfu(XMOS_DFU_IF);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user