Skip to content

Commit 2c0b9da

Browse files
committed
Improve error reporting for OpenOCD
1 parent 6b9decf commit 2c0b9da

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

rsc/ErrorMsg.txt

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ ErrorNr;Description;Solution
44
11;file not found;
55

66
100;no target connection (build project first)
7+
101;error message file could not be loaded
78

89
200;wrong number format;
910
201;missing right parenthesis;
@@ -119,6 +120,8 @@ ErrorNr;Description;Solution
119120
813;BDI packet wrong, try to reset BDI;
120121
814;ready bit not set, try to reset BDI;
121122
815;Connection to target not possible! (port seems to be busy);
123+
816;Connection to target not possible! (Cannot connect to OpenOCD server);
124+
817;Connection to target not possible! (Target not answering);
122125
820;no target image file found;
123126
821;no pl image file found;
124127
822;no bin file found;

src/org/deepjava/eclipse/launcher/DeepLaunchDelegate.java

-2
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,6 @@ public final void launch(ILaunchConfiguration configuration, String mode, ILaunc
108108
TargetConnection tc = (TargetConnection) m.invoke(cls);
109109
Launcher.setTargetConnection(tc);
110110
Launcher.openTargetConnection();
111-
long time = System.currentTimeMillis();
112-
while (System.currentTimeMillis() - time < 100);
113111
if (ErrorReporter.reporter.nofErrors == 0) {
114112
Launcher.downloadTargetImage();
115113
Launcher.startTarget(Launcher.getResetAddr());

src/org/deepjava/launcher/Launcher.java

+5-2
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ public static void downloadTargetImage() {
483483
} else if (e.getMessage().equals("target not connected")) {
484484
reporter.error(800);
485485
} else {
486-
reporter.error(801);
486+
reporter.error(801, e.getMessage());
487487
}
488488
}
489489
}
@@ -626,7 +626,10 @@ public static void openTargetConnection() {
626626
try {
627627
if (!tc.isConnected()) tc.openConnection();
628628
} catch (TargetConnectionException e) {
629-
reporter.error(815);
629+
if (dbg) vrb.println(e.getMessage());
630+
if (e.getMessage().equals("Cannot connect to OpenOCD server")) reporter.error(816);
631+
if (e.getMessage().equals("Target not answering")) reporter.error(817);
632+
else reporter.error(815, e.getMessage());
630633
}
631634
} else reporter.error(803);
632635
}

src/org/deepjava/launcher/TestLauncher.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232

3333
/**
3434
* Launcher for tests only!
35+
* When using OpenOCD -> starts OpenOCD manually!
3536
*/
3637
@SuppressWarnings("unused")
3738
public class TestLauncher {
@@ -54,8 +55,6 @@ public static void main(String[] args) {
5455
TargetConnection tc = (TargetConnection) m.invoke(cls);
5556
Launcher.setTargetConnection(tc);
5657
Launcher.openTargetConnection();
57-
long time = System.currentTimeMillis();
58-
while (System.currentTimeMillis() - time < 100);
5958
Launcher.downloadTargetImage();
6059
Launcher.startTarget(Launcher.getResetAddr());
6160
// Launcher.closeTargetConnection();

0 commit comments

Comments
 (0)