+ verifies the base64 encoded executable stored in flash
This commit is contained in:
parent
74ccc5a732
commit
a4bc10edfa
1 changed files with 25 additions and 1 deletions
|
@ -112,15 +112,17 @@ YIELD_THEN_WAIT_UNTIL(msg.equals("continue"));
|
|||
log.log("Uploading hello-world.b64:\n");
|
||||
cmdarr = "sh -c xxx".split(" ");
|
||||
cmdarr[2] = "../../tools/base64-encode < hello-world.ce";
|
||||
sb = new java.lang.StringBuilder();
|
||||
process = new java.lang.Runtime.getRuntime().exec(cmdarr, null, helloworld.getParentFile());
|
||||
stdIn = new java.io.BufferedReader(new java.io.InputStreamReader(process.getInputStream()));
|
||||
while ((line = stdIn.readLine()) != null) {
|
||||
write(mote, line + "\n");
|
||||
sb.append(line);
|
||||
|
||||
YIELD();
|
||||
|
||||
if (msg.startsWith(line)) {
|
||||
log.log("UPLOADED: " + line + "\n");
|
||||
log.log("UPLOADED: " + msg + "\n");
|
||||
} else {
|
||||
log.log("Serial port upload failed:\n" + line + "\n" + msg + "\n");
|
||||
log.testFailed();
|
||||
|
@ -133,6 +135,28 @@ write(mote, "~K\n");
|
|||
GENERATE_MSG(500, "continue");
|
||||
YIELD_THEN_WAIT_UNTIL(msg.equals("continue"));
|
||||
|
||||
log.log("Reading and verifying hello-world.b64 from flash\n");
|
||||
write(mote, "read hello-world.b64");
|
||||
YIELD();
|
||||
while (!msg.contains("Contiki>")) {
|
||||
if (!sb.toString().startsWith(msg.trim())) {
|
||||
log.log("Verify failed: '" + msg + "' does not start '" + sb.toString() + "'\n");
|
||||
log.testFailed();
|
||||
} else {
|
||||
log.log("VERIFIED: " + msg + "\n");
|
||||
sb.replace(0, msg.length()-1, new String(""));
|
||||
}
|
||||
|
||||
YIELD();
|
||||
}
|
||||
if (sb.length()>0) {
|
||||
log.log("Verify failed: remaining buffer: " + sb);
|
||||
log.testFailed();
|
||||
}
|
||||
GENERATE_MSG(500, "continue");
|
||||
YIELD_THEN_WAIT_UNTIL(msg.equals("continue"));
|
||||
|
||||
|
||||
log.log("Converting base64 to binary hello-world.ce\n");
|
||||
write(mote, "read hello-world.b64 | dec64 | write hello-world.ce | null");
|
||||
GENERATE_MSG(3000, "continue");
|
||||
|
|
Loading…
Reference in a new issue