target/armv7m_trace: Improve SWO frequency auto-detection 03/3903/5
authorMarc Schink <openocd-dev@marcschink.de>
Fri, 2 Dec 2016 14:39:23 +0000 (15:39 +0100)
committerPaul Fertser <fercerpav@gmail.com>
Sat, 21 Dec 2019 19:25:32 +0000 (19:25 +0000)
commit2dc88e1479f29ef0141b05bfcd907ad9a3e2d54c
treef52d7ef4e56c734d25f1bf12bed0fe01110c53cb
parent90bd7d148225efa587d8e62017625709a1ac002d
target/armv7m_trace: Improve SWO frequency auto-detection

The SWO frequency auto-detection with J-Link adapters does not work
properly in the current implementation. This is because the trace layer
has only information about the highest possible SWO frequency supported
by the adapter. With that the trace layer calculates the SWO prescaler
which usually leads to a frequency deviation greater than what is
permitted by J-Link adapters.

Move the calculation of the SWO prescaler from the trace layer into the
trace configuration of the adapter to overcome this problem.
The adapter has the necessary information to choose a suitable SWO
frequency and calculate the corresponding prescaler that complies with
the maximum allowed frequency deviation.

Tested with:
  - STM32L152RC Discovery Kit (ST-Link)
  - EFM32GG-STK3700 (J-Link)

Change-Id: I38ff2b89d32f0a92c597989b590afe5c75cf4902
Signed-off-by: Marc Schink <openocd-dev@marcschink.de>
Reviewed-on: http://openocd.zylin.com/3903
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
src/jtag/core.c
src/jtag/drivers/jlink.c
src/jtag/drivers/stlink_usb.c
src/jtag/hla/hla_interface.c
src/jtag/hla/hla_layout.h
src/jtag/interface.h
src/target/armv7m_trace.c
src/target/cortex_m.h