Skip to content

Commit

Permalink
probe: stlink: fix broken non-word-aligned 8-bit transfers (#1428)
Browse files Browse the repository at this point in the history
  • Loading branch information
flit authored Jul 5, 2022
1 parent 9724fa9 commit b80193c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pyocd/probe/stlink_probe.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ def read_memory_block8(self, addr: int, size: int, **attrs: Any) -> Sequence[int
res = []

# read leading unaligned bytes
unaligned_count = 4 - (addr & 3)
unaligned_count = addr & 3
if (size > 0) and (unaligned_count > 0):
res += self._link.read_mem8(addr, unaligned_count, self._apsel, csw)
size -= unaligned_count
Expand All @@ -332,7 +332,7 @@ def write_memory_block8(self, addr: int, data: Sequence[int], **attrs: Any) -> N
idx = 0

# write leading unaligned bytes
unaligned_count = 4 - (addr & 3)
unaligned_count = addr & 3
if (size > 0) and (unaligned_count > 0):
self._link.write_mem8(addr, data[:unaligned_count], self._apsel, csw)
size -= unaligned_count
Expand Down

0 comments on commit b80193c

Please sign in to comment.