FwUpdate: fw base prints the full sha256 of the running image (cache vs fresh)

This commit is contained in:
tth committed 2026-11-13 00:37:12 +01:00
1 parent 228e7a129b
commit 5f8788c4b4
1 file changed
+13 -1
+13 -1
View File
@@ -913,8 +913,20 @@ bool FwUpdate::handleCommand(uint32_t sender_timestamp, const char *command, cha
strcpy(reply, "OK");
} else if (strcmp(arg, "bl") == 0)
cmdBootloader(reply);
else if (strcmp(arg, "base") == 0) {
// full sha256 of the running image: the cached value and a fresh one
uint8_t fresh[32];
SHA256 sha;
sha.update((const uint8_t *)APP_START, imageEnd() - APP_START);
sha.finalize(fresh, 32);
const uint8_t *c = baseSha();
int pos = sprintf(reply, "> ");
for (int i = 0; i < 32; i++)
pos += sprintf(reply + pos, "%02x", c[i]);
sprintf(reply + pos, " %s", memcmp(c, fresh, 32) == 0 ? "ok" : "CACHE DIFFERS");
}
else
strcpy(reply, "ERR: fw status|begin|w|missing|verify|apply|abort|bl");
strcpy(reply, "ERR: fw status|begin|w|missing|verify|apply|abort|bl|base");
return true;
}