commit 4475711f88541e1fa01a740b8dec9c7c179bd4c1
Author: Dennis Gilmore <dennis(a)ausil.us>
Date: Thu May 31 13:48:42 2012 -0500
patch in flyswatter2 support
Tincantools-openocd-b0.12.patch | 308 +++++++++++++++++++++++++++++++++++++++
openocd.spec | 8 +-
2 files changed, 315 insertions(+), 1 deletions(-)
---
diff --git a/Tincantools-openocd-b0.12.patch b/Tincantools-openocd-b0.12.patch
new file mode 100644
index 0000000..44e7d77
--- /dev/null
+++ b/Tincantools-openocd-b0.12.patch
@@ -0,0 +1,308 @@
+diff -Ncr before/src/jtag/drivers/ft2232.c after/src/jtag/drivers/ft2232.c
+*** before/src/jtag/drivers/ft2232.c 2011-08-09 00:34:19.000000000 -0500
+--- after/src/jtag/drivers/ft2232.c 2011-09-05 02:59:48.198120095 -0500
+***************
+*** 177,182 ****
+--- 177,184 ----
+ static int icdi_jtag_init(void);
+ static int olimex_jtag_init(void);
+ static int flyswatter_init(void);
++ static int flyswatter2_init(void);
++ static int flyswatter3_init(void);
+ static int minimodule_init(void);
+ static int turtle_init(void);
+ static int comstick_init(void);
+***************
+*** 198,203 ****
+--- 200,207 ----
+ static void jtagkey_reset(int trst, int srst);
+ static void olimex_jtag_reset(int trst, int srst);
+ static void flyswatter_reset(int trst, int srst);
++ static void flyswatter2_reset(int trst, int srst);
++ static void flyswatter3_reset(int trst, int srst);
+ static void minimodule_reset(int trst, int srst);
+ static void turtle_reset(int trst, int srst);
+ static void comstick_reset(int trst, int srst);
+***************
+*** 213,218 ****
+--- 217,224 ----
+ /* blink procedures for layouts that support a blinking led */
+ static void olimex_jtag_blink(void);
+ static void flyswatter_jtag_blink(void);
++ static void flyswatter2_jtag_blink(void);
++ static void flyswatter3_jtag_blink(void);
+ static void turtle_jtag_blink(void);
+ static void signalyzer_h_blink(void);
+ static void ktlink_blink(void);
+***************
+*** 263,268 ****
+--- 269,284 ----
+ .reset = flyswatter_reset,
+ .blink = flyswatter_jtag_blink
+ },
++ { .name = "flyswatter2",
++ .init = flyswatter2_init,
++ .reset = flyswatter2_reset,
++ .blink = flyswatter2_jtag_blink
++ },
++ { .name = "flyswatter3",
++ .init = flyswatter3_init,
++ .reset = flyswatter3_reset,
++ .blink = flyswatter3_jtag_blink
++ },
+ { .name = "minimodule",
+ .init = minimodule_init,
+ .reset = minimodule_reset,
+***************
+*** 1571,1576 ****
+--- 1587,1624 ----
+ LOG_DEBUG("trst: %i, srst: %i, low_output: 0x%2.2x, low_direction: 0x%2.2x",
trst, srst, low_output, low_direction);
+ }
+
++ static void flyswatter2_reset(int trst, int srst)
++ {
++ if (trst == 1)
++ {
++ low_output &= ~nTRST;
++ }
++ else if (trst == 0)
++ {
++ low_output |= nTRST;
++ }
++
++ if (srst == 1)
++ {
++ low_output &= ~nSRST;
++ }
++ else if (srst == 0)
++ {
++ low_output |= nSRST;
++ }
++
++ /* command "set data bits low byte" */
++ buffer_write(0x80);
++ buffer_write(low_output);
++ buffer_write(low_direction);
++ LOG_DEBUG("trst: %i, srst: %i, low_output: 0x%2.2x, low_direction: 0x%2.2x",
trst, srst, low_output, low_direction);
++ }
++
++ static void flyswatter3_reset(int trst, int srst)
++ {
++ flyswatter2_reset(trst, srst);
++ }
++
+ static void minimodule_reset(int trst, int srst)
+ {
+ if (srst == 1)
+***************
+*** 2936,2941 ****
+--- 2984,3076 ----
+ return ERROR_OK;
+ }
+
++ static int flyswatter2_init(void)
++ {
++ uint8_t buf[3];
++ uint32_t bytes_written;
++
++ low_output = 0x18;
++ low_direction = 0x7b;
++
++ /* initialize low byte for jtag */
++ buf[0] = 0x80; /* command "set data bits low byte" */
++ buf[1] = low_output; /* value (TMS = 1,TCK = 0, TDI = 0, nOE = 0) */
++ buf[2] = low_direction; /* dir (output = 1), TCK/TDI/TMS = out, TDO = in, nOE[12]=out,
n[ST]srst = out */
++ LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]);
++
++ if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3))
++ {
++ LOG_ERROR("couldn't initialize FT2232 with 'flyswatter2'
layout");
++ return ERROR_JTAG_INIT_FAILED;
++ }
++
++ nTRST = 0x10;
++ nTRSTnOE = 0x0; /* not output enable for nTRST */
++ nSRST = 0x20;
++ nSRSTnOE = 0x00; /* no output enable for nSRST */
++
++ high_output = 0x00;
++ high_direction = 0x01;
++
++ /* initialize high port */
++ buf[0] = 0x82; /* command "set data bits high byte" */
++ buf[1] = high_output; /* value */
++ buf[2] = high_direction; /* all outputs (xRST and xRSTnOE) */
++ LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]);
++
++ if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3))
++ {
++ LOG_ERROR("couldn't initialize FT2232 with 'flyswatter2'
layout");
++ return ERROR_JTAG_INIT_FAILED;
++ }
++
++ return ERROR_OK;
++ }
++
++ //flyswatter3_init is currently identical to flyswatter2_init except for the error
messages
++ static int flyswatter3_init(void)
++ {
++ uint8_t buf[3];
++ uint32_t bytes_written;
++
++ low_output = 0x18;
++ low_direction = 0x7b;
++
++ /* initialize low byte for jtag */
++ buf[0] = 0x80; /* command "set data bits low byte" */
++ buf[1] = low_output; /* value (TMS = 1,TCK = 0, TDI = 0, nOE = 0) */
++ buf[2] = low_direction; /* dir (output = 1), TCK/TDI/TMS = out, TDO = in, nOE[12]=out,
n[ST]srst = out */
++ LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]);
++
++ if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3))
++ {
++ LOG_ERROR("couldn't initialize FT2232 with 'flyswatter3'
layout");
++ return ERROR_JTAG_INIT_FAILED;
++ }
++
++ nTRST = 0x10;
++ nTRSTnOE = 0x0; /* not output enable for nTRST */
++ nSRST = 0x20;
++ nSRSTnOE = 0x00; /* no output enable for nSRST */
++
++ high_output = 0x00;
++ high_direction = 0x01;
++
++ /* initialize high port */
++ buf[0] = 0x82; /* command "set data bits high byte" */
++ buf[1] = high_output; /* value */
++ buf[2] = high_direction; /* all outputs (xRST and xRSTnOE) */
++ LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]);
++
++ if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) || (bytes_written != 3))
++ {
++ LOG_ERROR("couldn't initialize FT2232 with 'flyswatter3'
layout");
++ return ERROR_JTAG_INIT_FAILED;
++ }
++
++ return ERROR_OK;
++ }
++
+ static int minimodule_init(void)
+ {
+ low_output = 0x18;//check if srst should be 1 or 0 initially. (0x08) (flyswatter
was 0x18)
+***************
+*** 3230,3235 ****
+--- 3365,3387 ----
+ buffer_write(high_direction);
+ }
+
++ static void flyswatter2_jtag_blink(void)
++ {
++ /*
++ * Flyswatter2 only has one LED connected to ACBUS2
++ */
++ high_output ^= 0x04;
++
++ buffer_write(0x82);
++ buffer_write(high_output);
++ buffer_write(high_direction);
++ }
++
++ static void flyswatter3_jtag_blink(void)
++ {
++ flyswatter2_jtag_blink();
++ }
++
+ static void turtle_jtag_blink(void)
+ {
+ /*
+diff -Ncr before/tcl/board/hammer.cfg after/tcl/board/hammer.cfg
+*** before/tcl/board/hammer.cfg 2011-08-09 00:43:40.000000000 -0500
+--- after/tcl/board/hammer.cfg 2011-09-05 02:51:06.374680305 -0500
+***************
+*** 1,6 ****
+--- 1,7 ----
+ # Target Configuration for the TinCanTools S3C2410 Based Hammer Module
+ #
http://www.tincantools.com
+
++ set CPUTAPID 0x0032409d
+ source [find target/samsung_s3c2410.cfg]
+
+ $_TARGETNAME configure -event reset-init {
+diff -Ncr before/tcl/board/olimex_pic32mx.cfg after/tcl/board/olimex_pic32mx.cfg
+*** before/tcl/board/olimex_pic32mx.cfg 1969-12-31 18:00:00.000000000 -0600
+--- after/tcl/board/olimex_pic32mx.cfg 2011-09-05 02:51:06.384680179 -0500
+***************
+*** 0 ****
+--- 1,10 ----
++ # Configuration for the Olimex PIC-32MX development board
++ # Config file supplied by TinCanTools
++ #
http://www.tincantools.com
++
++ jtag_khz 15000
++ set CPUTAPID 0x50916053
++ source [find target/pic32mx.cfg]
++
++
++
+diff -Ncr before/tcl/interface/flyswatter2.cfg after/tcl/interface/flyswatter2.cfg
+*** before/tcl/interface/flyswatter2.cfg 1969-12-31 18:00:00.000000000 -0600
+--- after/tcl/interface/flyswatter2.cfg 2011-09-05 02:51:06.384680179 -0500
+***************
+*** 0 ****
+--- 1,11 ----
++ #
++ # TinCanTools Flyswatter
++ #
++ #
http://www.tincantools.com/product.php?productid=16134
++ #
++
++ interface ft2232
++ ft2232_device_desc "Flyswatter2"
++ ft2232_layout "flyswatter2"
++ ft2232_vid_pid 0x0403 0x6010
++ jtag_khz 15000
+diff -Ncr before/tcl/interface/flyswatter3.cfg after/tcl/interface/flyswatter3.cfg
+*** before/tcl/interface/flyswatter3.cfg 1969-12-31 18:00:00.000000000 -0600
+--- after/tcl/interface/flyswatter3.cfg 2011-09-05 02:51:06.384680179 -0500
+***************
+*** 0 ****
+--- 1,8 ----
++ # TinCanTools Flyswatter3
++ #
http://www.tincantools.com
++
++ interface ft2232
++ ft2232_device_desc "Flyswatter3"
++ ft2232_layout "flyswatter3"
++ ft2232_vid_pid 0x0403 0x6010
++ jtag_khz 30000
+diff -Ncr before/tcl/interface/flyswatter.cfg after/tcl/interface/flyswatter.cfg
+*** before/tcl/interface/flyswatter.cfg 2011-08-09 00:43:40.000000000 -0500
+--- after/tcl/interface/flyswatter.cfg 2011-09-05 02:51:06.384680179 -0500
+***************
+*** 8,10 ****
+--- 8,11 ----
+ ft2232_device_desc "Flyswatter"
+ ft2232_layout "flyswatter"
+ ft2232_vid_pid 0x0403 0x6010
++ jtag_khz 6000
+diff -Ncr before/tcl/target/amdm37x.cfg after/tcl/target/amdm37x.cfg
+*** before/tcl/target/amdm37x.cfg 2011-08-09 00:43:41.000000000 -0500
+--- after/tcl/target/amdm37x.cfg 2011-09-04 23:52:00.000000000 -0500
+***************
+*** 29,35 ****
+ switch $CHIPTYPE {
+ dm37x {
+ # Primary TAP: ICEpick-C (JTAG route controller) and boundary scan
+! set _JRC_TAPID "-expected-id 0x1b89102f -expected-id 0x0b89102f"
+ }
+ am35x {
+ # Primary TAP: ICEpick-C (JTAG route controller) and boundary scan
+--- 29,35 ----
+ switch $CHIPTYPE {
+ dm37x {
+ # Primary TAP: ICEpick-C (JTAG route controller) and boundary scan
+! set _JRC_TAPID "-expected-id 0x2b89102f -expected-id 0x1b89102f
-expected-id 0x0b89102f"
+ }
+ am35x {
+ # Primary TAP: ICEpick-C (JTAG route controller) and boundary scan
diff --git a/openocd.spec b/openocd.spec
index c6d269c..398a4a0 100644
--- a/openocd.spec
+++ b/openocd.spec
@@ -1,6 +1,6 @@
Name: openocd
Version: 0.5.0
-Release: 2%{?dist}
+Release: 3%{?dist}
Summary: Debugging, in-system programming and boundary-scan testing for embedded
devices
Group: Development/Tools
@@ -10,6 +10,8 @@ Source0:
http://downloads.sourceforge.net/project/openocd/openocd/%{version}/
# Patch has been applied:
http://openocd.zylin.com/#change,274
Patch0: openocd.COPYING.patch
+# add flyswatter2 support patch from
http://elinux.org/images/5/5d/Tincantools-openocd-b0.12.patch
+Patch1: Tincantools-openocd-b0.12.patch
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
BuildRequires: chrpath, libftdi-devel
@@ -27,6 +29,7 @@ debugging.
%prep
%setup -q
%patch0
+%patch1 -p1
cd doc
iconv -f iso8859-1 -t utf-8 openocd.info > openocd.info.conv
mv -f openocd.info.conv openocd.info
@@ -86,6 +89,9 @@ rm -rf %{buildroot}
%{_mandir}/man1/*
%changelog
+* Thu May 31 2012 Dennis Gilmore <dennis(a)ausil.us> - 0.5.0-3
+- patch in flyswatter2 support
+
* Fri Jan 13 2012 Fedora Release Engineering <rel-eng(a)lists.fedoraproject.org> -
0.5.0-2
- Rebuilt for
https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild