Hi Tomek,

SWD will not work without patching the arm_adi_v5 file. You will get
errors because of the direct calls to the jtag subsystem.

I wrote my own driver for a SWD test. With this driver I can
successfully read and write memory and control the core of a LPC1343 via
openocd. For the moment it's a proof of concept driver. It's not as fast
as I expected. Each transfer over usb hardware needs about 10ms. Next, I
will try libusb instead of cdc-acm implementation.

I had a closer look to your fork from openocd. In my opinion it's not a
good idea doing the SWD bit disassembling in the transport layer. If you
do this, the driver has no chance to optimise the performance. It has to
be synchronous with the hardware. This means you write the 8 bit SWD
header, then you read the 3 bit ack. With the value of the ack you can
decide what to do. You need at least 4 USB transfers.

I think the driver should have the choice whether using you library or
not. In my proof of concept driver I send the whole command queue to the
uC with one USB transfer.

What do you think about the extension of the command queue? I attached a
patch file. The swd transport implementation sends one or more commands
(ADI_AP_READ, ADI_AP_WRITE, ADI_DP_READ and ADI_DP_WRITE) through the
existing queue and then calls jtag_execute_queue. The driver can decide
if using the SWD library or not. In case of the ft2232 the library must
be used. But for higher performances the debug hardware should implement
the low level SWD protocol.

Best regards,

Sven



Am 01.09.2011 22:15, schrieb Tomek CEDRO:
> I can take a look at this as I'm finishing to solder a hardware that I
> will finish the SWD implementation in upcoming days, but I would
> rather not change interface/jtag/transport layer until SWD is done.
> When its done and working then we can change internals, otherwise we
> will have two different forks and additional work to do.
>
> Best regards,
> Tomek
>

diff --git a/src/jtag/commands.h b/src/jtag/commands.h
index d591814..5053413 100644
--- a/src/jtag/commands.h
+++ b/src/jtag/commands.h
@@ -117,6 +117,13 @@ struct tms_command {
 	const uint8_t		*bits;
 };
 
+struct adi_command {
+	uint32_t *data;
+	uint32_t size;
+	unsigned reg;
+	uint8_t *ack;
+};
+
 /**
  * Defines a container type that hold a pointer to a JTAG command
  * structure of any defined type.
@@ -131,6 +138,7 @@ union jtag_command_container {
 	struct end_state_command	*end_state;
 	struct sleep_command		*sleep;
 	struct tms_command		*tms;
+	struct adi_command *adi;
 };
 
 /**
@@ -153,6 +161,11 @@ enum jtag_command_type {
 	JTAG_SLEEP        = 7,
 	JTAG_STABLECLOCKS = 8,
 	JTAG_TMS          = 9,
+	ADI_AP_READ       = 10,
+	ADI_AP_WRITE      = 11,
+	ADI_DP_READ       = 12,
+	ADI_DP_WRITE      = 13,
+	ADI_AP_ABORT      = 14,
 };
 
 struct jtag_command {
_______________________________________________
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to