Skip to content

Commit 12fde52

Browse files
committed
[app] Add command to verify that the load was successful
1 parent ff05e68 commit 12fde52

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

app/main.cc

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,28 @@ int main(int argc, char* argv[]) {
204204
return 0;
205205
};
206206

207+
auto verify_file_cmd = new_flash_command(
208+
"verify-file", "Compare the hash if a file to hash of the flash content at the address.");
209+
verify_file_cmd->add_argument("filename").help("The file path.");
210+
verify_file_cmd->add_argument("--addr")
211+
.help("The address to be loaded")
212+
.default_value(std::size_t{0})
213+
.scan<'x', std::size_t>();
214+
verify_file_cmd->add_argument("--quad")
215+
.help("Use qSPI")
216+
.default_value(false)
217+
.implicit_value(true);
218+
program.add_subparser(*verify_file_cmd);
219+
commands["verify-file"] = [&]() -> int {
220+
auto filename = verify_file_cmd->get<std::string>("filename");
221+
auto addr = verify_file_cmd->get<std::size_t>("--addr");
222+
auto quad = verify_file_cmd->get<bool>("--quad");
223+
auto spih = handle_flash_command(verify_file_cmd);
224+
commands::VerifyFile(flash::Generic(*spih), filename, addr, quad).run();
225+
226+
return 0;
227+
};
228+
207229
if (argc == 1) {
208230
std::cout << program; // This prints the auto-generated help
209231
return 0;

0 commit comments

Comments
 (0)