So I implement it as below:
First add swd_init_reset:
int swd_init_reset(struct command_context *cmd_ctx)
{
int retval = adapter_init(cmd_ctx);
if (retval != ERROR_OK)
return retval;
LOG_DEBUG("Initializing with hard SRST reset");
jtag_add_reset(0, 1);
jtag_add_reset(0, 0);
retval = jtag_execute_queue();
return retval;
}
And in jim_jtag_arp_init_reset:
if (transport_is_jtag())
e = jtag_init_reset(context);
else if (transport_is_swd())
e = swd_init_reset(context);
I'm doing some tests, if it's OK I'll format a new patch.
And next patch will be to make arm_adi_v5 transport independent.
And then add the SWD driver layer.
Then enjoy SWD.
simonqian.openocd
From: Tomek CEDRO
Date: 2012-03-15 23:03
To: simonqian.openocd
CC: openocd-devel; Peter Stuge
Subject: Re: Re: [OpenOCD-devel] make arm_adi_v5.c transport independent
Yup, the easiest way to test thing without changing stuff with dependencies in
multiple places would be simply to create a wrapper for existing function that
will call original with _jtag suffix or new one with _swd suffix, just as I did
in case of memapreadu32. Changing functions inline would produce more work in
future so I would prefer to create a wrapper and additional function to leave
original untouched (except _jtag prefix)... is that ok for you Simon?
Best regards :-)
Tomek
--
CeDeROM, SQ7MHZ, http://www.tomek.cedro.info
On Mar 15, 2012 2:57 PM, "simonqian.openocd" <simonqian.open...@gmail.com>
wrote:
OK, I have tested this patch with my other SWD patches, it works well.
But another code should be fixed too.
I want to query for how to fix it.
on "reset init" command, init_reset procedure in startup.tcl will be called:
proc init_reset { mode } {
jtag arp_init-reset
}
and then jim_jtag_arp_init_reset will be called to process "jtag
arp_init-reset".
But jim_jtag_arp_init_reset will call jtag_init_reset, which is not valid under
SWD mode.
I want to know how to fix it.
startup.tcl should detect current transport and call "jtag arp_init-reset" in
JTAG mode?
Or add a check in jim_jtag_arp_init_reset like below:
if (transport_is_jtag())
{
int e = jtag_init_reset(context);
if (e != ERROR_OK) {
Jim_Obj *eObj = Jim_NewIntObj(goi.interp, e);
Jim_SetResultFormatted(goi.interp, "error: %#s", eObj);
Jim_FreeNewObj(goi.interp, eObj);
return JIM_ERR;
}
}
simonqian.openocd
From: simonqian.openocd
Date: 2012-03-15 02:34
To: Tomek CEDRO
CC: openocd-devel; Peter Stuge
Subject: Re: Re: [OpenOCD-devel] make arm_adi_v5.c transport independent
First patch to review: no call jtag_add_reset regardless of the transport
selected.
simonqian.openocd
------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
OpenOCD-devel mailing list
OpenOCD-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openocd-devel