Version 0.04. master release/0.04
authorNIIBE Yutaka <gniibe@fsij.org>
Wed, 22 Aug 2018 05:05:16 +0000 (14:05 +0900)
committerNIIBE Yutaka <gniibe@fsij.org>
Wed, 22 Aug 2018 05:06:09 +0000 (14:06 +0900)
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
0001-jtag-drivers-bbg-swd-New-SWD-driver.patch
0002-jtag-bbg-swd-Fix-bbg_swd_interface_init-and-bbg_swd_.patch [new file with mode: 0644]
0003-target-cortex_m-Set-do_reconnect-at-deassert.patch [new file with mode: 0644]
0004-target-cortex-m-More-wait-tick.patch [new file with mode: 0644]
README
pru-swd.p

index a71033e..2d74d88 100644 (file)
@@ -1,13 +1,13 @@
 From ca085bb0dab3a732e71b4ca5e87757cd8351508f Mon Sep 17 00:00:00 2001
 From: NIIBE Yutaka <gniibe@fsij.org>
 Date: Wed, 14 Mar 2018 17:56:39 +0900
-Subject: [PATCH] jtag: drivers: bbg-swd: New SWD driver
+Subject: [PATCH 1/4] jtag: drivers: bbg-swd: New SWD driver
 
 ---
- configure.ac                 |  23 ++-
+ configure.ac                 |  23 +-
  src/jtag/drivers/Makefile.am |   3 +
- src/jtag/drivers/bbg-swd.c   | 399 +++++++++++++++++++++++++++++++++++++++++++
- src/jtag/drivers/bbg-swd.h   |  44 +++++
+ src/jtag/drivers/bbg-swd.c   | 399 +++++++++++++++++++++++++++++++++++
+ src/jtag/drivers/bbg-swd.h   |  44 ++++
  src/jtag/interfaces.c        |   6 +
  5 files changed, 474 insertions(+), 1 deletion(-)
  create mode 100644 src/jtag/drivers/bbg-swd.c
@@ -569,5 +569,5 @@ index ad656a84..cbd08c79 100644
                NULL,
        };
 -- 
-2.11.0
+2.18.0
 
diff --git a/0002-jtag-bbg-swd-Fix-bbg_swd_interface_init-and-bbg_swd_.patch b/0002-jtag-bbg-swd-Fix-bbg_swd_interface_init-and-bbg_swd_.patch
new file mode 100644 (file)
index 0000000..e95c646
--- /dev/null
@@ -0,0 +1,45 @@
+From 5e8ffbce4ff82a6e8045d64a788bed2222bfb376 Mon Sep 17 00:00:00 2001
+From: NIIBE Yutaka <gniibe@fsij.org>
+Date: Tue, 21 Aug 2018 18:54:24 +0900
+Subject: [PATCH 2/4] jtag: bbg-swd: Fix bbg_swd_interface_init and
+ bbg_swd_execute_reset.
+
+* src/jtag/drivers/bbg-swd.c (bbg_swd_interface_init): Call
+bbg_swd_switch_seq with LINE_RESET.
+(bbg_swd_execute_reset): Add delay.
+---
+ src/jtag/drivers/bbg-swd.c | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/src/jtag/drivers/bbg-swd.c b/src/jtag/drivers/bbg-swd.c
+index 2a4fa812..19548688 100644
+--- a/src/jtag/drivers/bbg-swd.c
++++ b/src/jtag/drivers/bbg-swd.c
+@@ -1,5 +1,5 @@
+ /***************************************************************************
+- *   Copyright (C) 2016  Flying Stone Technology                           *
++ *   Copyright (C) 2016, 2018  Flying Stone Technology                     *
+  *   Author: NIIBE Yutaka <gniibe@fsij.org>                                *
+  *                                                                         *
+  *   This program is free software; you can redistribute it and/or modify  *
+@@ -126,6 +126,9 @@ static int bbg_swd_interface_init(void)
+               }
+       }
++      if (bbg_swd_switch_seq(LINE_RESET) != ERROR_OK)
++              return ERROR_FAIL;
++
+       LOG_INFO("BBG-SWD: Interface ready");
+       return ERROR_OK;
+@@ -327,6 +330,7 @@ static const struct command_registration bbg_swd_command_handlers[] = {
+ static void bbg_swd_execute_reset(struct jtag_command *cmd)
+ {
+       bbg_swd_gpio_srst(cmd->cmd.reset->srst ? 0: 1);
++      alive_sleep (10);
+ }
+ static void bbg_swd_execute_sleep(struct jtag_command *cmd)
+-- 
+2.18.0
+
diff --git a/0003-target-cortex_m-Set-do_reconnect-at-deassert.patch b/0003-target-cortex_m-Set-do_reconnect-at-deassert.patch
new file mode 100644 (file)
index 0000000..cc89a78
--- /dev/null
@@ -0,0 +1,28 @@
+From f18c59ca303931627155bffe9de993a499a9f006 Mon Sep 17 00:00:00 2001
+From: NIIBE Yutaka <gniibe@fsij.org>
+Date: Tue, 21 Aug 2018 18:57:18 +0900
+Subject: [PATCH 3/4] target: cortex_m: Set do_reconnect at deassert.
+
+--
+
+This is needed for FSM-55 reset.
+---
+ src/target/cortex_m.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/target/cortex_m.c b/src/target/cortex_m.c
+index 36a77467..6a0ffdad 100644
+--- a/src/target/cortex_m.c
++++ b/src/target/cortex_m.c
+@@ -1122,6 +1122,8 @@ static int cortex_m_deassert_reset(struct target *target)
+               }
+       }
++      armv7m->debug_ap->dap->do_reconnect = true;
++
+       return ERROR_OK;
+ }
+-- 
+2.18.0
+
diff --git a/0004-target-cortex-m-More-wait-tick.patch b/0004-target-cortex-m-More-wait-tick.patch
new file mode 100644 (file)
index 0000000..f76393b
--- /dev/null
@@ -0,0 +1,28 @@
+From 56d37ac1b0bd7e3230096341aa894effa062fd62 Mon Sep 17 00:00:00 2001
+From: NIIBE Yutaka <gniibe@fsij.org>
+Date: Wed, 22 Aug 2018 13:49:13 +0900
+Subject: [PATCH 4/4] target: cortex-m: More wait tick.
+
+--
+This is needed for sleeping FST-01G.  I don't know if 80 is
+relevant, but it works at least.
+---
+ src/target/cortex_m.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/target/cortex_m.c b/src/target/cortex_m.c
+index 6a0ffdad..4201e984 100644
+--- a/src/target/cortex_m.c
++++ b/src/target/cortex_m.c
+@@ -1927,7 +1927,7 @@ int cortex_m_examine(struct target *target)
+               }
+               /* Leave (only) generic DAP stuff for debugport_init(); */
+-              armv7m->debug_ap->memaccess_tck = 8;
++              armv7m->debug_ap->memaccess_tck = 80;
+               retval = mem_ap_init(armv7m->debug_ap);
+               if (retval != ERROR_OK)
+-- 
+2.18.0
+
diff --git a/README b/README
index af7f627..4699d3f 100644 (file)
--- a/README
+++ b/README
@@ -1,7 +1,7 @@
 BeagleBoneGreen SWD - a practical tool for computing freedom
 
-                                                       Version 0.03
-                                                         2018-03-22
+                                                       Version 0.04
+                                                         2018-08-22
                                                        Niibe Yutaka
                                             Flying Stone Technology
 
@@ -12,28 +12,31 @@ BeagleBoneGreen SWD (BBG-SWD) is a tool to control SWD protocol by
 BeagleBoneGreen or PocketBeagle.
 
 
-Note for release 0.03
+Note for release 0.04
 =====================
 
-The patch is for OpenOCD 0.10.0.
-
-The BBG-SWD driver for OpenOCD is by a patch:
+The patches are against OpenOCD 0.10.0.
 
        0001-jtag-drivers-bbg-swd-New-SWD-driver.patch
+       0002-jtag-bbg-swd-Fix-bbg_swd_interface_init-and-bbg_swd_.patch
+       0003-target-cortex_m-Set-do_reconnect-at-deassert.patch
+       0004-target-cortex-m-More-wait-tick.patch
 
-The BBG-SWD driver is ready for use.  It is tested with FST-01 (STM32F103),
-FSM-55 (STM32F030) and prototype of FS-BB48 (KL27Z256).
+The BBG-SWD driver is ready for use.  It is tested with FST-01G
+(STM32F103), FSM-55 (STM32F030) and prototype of FS-BB48 (KL27Z256).
 
 Use of "bone-kernel" is assumed for UIO user space PRUSS driver.
 
 It is also tested with PocketBeagle.
 
+The delay constant in pru-swd.p is changed for speed.  And I modified
+original OpenOCD Cortex-M target, so that it works for my boards.
+
 
 Future Works
 ============
 
 It would be good to support different speed for communication.
-Now, it is fixed to 1000kHz.
 
 
 The purpose
@@ -97,13 +100,19 @@ The program pru-swd.p is distributed under GPLv3+.
 The OpenOCD patch  is under GPLv2+.
 
 
-Patch for OpenOCD
-=================
+Patches for OpenOCD
+===================
+
+The patches are: 
+
+       0001-jtag-drivers-bbg-swd-New-SWD-driver.patch
+       0002-jtag-bbg-swd-Fix-bbg_swd_interface_init-and-bbg_swd_.patch
+       0003-target-cortex_m-Set-do_reconnect-at-deassert.patch
+       0004-target-cortex-m-More-wait-tick.patch
 
-The patch is: 
-       0001-Add-new-SWD-driver-bbg-swd.patch
+Please apply those patches to OpenOCD 0.10.0.
 
-You can configure BBG-SWD driver by the --enable-bbg-swd option.
+Then, you can configure BBG-SWD driver by the --enable-bbg-swd option.
 
     ./configure --enable-bbg-swd
 
@@ -130,9 +139,17 @@ source [find target/klx.cfg]
 reset_config srst_only separate srst_nogate srst_push_pull connect_assert_srst
 --------------------------
 
+For FSM-55,  I use following configuration.
 
-Request-Response
-================
+-------------------------- File: fsm-55-bbg-swd.cfg
+interface bbg-swd
+source [find target/stm32f0x.cfg]
+reset_config srst_only srst_nogate connect_assert_srst
+-------------------------- 
+
+
+Request-Response between PRUSS
+==============================
 
 FORMAT:
   Request:
index f219918..89f29c7 100644 (file)
--- a/pru-swd.p
+++ b/pru-swd.p
@@ -1,7 +1,7 @@
 //                                                     -*- mode: asm -*-
 // pru-swd.p - PRU program to handle SWD protocol
 //
-// Copyright (C) 2016  Flying Stone Technology
+// Copyright (C) 2016, 2018  Flying Stone Technology
 // Author: NIIBE Yutaka <gniibe@fsij.org>
 //
 // This file is a part of BBG-SWD, a SWD tool for BeagleBoneGreen.
@@ -23,7 +23,7 @@
 .origin 0
 .entrypoint START
 
-#define CONST_DELAY            47 // 470ns To be 1000 kHz
+#define CONST_DELAY            10 // 100ns
 
 //
 //     DELAY - Macro for do nothing but wait