cmsis-dap: add initial cmsis-dap support
This is based on work from: https://github.com/TheShed/OpenOCD-CMSIS-DAP/tree/cmsis-dap Main changes include moving over to using HIDAPI rather than libusb-1.0 and cleaning up to merge into master. Support for reset using srst has also been added. It has been tested on all the mbed boards as well as the Freedom board from Freescale. These boards only implement SWD mode, however JTAG mode has been tested with a Keil ULINK2 and a stm32 target - but requires a lot more work. Change-Id: I96d5ee1993bc9c0526219ab754c5aad3b55d812d Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Signed-off-by: Andrey Yurovsky <yurovsky@gmail.com> Reviewed-on: http://openocd.zylin.com/1542 Tested-by: jenkins
This commit is contained in:
@@ -134,8 +134,6 @@ static int jtag_speed;
|
||||
|
||||
static struct jtag_interface *jtag;
|
||||
|
||||
const struct swd_driver *swd;
|
||||
|
||||
/* configuration */
|
||||
struct jtag_interface *jtag_interface;
|
||||
|
||||
@@ -1824,6 +1822,8 @@ void adapter_assert_reset(void)
|
||||
jtag_add_reset(0, 1);
|
||||
} else if (transport_is_swd())
|
||||
swd_add_reset(1);
|
||||
else if (transport_is_cmsis_dap())
|
||||
swd_add_reset(1); /* FIXME */
|
||||
else if (get_current_transport() != NULL)
|
||||
LOG_ERROR("reset is not supported on %s",
|
||||
get_current_transport()->name);
|
||||
@@ -1837,6 +1837,8 @@ void adapter_deassert_reset(void)
|
||||
jtag_add_reset(0, 0);
|
||||
else if (transport_is_swd())
|
||||
swd_add_reset(0);
|
||||
else if (transport_is_cmsis_dap())
|
||||
swd_add_reset(0); /* FIXME */
|
||||
else if (get_current_transport() != NULL)
|
||||
LOG_ERROR("reset is not supported on %s",
|
||||
get_current_transport()->name);
|
||||
|
||||
@@ -6,7 +6,8 @@ libocdjtagdrivers_la_LIBADD =
|
||||
libocdjtagdrivers_la_SOURCES = \
|
||||
$(DRIVERFILES)
|
||||
|
||||
libocdjtagdrivers_la_CPPFLAGS = $(AM_CPPFLAGS) $(LIBUSB1_CFLAGS) $(LIBUSB0_CFLAGS)
|
||||
libocdjtagdrivers_la_CPPFLAGS = $(AM_CPPFLAGS) $(LIBUSB1_CFLAGS) \
|
||||
$(LIBUSB0_CFLAGS) $(HIDAPI_CFLAGS)
|
||||
|
||||
ULINK_FIRMWARE = $(srcdir)/OpenULINK
|
||||
|
||||
@@ -122,6 +123,10 @@ if OPENJTAG
|
||||
DRIVERFILES += openjtag.c
|
||||
endif
|
||||
|
||||
if CMSIS_DAP
|
||||
DRIVERFILES += cmsis_dap_usb.c
|
||||
endif
|
||||
|
||||
noinst_HEADERS = \
|
||||
bitbang.h \
|
||||
bitq.h \
|
||||
|
||||
1091
src/jtag/drivers/cmsis_dap_usb.c
Normal file
1091
src/jtag/drivers/cmsis_dap_usb.c
Normal file
File diff suppressed because it is too large
Load Diff
@@ -302,8 +302,6 @@ struct jtag_interface {
|
||||
|
||||
extern const char *jtag_only[];
|
||||
|
||||
extern const struct swd_driver *swd;
|
||||
|
||||
void adapter_assert_reset(void);
|
||||
void adapter_deassert_reset(void);
|
||||
|
||||
|
||||
@@ -128,6 +128,9 @@ extern struct jtag_interface aice_interface;
|
||||
#if BUILD_BCM2835GPIO == 1
|
||||
extern struct jtag_interface bcm2835gpio_interface;
|
||||
#endif
|
||||
#if BUILD_CMSIS_DAP == 1
|
||||
extern struct jtag_interface cmsis_dap_interface;
|
||||
#endif
|
||||
#endif /* standard drivers */
|
||||
|
||||
/**
|
||||
@@ -224,6 +227,9 @@ struct jtag_interface *jtag_interfaces[] = {
|
||||
#if BUILD_BCM2835GPIO == 1
|
||||
&bcm2835gpio_interface,
|
||||
#endif
|
||||
#if BUILD_CMSIS_DAP == 1
|
||||
&cmsis_dap_interface,
|
||||
#endif
|
||||
#endif /* standard drivers */
|
||||
NULL,
|
||||
};
|
||||
|
||||
@@ -110,11 +110,17 @@ struct swd_driver {
|
||||
*/
|
||||
int (*write_reg)(uint8_t cmd, uint32_t value);
|
||||
|
||||
/* XXX START WITH enough to:
|
||||
* init (synch mode, WCR)
|
||||
* for async, TRN > 1
|
||||
* read IDCODE from DP
|
||||
*/
|
||||
/**
|
||||
* Synchronous block read of an AP or DP register.
|
||||
*
|
||||
* @param cmd with APnDP/RnW/addr/parity bits
|
||||
* @param number of reads from register to be executed
|
||||
* @param buffer to store data read from register
|
||||
*
|
||||
* @return SWD_ACK_* code for the transaction
|
||||
* or (negative) fault code
|
||||
*/
|
||||
int (*read_block)(uint8_t cmd, uint32_t blocksize, uint8_t *buffer);
|
||||
|
||||
/**
|
||||
* Configures data collection from the Single-wire
|
||||
@@ -135,5 +141,6 @@ int swd_init_reset(struct command_context *cmd_ctx);
|
||||
void swd_add_reset(int req_srst);
|
||||
|
||||
bool transport_is_swd(void);
|
||||
bool transport_is_cmsis_dap(void);
|
||||
|
||||
#endif /* SWD_H */
|
||||
|
||||
@@ -59,8 +59,6 @@ static const Jim_Nvp nvp_jtag_tap_event[] = {
|
||||
{ .name = NULL, .value = -1 }
|
||||
};
|
||||
|
||||
extern struct jtag_interface *jtag_interface;
|
||||
|
||||
struct jtag_tap *jtag_tap_by_jim_obj(Jim_Interp *interp, Jim_Obj *o)
|
||||
{
|
||||
const char *cp = Jim_GetString(o, NULL);
|
||||
|
||||
Reference in New Issue
Block a user