Commit Graph

4127 Commits

Author SHA1 Message Date
David Brownell d60ebc0ab5 jtag/tcl.c cleanup -- split out "adapter.c"
Clean up the jtag/tcl.c file, which was one of the biggest and
messiest ones in that directory.  Do it by splitting out all the
generic adapter commands to a separate "adapter.c" file (leaving
the "tcl.c" file holding only JTAG utilities).

Also rename the little-used "jtag interface" to "adapter_name", which
should have been at least re-categorized earlier (it's not jtag-only).

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2010-03-27 10:07:13 -07:00
Antonio Borneo a092e8d237 NOR TCL: fix usage message
The command "flash bank" has updated syntax.
Add the mandatory parameter <target> to the usage message
that prints in case of error.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-03-26 09:14:56 +01:00
Antonio Borneo 27b98c2fa5 TCL scripts: update to current "flash bank" syntax
While "flash bank" syntax has been changed long ago,
several tcl script are still not fully update.

Fix following cases related with "cfi" driver:
- syntax error: the mandatory <name> parameter is missing
- warning: the <target> parameter is a number, instead of
  the target name
- the comment line above the command does not report
  actual syntax

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-03-26 08:42:58 +01:00
Øyvind Harboe ed81249129 zy1000: dev tool
first cut peek/poke over tcp/ip, used for debug/research
purposes only. Long term JTAG over TCP/IP might be an
offshoot. The performance is usable for development/testing
purposes.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-03-25 20:46:34 +01:00
Øyvind Harboe ed6756fb23 target: fix poll off
I don't know when "poll off" broke, but "poll off" didn't
stop background polling of target. The polling status flag
simply wasn't checked in the handle_target timer callback.

All target polling(including power/reset state) is now stopped
upon "poll off".

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-03-25 20:46:34 +01:00
Daniel Bäder 010492a1ed change %x and %d to PRIx32 and PRId32 where needed for cygwin 2010-03-25 12:45:32 +01:00
Øyvind Harboe e736468b0e zy1000: allow it to build on linux host for testing purposes
For testing and checking the build this can be useful,
it doesn't have any practical application outside development.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-03-25 09:50:37 +01:00
Antonio Borneo 4af724df23 telnet_server: review unused symbols
Remove unused function

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-03-25 07:44:59 +01:00
Antonio Borneo ec28c674af telnet_server: review scope of functions
Add "static" qualifier to private functions.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-03-25 07:44:55 +01:00
David Brownell d7dba8d346 FT2232 Messaaging fix
The init cleanup patch overlooked a message which was
wrongly specific to the "usbjtag" layout.  Fix.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2010-03-24 16:04:26 -07:00
Antonio Borneo 1cda3e64e4 server: review unused symbols
Remove unused function

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-03-24 07:44:28 +01:00
Antonio Borneo 9f1d9499ce server: review scope of functions and data
Add "static" qualifier to private functions and data.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-03-24 07:44:18 +01:00
Øyvind Harboe 721502f1d3 zy1000: fix optimisaion bug in dcc writes
Introduced & corrected since 0.4.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-03-22 08:28:19 +01:00
Mike Dunn 4be9eded7f fix software breakpoints on xscale
This patch fixes xscale software breakpoints by cleaning the dcache and
invalidating the icache after the bkpt instruction is inserted or removed.  The
icache operation is necessary in order to flush the fetch buffers, even if the
icache is disabled (see section 4.2.7 of the xscale core developer's manual).
The dcache is presumed to be enabled; no harm done if not.  The dcache is also
invalidated after cleaning in order to safeguard against a future load of
invalid data, in the event that cache_clean_address points to memory that is
valid and in use.

Also corrected a confusing typo I noticed in a comment.

TODO (or not TODO...?): the xscale's 2K "mini dcache" is not cleaned.  This
cache is not used unless the 'X' bit in the page table entry is set.  This is a
proprietary xscale extension to the ARM architecture.  If a target's OS or
executive makes use of this for memory regions holding code, the breakpoint
problem will persist.  Flushing the mini dcache requires that 2K of valid
cacheable memory (mapped with 'X' bit set) be designated by the user for this
purpose.  The debug handler that gets downloaded to the target will also need to
be extended.
2010-03-22 08:28:19 +01:00
Øyvind Harboe ccfaed8bc7 bitq: fix warning now that out_value is const
This was an easy one. Just add the missing "const" to a
local variable definition.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-03-22 07:21:09 +01:00
David Brownell c2f714bd44 ft2232 init mess cleanup
In the ft2232 driver, initialization for many layouts punts to a routine
called usbjtag_init(), instead of a routine specific to each layout.

That routine is  a mess  built around a "what type layout am I" core.
That's a bad design ... in this case, especially so, since it bypasses
the layout-specific dispatch which was just done, and obfuscates the
initialization which is at least somewhat generic, instead of being
specific to the "usbjtag" layout.

Split and document out the generic parts of usbjtag_init(), and make
the rest of those layouts have layout-specific init methods.  Also,
rename usbjtag_reset() ... that also was not specific to the "usbjtag"
layout, and thus contributed to the previous code structure confusion.

(Eventually, all layout-specific code (and method tables) should probably
live in files specific to each layout.  These changes will facilitate
those and other cleanups to this driver.)

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2010-03-21 22:49:23 -07:00
Øyvind Harboe b7811b7679 arm breakpoints: amended fix comment
the handling of caches, should be moved into the breakpoint
specific callbacks rather than being plonked into generic
memory write fn's.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-03-21 19:21:15 +01:00
Øyvind Harboe 5dcad2d34f jtag: make out_value const
Tightens up the jtag_add_xxx_scan() API

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-03-21 19:13:49 +01:00
Øyvind Harboe 96949890ee jtag: move towards making out_value const
These were relatively straightforward fixes which are
backwards compatible.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-03-20 11:16:49 +01:00
David Brownell 3b310dbac5 FT2232 comment tweaks
Note that the FT4232 chips have four channels not two, and
Elaborate on uses of the additional channels.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2010-03-19 10:31:44 -07:00
Øyvind Harboe 7373d1c342 zy1000: clean up jtag_add_xx_scan fn's
The implementation is now more straightforward as the
scan_fields have been greatly simplified over time.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-03-19 14:47:01 +01:00
Øyvind Harboe 03359b1680 zy1000: fix bug in end state of DCC writes
Introduced in latest commits, found by code inspection &
GCC warning.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-03-19 14:27:19 +01:00
Øyvind Harboe 7f6bab0c4c jtag: retire jtag_get/set_end_state()
Voila! This get rids of mysteries about what what
state the TAP is in.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-03-19 08:31:44 +01:00
Øyvind Harboe 15ff2aeca9 jtag: remove jtag_get_end_state() usage
Code inspection indicated what constant end states to
use.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-03-19 08:31:44 +01:00
Øyvind Harboe 1911c8ec8d jtag: get rid of unecessary jtag_get_end_state()
By code inspection.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-03-19 08:31:44 +01:00
Øyvind Harboe 7298452382 jtag: remove unecessary usage of jtag_get_end_state().
By code inspection.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-03-19 08:31:44 +01:00
Øyvind Harboe 8ce828dd38 jtag: remove jtag_get_end_state()'s that should be unecessary
By a bit of code inspection it seems like all of these
instances of jtag_get_end_state() can be unambigously
replaced by constants.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-03-19 08:31:44 +01:00
Mike Dunn 8d411d0d24 Fix underlying problem with xscale icache and dcache commands
Fix problem with the xscale icache and dcache commands.  Both commands were
enabling or disabling the mmu, not the caches

I didn't look any further after my earlier patch fixed the trivial problem
with command argument parsing.  Turns out the underlying code was broken.

The resolution is straightforward when you look at the arguments to
xscale_enable_mmu_caches() and xscale_disable_mmu_caches().  I finally
took a deeper look after dumping the cp15 control register (XSCALE_CTRL)
and seeing that the cache bits weren't changing, but the mmu bit was
(which caused all manner of grief, as you can imagine).  This has been
tested and works OK now.

 src/target/xscale.c |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2010-03-18 21:34:13 -07:00
David Brownell fc9de56a25 ADI_v5 - it's not always an "SWJ-DP"
So don't use the name "swjdp" for all DAPs; rename to
plain old "dap", which *is* always correct.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2010-03-18 12:32:35 -07:00
David Brownell c09035ea2c Merge branch 'master' of ssh://dbrownell@openocd.git.sourceforge.net/gitroot/openocd/openocd 2010-03-18 12:11:58 -07:00
David Brownell 52a788e008 remove more duplication
Not sure how the original "move code to adi_v5_swd.c" patch left
some code in the "arm_adi_v5.c" file, but a recent patch was only
a partial fix -- it didn't remove all the duplication.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2010-03-18 11:56:17 -07:00
Øyvind Harboe ec108ff59e jtag: retire one instance of jtag_get_end_state() usage
Less global variables....

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-03-18 12:08:11 +01:00
Øyvind Harboe 46f92878da oops: committed and pushed two temp files....
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-03-18 12:08:11 +01:00
Spencer Oliver d37ed9094a DOCS: update flash bank examples
- include the $_FLASHNAME in all flash bank examples.

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-03-18 09:36:00 +00:00
Spencer Oliver ae1c64706a PIC32MX: add unlock cmd
'unlock' performs a full unlock/erase of the device, removing any
code protection.

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-03-18 09:35:45 +00:00
Spencer Oliver b48a94f05d MIPS: remove unused arg from mips_ejtag_set_instr
This arg was never used and was just taken from the arm jtag code.

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-03-18 09:19:39 +00:00
Øyvind Harboe 36df240cea jtag: cut down on usage of unintended modification of global end state
jtag_get/set_end_state() is now deprecated.

There were lots of places in the code where the end state was
unintentionally modified.

The big Q is whether there were any places where the intention
was to modify the end state. 0.5 is a long way off, so we'll
get a fair amount of testing.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-03-18 08:43:19 +01:00
Øyvind Harboe fccdfc1cd7 linker error: fix problem with duplicate fn
A fn was copied instead of moved to a new file. The linker
can discard exact copies of fn's without warning.

This is a C++'ism.

However on my Ubuntu 9.10 machine, it fails.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-03-18 08:39:51 +01:00
Øyvind Harboe 0529431fe7 mips: fix warning
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-03-17 21:34:43 +01:00
Øyvind Harboe cc197c8086 gdb: long running "monitor mww" now works w/gdb
invoke keep_alive() to make sure that the default 2000ms
timeout does not trigger.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-03-17 12:59:33 +01:00
Øyvind Harboe bf71e34cbf target: faster mww operations
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-03-17 12:45:56 +01:00
Øyvind Harboe 099ffc754a target: mdX/mwX on target were badly broken
- incorrect parsing of arguments
- mdX didn't display arguments correctly

I don't think anyone ever used that code path :-)

Did you know that "target mdw" and mdw are very different?

for {set i 0} {$i < 256} {set i [expr $i+1]} {mwb [expr 0x2000000+$i] $i}

 mdw 0x2000000 0x10
0x02000000: 03020100 07060504 0b0a0908 0f0e0d0c 13121110 17161514 1b1a1918 1f1e1d1c
0x02000020: 23222120 27262524 2b2a2928 2f2e2d2c 33323130 37363534 3b3a3938 3f3e3d3c

> zy1000.cpu mdb 0x2000000 0x20
0x02000000 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f ................
0x02000010 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f ................
> zy1000.cpu mdh 0x2000000 0x20
0x02000000 0100 0302 0504 0706 0908 0b0a 0d0c 0f0e ................
0x02000010 1110 1312 1514 1716 1918 1b1a 1d1c 1f1e ................
0x02000020 2120 2322 2524 2726 2928 2b2a 2d2c 2f2e  !"#$%&'()*+,-./
0x02000030 3130 3332 3534 3736 3938 3b3a 3d3c 3f3e 0123456789:;<=>?
> zy1000.cpu mdw 0x2000000 0x20
0x02000000 03020100 07060504 0b0a0908 0f0e0d0c ................
0x02000010 13121110 17161514 1b1a1918 1f1e1d1c ................
0x02000020 23222120 27262524 2b2a2928 2f2e2d2c  !"#$%&'()*+,-./
0x02000030 33323130 37363534 3b3a3938 3f3e3d3c 0123456789:;<=>?
0x02000040 43424140 47464544 4b4a4948 4f4e4d4c @ABCDEFGHIJKLMNO
0x02000050 53525150 57565554 5b5a5958 5f5e5d5c PQRSTUVWXYZ[\]^_
0x02000060 63626160 67666564 6b6a6968 6f6e6d6c `abcdefghijklmno
0x02000070 73727170 77767574 7b7a7978 7f7e7d7c pqrstuvwxyz{|}~.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-03-17 12:45:24 +01:00
Spencer Oliver 3ad171cd53 SCRIPT: add add_script_search_dir cmd
Add a add_script_search_dir cmd so that adding search
dir's can be added to cfg scripts.

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-03-17 09:57:44 +00:00
Spencer Oliver e7e9bfde47 PIC32: add software reset support
The PIC32MX does not support the ejtag software reset - it is
optional in the ejtag spec.

We perform the equivalent using the microchip specific MTAP cmd's.

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-03-17 09:01:47 +00:00
Spencer Oliver 79ca05b106 MIPS: remove ejtag_srst variant
The mips_m4k_assert_reset has now been restructured
so the variant ejtag_srst is not required anymore.
The ejtag software reset will be used if the target does not
have srst connected.

Remove ejtag_srst from docs.

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-03-17 09:01:45 +00:00
Øyvind Harboe 051e2c99ab gdb_server: improved gdb load performance
by ack'ing memory writes immediately and reporting either
at next memory write or stepi/continue time. GDB will then
send off a new packet that is ready by the time the previous
packet has been written to target memory.

On faster adapters this can be as much as 10% improvement.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-03-17 07:40:00 +01:00
Øyvind Harboe 7e447043cd zy1000: tweak the DCC inner loop a tiny bit
Uses FIFO a bit more efficiently now.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-03-17 07:40:00 +01:00
Øyvind Harboe 1d9fba8c14 arm7/9: remove unused post_restore_context
Unused. If something should happen after context restore, then the
calling code can just do it afterwards.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-03-17 07:40:00 +01:00
David Brownell 6f8b8593d6 ADIv5 transport support moves to separate files
Unclutter arm_adi_v5.c by moving most transport-specific code
to a transport-specific files adi_v5_{jtag,swd}.c ... it's not
a full cleanup, because of some issues which need to be addressed
as part of SWD support (along with implementing the DAP operations
on top of SWD transport):

 - The mess where mem_ap_read_buf_u32() is currently coded to
   know about JTAG scan chains, and thus needs rewriting before
   it will work with SWD;

 - Initialization is still JTAG-specific

Also  move JTAG_{DP,ACK}_* constants from adi_v5.h to the JTAG
file; no other code should care about those values.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2010-03-16 14:12:00 -07:00
Øyvind Harboe 030ee192dd bitbang: add jtag_add_tms_seq support
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-03-16 21:44:38 +01:00