David Brownell <david-b@pacbell.net>:
authorzwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Mon, 29 Jun 2009 20:03:59 +0000 (20:03 +0000)
committerzwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Mon, 29 Jun 2009 20:03:59 +0000 (20:03 +0000)
Warn when people (or scripts) use numeric identifiers for TAPs,
instead of dotted.name values.  We want this usage to go away,
so that for example adding more TAPs doesn't cause config scripts
to break because some sequence number changed.

It's been deprecated since late 2008, but putting a warning on
this should help us remove it (say, in June 2010) by helping to
phase out old (ab)usage in config scripts.

Other than in various config files, the only code expecting such
a number was the almost unused str9xpec driver.  This code was
changed to use the TAP it was passed, instead of making its own
dubious lookup and ignoring that TAP.

git-svn-id: svn://svn.berlios.de/openocd/trunk@2415 b42882b7-edfa-0310-969c-e2dbd0fdcd60

doc/openocd.texi
src/flash/str9xpec.c
src/jtag/core.c
src/jtag/jtag.h

index fa17cfe44f247a705c075d2f89de896dd67b8fe7..c55ae482b839dea1c90077b5c67e6c91a4e50334 100644 (file)
@@ -2397,8 +2397,9 @@ and underscores are OK; while others (including dots!) are not.
 In older code, JTAG TAPs were numbered from 0..N.
 This feature is still present.
 However its use is highly discouraged, and
-should not be counted upon.
-Update all of your scripts to use TAP names rather than numbers.
+should not be relied on; it will be removed by mid-2010.
+Update all of your scripts to use TAP names rather than numbers,
+by paying attention to the runtime warnings they trigger.
 Using TAP numbers in target configuration scripts prevents
 reusing those scripts on boards with multiple targets.
 @end quotation
index c1021ba026e7d7f9598cab129cd8c623292f28d6..bca3b88fc6ff769b1dc0c3a1131716094c7678fb 100644 (file)
@@ -318,14 +318,14 @@ static int str9xpec_flash_bank_command(struct command_context_s *cmd_ctx, char *
        str9xpec_info = malloc(sizeof(str9xpec_flash_controller_t));
        bank->driver_priv = str9xpec_info;
 
-       /* find out jtag position of flash controller
-        * it is always after the arm966 core */
-
+       /* REVISIT verify that the jtag position of flash controller is
+        * right after *THIS* core, which must be a STR9xx core ...
+        */
        armv4_5 = bank->target->arch_info;
        arm7_9 = armv4_5->arch_info;
        jtag_info = &arm7_9->jtag_info;
 
-       str9xpec_info->tap = jtag_tap_by_position(jtag_info->tap->abs_chain_position - 1);
+       str9xpec_info->tap = bank->target->tap;
        str9xpec_info->isc_enable = 0;
 
        str9xpec_build_block_list(bank);
index 651e654594d94c4f8037f860f6d47825c61dff66..c721b91b038efeca372167aa4b02a0b308e24800 100644 (file)
@@ -162,10 +162,22 @@ void jtag_tap_add(struct jtag_tap_s *t)
        *tap = t;
 }
 
+/* returns a pointer to the n-th device in the scan chain */
+static inline jtag_tap_t *jtag_tap_by_position(unsigned n)
+{
+       jtag_tap_t *t = jtag_all_taps();
+
+       while (t && n-- > 0)
+               t = t->next_tap;
+
+       return t;
+}
+
 jtag_tap_t *jtag_tap_by_string(const char *s)
 {
        /* try by name first */
        jtag_tap_t *t = jtag_all_taps();
+
        while (t)
        {
                if (0 == strcmp(t->dotted_name, s))
@@ -178,7 +190,16 @@ jtag_tap_t *jtag_tap_by_string(const char *s)
        if (parse_uint(s, &n) != ERROR_OK)
                return NULL;
 
-       return jtag_tap_by_position(n);
+       /* FIXME remove this numeric fallback code late June 2010, along
+        * with all info in the User's Guide that TAPs have numeric IDs.
+        * Also update "scan_chain" output to not display the numbers.
+        */
+       t = jtag_tap_by_position(n);
+       if (t)
+               LOG_WARNING("Specify TAP '%s' by name, not number %u",
+                       t->dotted_name, n);
+
+       return t;
 }
 
 jtag_tap_t *jtag_tap_by_jim_obj(Jim_Interp *interp, Jim_Obj *o)
@@ -192,17 +213,6 @@ jtag_tap_t *jtag_tap_by_jim_obj(Jim_Interp *interp, Jim_Obj *o)
        return t;
 }
 
-/* returns a pointer to the n-th device in the scan chain */
-jtag_tap_t *jtag_tap_by_position(unsigned n)
-{
-       jtag_tap_t *t = jtag_all_taps();
-
-       while (t && n-- > 0)
-               t = t->next_tap;
-
-       return t;
-}
-
 jtag_tap_t* jtag_tap_next_enabled(jtag_tap_t* p)
 {
        p = p ? p->next_tap : jtag_all_taps();
index 1564ca650c2bdab372170291e8a430337c7f0ba3..7cdaa51ff9971c3bebd0b2aff9e8293325429b49 100644 (file)
@@ -185,7 +185,6 @@ extern jtag_tap_t* jtag_all_taps(void);
 extern const char *jtag_tap_name(const jtag_tap_t *tap);
 extern jtag_tap_t* jtag_tap_by_string(const char* dotted_name);
 extern jtag_tap_t* jtag_tap_by_jim_obj(Jim_Interp* interp, Jim_Obj* obj);
-extern jtag_tap_t* jtag_tap_by_position(unsigned abs_position);
 extern jtag_tap_t* jtag_tap_next_enabled(jtag_tap_t* p);
 extern unsigned jtag_tap_count_enabled(void);
 extern unsigned jtag_tap_count(void);

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)