remote_bitbang: Change sleep commands to Zz to avoid conflict with SWD 91/8191/5
authorJ. Neuschäfer <j.neuschaefer@gmx.net>
Sat, 30 Mar 2024 12:18:43 +0000 (13:18 +0100)
committerAntonio Borneo <borneo.antonio@gmail.com>
Sun, 7 Apr 2024 19:36:29 +0000 (19:36 +0000)
It was noticed that the remote_bitbang protocol has a design issue:
SWD and sleep commands cannot be implemented at the same time, because
they overlap:

 - SWD uses d,e,f,g for setting pin state
 - sleep uses d,D for microsecond and millisecond sleep, respectively

This has previously been reported by Marek Vrbka, but it wasn't fixed.

This commit does the following to resolve the issue:

 - Change the sleep commands to 'Z' for 1 ms, 'z' for 1 µs
 - Document 'D' and 'd' as deprecated aliases
 - Switch the remote_bitbang driver in OpenOCD to 'Z' and 'z'

Unfortunately that's a breaking change, because existing adapter-side
implementations of the protocol will have to implement the new commands
to keep working with future versions of OpenOCD. Fortunately, the
remote sleep commands haven't been part of an OpenOCD release yet,
which should limit the breakage somewhat.

Reported-by: Marek Vrbka <marek.vrbka@codasip.com>
Link: https://sourceforge.net/p/openocd/mailman/openocd-devel/thread/670d28d2-75a1-45ec-afe5-541415701d7a%40codasip.com/
Fixes: e8e09b1b5 ("remote_bitbang: add use_remote_sleep option to send delays to remote")
Change-Id: I04d2790a33bff9d47eb7f69b3275fd9a271625ae
Signed-off-by: J. Neuschäfer <j.neuschaefer@gmx.net>
Reviewed-on: https://review.openocd.org/c/openocd/+/8191
Reviewed-by: David Ryskalczyk <david.rysk@gmail.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
Reviewed-by: Jeremy Herbert <jeremy.006@gmail.com>
doc/manual/jtag/drivers/remote_bitbang.txt
src/jtag/drivers/remote_bitbang.c

index 94d6038163fef77f19f1d722e9abb5ea8db8e427..8316cb0dd53a8fcb5ca0d036d4821b751b1b1e87 100644 (file)
@@ -77,7 +77,12 @@ The read responses are encoded in ASCII as either digit 0 or 1.
 If the use_remote_sleep option is set to 'yes', two additional requests may
 be sent:
 
-       D - Sleep for 1 millisecond
-       d - Sleep for 1 microsecond
+       Z - Sleep for 1 millisecond
+       z - Sleep for 1 microsecond
+
+NOTE: Previously these were specified as 'D' and 'd', which conflicts with the
+"SWD write 0 0" command defined above. Adapters that implement Dd for remote
+sleep must be updated to work with Zz.
+
 
  */
index c97b6b6abeb04ad95edfeab12ddb36b3c233f19e..53d2151fdce7bf57c149ce35a13b6127938eec92 100644 (file)
@@ -230,13 +230,13 @@ static int remote_bitbang_sleep(unsigned int microseconds)
        unsigned int us = microseconds % 1000;
 
        for (unsigned int i = 0; i < ms; i++) {
-               tmp = remote_bitbang_queue('D', NO_FLUSH);
+               tmp = remote_bitbang_queue('Z', NO_FLUSH);
                if (tmp != ERROR_OK)
                        return tmp;
        }
 
        for (unsigned int i = 0; i < us; i++) {
-               tmp = remote_bitbang_queue('d', NO_FLUSH);
+               tmp = remote_bitbang_queue('z', NO_FLUSH);
                if (tmp != ERROR_OK)
                        return tmp;
        }

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)