target: "dap info" command cosmetic output changes 18/1518/7
authorBrad Riensche <brad.riensche@gmail.com>
Mon, 22 Jul 2013 15:22:08 +0000 (10:22 -0500)
committerAndreas Fritiofson <andreas.fritiofson@gmail.com>
Fri, 7 Mar 2014 18:50:35 +0000 (18:50 +0000)
This makes the listing easier to read, imho. The tab indentation
technique causes the base address to precess as the parser proceeds
through the subtables, and can easily wrap.

Change-Id: Iea5e678255e6314a9d532e4b222a2572b5394390
Signed-off-by: Brad Riensche <brad.riensche@gmail.com>
Reviewed-on: http://openocd.zylin.com/1518
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
src/target/arm_adi_v5.c

index d4faf16bb955f96d10cebf714046a836d883339c..1f4ade09715f7104222129dd100c791ea618e7c5 100644 (file)
@@ -1031,17 +1031,15 @@ static int dap_rom_display(struct command_context *cmd_ctx,
        int retval;
        uint32_t cid0, cid1, cid2, cid3, memtype, romentry;
        uint16_t entry_offset;
        int retval;
        uint32_t cid0, cid1, cid2, cid3, memtype, romentry;
        uint16_t entry_offset;
-       int i;
-       char tabs[16 + 1];
+       char tabs[7] = "";
 
        if (depth > 16) {
                command_print(cmd_ctx, "\tTables too deep");
                return ERROR_FAIL;
        }
 
 
        if (depth > 16) {
                command_print(cmd_ctx, "\tTables too deep");
                return ERROR_FAIL;
        }
 
-       for (i = 0; i < depth; ++i)
-               tabs[i] = '\t';
-       tabs[i] = '\0';
+       if (depth)
+               snprintf(tabs, sizeof(tabs), "[L%02d] ", depth);
 
        /* bit 16 of apid indicates a memory access port */
        if (dbgbase & 0x02)
 
        /* bit 16 of apid indicates a memory access port */
        if (dbgbase & 0x02)
@@ -1140,12 +1138,12 @@ static int dap_rom_display(struct command_context *cmd_ctx,
                                return retval;
                        c_cid3 &= 0xff;
 
                                return retval;
                        c_cid3 &= 0xff;
 
-                       command_print(cmd_ctx, "\t%s\tComponent base address 0x%" PRIx32 ", "
-                                     "start address 0x%" PRIx32, tabs, component_base,
+                       command_print(cmd_ctx, "\t\tComponent base address 0x%" PRIx32 ", "
+                                     "start address 0x%" PRIx32, component_base,
                                      /* component may take multiple 4K pages */
                                      (uint32_t)(component_base - 0x1000*(c_pid4 >> 4)));
                                      /* component may take multiple 4K pages */
                                      (uint32_t)(component_base - 0x1000*(c_pid4 >> 4)));
-                       command_print(cmd_ctx, "\t%s\tComponent class is 0x%x, %s",
-                                       tabs, (c_cid1 >> 4) & 0xf,
+                       command_print(cmd_ctx, "\t\tComponent class is 0x%x, %s",
+                                       (c_cid1 >> 4) & 0xf,
                                        /* See ARM IHI 0029B Table 3-3 */
                                        class_description[(c_cid1 >> 4) & 0xf]);
 
                                        /* See ARM IHI 0029B Table 3-3 */
                                        class_description[(c_cid1 >> 4) & 0xf]);
 
@@ -1256,26 +1254,25 @@ static int dap_rom_display(struct command_context *cmd_ctx,
                                        }
                                        break;
                                }
                                        }
                                        break;
                                }
-                               command_print(cmd_ctx, "\t%s\tType is 0x%02x, %s, %s",
-                                               tabs, devtype & 0xff,
+                               command_print(cmd_ctx, "\t\tType is 0x%02x, %s, %s",
+                                               devtype & 0xff,
                                                major, subtype);
                                /* REVISIT also show 0xfc8 DevId */
                        }
 
                        if (!is_dap_cid_ok(cid3, cid2, cid1, cid0))
                                command_print(cmd_ctx,
                                                major, subtype);
                                /* REVISIT also show 0xfc8 DevId */
                        }
 
                        if (!is_dap_cid_ok(cid3, cid2, cid1, cid0))
                                command_print(cmd_ctx,
-                                               "\t%s\tCID3 0%02x"
+                                               "\t\tCID3 0%02x"
                                                ", CID2 0%02x"
                                                ", CID1 0%02x"
                                                ", CID0 0%02x",
                                                ", CID2 0%02x"
                                                ", CID1 0%02x"
                                                ", CID0 0%02x",
-                                               tabs,
                                                (int)c_cid3,
                                                (int)c_cid2,
                                                (int)c_cid1,
                                                (int)c_cid0);
                        command_print(cmd_ctx,
                                                (int)c_cid3,
                                                (int)c_cid2,
                                                (int)c_cid1,
                                                (int)c_cid0);
                        command_print(cmd_ctx,
-                               "\t%s\tPeripheral ID[4..0] = hex "
-                               "%02x %02x %02x %02x %02x", tabs,
+                               "\t\tPeripheral ID[4..0] = hex "
+                               "%02x %02x %02x %02x %02x",
                                (int)c_pid4, (int)c_pid3, (int)c_pid2,
                                (int)c_pid1, (int)c_pid0);
 
                                (int)c_pid4, (int)c_pid3, (int)c_pid2,
                                (int)c_pid1, (int)c_pid0);
 
@@ -1386,8 +1383,8 @@ static int dap_rom_display(struct command_context *cmd_ctx,
                                full = "";
                                break;
                        }
                                full = "";
                                break;
                        }
-                       command_print(cmd_ctx, "\t%s\tPart is %s %s",
-                                       tabs, type, full);
+                       command_print(cmd_ctx, "\t\tPart is %s %s",
+                                       type, full);
 
                        /* ROM Table? */
                        if (((c_cid1 >> 4) & 0x0f) == 1) {
 
                        /* ROM Table? */
                        if (((c_cid1 >> 4) & 0x0f) == 1) {
@@ -1397,7 +1394,7 @@ static int dap_rom_display(struct command_context *cmd_ctx,
                        }
                } else {
                        if (romentry)
                        }
                } else {
                        if (romentry)
-                               command_print(cmd_ctx, "\t%s\tComponent not present", tabs);
+                               command_print(cmd_ctx, "\t\tComponent not present");
                        else
                                break;
                }
                        else
                                break;
                }

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)