Different issue running DFU under Windows 10 - mfc120.dll is missing #1182
This commit is contained in:
parent
6e90dc6c1f
commit
b9376b6d9e
|
@ -71,9 +71,16 @@ public class DfuFlasher {
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
throw new IllegalStateException(e);
|
throw new IllegalStateException(e);
|
||||||
}
|
}
|
||||||
ExecHelper.executeCommand(FirmwareFlasher.BINARY_LOCATION,
|
StringBuffer stdout = new StringBuffer();
|
||||||
|
String errorResponse = ExecHelper.executeCommand(FirmwareFlasher.BINARY_LOCATION,
|
||||||
FirmwareFlasher.BINARY_LOCATION + File.separator + DFU_COMMAND,
|
FirmwareFlasher.BINARY_LOCATION + File.separator + DFU_COMMAND,
|
||||||
DFU_BINARY, wnd);
|
DFU_BINARY, wnd, stdout);
|
||||||
|
if (stdout.toString().contains("Verify successful")) {
|
||||||
|
wnd.appendMsg("SUCCESS!");
|
||||||
|
} else {
|
||||||
|
wnd.appendMsg(stdout.length() + " / " + errorResponse.length());
|
||||||
|
wnd.appendMsg("ERROR: does not look like DFU has worked!");
|
||||||
|
}
|
||||||
wnd.appendMsg("Please power cycle device to exit DFU mode");
|
wnd.appendMsg("Please power cycle device to exit DFU mode");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,16 +43,24 @@ public class ExecHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public static StringBuffer executeCommand(String workingDirPath, String command, String binaryRelativeName, StatusConsumer wnd) {
|
public static String executeCommand(String workingDirPath, String command, String binaryRelativeName, StatusConsumer wnd) {
|
||||||
|
return executeCommand(workingDirPath, command, binaryRelativeName, wnd, new StringBuffer());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param output out parameter with stdout content
|
||||||
|
* @return stderr of invoked command
|
||||||
|
*/
|
||||||
|
@NotNull
|
||||||
|
public static String executeCommand(String workingDirPath, String command, String binaryRelativeName, StatusConsumer wnd, StringBuffer output) {
|
||||||
StringBuffer error = new StringBuffer();
|
StringBuffer error = new StringBuffer();
|
||||||
String binaryFullName = workingDirPath + File.separator + binaryRelativeName;
|
String binaryFullName = workingDirPath + File.separator + binaryRelativeName;
|
||||||
if (!new File(binaryFullName).exists()) {
|
if (!new File(binaryFullName).exists()) {
|
||||||
wnd.appendMsg(binaryFullName + " not found :(");
|
wnd.appendMsg(binaryFullName + " not found :(");
|
||||||
return error;
|
return error.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
wnd.appendMsg("Executing " + command);
|
wnd.appendMsg("Executing " + command);
|
||||||
StringBuffer output = new StringBuffer();
|
|
||||||
try {
|
try {
|
||||||
File workingDir = new File(workingDirPath);
|
File workingDir = new File(workingDirPath);
|
||||||
Process p = Runtime.getRuntime().exec(command, null, workingDir);
|
Process p = Runtime.getRuntime().exec(command, null, workingDir);
|
||||||
|
@ -65,7 +73,7 @@ public class ExecHelper {
|
||||||
wnd.appendMsg("WaitError: " + e);
|
wnd.appendMsg("WaitError: " + e);
|
||||||
}
|
}
|
||||||
wnd.appendMsg("Done!");
|
wnd.appendMsg("Done!");
|
||||||
return error;
|
return error.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static void submitAction(Runnable runnable, String threadName) {
|
protected static void submitAction(Runnable runnable, String threadName) {
|
||||||
|
|
|
@ -61,7 +61,7 @@ public class FirmwareFlasher {
|
||||||
return OPENOCD_EXE + " -f openocd/" + cfg;
|
return OPENOCD_EXE + " -f openocd/" + cfg;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static StringBuffer executeOpenOCDCommand(String command, StatusWindow wnd) {
|
protected static String executeOpenOCDCommand(String command, StatusWindow wnd) {
|
||||||
return ExecHelper.executeCommand(BINARY_LOCATION,
|
return ExecHelper.executeCommand(BINARY_LOCATION,
|
||||||
BINARY_LOCATION + File.separator + command,
|
BINARY_LOCATION + File.separator + command,
|
||||||
OPENOCD_EXE, wnd);
|
OPENOCD_EXE, wnd);
|
||||||
|
@ -74,12 +74,12 @@ public class FirmwareFlasher {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
StatusAnimation sa = new StatusAnimation(wnd);
|
StatusAnimation sa = new StatusAnimation(wnd);
|
||||||
StringBuffer error = executeOpenOCDCommand(getOpenocdCommand() + " -c \"program " +
|
String error = executeOpenOCDCommand(getOpenocdCommand() + " -c \"program " +
|
||||||
fileName +
|
fileName +
|
||||||
" verify reset exit 0x08000000\"", wnd);
|
" verify reset exit 0x08000000\"", wnd);
|
||||||
if (error.toString().contains(NO_DRIVER_MESSAGE_TAG)) {
|
if (error.contains(NO_DRIVER_MESSAGE_TAG)) {
|
||||||
wnd.appendMsg(" !!! ERROR: looks like stm32 driver is not installed? The link is above !!!");
|
wnd.appendMsg(" !!! ERROR: looks like stm32 driver is not installed? The link is above !!!");
|
||||||
} else if (error.toString().contains(SUCCESS_MESSAGE_TAG) && !error.toString().toLowerCase().contains(FAILED_MESSAGE_TAG)) {
|
} else if (error.contains(SUCCESS_MESSAGE_TAG) && !error.toLowerCase().contains(FAILED_MESSAGE_TAG)) {
|
||||||
wnd.appendMsg("Flashing looks good!");
|
wnd.appendMsg("Flashing looks good!");
|
||||||
sa.stop();
|
sa.stop();
|
||||||
wnd.setStatus(DONE);
|
wnd.setStatus(DONE);
|
||||||
|
|
Loading…
Reference in New Issue