This is an automated email from Gerrit.

Evan Hunter ([email protected]) just uploaded a new patch set to Gerrit, 
which you can find at http://openocd.zylin.com/2869

-- gerrit

commit 7bd1c87637100fdddf8ad36f81f7fbd7b91f4555
Author: Evan Hunter <[email protected]>
Date:   Thu Jul 16 16:04:21 2015 +0100

    Add verify_image_checksum command
    
    Change-Id: I986ba7687cea76f30e37a6bca58aabde18198263
    Signed-off-by: Evan Hunter <[email protected]>

diff --git a/src/target/target.c b/src/target/target.c
index 4ea445f..cf94602 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -3234,7 +3234,7 @@ COMMAND_HANDLER(handle_dump_image_command)
        return retval;
 }
 
-static COMMAND_HELPER(handle_verify_image_command_internal, int verify)
+static COMMAND_HELPER(handle_verify_image_command_internal, int verify, int 
verify_checksum_only)
 {
        uint8_t *buffer;
        size_t buf_cnt;
@@ -3305,7 +3305,12 @@ static 
COMMAND_HELPER(handle_verify_image_command_internal, int verify)
                                free(buffer);
                                break;
                        }
-
+                       if ((checksum != mem_checksum) && (verify_checksum_only 
== 1)) {
+                               LOG_ERROR("checksum mismatch");
+                               free(buffer);
+                               retval = ERROR_FAIL;
+                               goto done;
+                       }
                        if (checksum != mem_checksum) {
                                /* failed crc checksum, fall back to a binary 
compare */
                                uint8_t *data;
@@ -3370,14 +3375,19 @@ done:
        return retval;
 }
 
+COMMAND_HANDLER(handle_verify_image_checksum_command)
+{
+       return CALL_COMMAND_HANDLER(handle_verify_image_command_internal, 1, 1);
+}
+
 COMMAND_HANDLER(handle_verify_image_command)
 {
-       return CALL_COMMAND_HANDLER(handle_verify_image_command_internal, 1);
+       return CALL_COMMAND_HANDLER(handle_verify_image_command_internal, 1, 0);
 }
 
 COMMAND_HANDLER(handle_test_image_command)
 {
-       return CALL_COMMAND_HANDLER(handle_verify_image_command_internal, 0);
+       return CALL_COMMAND_HANDLER(handle_verify_image_command_internal, 0, 0);
 }
 
 static int handle_bp_command_list(struct command_context *cmd_ctx)
@@ -6070,6 +6080,12 @@ static const struct command_registration 
target_exec_command_handlers[] = {
                .usage = "filename address size",
        },
        {
+               .name = "verify_image_checksum",
+               .handler = handle_verify_image_checksum_command,
+               .mode = COMMAND_EXEC,
+               .usage = "filename [offset [type]]",
+       },
+       {
                .name = "verify_image",
                .handler = handle_verify_image_command,
                .mode = COMMAND_EXEC,

-- 

------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to