Different issue running DFU under Windows 10 - mfc120.dll is missing #1182

This commit is contained in:
rusefi 2020-03-10 21:09:22 -04:00
parent 70c2f6990f
commit 1f71b51f32
3 changed files with 25 additions and 10 deletions

View File

@ -71,9 +71,16 @@ public class DfuFlasher {
} catch (InterruptedException 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,
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");
}

View File

@ -43,16 +43,24 @@ public class ExecHelper {
}
@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();
String binaryFullName = workingDirPath + File.separator + binaryRelativeName;
if (!new File(binaryFullName).exists()) {
wnd.appendMsg(binaryFullName + " not found :(");
return error;
return error.toString();
}
wnd.appendMsg("Executing " + command);
StringBuffer output = new StringBuffer();
try {
File workingDir = new File(workingDirPath);
Process p = Runtime.getRuntime().exec(command, null, workingDir);
@ -65,7 +73,7 @@ public class ExecHelper {
wnd.appendMsg("WaitError: " + e);
}
wnd.appendMsg("Done!");
return error;
return error.toString();
}
protected static void submitAction(Runnable runnable, String threadName) {

View File

@ -61,7 +61,7 @@ public class FirmwareFlasher {
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,
BINARY_LOCATION + File.separator + command,
OPENOCD_EXE, wnd);
@ -74,12 +74,12 @@ public class FirmwareFlasher {
return;
}
StatusAnimation sa = new StatusAnimation(wnd);
StringBuffer error = executeOpenOCDCommand(getOpenocdCommand() + " -c \"program " +
String error = executeOpenOCDCommand(getOpenocdCommand() + " -c \"program " +
fileName +
" 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 !!!");
} 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!");
sa.stop();
wnd.setStatus(DONE);