53 Commits

Author SHA1 Message Date
Jason Kotzin
c121da06c8 Merge commit 'a0c77e216d268f2e1caa3442db02cf21f36fad91' into sam-update 2022-08-10 22:20:36 -07:00
Jason Kotzin
542c157955 Merge commit 'd9ef3ff14711457eaf0ea7152067c95b4bb45c03' into sam-update 2022-08-10 22:19:41 -07:00
Jason Kotzin
d4dd288426 Merge commit 'bba2bfdcf49695cb9b88482c7ed3db69db58b082' into sam-update 2022-08-10 22:18:39 -07:00
Jason Kotzin
7bd7c3d0f5 Merge commit '8fb3b7b1a8d1cb2ac8b54204f452106939eb2ab7' into sam-update
# Conflicts:
#	src/target/adiv5_swdp.c
2022-08-10 22:17:33 -07:00
Jason Kotzin
ca1c0acb27 Merge commit '23534ab174ffadd63bbdb2e0626770753eff7c3b' into sam-update 2022-08-10 22:05:07 -07:00
Jason Kotzin
c91322e38e fix stack compile warning 2022-08-10 20:37:14 -07:00
Jason Kotzin
85fc728293 Merge commit '59dc2255687436d7a21458615e4eb2e563ca64c1' into sam-update 2022-08-10 20:32:50 -07:00
Jason Kotzin
9dc79becc2 Merge commit '35687018eb634ea329609c86d9ed476bb79c0e91' into sam-update
# Conflicts:
#	src/platforms/common/cdcacm.c
#	src/target/adiv5_swdp.c
2022-08-10 20:19:55 -07:00
Jason Kotzin
a2f6776bf8 Merge commit '8089e05a0018a040251ec5de145bccca0977bf78' into sam-update 2022-08-10 20:13:59 -07:00
Jason Kotzin
def176b240 Merge commit '8da2dee0c41eead0c2b4f466fbc889ef413cf7e9' into sam-update 2022-08-10 20:08:13 -07:00
Jason Kotzin
d5a8717bb0 stack bug fix 2022-08-10 20:08:05 -07:00
dragonmux
a0c77e216d adiv5_swdp: Changed the low-level access code to retry till timeout (partial revert of 61efe26)
Proper initialisation of the ack value also fixes a potential use-before-init UB
2022-03-29 15:33:23 -07:00
dragonmux
d9ef3ff147 adiv5_swdp: Formatting consistency cleanup 2022-03-29 15:33:23 -07:00
dragonmux
bba2bfdcf4 advi5: Raise the access timeouts as 20ms is too low in some cases 2022-03-29 15:33:23 -07:00
mean
8fb3b7b1a8 reuse exception to avoid using the stack 2022-03-22 10:10:33 -04:00
dragonmux
361dc9c234 Revert "adiv5_swdp_scan: If SWD scan fails, try a JTAG scan."
This reverts commit 3df692ecb247fdc7c62f3c3dc622030ad12817e6.
2022-03-14 21:37:44 -07:00
Uwe Bonnes
73b4612ec7 adiv5_swdp: Initialize a volatile variable
GCC did not warn about possibly missing initialization and so for gdb target
was not recognized.
2021-11-20 22:38:35 +01:00
Uwe Bonnes
5cb501049a adiv5_swdp/scan: Handle parity errors, seen with NRF52 with SYSTEMOFF #381/#949 2021-11-18 22:59:17 +01:00
Uwe Bonnes
a1d4649795 SWD: Use dp_low_write to allow multidrop scan. 2021-10-31 12:55:41 +01:00
Uwe Bonnes
4f36c1ddf8 Remove dp_low_read() and use exception protected dp_read() 2021-10-31 12:55:41 +01:00
Uwe Bonnes
761e0230d4 cmsis-dap: Print messages when transfers fail.
Expect signal integrity errors when using jumper cables. Often probes switch
the SWJ GPIO with highest speed, resulting in possible reflections. Additional
ground wires may help. If there is isolation between probe and targets,
additional ground wires are a must or ground shift will wrack the transfer!
2021-10-31 12:55:41 +01:00
Uwe Bonnes
5dafc0828c SWD: Remove excessive line resets. 2021-10-31 11:12:46 +01:00
Uwe Bonnes
863a41daac adiv5_swdp: Initialize initial_dp with the definition 2021-08-15 16:43:29 +02:00
Uwe Bonnes
3df692ecb2 adiv5_swdp_scan: If SWD scan fails, try a JTAG scan. 2021-08-15 16:43:29 +02:00
Uwe Bonnes
0c63903071 adiv5: Recover from bad AP access.
E.g. AP1 on a STM32WLE5 points to a ROM table, but access to the ROM table
via AP1 hangs forever.
- Substantial reduce timeout when wait for a response. Valid access should
  succeed fast.
- Abort AP access to free DP for other accesses
- Don't throw exception, only set dp->fault
- React on higher level
2021-07-15 15:06:54 +02:00
Björn Mellström
711a87f7ba Fix some warnings when compiling with -Wshadow
There are still a few more places that would need to be corrected
before -Wshadow could be added by default.
2021-06-03 12:55:28 +02:00
Uwe Bonnes
f9414d5826 cmsis-dap: Handle ADI DP22 devices on probes not multidrop capable. 2021-04-26 18:18:18 +02:00
Uwe Bonnes
61efe26348 swdp_scan: Break infinite loop after Dormant->SWD transition. 2021-04-21 21:50:38 +02:00
Uwe Bonnes
ea92c8b8c8 cmsis-dap: Allow to use adiv5_swdp_scan. 2021-04-21 21:50:38 +02:00
Uwe Bonnes
23f942ac8c Raspberry RP2040: Recognize. No flash handling yet. 2021-04-21 21:50:35 +02:00
Uwe Bonnes
04d1c9805b swd: Remove swd_proc and swdptap.h. 2021-04-21 21:50:04 +02:00
Uwe Bonnes
b6fbf86743 Extend ADIv5_DP_t for low level routines needed for multi-drop.
Will replace swd_proc
2021-04-21 21:50:04 +02:00
Uwe Bonnes
5abb288c7a hosted: Provide the DP functions in swd_proc. 2021-04-21 21:50:04 +02:00
Uwe Bonnes
fa561c8d66 adiv5_swdp: Starting point to handle multi-drop
- RP2040 show both DPs
- Multidrop test with STM32L552 and STM32H745 allows selection
  with "-m 0x4500041" (H7), "-m 1" (L552) or "-m 0x01002927" (RP2040)
2021-04-21 21:50:04 +02:00
Uwe Bonnes
7859a2aabd adiv5_swd: Factor out creation of packet request. 2021-03-06 13:30:09 +01:00
Uwe Bonnes
c776e7a9a6 swd_scan: Add '-m' as targetid argument to swd_scan to prepare multi-drop.
In a real multi-drop setup, the device to use must be specified.
2021-02-15 17:47:29 +01:00
Uwe Bonnes
7df314e265 Firmware/Jlink: Fix double free when debug power-up fails (#780) 2020-11-29 15:48:50 +01:00
Uwe Bonnes
bf548e92c0 swd: After write low_access, always append 8 clk to move data through SW-DP.
Especially needed when leaving the debugger or during debug unit power-up.

ARM Debug Interface Architecture Specification ADIv5.0 to ADIv5.2
tells to clock the data through SW-DP to either :
- immediate start a new transaction
- continue to drive idle cycles
- or clock at least 8 idle cycles

Implement last option to favour correctness over slight speed decrease

Implement only for adapters where we assemble the seq_out_parity in our code,
as on firmware, ftdi and jlink. Hopefully the high level adapters do it right.

Reverts 2c33cde63fe779d3019fe8f63dd4420cb960bbfe and
cde7726b8730242cd40a9974d129b46af80c68af
2020-11-27 22:26:48 +01:00
Uwe Bonnes
80154c5c7a adiv5_swdp: Fix more memory leak. 2020-11-27 22:26:48 +01:00
Uwe Bonnes
18673d9a56 adiv5: Rework DP/AP refcounting.
ASAN non longer reports leaks with the STM32H745.
2020-10-23 09:40:15 +02:00
Uwe Bonnes
3d92b82678 jtag: Use index and not device structure for jtag_dev_write_ir and jtag_dev_shift_dr 2020-10-16 20:03:03 +02:00
Uwe Bonnes
bdb351a6ea adiv5_swdp: On ACK_FAULT, error() and try again once #731
when writing CSW.
2020-09-18 20:07:32 +02:00
Uwe Bonnes
8a2bce26f2 Hosted: Fix memory leak when platform_swdptap_init fails. 2020-09-04 11:49:13 +02:00
Uwe Bonnes
09ceaea70f adiv5_swdp: Fix another memory leak. 2020-07-14 15:02:13 +02:00
Uwe Bonnes
dc3fd2eb06 Classify debug messages
Firmware BMP with ENABLE_DEBUG=1 will print WARN and INFO as before.
PC-Hosted BMPwill alway print to stderr. Warn is printed unconditional,
INFO, GDB, TARGET, DONGLE and WIRE will print if their appropriate bit in
cl_debuglevel is set via the -v verbose command line argument.
INFO will go to stdout with -t or -l.
2020-06-05 14:59:30 +02:00
Valmantas Paliksa
b06c0ba8d5 bmp_remote: Use high level functions.
Based on #570 (OpenOCD HLA interface driver for Blackmagic), but now
usefull for bmp-remote.
2020-06-05 14:59:30 +02:00
Uwe Bonnes
e34a27f72c Detour swd primitives. 2020-06-05 14:59:30 +02:00
Richard Meadows
600bc9f029 Generate DEBUG warnings and return if malloc/calloc fail.
This is will make debugging earier if this does happen, rather than
dereferencing the null pointer (or passing it to memcpy, or worse).

blackmagic PR #475
2019-05-26 18:56:12 +02:00
Uwe Bonnes
f5cf6d4497 adiv5_swdp: Add extra idle cycles with write transactions.
These extra cycles are needed by some CPU, e.g. STM32L0x1 to cross the SWCLK
/HCLK domains. Revert insufficient #373 also tackling that problem.

Thanks to Thorsten von Eicken for pointing out.
2018-09-06 17:29:20 +02:00
Uwe Bonnes
5548d54626 common/swdptap: some clean up.
Remove superfluous transaction.
Use native variable size.
2018-06-26 19:50:14 +02:00