SparkFun Forums 

Where electronics enthusiasts find answers.

Open source ARM Debugger
By baddu

I'm using openocd with Olimex arm-usb-ocd for a custom str912 board. I have a problem with str9xpec enable_turbo command.
It will give the error: "**STR9FLASH** (tap2) invalid chain?"

Flashing the device works fine (with str9x driver) but I need to change the boot bank with str9xpec driver.
Code: Select all
~/code/olimex/openocd$ telnet localhost 4444
Connected to localhost.
Escape character is '^]'.
Open On-Chip Debugger
> reset halt
RCLK not supported - fallback to 16 kHz
JTAG tap: str912.flash tap/device found: 0x04570041 (mfg: 0x020, part: 0x4570, ver: 0x0)
JTAG tap: str912.cpu tap/device found: 0x25966041 (mfg: 0x020, part: 0x5966, ver: 0x2)
JTAG tap: tap/device found: 0x2457f041 (mfg: 0x020, part: 0x457f, ver: 0x2)
target state: halted
target halted in ARM state due to debug-request, current mode: Supervisor
cpsr: 0x000000d3 pc: 0x00000000
> jtag_reset 0 1
> poll off
> str9xpec enable_turbo 0
**STR9FLASH** (tap2) invalid chain?
I'm using the following config script:
Code: Select all
interface ft2232
ft2232_device_desc "Olimex OpenOCD JTAG A"
ft2232_layout "olimex-jtag"
ft2232_vid_pid 0x15BA 0x0003

# jtag speed. We need to stick to 16kHz until we've finished reset.
jtag_rclk 16

jtag_nsrst_delay 100
jtag_ntrst_delay 100

#use combined on interfaces or targets that can't set TRST/SRST separately
reset_config trst_and_srst

# _CHIPNAME str912
# _ENDIAN little
# _FLASHTAPID 0x04570041
# _CPUTAPID 0x25966041
# _BSTAPID 0x1457f041
# _TARGETNAME str912.cpu

jtag newtap str912 flash -irlen 8 -ircapture 0x1 -irmask 0x1 -expected-id 0x04570041
jtag newtap str912 cpu   -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id 0x25966041
jtag newtap str912 bs    -irlen 5 -ircapture 0x1 -irmask 0x1 -expected-id 0x2457f041

target create str912.cpu arm966e -endian little -chain-position str912.cpu -variant arm966e

str912.cpu configure -event reset-start {
  jtag_rclk 16

str912.cpu configure -event reset-init {
  # We can increase speed now that we know the target is halted.
  jtag_rclk 16
  # -- Enable 96K RAM
  # PFQBC enabled / DTCM & AHB wait-states disabled
  mww 0x5C002034 0x0191

str912.cpu configure -work-area-virt 0 -work-area-phys 0x50000000 -work-area-size 16384 -work-area-backup 0

#flash bank str9x <base> <size> 0 0 <target#> <variant>
flash bank str912.flash0 str9xpec 0x00020000 0x00200000 0 0 str912.cpu
flash bank str912.flash1 str9xpec 0x00000000 0x00020000 0 0 str912.cpu
Thanks in advance!
By baddu
I found a bug in openocd which caused that and sent a patch to the development list.
Code: Select all
diff --git a/src/flash/nor/str9xpec.c b/src/flash/nor/str9xpec.c
index 18761c2..c06e6d1 100644
--- a/src/flash/nor/str9xpec.c
+++ b/src/flash/nor/str9xpec.c
@@ -306,7 +306,8 @@ FLASH_BANK_COMMAND_HANDLER(str9xpec_flash_bank_command)
  arm7_9 = armv4_5->arch_info;
  jtag_info = &arm7_9->jtag_info;

- str9xpec_info->tap = bank->target->tap;
+ /* The core is the next tap after the flash controller in the chain */
+ str9xpec_info->tap = jtag_tap_by_position(jtag_info->tap->abs_chain_position - 1);
  str9xpec_info->isc_enable = 0;

diff --git a/src/jtag/core.c b/src/jtag/core.c
index 0c222db..d7e1cce 100644
--- a/src/jtag/core.c
+++ b/src/jtag/core.c
@@ -216,7 +216,7 @@ void jtag_tap_add(struct jtag_tap *t)

 /* returns a pointer to the n-th device in the scan chain */
-static inline struct jtag_tap *jtag_tap_by_position(unsigned n)
+struct jtag_tap *jtag_tap_by_position(unsigned n)
  struct jtag_tap *t = jtag_all_taps();

diff --git a/src/jtag/jtag.h b/src/jtag/jtag.h
index df01537..6709cf7 100644
--- a/src/jtag/jtag.h
+++ b/src/jtag/jtag.h
@@ -173,6 +173,7 @@ struct jtag_tap* jtag_all_taps(void);
 const char *jtag_tap_name(const struct jtag_tap *tap);
 struct jtag_tap* jtag_tap_by_string(const char* dotted_name);
 struct jtag_tap* jtag_tap_by_jim_obj(Jim_Interp* interp, Jim_Obj* obj);
+struct jtag_tap* jtag_tap_by_position(unsigned abs_position);
 struct jtag_tap* jtag_tap_next_enabled(struct jtag_tap* p);
 unsigned jtag_tap_count_enabled(void);
 unsigned jtag_tap_count(void);
long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]