]> git.sur5r.net Git - openocd/commitdiff
flash/nor/tcl.c: Less verbose output of flash erase_check.
authorUwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de>
Sat, 21 May 2016 13:50:49 +0000 (15:50 +0200)
committerAndreas Fritiofson <andreas.fritiofson@gmail.com>
Sat, 13 Aug 2016 23:38:29 +0000 (00:38 +0100)
Only report non-erased or unknown sectors or if bank is fully erased.

Change-Id: I94f0bc2a0d6529d1ea5f66b284cefd6a2c61fe39
Signed-off-by: Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de>
Reviewed-on: http://openocd.zylin.com/3501
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
src/flash/nor/tcl.c

index 77f19de1736a304ba642b05a53dd5e603ffca1a0..9628684ed6bac7eb680bf977df2aa51d24640b15 100644 (file)
@@ -160,6 +160,7 @@ COMMAND_HANDLER(handle_flash_probe_command)
 
 COMMAND_HANDLER(handle_flash_erase_check_command)
 {
+       bool blank = true;
        if (CMD_ARGC != 1)
                return ERROR_COMMAND_SYNTAX_ERROR;
 
@@ -185,10 +186,11 @@ COMMAND_HANDLER(handle_flash_erase_check_command)
                if (p->sectors[j].is_erased == 0)
                        erase_state = "not erased";
                else if (p->sectors[j].is_erased == 1)
-                       erase_state = "erased";
+                       continue;
                else
                        erase_state = "erase state unknown";
 
+               blank = false;
                command_print(CMD_CTX,
                        "\t#%3i: 0x%8.8" PRIx32 " (0x%" PRIx32 " %" PRIi32 "kB) %s",
                        j,
@@ -198,6 +200,8 @@ COMMAND_HANDLER(handle_flash_erase_check_command)
                        erase_state);
        }
 
+       if (blank)
+               command_print(CMD_CTX, "\tBank is erased");
        return retval;
 }