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 <simonqian.open...@gmail.com>
> *Date:* 2012-03-15 02:34
> *To:* Tomek CEDRO <tomek.ce...@gmail.com>
> *CC:* openocd-devel <openocd-devel@lists.sourceforge.net>; Peter 
> Stuge<pe...@stuge.se>
> *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

Reply via email to