Skip to content

SWD_Sequence() off-by-one in reference implementation #4

Description

@flit

There is a reported off-by-one error in value returned by the implementation of SWD_Sequence() in SW_DP.c.

Description of patch with fix:

The original SWD sequence has an off-by-one error that causes
all returned values to be shifted. This isn't an issue for most
software, since they tend to use `SWD_Sequence()` as a write-only
primitive and don't care about the return value.

The Black Magic Debug Project uses this for additional checks,
which works around this bug if it's detected. For details, see:
https://github.com/blackmagic-debug/blackmagic/blob/31d30ada18862cdf44ae7ed798325cb7366d05e0/src/platforms/hosted/dap_command.c#L428-L458

This bug is present in reference code from ARM. If this file is
updated to a newer build, please ensure this fix is carried
forward, or ensure the newer version no longer has this bug.

Signed-off-by: Sean Cross <sean@xobs.io>

Link to above: devanlai/dap42@d67619b

(Please note that I have not had time to verify this issue or the patch, or to create a pull request, but I wanted to create an issue so it doesn't get lost.)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions