Compare commits

...

1599 Commits

Author SHA1 Message Date
Zachary T Welch
70f735007d The openocd 0.3.0-rc0 release.
Remove '-dev' version tag: 0.3.0-rc0-dev -> 0.3.0-rc0
2009-10-28 21:23:17 -07:00
David Brownell
ce88e8adf7 Cortex-M3: remove exports and forward decls
Unneeded exports cause confusion about the module interfaces.
Make most functions static, and fix some line-too-long issues.
Delete some now-obviously-unused code.

The forward decls are just code clutter; move their references
later, after the normal declarations.  (Or vice versa.)

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-28 10:53:11 -07:00
David Brownell
4d17541a2c ARM926: remove exports and forward decls
Unneeded exports cause confusion about the module interfaces.
Only the Feroceon code builds on this, so only routines it
reuses should be public..  Make most remaining functions
static, and fix some of the line-too-long issues.

The forward decls are just code clutter; move their references
later, after the normal declarations.  Turns out we don't need
even one forward declaration in this file.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-28 10:42:23 -07:00
Franck HÉRÉSON
053a763aa6 bugfix: stack corruption loading IHex images
The Hex parser uses a fixed number of sections.  When the
number of sections in the file is greater than that, the
stack get corrupted and a CHECKSUM ERROR is detected
which is very confusing.

This checks the number of sections read, and increases
IMAGE_MAX_SECTIONS so it works on my file.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-28 10:24:55 -07:00
Zachary T Welch
0b882951b7 Add script to test the release process.
Runs the release.sh script in a freshly cloned repository, charting
one hypothetical future of OpenOCD's lineage.
2009-10-27 23:53:15 -07:00
Zachary T Welch
e8dc384be9 Rewrite release script to use GIT.
Update documentation to reflect GIT methodology.  Rewrite release.sh
script to use appropriate process.  With this update, tools/release.sh
can be used for producing private release tags on local branches.
The documentation still needs work, but their use for v0.3.x should
help rectify the deficiences.
2009-10-27 23:47:31 -07:00
Zachary T Welch
07c85e41a4 Factor version munging capabilities out of release.sh. 2009-10-27 23:20:24 -07:00
Zachary T Welch
c970d03ddb Factor release version functions into new script. 2009-10-27 23:20:24 -07:00
Zachary T Welch
eb9790dc91 Add git2cl from repo.or.cz as a submodule in tools/git2cl. 2009-10-27 23:20:24 -07:00
Zachary T Welch
89c1bea931 Improve .gitignore rules.
A '.*' rule prevents the 'git submodule add' from correctly adding the
first submodule, because it creates the .gitmodule file.  This file will
not be added (without -f) result in incomplete submodule commits.
The new rules mask the specific files present in my own build tree, but
additional rules may be needed to hide other types of temporary files.
2009-10-27 23:20:24 -07:00
Nicolas Pitre
76afa936ba ARM: fix single-step of Thumb unconditional branch
Only type 1 branch instruction has a condition code, not type 2.
Currently they're both tagged with ARM_B which doesn't allow for the
distinction.

Signed-off-by: Nicolas Pitre <nico@marvell.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-27 19:25:54 -07:00
Nicolas Pitre
39dd68bca6 ARM: fix target address when disassembling Thumb BLX
A Thumb BLX instruction is branching to ARM code, and therefore the
first 2 bits of the target address must be cleared.

Signed-off-by: Nicolas Pitre <nico@marvell.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-27 19:25:54 -07:00
Oleg Seiljus
993fe4ab63 Signalyzer: H2 and H4 support
This patch includes partial support for these new JTAG adapters.
More complete support will require updates to the libftdi code,
for EEPROM access.

[dbrownell@users.sourceforge.net: fix whitespace, linelen, etc ]

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-27 12:40:24 -07:00
Oleg Seiljus
ad5192a2b9 Signalyzer: new config files
Add configs for H2, H4, LITE.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-27 11:56:04 -07:00
Nicolas Pitre
68937cadfb ARM: fix Thumb mode handling when single-stepping register based branch insns
Currently, OpenOCD is always caching the PC value without the T bit.
This means that assignment to the PC register must clear that bit and set
the processor state to Thumb when it is set.  And when the PC register
value is transferred to another register or stored into memory then
the T bit must be restored.

Discussion: It is arguable if OpenOCd should have preserved the original
PC value which would have greatly simplified this code.  The processor
state could then be obtained simply by getting at bit 0 of the PC.  This
however would require special handling elsewhere instead since the T bit
is not always relevant (like when PC is used with ALU insns or as an index
with some addressing modes).  It is unclear which way would be simpler in
the end.

Signed-off-by: Nicolas Pitre <nico@marvell.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-26 23:53:32 -07:00
Nicolas Pitre
068a6c7895 ARM: allow proper single stepping of Thumb BL and BLX instructions
Whenever an unconditional branch with the H bits set to 0b10 is met, the
offset must be combined with the offset from the following opcode and not
ignored like it is now.

A comment in evaluate_b_bl_blx_thumb() suggests that the Thumb2 decoder
would be a simpler solution.  That might be true when single-stepping of
Thumb2 code is implemented.  But for now this appears to be the simplest
solution to fix Thumb1 support.

Signed-off-by: Nicolas Pitre <nico@marvell.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-26 23:53:21 -07:00
Nicolas Pitre
ee8e93cb83 ARM: call thumb_pass_branch_condition() only for actual branch opcodes
Calling it first with every opcodes and then testing if the opcode
was indeed a branch instruction is wasteful and rather strange.
If ever thumb_pass_branch_condition() has side effects (say, like
printing a debugging traces) then the result would be garbage for most
Thumb instructions which have no condition code.

While at it, let's make the nearby code more readable by reducing some of
the redundant brace noise and reworking the error handling construct.

Signed-off-by: Nicolas Pitre <nico@marvell.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-26 23:53:07 -07:00
David Brownell
1020569b9f ft2232: less noise with _DEBUG_JTAG_IO_
Don't log "Yes, I'm *still* in TAP_IDLE" every seven runtest clocks.
2009-10-26 23:10:40 -07:00
David Brownell
0b476c9f4c JTAG: "jtag newtap ..." cleanup
Get rid of needless variable, improve and shrink diagnostic.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-26 23:06:22 -07:00
David Brownell
4a26390eec PXA255: force reset config
These chips need both SRST and TRST when debugging,
and SRST doesn't gate JTAG.
2009-10-26 22:59:46 -07:00
David Brownell
4a91b070ff omap3530: target reset/init improvements
Now I can issue "reset halt" and have everything act smoothly;
the vector_catch hardware is obviously not kicking in, but the
rest of the reset sequence acts sanely.

 - TAP "setup" event enables the DAP, not omap3_dbginit
   (resolving a chicken/egg bug I noted a while back)
 - Remove stuff from omap3_dbginit which should never be
   used in event handlers
 - Cope better with slow clocking during reset

Also, stop hard-wiring the target name: use the input params in
the standard way, and set up $_TARGETNAME as an output param.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-26 22:53:18 -07:00
David Brownell
ddade10d4a ARM ADIv5: "dap info" gets more readable
Make the "dap info" output more comprehensible:

 - Don't show CIDs unless they're incorrect (only four bits matter)
 - For CoreSight parts, interpret the part type
 - Interpret the part number
 - Show all five PID bytes together
 - Other minor cleanups

Also some whitespace fixes, and shrink a few overlong source lines.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-26 16:02:45 -07:00
Spencer Oliver
8f3b28ff41 Fix incorrect line endings
Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2009-10-26 22:39:24 +00:00
David Brownell
d87ee640c7 Merge branch 'master' of ssh://dbrownell@openocd.git.sourceforge.net/gitroot/openocd/openocd 2009-10-26 11:14:28 -07:00
Wookey
eaebc6cd69 balloon3 board base config
This is the very basic board config for the balloon3 board cpu JTAG
channel.

The rest of the config comprises another 14 .cfg files which I suspect
openocd doesn't really want all of. I'm still not sure how to deal
with this. I'll post another mail/patch to discuss.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-26 11:14:08 -07:00
Michael Roth
592e021543 SVF: fix parsing hex strings containing leading '0' characters
Ignore leading '0' characters on hex strings.  For example a bit
pattern consisting of 6 bits could be written as 3f, 03f or 003f and
so on.

Signed-off-by: Michael Roth <mroth@nessie.de>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-26 11:14:08 -07:00
Øyvind Harboe
8b30f22dec Idea for adding watchpoint masks. 2009-10-26 09:12:11 +01:00
David Brownell
6cb1d10cda JTAG: simple autoprobing
This patch adds basic autoprobing support for the JTAG scan chains
which cooperate.  To use, you can invoke OpenOCD with just:

 - interface spec: "-f interface/...cfg"
 - possibly with "-c 'reset_config ...'" for SRST/TRST
 - possibly with "-c 'jtag_khz ...'" for the JTAG clock

Then set up config files matching the reported TAPs.  It doesn't
declare targets ... just TAPs.  So facilities above the JTAG and
SVF/XSVF levels won't be available without a real config; this is
almost purely a way to generate diagnostics.

Autoprobe was successful with most boards I tested, except ones
incorporating C55x DSPs (which don't cooperate with this scheme
for IR length autodetection).  Here's what one multi-TAP chip
reported, with the "Warn:" prefixes removed:

 clock speed 500 kHz
 There are no enabled taps.  AUTO PROBING MIGHT NOT WORK!!
 AUTO auto0.tap - use "jtag newtap auto0 tap -expected-id 0x2b900f0f ..."
 AUTO auto1.tap - use "jtag newtap auto1 tap -expected-id 0x07926001 ..."
 AUTO auto2.tap - use "jtag newtap auto2 tap -expected-id 0x0b73b02f ..."
 AUTO auto0.tap - use "... -irlen 4"
 AUTO auto1.tap - use "... -irlen 4"
 AUTO auto2.tap - use "... -irlen 6"
 no gdb ports allocated as no target has been specified

The patch tweaks IR setup a bit, so we can represent TAPs with
undeclared IR length.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-26 00:36:03 -07:00
David Brownell
0cac8b67be minor fixes to TODO list 2009-10-25 16:30:30 -07:00
Øyvind Harboe
a07422c26c fix syntax of mww phys. 2009-10-25 22:15:57 +01:00
Øyvind Harboe
d785f552ee check if mmu is enabled before using mmu code path 2009-10-25 22:15:57 +01:00
David Brownell
19b84dafb0 ARM: rename "arm9tdmi vector_catch" to "arm9 ..."
And update doc accordingly.  That EmbeddedICE register was
introduced for ARM9TDMI and then carried forward into most
new chips that use EmbeddedICE.
2009-10-25 14:03:14 -07:00
David Brownell
e98817c463 JTAG: jtag_tap_init() bugfixes
Stop allocating three bytes per IR bit, and cope somewhat better
with IR lengths over 32 bits.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-25 13:07:57 -07:00
David Brownell
2a8aa3b7ef xscale: always reload handler after reset
Remove needless debug handler state.

 - "handler_installed" became wrong as soon as the second TRST+SRST
   reset was issued ... so the handler was never reloaded after the
   reset removed it from the mini-icache.

   This fixes the bug where subsequent resets fail on PXA255 (if the
   first one even worked, which is uncommon).  Other XScale chips
   would have problems too; PXA270 seems to have, IXP425 maybe not.

 - "handler_running" was never tested; it's pointless.

Plus a related bugfix: invalidate OpenOCD's ARM register cache on reset.
It was no more valid than the XScale's mini-icache.  (Though ... such
invalidations might be better done in "SRST asserted" callbacks.)

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-25 13:06:47 -07:00
Øyvind Harboe
0b436497e0 vector_catch and watchpoint TODO items. 2009-10-24 13:06:13 +02:00
David Brownell
75cdc8a260 arm9tdmi vector_catch: reserved means "don't use"
Bit 5 shouldn't be used.  Remove all support for modifying it.
Matches the exception vector table, of course ... more than one
bootloader uses that non-vector to help distinguish valid boot
images from random garbage in flash.
2009-10-23 12:28:03 -07:00
Øyvind Harboe
bfefe85645 Improve help for arm9 vector_catch. 2009-10-23 16:18:00 +02:00
Øyvind Harboe
cb854323c9 Remove debug output that could cause compile warnings. 2009-10-23 13:09:16 +02:00
Øyvind Harboe
0a1356c9cc mcr/mrc interface work. Implemented for arm926ejs and arm720t. mcr/mrc commands added. 2009-10-23 12:39:00 +02:00
Øyvind Harboe
18aad44f71 Embedded ICE version is now dumped with debug_level 1 2009-10-23 12:39:00 +02:00
David Brownell
79f71fad58 jtag: clean up TAP state name handling
Some cosmetic cleanup, and switch to a single table mapping
between state names and symbols (vs two routines which only
share that state with difficulty).

Get rid of TAP_NUM_STATES, and some related knowledge about
how TAP numbers are assigned.  Later on, this will help us
get rid of more such hardwired knowlege.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-23 01:02:22 -07:00
David Brownell
814183a5c4 SVF: clean up, mostly for TAP state name handling
- Use the name mappings all the other code uses:
    + name-to-state ... needed to add one special case
    + state-to-name
 - Improve various diagnostics:
    + don't complain about a "valid" state when the issue
      is actually that it must be "stable"
    + say which command was affected
 - Misc:
    + make more private data and code be static
    + use public DIM() not private dimof()
    + shorten the affected lines

Re the mappings, this means we're more generous in inputs we
accept, since case won't matter.  Also our output diagnostics
will be a smidgeon more informative, saying "RUN/IDLE" not
just "IDLE" (emphasizing that there can be side effects).

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-23 01:00:32 -07:00
Nicolas Pitre
517e812de3 Ferocion: fix corruption of r0 when resuming Thumb mode
The wrong variable (pc instead of r0) was used.  Furthermore, someone
did cover this error by stupidly silencing the compiler warning that
occurred before a dummy void reference to r0 was added to the code.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-22 21:21:09 -07:00
David Brownell
f593ff0a3d have "reg" command print cache names too
When dumping over 100 registers (as on most ARM9 + ETM cores),
aid readability by splitting them into logical groups.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-22 12:05:04 -07:00
David Brownell
344bed2f7e ETM: rename registers, doc tweaks
The register names are perversely not documented as zero-indexed,
so rename them to match that convention.  Also switch to lowercase
suffixes and infix numbering, matching ETB and EmbeddedICE usage.

Update docs to be a bit more accurate, especially regarding what
the "trigger" event can cause; and to split the issues into a few
more paragraphs, for clarity.

Make "configure" helptext point out that "oocd_trace" is prototype
hardware, not anything "real".

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-22 12:01:27 -07:00
Øyvind Harboe
3537c368fe disable ZY1000's UART forwarding test code. 2009-10-22 10:23:15 +02:00
Øyvind Harboe
fcf1301e52 mww_phys retired. Replaced by generic mww phys in target.c 2009-10-21 22:25:33 +02:00
Øyvind Harboe
e996452089 virt2phys is now implemented by target.c globally, retire target specific documentation. 2009-10-21 22:25:24 +02:00
Øyvind Harboe
1e5daf5886 retire obsolete mXY_phys commands. Handled by generic memory read/modify commands and target read/write physical memory callbacks. 2009-10-21 15:36:31 +02:00
Øyvind Harboe
2d45a10dfd read/write physical target fn's 2009-10-21 15:32:29 +02:00
Øyvind Harboe
85bf1627cd add support for target_read/write_phys_memory callbacks. 2009-10-21 14:46:12 +02:00
Øyvind Harboe
2783cba810 Added target_read/write_phys_memory() fn's. mdX/mwX commands updated to support phys flag to specify bypassing of MMU. 2009-10-21 14:45:39 +02:00
Øyvind Harboe
818cedaff3 Merge branch 'master' of ssh://gowinex@openocd.git.sourceforge.net/gitroot/openocd/openocd into HEAD 2009-10-21 13:20:29 +02:00
Øyvind Harboe
69a6037ce6 Retire obsolete and superfluous implementations of virt2phys in each target. This is done in a polymorphic implementation in target.c 2009-10-21 13:14:27 +02:00
Øyvind Harboe
e895246966 Retire obsolete and superfluous implementations of virt2phys in each target. This is done in a polymorphic implementation in target.c 2009-10-21 13:10:32 +02:00
Øyvind Harboe
a4a1de4dd1 First cut at implementing software breakpoints for mmu read only memory 2009-10-21 13:07:44 +02:00
Øyvind Harboe
62525792e0 Defined target_write_memory() to be able to handle implementing breakpoints for read only ram(e.g. MMU write protected. 2009-10-21 12:54:41 +02:00
Øyvind Harboe
a02411a15f eCos synthetic target updates. 2009-10-21 12:02:04 +02:00
David Brownell
7556a93aed XSVF: use svf_add_statemove()
XSVF improvements:

 - Layer parts of XSVF directly over SVF, calling svf_add_statemove()
   instead of expecting jtag_add_statemove() to conform to the SVF/XSVF
   requirements (which it doesn't).

   This should improve XSTATE handling a lot; it removes most users of
   jtag_add_statemove(), and the comments about how it should really do
   what svf_add_statemove() does.

 - Update XSTATE logic to be a closer match to the XSVF spec.  The main
   open issue here is (still) that this implementation doesn't know how
   to build and submit paths from single-state transitions ... but now
   it will report that error case.

 - Update the User's Guide to mention the two utility scripts for
   working with XSVF, and to mention the five extension opcodes.

Handling of state transition paths is, overall, still a mess.  I think
they should all be specified as paths not unlike SVF uses, and compiled
to the bitstrings later ... so that we can actually make sense of the
paths.  (And see the extra clocks, detours through RUN, etc.)

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-20 20:04:36 -07:00
Øyvind Harboe
a1609e5ad1 Removed unused interface_jtag_set_end_state and wrote down some notes on TCP/IP client/server scheme. 2009-10-20 15:54:53 +02:00
Øyvind Harboe
79e257a209 Added the faux flash driver and target. Used for testing. 2009-10-20 12:23:56 +02:00
Øyvind Harboe
ad75639611 Added 'unlock' option to flash write_image 2009-10-20 12:03:36 +02:00
Øyvind Harboe
e4dba30b63 More svn to git version string fixes. 2009-10-20 09:46:23 +02:00
David Brownell
6907ef9d50 SVF: better spec conformance for STATE switch
Don't add extra TCK in current state; exit from RESET had four extras.
Only IDLE --> IDLE needs such an extra clock.  (At least one TCK must
be issued.)

Allow entry to RESET; SVF allows it, so must we (despite those entries
being commented out of the statemove table).

When entering RESET, always use TLR ... we might end up with extra clocks
in reset that way, which is harmless, but we'll never end up in any other
state than RESET, which is useful paranoia.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-19 23:33:08 -07:00
David Brownell
c70073ef67 davinci: add watchdog reset method
Lightly tested on dm365.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-19 22:50:51 -07:00
David Brownell
d243e641d3 jtag_add_statemove() always uses TLR to get to RESET
As decided a while back, this isn't a transition we want to chance.
Whenever someone wants to got to RESET, force it.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-19 22:50:51 -07:00
David Brownell
3cc147efd9 SVF/XSVF: comment and whitespace fixes
SVF: comment the predefined/default paths; make them static const

SVF, XSVF: whitespace fixes, mostly so copyrights display sanely

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-19 22:50:51 -07:00
Zachary T Welch
53979244b1 Improve Makefile rules for XScale debug handler; fixes 'make distcheck'. 2009-10-19 19:59:02 -07:00
Redirect 'Slash' NIL
fb61f52731 MinGW: always use "-D__USE_MINGW_ANSI_STDIO"
This is unfortunately needed to make stdio work like OpenOCD expects -- matching
the ANSI-C standard, instead of MS-Windows.

I tested it in both MinGW-W64 on Vista 64 and MinGW-W32 on XP, and I don't
see any adverse effects to enabling it for all MinGW versions.
2009-10-19 17:55:40 -07:00
Redirect 'Slash' NIL
0388a9c0e5 MinGW: use WinSock2
After reading a bit further, it appears that ws2_32 (Windows Sockets 2)
is included in all versions of Windows and backwards compatible with
wsock32, at least according to

 http://msdn.microsoft.com/en-us/library/ms740673%28VS.85%29.aspx.

Only Win95 seems to require a manual installation; is not a big deal.

So I think we can drop this whole business of detecting 64 bit MinGW and
just use -lws2_32 for all MinGW platforms.
2009-10-19 17:48:19 -07:00
David Brownell
6ec1026bbb Doc: jtag_init must validate scan chain too
Same requirement as like init_reset, and for the same reason:
we need to start with a known and working state.
2009-10-19 14:45:43 -07:00
Nicolas Pitre
6726b78707 fix single step of bx instruction going into Thumb mode
Without this fix, the following code cannot be single stepped:

	add	ip, pc, #1
	bx	ip
	[thumb code here]
2009-10-19 22:04:07 +02:00
David Brownell
97166327db Ignore openocd.exe for "git status" 2009-10-19 09:53:45 -07:00
Redirect 'Slash' NIL
113679ff59 corrective fix for MinGW GNU C99 printf compliance
Compilation on cygwin, using gcc v3 with option -mno-cygwin,
currently produces a large number of the following warnings:

   warning: `gnu_printf' is an unrecognized format function type

These have been introduced with the recent MinGW GNU C99 printf
compliance patch, as gnu_printf was only introduced with gcc v4.4
and is not recognized with earlier versions.

The attached fix adds gcc version detection to the previous patch
to avoid the problem.
2009-10-19 09:49:34 -07:00
oyvind
557d1b6490 Sync with official Jim Tcl repository. 2009-10-19 15:16:42 +02:00
oyvind
89a8a37998 Switch from svn to git version string handling. 2009-10-19 15:08:52 +02:00
Dean Glazeski
76b4ee8935 SDRAM and clock configuration for the SAM9-L9260 board from Olimex 2009-10-18 22:26:38 +02:00
Redirect 'Slash' NIL
990f50a73b safer conversion to HANDLER on MinGW-W64
Assign to "intptr_t", which on some versions of MS-Windows
will widen the variable; then cast to HANDLE.
2009-10-17 22:18:38 -07:00
David Brownell
5cf0af002c Ignore two more generated files
On Windows the name is "bin2char.exe".
All operating systems now have "xscale_handler.h".
2009-10-17 17:50:23 -07:00
Redirect 'Slash' NIL
73349dc5ac More MinGW C99 printf compliance
Passing "--std=gun99" is unfortunately not sufficient to make current
MinGW compilers conform with respect to checking printf format strings.
(The C runtime seems not to have problems.)

Fix by using a "gnu_printf" format specifier not "printf".
2009-10-17 17:47:52 -07:00
Redirect \"Slash\" NIL
c9fbfbd95c jim-eventloop for MinGW-w64
Use JIM_WIDE_MODIFIER for the sscanf format, and apply it for MINGW32 as
well as other Windows environments.  (Microsoft doesn't conform to the
C99 standard, and uses "%I64d" not "%lld" for "long long".)

NB: __MINGW32__ should work on both w32 and w64,.
2009-10-17 12:15:13 -07:00
David Brownell
05d6716936 build tweak for bin2char
Work better when building outside the source tree.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-17 12:14:19 -07:00
David Brownell
cb7965da15 xscale: better fix for debug_handler.bin
Generate a C struct with the data, and use that, instead of an
assembly language file.  The assembly language causes issues on
Darwin and MS-Windows, which don't necessarily use GNU AS; or
if they do, don't necessarily use its ELF syntax.

It's also better in two other ways:  fewer global symbols; and
the init-time size check gets optimized away at compile time.
(Unless it fails, in which case bigger chunks of the file vanish.)

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-16 13:52:40 -07:00
David Brownell
a61b57a87f another portability update
Just use "%p" instead of consing up some integral type for pointer printf.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-14 20:24:31 -07:00
David Brownell
510db585fd portability updates
Based on some patches from <redirect.slash.nil@gmail.com>
for preliminary Win64 compilation.  More such updates are
needed, but they need work.  Compile tested on 64 and 32 bit
Linuxes, and Cygwin.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-14 20:04:33 -07:00
David Brownell
bc792857a5 doc updates to match "help" better
This makes the documentation a closer match to "help" output:

 - "pathmove" somehow was not documented in the User's Guide

 - "jtag_nsrst_assert_width" and "jtag_ntrst_assert_width"
   are new; both needed descriptions.

 - Removed two undocumented and fairly useless script mechanisms:
    * production/production_info/production_test ... using it,
      requires replacing everything; so having it adds no value.
    * cpu ... way out of date; hopeless to keep that current

Note that anyone using that "production" stuff already defines
their own procedures, and can keep using them with no change.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-14 15:18:00 -07:00
Wookey
dd54981702 Fw: [PATCH] OpenRD board configuration
Ofrwarded from Ron, who's not subscribed.

----- Forwarded message from Ron <ron@debian.org> -----

From: Ron <ron@debian.org>
Date: Wed, 14 Oct 2009 04:50:17 +1030
To: wookey@debian.org
Subject: [PATCH] OpenRD board configuration
X-Spam-Status: No, score=-3.6 required=4.5 tests=BAYES_00,RCVD_IN_DNSWL_LOW
	autolearn=ham version=3.2.5

This piggybacks on the 'sheevaplug' layout which uses the same Kirkwood SoC.

Signed-off-by: Ron Lee <ron@debian.org>
2009-10-14 15:51:57 +02:00
Øyvind Harboe
a894c2d8b2 S29WS-N CFI query fix is to try 0x555 if 0x55 fails. 2009-10-14 12:01:52 +02:00
Øyvind Harboe
4490a42a09 Work in progress on arm11 reset. Assert srst. 2009-10-14 11:14:04 +02:00
Øyvind Harboe
44e9200d0a iMX target config script's ported from Freescale BSP. 2009-10-14 11:04:44 +02:00
David Brownell
1ee8ef4210 Fix problems building xscale_debug.S 2009-10-14 11:04:37 +02:00
David Brownell
7afc181e42 omap2420.cfg updates
Remove ircapture/mask attributes.  Add "srst_nogate".

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-14 02:00:34 -07:00
Lennert Buytenhek
9b9bc78ef1 fix detection of PLD instructions
Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-13 15:35:01 -07:00
Lennert Buytenhek
ed1e45b388 fix pass_condition() LE condition code check
The LE check is obviously buggy (as easily triggered during some
testing), but I didn't audit the rest of the cases.

Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-13 15:33:04 -07:00
David Brownell
5535399a46 cosmetic cleanup in TMS tables
Cleanup comments and layout/whitespace in the TMS tables.
Table contents stayed the same (ignoring whitespace).

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-13 10:55:24 -07:00
Yauheni Kaliuta
6a2fd7cad5 Cleanup: nuke trailling whitespaces
Signed-off-by: Yauheni Kaliuta <y.kaliuta@gmail.com>
2009-10-13 19:16:57 +02:00
Yauheni Kaliuta
bc0cc62afd Do not replace virt2phys with the default one if it was assigned
Signed-off-by: Yauheni Kaliuta <y.kaliuta@gmail.com>
2009-10-13 17:55:44 +02:00
Øyvind Harboe
79bf27da71 Retired gdb_attach. gdb-detach event covers this functionality. 2009-10-13 13:44:15 +02:00
Øyvind Harboe
4d32b6eee9 Missing type for eCos. 2009-10-13 13:13:29 +02:00
Øyvind Harboe
20c8f64f0a Fix warning. 2009-10-13 12:22:23 +02:00
Øyvind Harboe
1f917bdc0c Delete commented out code. Add a bit of error checking. 2009-10-13 12:10:23 +02:00
Øyvind Harboe
f8cd850c4d arm11 seems to gate JTAG when srst is asserted 2009-10-13 12:10:23 +02:00
Øyvind Harboe
86cbbe8a4a Propagate error from assert, deassert and halt on tcl target object. 2009-10-13 12:10:23 +02:00
David Brownell
b6c4d1006f xscale: stackframe corruption bugfix
Resolve a "FIX" comment; yes that was superfluous given that the
JTAG core does that check by default.  It was also buggy since it
wrote to a stack frame that went away before the write happened!!

Other fixes:  remove pointless malloc(); zero-init scan_field_t
values wherever they appear; whitespace scrub; spelling fix.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-13 01:21:24 -07:00
Øyvind Harboe
85398ccdcf More error propagation fixes. 2009-10-12 15:25:00 +02:00
Øyvind Harboe
23c629a85e arm11 burst writes are now only enabled for writes larger than 1 word. Single word writes are frequently used from reset init scripts to non-memory peripherals. 2009-10-12 15:13:44 +02:00
Wookey
407061eaa6 Xilinx xcr3256.cfg basic config script 2009-10-12 15:12:35 +02:00
Øyvind Harboe
35affce085 Retire arm11 no_increment. Intended for future expansion to read/write to ports. New arm11 commands would have to be added to exploit it. 2009-10-12 14:21:38 +02:00
Øyvind Harboe
0ca473468c Propagate wDTR/rDTR failure immediately, otherwise it's followed up by timeout errors. 2009-10-12 14:10:49 +02:00
Øyvind Harboe
165e3a1468 Fix warning and improve error message upon burst transfer failure 2009-10-12 14:09:10 +02:00
Øyvind Harboe
bbd7e22f0b burst writes work fine. clean up junk. 2009-10-12 14:08:29 +02:00
Øyvind Harboe
b5b4fee811 Fix bogus 'transfer errors' with arm11 'memwrite burst enable'. A regression introduced in b8103660fa36a77158bd77379572c09913d85c00 2009-10-12 11:59:18 +02:00
David Brownell
5e837387aa simplify XScale debug handler installation
Load the XScale debug handler from the read-only data section
instead of from a separate file that can get lost or garbaged.
This eliminates installation and versioning issues, and also
speeds up reset handling a bit.

Plus some minor bits of cleanup related to loading that handler:
comments about just what this handler does, and check fault codes
while writing it into the mini-icache.

The only behavioral changes should be cleaner failure modes after
errors during handler loading, and being a bit faster.

NOTE:  presumes GNU assembly syntax, with ".incbin"; and ELF,
because of the syntax of the ".size" directive.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-12 02:39:18 -07:00
David Brownell
9f6c23f479 more xscale cleanup (mostly removing JTAG hooks)
Streamline/shrink some needless JTAG stuff:

 - Use #defines for the JTAG instructions; they can't ever change
 - Remove an unused (!) shadow of tap->ir_length
 - Stop using a copy of target->tap
 - Don't bother saving the variant after sanity checking ir_length

Also, make target_create() work as on other targets:  build the
register cache later, making init_target() no longer be a NOP.
Handle malloc failure; remove a comment that was obsoleted by the
not-so-new target syntax.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-12 02:39:01 -07:00
Øyvind Harboe
026559068d Merge commit 'origin/master' 2009-10-12 09:28:56 +02:00
Øyvind Harboe
c8d935ab7c If halt times out, stop GDB. Allows e.g. manual reset via monitor commands. 2009-10-12 09:27:27 +02:00
Øyvind Harboe
b23b096c8e Supply default reset_config statement to make target scripts useful standalone and provide sensible default 2009-10-12 09:25:08 +02:00
David Brownell
2d924a59db xscale_load_ic cleanup
Remove unused and deprecated (in the arch spec) mode for loading
code into the *main* icache (vs the "mini" icache).  Disable some
extremely noisy (and rarely useful) low-level debug messages

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-11 10:35:52 -07:00
David Brownell
688003cb23 xscale.c cleanup
Declare almost everything as static.
Move stuff to remove most forward references.
Remove most forward declarations.
Warn if the unimplemented register functions get called.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-11 10:35:28 -07:00
David Brownell
8b3bfcfc5b xscale bugfix to handler loading
Just fill out the rest of the cache line with NOPs; don't change
the record of how much data we consumed.  Otherwise the count of
how much data is left can roll over from positive to negative
("VERY positive") and skip the loop termination of zero.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-11 10:06:08 -07:00
David Brownell
5aba621b55 xscale minor cleanup
Add a header comment referencing useful XScale specs.
Make most data static, and the tables readonly.
Scrub extra blank lines.
Return fault codes from one routine.
Remove a needless NOP methood.

(BUGFIX) When we update R0, mark R0 as dirty/valid ... not R15/PC!

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-11 02:52:00 -07:00
David Brownell
a0b1e05b53 printf format warning fixes
Observed on a Cygwin build.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-10 11:32:39 -07:00
Wookey
456ec36795 Fix reset delays and tinker with ID's 2009-10-10 09:08:06 +02:00
David Brownell
dbf7440148 tweak new "translating ..." text
Fix formatting and layout bugs in the new "translating configuration
files" bit.  Make it a section within the chapter about config files.
Add a crossreference.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-09 15:51:16 -07:00
David Brownell
bc13c12be9 add documentation about reset customization
We added two overridable procedures; document them, and the
two jtag arp_* operations they necessarily expose.

Update the comment about the jtag_init_reset() routine; it's
been obsolete for as long as it's had SRST support.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-09 12:52:42 -07:00
Øyvind Harboe
c3428f5b7a Stop debug session if halt fails 2009-10-09 10:31:40 +02:00
Øyvind Harboe
8f09c5df85 ARM11 error checking 2009-10-09 10:00:05 +02:00
Øyvind Harboe
20a3b14828 Merge commit 'origin/master' 2009-10-09 09:14:27 +02:00
Øyvind Harboe
bffe824df6 Added tip in documentation on how to translate quirky syntax 2009-10-09 09:03:53 +02:00
David Brownell
60e24aa597 make PXA255 targets enumerate sort-of-OK
Startup now mostly works, except that the initial target state
is "unknown" ... previously, it refused to even start.

Getting that far required fixing the ircapture value (which
can never have been correct!) and the default JTAG clock rate,
then providing custom reset script.

The "reset" command is still iffy.  DCSR updates, and loading
the debug handler, report numerous DR/IR capture failures.
But once that's done, "poll" reports that the CPU is halted
(which it shouldn't be, this was "reset run"!), due to the
rather curious reason "target-not-halted".

Summary:  you still can't debug these parts, but it's closer.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-08 23:51:50 -07:00
David Brownell
6160a946ec add overridable Tcl "init_reset"
This abstracts the "jtag arp_init-reset" call into a method
called from OpenOCD startup and reset processing.

Platforms which have different requirements for how such hard
resets must be performed can now override "init_reset" instead
of needing to rebuild custom hacked versions of the server.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-08 23:51:50 -07:00
David Brownell
5b352c9e79 minor JTAG init messaging tweaks
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-08 23:51:50 -07:00
Rabeeh Khoury
7b650a6abe Function to flash SheevaPlug u-boot sectors
This function is used by the SheevaPlug installer to flash the
erase and re-flash the U-Boot environment in the NAND Flash.
2009-10-08 17:10:52 -07:00
David Brownell
41c1af7c67 initial builds of OSK5912 boards need srst_pulls_trst
This is clearly noted in the hardware spec (section 5.2.3); it
works around a chip erratum:  "If the MPU_RESET signal is used,
it may cause the EMIFS bus to lock."

I seem to have a board with such an initial build.  The chip
is labeled XOMAP.  Presumably, parts without that "X" prefix
(eXperimental) resolve this.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-08 13:15:18 -07:00
David Brownell
a8234af06c prevent abort via polling during jtag_reset
Observed:

  openocd: core.c:318: jtag_checks: Assertion `jtag_trst == 0' failed.

The issue was that nothing disabled background polling during calls
from the TCL shell to "jtag_reset 1 1".  Fix by moving the existing
poll-disable mechanism to the JTAG layer where it belongs, and then
augmenting it to always pay attention to TRST and SRST.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-08 11:14:00 -07:00
David Brownell
40c9668b70 Stop ignoring most scan chain validation errors
Among other things this causes startup errors to kick in the
fallback "reset harder" logic during server startup.  Comments
are also updated a bit, explaining what the various error paths
signify (in at least my observation).

There's one class of validation error that we can still plausibly
ignore:  when wrong IDCODE values are observed.

This change seems to have helped make an OMAP5912 behave much
more reliably.  There's still some post-reset flakiness, but
it's unrelated to scan verification.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-08 09:16:01 -07:00
David Brownell
22aff82cae Merge branch 'master' of ssh://dbrownell@openocd.git.sourceforge.net/gitroot/openocd/openocd 2009-10-08 07:32:47 -07:00
Øyvind Harboe
4aacf01e19 Testing committing changes to .gitignore to ignore more build output 2009-10-08 15:43:51 +02:00
Øyvind Harboe
cf7eae176e Add .project to .gitignore 2009-10-08 15:27:09 +02:00
Øyvind Harboe
f525f2ef0d Stop GDB when polling fails, srst assert or powerdropout is detected 2009-10-08 14:53:25 +02:00
Øyvind Harboe
d75b9ec697 Update copyright statements. Make it easier to sync with Jim Tcl 2009-10-08 13:56:57 +02:00
David Brownell
6efaa95c44 make OMAP5912 resets more reliable
Without some extra delay after releasing SRST, we seemed to
be trying to talk to the TAP before it was ready to respond.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-07 23:29:18 -07:00
John Rigby
37e9f65f5a iMX25 target support
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-07 21:49:36 -07:00
David Brownell
7252a72465 Houston, we have Mirror! 2009-10-07 19:11:37 -07:00
David Brownell
8a162e5e06 Merge branch 'master' of ssh://dbrownell@openocd.git.sourceforge.net/gitroot/openocd/openocd 2009-10-07 17:14:58 -07:00
dbrownell
03c9e48f88 Change most in-tree references from SVN to GIT.
Also, talk about "mainline" not "trunk".

The release.txt and release.sh files need more updates.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2825 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-10-08 00:13:50 +00:00
dbrownell
cdc33b3808 Force sane SRST and TRST initialization
At least some FT2232 based adapters don't necessarily come up
in the expected state, with SRST and TRST disabled.  Since
other adapters could suffer the same problem, let's avoid
needing to patch every driver and just force *all* adapters
to initialize those values properly at server startup.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2824 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-10-07 19:02:21 +00:00
dbrownell
246ff4f601 Better fix for TAPs violating the JTAG spec for IR-Capture.
Instead of just assuming all IDCODE-deprived TAPs violate the
JTAG spec (they don't!), just require TAPs with such problems
to be declared with proper ircapture/irmask values.  Example,
with mask and value of zero.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2823 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-10-07 18:51:11 +00:00
dbrownell
7035b37e71 Remove much #ifdeffery around _DEBUG_JTAG_IO_ usage.
Have DEBUG_JTAG_IO() always trigger necessary warnings.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2822 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-10-07 17:30:51 +00:00
dbrownell
4c450b5c6b buildfix
git-svn-id: svn://svn.berlios.de/openocd/trunk@2821 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-10-07 16:28:44 +00:00
David Brownell
55f4e430e8 Merge branch 'master' of ssh://dbrownell@openocd.git.sourceforge.net/gitroot/openocd/openocd 2009-10-07 09:16:39 -07:00
dbrownell
f8c8d8bc72 Remove pointless "target library" chapter.
It had a very little bit of content; move that to the more extensive
chapter on config file guidelines, and give more current "ls" output
to show the available library code.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2820 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-10-07 16:15:21 +00:00
dbrownell
f2dc1eeef1 Note bug in handling of variables through command line parameters.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2819 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-10-07 15:56:11 +00:00
dbrownell
b83d79a42f Updates for "reset_config":
- revert to previous default: don't talk JTAG during SRST
 - add "srst_nogates" flag, the converse of "srst_gates_jtag"
 - with no args, display the current configuration

And update the User's Guide text with bullet lists to be a bit more clear.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2818 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-10-07 15:31:33 +00:00
oharboe
dc871f422d first stab at imx35 reset init script
git-svn-id: svn://svn.berlios.de/openocd/trunk@2817 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-10-07 12:21:58 +00:00
oharboe
71bca7640a remove recrusive reset invocation from reset init callback
git-svn-id: svn://svn.berlios.de/openocd/trunk@2816 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-10-07 12:20:06 +00:00
oharboe
616c154866 add timeouts and fix syntax error handling of mrc/mcr commands.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2815 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-10-07 12:19:17 +00:00
oharboe
b4e4532dd2 add timeouts and fix syntax error handling of mrc/mcr commands.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2814 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-10-07 12:05:37 +00:00
oharboe
40ac8d7753 increase pause before reboot so web interface remains responsive when issuing a reboot of zy1000
git-svn-id: svn://svn.berlios.de/openocd/trunk@2813 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-10-07 11:03:56 +00:00
oharboe
53dea2f952 Do not check ir capture if there is no IDCODE
git-svn-id: svn://svn.berlios.de/openocd/trunk@2812 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-10-07 11:03:01 +00:00
oharboe
e4cc19521b 1.55 snapshot
git-svn-id: svn://svn.berlios.de/openocd/trunk@2810 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-10-07 06:53:44 +00:00
dbrownell
b1f7b35983 Change version labels to work better with GIT
- The guess-rev.sh script is now a tweaked version of "setlocalversion" as
   seen in Linux, U-Boot, and various other projects.  When it finds source
   control support (git, hg, svn) it uses IDs from there.  Else (specific
   to this project) it reports itself as "-snapshot", e.g. from gitweb.

   I verified this new "guess-rev.sh" script runs under Cygwin.

 - Also update the generic version strings to be like "0.3.0-dev" (during
   development) instead of the very long "0.3.0-in-development".  These also
   show up in the PDF docs.  For better tracking, we might eventually change
   these strings to include the version IDs too.

 - Change the startup banner version strings so they include the guess-rev
   output.  Development and release versions with GIT will be like

    Open On-Chip Debugger 0.3.0-dev-00282-g7191a4f-dirty (2009-10-05-20:57) 
    Open On-Chip Debugger 0.3.0 (2009-10-05-20:57) 

   instead of the previous SVN-specific (even when using git-svn!)

    Open On-Chip Debugger 0.3.0-in-development (2009-10-05-01:39) svn:exported
    Open On-Chip Debugger 0.3.0 (2009-10-05-01:39) Release



git-svn-id: svn://svn.berlios.de/openocd/trunk@2809 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-10-07 05:43:05 +00:00
David Brownell
a343b18bfb Merge branch 'master' of ssh://dbrownell@openocd.git.sourceforge.net/gitroot/openocd/openocd 2009-10-06 15:58:06 -07:00
dbrownell
0da2f750a1 Add basic support for DM6446 EVM board.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2808 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-10-06 22:56:52 +00:00
dbrownell
60f8770502 Dragonite has the same EICE affliction as feroceon.
From: Nicolas Pitre <nico@fluxnic.net>


git-svn-id: svn://svn.berlios.de/openocd/trunk@2807 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-10-06 22:55:46 +00:00
dbrownell
7d78021efa Dragonite target script
From: Nicolas Pitre <nico@fluxnic.net>


git-svn-id: svn://svn.berlios.de/openocd/trunk@2806 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-10-06 22:55:04 +00:00
David Brownell
4119cd6db2 Merge branch 'master' of ssh://dbrownell@openocd.git.sourceforge.net/gitroot/openocd/openocd 2009-10-06 08:29:23 -07:00
oharboe
39b57471bf Introduced jtag_init and "jtag arp_init" to allow target scripts more control over how OpenOCD starts up and initializes the target.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2805 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-10-06 08:10:57 +00:00
oharboe
a2886fe3c6 stop using targetnum
git-svn-id: svn://svn.berlios.de/openocd/trunk@2804 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-10-06 08:10:05 +00:00
dbrownell
00f2c9e062 Take "patches" out of .gitignore ... Win32 is case-crazy
git-svn-id: svn://svn.berlios.de/openocd/trunk@2803 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-10-06 05:28:30 +00:00
David Brownell
0d3632adff Merge branch 'master' of ssh://dbrownell@openocd.git.sourceforge.net/gitroot/openocd/openocd 2009-10-05 16:49:51 -07:00
dbrownell
64ec7f66a8 Add initial ".gitignore".
git-svn-id: svn://svn.berlios.de/openocd/trunk@2802 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-10-05 23:45:14 +00:00
David Brownell
7280a52e69 Merge branch 'master' of ssh://dbrownell@openocd.git.sourceforge.net/gitroot/openocd/openocd 2009-10-05 01:27:43 -07:00
dbrownell
7a57c31619 Improve jtag_validate_ircapture() diagnostics.
Bugfix the error message so it shows the disliked value, and add
a debug message showing each TAP's IR capture value, all N bits.

This just changes diagnostics ... it still ignores the parameters
given to us at TAP declaration time.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2801 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-10-05 08:23:33 +00:00
dbrownell
7c7467b34f Add a new JTAG "setup" event; use for better DaVinci ICEpick support.
The model is that this fires after scanchain verification, when it's
safe to call "jtag tapenable $TAPNAME".  So it will fire as part of
non-error paths of "init" and "reset" command processing.  However it
will *NOT* trigger during "jtag_reset" processing, which skips all
scan chain verification, or after verification errors.

ALSO:
 - switch DaVinci chips to use this new mechanism
 - log TAP activation/deactivation, since their IDCODEs aren't verified
 - unify "enum jtag_event" scripted event notifications
 - remove duplicative JTAG_TAP_EVENT_POST_RESET


git-svn-id: svn://svn.berlios.de/openocd/trunk@2800 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-10-05 08:20:28 +00:00
dbrownell
16a7ad5799 Minor cleanup to ARM926 debug entry:
- don't needlessly export this function
 - handle "case 0" debug method-of-entry better (silent by default)

The "case 0" is a valid debug entry mode so it doesn't deserve the
warning int now gets.  But it probably means that OpenOCD confused
itself somehow; or that it confused the ARM9EJS target.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2799 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-10-05 08:18:17 +00:00
dbrownell
3aa9fabfe9 Update the NEWS file to cover more of the user-visible changes.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2798 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-10-05 08:14:57 +00:00
dbrownell
c6b24fb4f0 Get rid of needless OMAP and Davinci target config options
so they provide better examples and are easier to maintain.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2797 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-10-05 08:13:00 +00:00
mlu
f87985b614 Updated reset event handling in omap3530 cfg
git-svn-id: svn://svn.berlios.de/openocd/trunk@2796 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-10-02 16:52:02 +00:00
mlu
16742b529b It is not possible to invalidate I-Cache on memory writes while the target is running
git-svn-id: svn://svn.berlios.de/openocd/trunk@2795 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-10-02 16:50:42 +00:00
mlu
49f3497bfa Make sure that DSCR_DTR_RX is not full before writing
git-svn-id: svn://svn.berlios.de/openocd/trunk@2794 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-10-02 16:44:16 +00:00
mlu
1b90a9f5eb More error reporting in Cortex_a8 execute_opcode
git-svn-id: svn://svn.berlios.de/openocd/trunk@2793 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-10-02 16:39:50 +00:00
mlu
84dabdcc72 Added asser_reset and deassert_reset for cortex_a8
git-svn-id: svn://svn.berlios.de/openocd/trunk@2792 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-10-02 16:37:22 +00:00
mlu
c74ede4248 Added asser_reset and deassert_reset for cortex_a8
git-svn-id: svn://svn.berlios.de/openocd/trunk@2791 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-10-02 16:36:03 +00:00
dbrownell
1033633321 Minor ETB and ETM bugfixes and doc updates
- ETB
    * report _actual_ hardware status, not just expected status
    * add a missing diagnostic on a potential ETB setup error
    * prefix any diagnostics with "ETB"
 - ETM
    * make "etm status" show ETM hardware status too, instead of
      just traceport status (which previously was fake, sigh)
 - Docs
    * flesh out "etm tracemode" docs a bit
    * clarify "etm status" ... previously it was traceport status
    * explain "etm trigger_percent" as a *traceport* option

ETM+ETB tracing still isn't behaving, but now I can see that part of 
the reason is that the ETB turns itself off almost immediately after
being enabled, and before collecting any data.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2790 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-10-02 09:19:03 +00:00
mlu
d340906476 ARMv7A: Report fault status registers when in Abort state
git-svn-id: svn://svn.berlios.de/openocd/trunk@2789 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-10-01 17:39:13 +00:00
zwelch
e3d82fe24d Update release process documentation.
- Improve and clarify the wording of the introduction.
- Add section on version taggging.
- Some other minor corrections.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2788 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-30 23:20:52 +00:00
zwelch
1beb24a61c Improve release script version tag management commands.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2787 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-30 23:20:43 +00:00
zwelch
eccd9059d3 Add numeric version tag support to release script.
The release process itself does not use this support yet, but it allows
packagers to automate the process of managing their own tags, if they
patch the source code before releasing binaries.  The release processes
should be revised to incorporate this feature to support -rc packages.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2786 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-30 23:20:36 +00:00
zwelch
740fd107f2 Improve release script version handling commands.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2785 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-30 23:20:20 +00:00
zwelch
14be119906 Add workaround to release script to update source code URL keyword.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2784 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-30 23:20:13 +00:00
zwelch
7b9f01e0ae Document and automate signature creation for the release archives.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2783 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-30 23:20:06 +00:00
zwelch
8624535b80 Fix release script bugs after experience from 0.2.0:
- The NEWS step failed due to an empty commit comment.
- The final release step would have failed, because the steps to switch
  from the secure to insecure repository (and back again) require both
  switch and a URL relocation steps


git-svn-id: svn://svn.berlios.de/openocd/trunk@2782 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-30 23:19:53 +00:00
dbrownell
32599fab1a Remove annoying EOL whitespace (again, sigh).
git-svn-id: svn://svn.berlios.de/openocd/trunk@2781 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-30 23:02:15 +00:00
mlu
aaf1daa056 Add DSCR_DTR_RX_FULL bit define
git-svn-id: svn://svn.berlios.de/openocd/trunk@2780 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-30 17:24:43 +00:00
oharboe
54c16fc56e strip gdb config options
git-svn-id: svn://svn.berlios.de/openocd/trunk@2779 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-30 05:40:40 +00:00
oharboe
642519649e michal smulski <michal.smulski@ooma.com> reset now works
git-svn-id: svn://svn.berlios.de/openocd/trunk@2778 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-30 05:37:32 +00:00
dbrownell
e4de4251fe Streamline Capture-IR validation code
- Don't issue needless JTAG resets ... only do them after
   errors. Normal exit now leaves every TAP in BYPASS.
   
 - Fix an unlikely memory leak on one fault path.

 - Remove the oddball limitation that invalid capture LSBs 
   trigger errors only for TAPs that support IDCODE.

Re the JTAG reset:  there are too many of them, and they can
(and do!) change system state.  So the needless ones should
get removed.  This one was especially pointless.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2777 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-29 19:28:08 +00:00
dbrownell
6d4cdddbe2 ARM11 command handling fixes
- Commands were supposed to have been "arm11 memwrite ..."
   not "memwrite ..."
 - Get rid of obfuscatory macros
 - Re-alphabetize
 - Add docs for "arm11 vcr"


git-svn-id: svn://svn.berlios.de/openocd/trunk@2776 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-29 18:30:06 +00:00
dbrownell
4297209ac9 Make "-expected-id 0" suppress warnings; not unlike it used to do.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2775 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-29 18:26:18 +00:00
dbrownell
bde4a40422 Doc updates: add section on target software changes, minor fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@2774 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-29 18:20:30 +00:00
dbrownell
d96e3eae23 ETM: fix build issue on MinGW.
The Win32 global namespace is rather cluttered...


git-svn-id: svn://svn.berlios.de/openocd/trunk@2773 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-29 18:08:16 +00:00
dbrownell
afc3a5cc6f ETB: cleanup needless symbol exports and forward decls.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2772 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-29 18:06:26 +00:00
oharboe
f4fce92f28 handle single threading
git-svn-id: svn://svn.berlios.de/openocd/trunk@2771 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-29 14:24:02 +00:00
oharboe
035b6ba84b reentry assert
git-svn-id: svn://svn.berlios.de/openocd/trunk@2770 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-29 14:23:42 +00:00
oharboe
9bdbffb8cc httpd smoketest info
git-svn-id: svn://svn.berlios.de/openocd/trunk@2769 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-29 13:46:26 +00:00
oharboe
c5949a03a7 added t/nsrst_assert_width commands
git-svn-id: svn://svn.berlios.de/openocd/trunk@2768 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-29 06:07:50 +00:00
oharboe
e3a0647558 if srst pulls trst, then set state to TAP_RESET.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2767 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-28 12:22:20 +00:00
oharboe
62b7e1ce64 spelling fix
git-svn-id: svn://svn.berlios.de/openocd/trunk@2766 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-28 12:13:49 +00:00
dbrownell
cbe34d0819 Shrink symbols exported from arm9tdmi.c and remove a forward ref.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2765 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-28 04:55:23 +00:00
dbrownell
9a4e650083 Add list of JTAG adapter drivers with TAP_RESET statemove bug.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2764 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-27 17:08:42 +00:00
dbrownell
817ea3f4e4 Update FT2232 driver so that it reliably enters TAP_RESET.
When the OpenOCD server starts up it records its state as TAP_RESET,
even though it could be anything.  Then when it starts to examine
the scan chain, it calls jtag_add_tlr() which sees it doesn't have
any work to do, and so it does nothing.  This can make the next
operations fail because they start from the wrong TAP state...

Instead of caring about the current recorded state, always enter
TAP_RESET by forcing five clocks with TMS high.

(NOTE:  it seems most other JTAG adapter drivers have this same bug.)


git-svn-id: svn://svn.berlios.de/openocd/trunk@2763 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-27 16:55:52 +00:00
dbrownell
fbbd3066ff Don't provide invalid OMAP5912 IR capture value/mask attributes
git-svn-id: svn://svn.berlios.de/openocd/trunk@2762 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-27 07:59:10 +00:00
dbrownell
5c3c4af88f On DM355 EVM board, associate NAND chips with $_TARGETNAME
instead of a target number.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2761 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-26 22:08:50 +00:00
dbrownell
2329ae9306 Diagnostics tweaks for jtag_examine_chain() failure paths.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2760 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-26 22:01:24 +00:00
dbrownell
f64e924ba9 Updates to the initial scanchain validation code:
- minor bug fixes
  - code cleanup
  - update comments
  - improve diagnostics
  - etc


git-svn-id: svn://svn.berlios.de/openocd/trunk@2759 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-26 19:18:42 +00:00
dbrownell
2e210ee48f Streamline Capture-IR handling and integrity test.
Change the handling of the "-ircapture" and "-irmask" parameters
to be slightly more sensible, given that the JTAG spec describes
what is required, and that we already require that conformance in
one place.  IR scan returns some bitstring with LSBs "01".

 - First, provide and use default values that satisfy the IEEE spec.
   Existing TAP configs will override the defaults, but those parms
   are no longer required.

 - Second, warn if any TAP gets set up to violate the JTAG spec.
   It's likely a bug, but maybe not; else this should be an error.
   Improve the related diagnostics to say which TAP is affected.

And associated minor fixes/cleanups to comments and diagnostics.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2758 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-26 19:08:34 +00:00
dbrownell
ad43374c7f Update DM355 target config to know about ICEpick.
Still defaults to nonstandard EMU0/EMU1 settings.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2757 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-25 17:02:59 +00:00
oharboe
43b3807878 Michael Hasselberg <mh@open-engineering.de> target configuration files for Toshiba TX09 familiy
git-svn-id: svn://svn.berlios.de/openocd/trunk@2756 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-25 16:48:15 +00:00
oharboe
1c262c8826 Try/catch scheme. Typed up the functionality and regression tested.
Ready for discussion and tiny patches that tries out this scheme.

git-svn-id: svn://svn.berlios.de/openocd/trunk@2755 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-25 11:11:39 +00:00
oharboe
37755ffdb6 When attaching GDB to OpenOCD, the target state is no longer affected.
Added gdb_sync feature that allows GDB to sync up to target state.
Issue "monitor gdb_sync" and the next stepi, will return immediately
with updated register values to GDB.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2754 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-24 06:34:23 +00:00
dbrownell
23e22b6ec4 Start handling the (second) SRST stage of reset better:
make sure that when there are two or more targets, their
various pre/post event reports are correctly ordered.

Previously, only the first target always saw its "pre"
method before SRST was asserted or deasserted.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2753 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-23 22:03:41 +00:00
dbrownell
22045fa6f2 When setting up an ETM, cache its ETM_CONFIG register. Then
only expose the registers which are actually present.  They
could be missing for two basic reasons:

 - This version might not support them at all; e.g. ETMv1.1
   doesn't have some control/status registers.  (My sample of
   ARM9 boards shows all with ETMv1.3 support, FWIW.)

 - The configuration on this chip may not populate as many
   registers as possible; e.g. only two data value comparators
   instead of eight.

Includes a bugfix in the "etm info" command:  only one of the
two registers is missing on older silicon, so show the first
one before bailing.

Update ETM usage docs to explain that those registers need to be
written to configure what is traced, and that some ETM configs
are not yet handled.  Also, give some examples of the kinds of
constrained trace which could be arranged.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2752 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-23 21:52:40 +00:00
dbrownell
d9ce8a2f60 Start cleaning up ETM register handling. On one ARM926 ETM+ETB
system, removes 20 non-existent registers ... but still includes
over 45 (!) ETM registers which don't even exist there ...

 - Integrate the various tables to get one struct per register
 - Get rid of needless per-register dynamic allocation
 - Double check list of registers:
    * Remove sixteen (!) non-registers for data comparators
    * Remove four registers that imply newer ETM than we support
    * Change some names to match current architecture specs
 - Handle more register info
    * some are write-only
    * some are read-only
    * record which versions have them, just in case
 - Reorganize the registers to facilitate removing the extras
    * group e.g. comparator/counter #N registers together
    * add and use lookup-by-ID


git-svn-id: svn://svn.berlios.de/openocd/trunk@2751 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-23 09:16:00 +00:00
dbrownell
a6d858ebcd Initial ETM cleanups. Most of these are cosmetic:
- Add a header comment
 - Line up the ETM context struct, pack it a bit
 - Remove unused context_id (this doesn't support ETMv2 yet)
 - Make most functions static
 - Remove unused string table and other needless lines of code
 - Correct "tracemode" helptext

Also provide and use an etm_reg_lookup() to find entries in the ETM
register cache.  This will help cope with corrected contents of that
cache, which doesn't include entires for non-existent registers.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2750 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-23 07:49:38 +00:00
oharboe
7393fcfc90 Nico Coesel <ncoesel@dealogic.nl> fix warnings. . I'm wondering why these
didn't turn up earlier. Is everyone still using gcc 3.x? Or is the x86
version of gcc 4.x much more relaxed?

git-svn-id: svn://svn.berlios.de/openocd/trunk@2749 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-23 07:14:03 +00:00
ntfreak
6521b75ec2 - fix build issue under win32 (cygwin/msys) from svn r2746
git-svn-id: svn://svn.berlios.de/openocd/trunk@2748 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-22 15:39:23 +00:00
ntfreak
a2a3620d35 - add missing svn props from previous commit
git-svn-id: svn://svn.berlios.de/openocd/trunk@2747 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-22 14:50:46 +00:00
dbrownell
50b94628ae Make it easier to erase or protect through to the end
of a (NOR) flash chip: allow passing "last" as an alias
for the number of the last sector.

Improve several aspects of error checking while we're at it.

From: Johnny Halfmoon <jhalfmoon@milksnot.com>


git-svn-id: svn://svn.berlios.de/openocd/trunk@2746 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-22 05:39:06 +00:00
dbrownell
6cba486356 Update presentation of TAP events and tap enable/disable.
Highlight that the "post-reset" event kicks in before the
scan chain is validated, which limits what can be done
in a post-reset handler.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2745 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-21 21:35:56 +00:00
dbrownell
b11d79110e Remove annoying end-of-line whitespace from doc/* files.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2744 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-21 18:52:45 +00:00
dbrownell
71af49ca7f Remove annoying end-of-line whitespace from tcl/* files
git-svn-id: svn://svn.berlios.de/openocd/trunk@2743 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-21 18:48:22 +00:00
dbrownell
86a7d813a1 Remove annoying end-of-line whitespace from most src/*
files; omitted src/httpd


git-svn-id: svn://svn.berlios.de/openocd/trunk@2742 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-21 18:40:55 +00:00
oharboe
0bcf5a6b76 Ethan Eade <ethan@evolution.com> board config script for Cogent CSB732 i.MX35 (arm1136)
git-svn-id: svn://svn.berlios.de/openocd/trunk@2741 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-21 09:25:52 +00:00
dbrownell
108028112f Ensure that DaVinci chips can't start with a too-fast JTAG clock.
It can be sped up later, once it's known the PLLs are active.

Note that modern tools from TI all use adaptive clocking; and
that if that's done with OpenOCD, "too fast" is also a non-issue.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2740 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-21 00:37:58 +00:00
dbrownell
d20103cd93 Update the jtag-examine_chain() logic to verify that there's no
garbage after the expected data (from the TAPs' BYPASS or IDCODE
registers).

NOTE that there was previously some code that looked like it was
trying to do this ... which didn't work, because it was looping
over the list of expected TAPs, and never checked *after* that
list completed!  That could hide some *nasty* reset issues...

Also replace a now-obsolete scanchain length test with one that
behaves correctly; and update reporting of unexpected IDCODEs.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2739 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-21 00:04:35 +00:00
dbrownell
48e96a18ed Enhancement: stm32 flash protection error message
This patch modifies an error message which, in its original state,
I find somewhat unhelpful. So a small hint was added.

Signed-off-by: Johnny Halfmoon <jhalfmoon at milksnot.com>


git-svn-id: svn://svn.berlios.de/openocd/trunk@2738 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-20 23:54:13 +00:00
dbrownell
24df719b09 Update the User's Guide to cover the scan chain verification step
done on exit from the config stage, how JTAG clocking issues can
trigger errors there, and how to avoid such problems.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2737 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-20 21:17:08 +00:00
dbrownell
0c4b119d3f Debug message updates:
- Shrink messaging during resets, primarily by getting rid of
   "nothing happened" noise that hides *useful* information.

 - Improve: the "no IDCODE" message by identifying which tap only
   supports BYPASS; and the TAP event strings.

Related minor code updates:

 - Remove two needless tests when examining the chain:  we know
   we have a TAP, and that all TAPs have names.

 - Clean up two loops, turning "while"s into "for"s which better
   show what's actually being done.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2736 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-20 07:55:11 +00:00
dbrownell
75581ffea6 Minor regression bugfix for the jtag_tap_handle_event() case
for disabling TAPs.  We don't actually know how to make any
JRCs which do that yet; but when we do, this will matter.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2735 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-20 07:46:22 +00:00
mlu
965b331d0b Added CPUDBG_WCR_BASE define
git-svn-id: svn://svn.berlios.de/openocd/trunk@2734 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-19 20:38:38 +00:00
mlu
781997f556 Avoid cache invalidation when writing to hardware debug registers
git-svn-id: svn://svn.berlios.de/openocd/trunk@2733 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-19 14:50:18 +00:00
mlu
01735c515f Reduced sleep time after reset
git-svn-id: svn://svn.berlios.de/openocd/trunk@2732 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-19 14:47:53 +00:00
dbrownell
3e87fc20ab Style cleanup for the updated ft2232_add_pathmove().
Indentation, whitespace, line lengths.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2731 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-19 06:54:01 +00:00
dbrownell
2d3bcddf04 Minor behavior fixes for the two JTAG reset events (C/internal,
and Tcl/external):

 - Reorder so *both* paths (TCK/TMS or TRST) can enable TAPs with
   ICEpick ... first C code flags TAPs that got disabled, then call
   any Tcl code that might want to re-enable them.

 - Always call the C/internal handlers when JTAG operations can be
   issued; previously that wasn't done when TRST was used. 

Plus some small cleanups (whitespace, strings, better messaging
during debug and on some errors) to reset-related code.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2730 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-19 06:49:40 +00:00
dbrownell
74ae645623 Minor tweaks to description of JTAG adapter/dongle issues.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2729 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-19 06:42:50 +00:00
mlu
7b3be0e21e Move Cortex A8 debug access initialisation from omap3530.cfg to cortex_a8.c
git-svn-id: svn://svn.berlios.de/openocd/trunk@2728 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-18 15:11:46 +00:00
oharboe
631b2ab244 remove unused externs
git-svn-id: svn://svn.berlios.de/openocd/trunk@2727 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-18 07:09:44 +00:00
dbrownell
358263f484 Tweak TCL reset script ... mostly improving descriptions of
the various steps, but also calling [target names] only once.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2726 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-18 00:11:51 +00:00
dbrownell
e961bd14d9 Address codereview comment from Steve Grubb <sgrubb@redhat.com>:
avoid a duplicate test.

Plus other cleanup in the same code: be "static", sane line lengths
for source and diagnostics, and fix misleading variable names.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2725 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-17 19:20:18 +00:00
dbrownell
9536577c02 Minor fixes to NAND code and docs
Erase logic:
 - command invocation
    + treat "nand erase N" (no offset/length) as "erase whole chip N"
    + catch a few more bogus parameter cases, like length == 0 (sigh)
 - nand_erase() should be static
 - on error
    + say which block failed, and if it was a bad block
    + don't give up after the first error; try to erase the rest
 - on success, say which nand device was erased (name isn't unique)

Device list ("nand list"):
 - say how many blocks there are
 - split summary into two lines
 - give example in the docs

Doc tweaks:
 - Use @option{...} for DaVinci's supported hardware ECC options

For the record, I've observed that _sometimes_ erasing bad blocks causes
failure reports, and that manufacturer bad block markers aren't always
erasable (even when erasing their blocks doesn't trigger an error report).


git-svn-id: svn://svn.berlios.de/openocd/trunk@2724 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-17 18:56:17 +00:00
dbrownell
9655c5b093 Fix coredump seen in some code paths.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2723 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-17 18:52:32 +00:00
oharboe
84f51bf50c michal smulski <michal.smulski@ooma.com> fix regression in jtag_add_pathmove() which broke arm11 in r1825. Other uses of jtag_add_pathmove are svn + xsvf + xscale...
git-svn-id: svn://svn.berlios.de/openocd/trunk@2722 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-17 12:25:53 +00:00
oharboe
1dd302883d prefix zy1000_reboot command to avoid name conflicts
git-svn-id: svn://svn.berlios.de/openocd/trunk@2721 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-17 11:44:14 +00:00
oharboe
016e7ebbfa srst_gates_jtag option. at91sam9260 needs retesting, and possibly srst_gates_jtag added to reset_config. Could i.MX27 be a case where srst does not pull trst, but really srst gates jtag clock?
git-svn-id: svn://svn.berlios.de/openocd/trunk@2720 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-17 11:23:41 +00:00
dbrownell
cb7ad25c04 The "arm9tdmi.c" file is more of a generic ARM9 support file:
- update comments to say so.
 - update docs to clarify that the "arm9tdmi" command prefix
   is a misnomer.
 - bugfix some messages that wrongly assume only ARM9TDMI
   based processors use this code.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2719 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-17 08:02:43 +00:00
dbrownell
e18bd3b55e Doc update: mention how ARM's WFI instruction affects
JTAG clocking by gating the core clock, and workarounds.
Most details are with the "halt" command, which is one
of the first places this issue will be noticed.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2718 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-17 07:56:24 +00:00
mlu
9b11eebf33 Remove unused varables (moved to armv7a)
git-svn-id: svn://svn.berlios.de/openocd/trunk@2717 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-16 18:18:38 +00:00
mlu
45f03dd9b5 Use a variable armv7a->debug_base instead of hardedcoded OMAP3530_DEBUG_BASE
git-svn-id: svn://svn.berlios.de/openocd/trunk@2716 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-16 18:17:26 +00:00
oharboe
9542318312 Rolf Meeser <rolfm_9dq@yahoo.de> adds flash support for NXP's LPC2900 family (ARM968E).
git-svn-id: svn://svn.berlios.de/openocd/trunk@2715 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-16 12:38:26 +00:00
mlu
6d2473b65b Define debug_base, debug_ap, memory_ap in armv7a_common_t
git-svn-id: svn://svn.berlios.de/openocd/trunk@2714 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-15 16:20:39 +00:00
mlu
f0ddb40ced Updated mode string list.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2713 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-15 15:50:09 +00:00
mlu
7e4f9ac697 Definy symbolic values for VA to PA address translation operations
git-svn-id: svn://svn.berlios.de/openocd/trunk@2712 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-15 15:41:14 +00:00
oharboe
388e94d5c1 fix bug when using 32 instead of 64 bit value in callback, caught by -Wall
git-svn-id: svn://svn.berlios.de/openocd/trunk@2711 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-15 14:20:37 +00:00
oharboe
379386743a added embedded ice programming while srst is asserted todo item
git-svn-id: svn://svn.berlios.de/openocd/trunk@2710 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-15 09:41:09 +00:00
mlu
45674af63a Check return values to avoid infinite wait in loop on error.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2709 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-14 22:41:47 +00:00
mlu
d4e4d65d28 Cache invalidation when writing to memory
git-svn-id: svn://svn.berlios.de/openocd/trunk@2708 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-14 22:36:27 +00:00
oharboe
14dc22612b error message upon recursive invocation of reset from reset event handlers
git-svn-id: svn://svn.berlios.de/openocd/trunk@2707 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-14 13:54:49 +00:00
oharboe
5a6980869b fix email address
git-svn-id: svn://svn.berlios.de/openocd/trunk@2706 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-14 08:03:57 +00:00
oharboe
8e39f86ef4 Rolf Meeser <rolfm_9dq@yahoo.de> warning fix in previous commit was wrong. target_code_size needs the real value later.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2705 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-14 07:48:28 +00:00
oharboe
9816f2ecda fix warning
git-svn-id: svn://svn.berlios.de/openocd/trunk@2704 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-14 06:06:35 +00:00
oharboe
772d8d06ea Magnus Lundin <lundin@mlu.mine.nu> Disable poll while core register initialization
git-svn-id: svn://svn.berlios.de/openocd/trunk@2703 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-13 20:07:13 +00:00
mlu
d4607c1f7c More CortexA8 debug register definitions.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2702 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-13 17:26:07 +00:00
mlu
c4ee12ea77 Fix argument passing in cortex_a8_write_cp.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2701 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-13 13:57:50 +00:00
oharboe
a17eb667a3 Dirk Behme <dirk.behme@googlemail.com> document post TAP reset event
git-svn-id: svn://svn.berlios.de/openocd/trunk@2700 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-12 13:05:20 +00:00
oharboe
40f361dd94 David Brownell <david-b@pacbell.net>
Update the board config for the DaVinci DM355 EVM so the reset-init
event handler does the rest of the work it should do:

 - minor PLL setup bugfixes
 - initialize the DDR2 controller
 - probe both NAND banks
 - initialize UART0
 - enable the icache


git-svn-id: svn://svn.berlios.de/openocd/trunk@2699 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-12 08:11:45 +00:00
oharboe
c993d75d1f David Brownell <david-b@pacbell.net>
Cleanup some the downloaded ARM target algorithm code:

 - Provide more complete disassembly of the DCC bulk write code

 - Make code blocks "static const", in case GCC doesn't

 - Fix some tabbing/layout issues

 - Make some arm7_9_common.h flags be "bool" not "int"; and compact
   the layout a bit (group most bools together)

git-svn-id: svn://svn.berlios.de/openocd/trunk@2698 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-12 08:10:19 +00:00
oharboe
f6a29d438e David Brownell <david-b@pacbell.net> some early todo items on run_algorithm
git-svn-id: svn://svn.berlios.de/openocd/trunk@2697 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-11 21:14:31 +00:00
oharboe
4f7761828c tap post reset event added. Allows omap3530 to send 100 runtest idle tickle's after a TAP_RESET.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2696 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-11 18:34:15 +00:00
ntfreak
ec3015db1a - revert change made to sheevaplug.cfg in rev2573
git-svn-id: svn://svn.berlios.de/openocd/trunk@2695 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-11 14:08:28 +00:00
oharboe
25f9a466ca Nicolas Pitre <nico@cam.org> put feroceon target definition at the end so to avoid a
bunch of useless forward declarations.

git-svn-id: svn://svn.berlios.de/openocd/trunk@2694 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-11 08:04:50 +00:00
oharboe
00e900f8a1 Nicolas Pitre <nico@cam.org> Dragonite support
git-svn-id: svn://svn.berlios.de/openocd/trunk@2693 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-11 08:03:46 +00:00
oharboe
f89d1cbfd6 spelling mistake
git-svn-id: svn://svn.berlios.de/openocd/trunk@2692 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-11 07:46:50 +00:00
oharboe
0dcfbec7fb do not use dynamically sized stack arrays, not compatible with embedded OS's
git-svn-id: svn://svn.berlios.de/openocd/trunk@2691 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-11 07:43:36 +00:00
oharboe
58b78818e0 registering a target event twice caused infinite loop. Same bug as in jtag/core.c copy & pasted.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2690 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-11 06:58:49 +00:00
oharboe
6dd8f37e6d syntax error fix
git-svn-id: svn://svn.berlios.de/openocd/trunk@2689 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-11 06:08:51 +00:00
oharboe
9b1a938a22 Alexei Babich <a.babich@rez.ru> cleanup
git-svn-id: svn://svn.berlios.de/openocd/trunk@2688 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-11 06:01:28 +00:00
oharboe
c5f54c5333 Nicolas Pitre <nico@cam.org> tighten error checking in bulk_write
git-svn-id: svn://svn.berlios.de/openocd/trunk@2687 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-11 05:57:51 +00:00
oharboe
49d0ea2126 eol-style:native
git-svn-id: svn://svn.berlios.de/openocd/trunk@2686 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-10 13:35:08 +00:00
oharboe
9262e0dbdf Alexei Babich <a.babich@rez.ru> imx31 nand flash controller support
git-svn-id: svn://svn.berlios.de/openocd/trunk@2685 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-10 13:17:25 +00:00
oharboe
3bade442b1 Alexei Babich <a.babich@rez.ru> fix problems with unecessary tailend byte accesses. Use 16 bit access on tailend of a memory read if possible.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2684 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-10 13:17:05 +00:00
oharboe
b4acbee47f michal smulski <michal.smulski@ooma.com> telo target/board scripts
git-svn-id: svn://svn.berlios.de/openocd/trunk@2683 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-10 08:06:22 +00:00
oharboe
7b5ddb4a58 Rolf Meeser <rolfm_9dq@yahoo.de>
This patch adds target algorithm support for those flash devices that do not support DQ5 polling. So far they could only be programmed with host algorithm, but this was way too slow.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2682 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-09 16:11:33 +00:00
oharboe
983f5a1ae9 - Fix bug-in-waiting when adding more than one TAP event type
- Infinite loop bugfix when running tap configure a second time


git-svn-id: svn://svn.berlios.de/openocd/trunk@2681 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-09 07:09:14 +00:00
oharboe
aa46b15377 David Brownell <david-b@pacbell.net>
Optionally shave time off the armv4_5 run_algorithm() code:  let
them terminate using software breakpoints, avoiding roundtrips
to manage hardware ones.

Enable this by using BKPT to terminate execution instead of "branch
to here" loops.  Then pass zero as the exit address, except when
running on an ARMv4 core.  ARM7TDMI, ARM9TDMI, and derived cores
now set a flag saying they're ARMv4.

Use that mechanism in arm_nandwrite(), for about 3% speedup on a
DaVinci ARM926 core; not huge, but it helps.  Some other algorithms
could use this too (mostly flavors of flash operation).

git-svn-id: svn://svn.berlios.de/openocd/trunk@2680 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-09 06:28:49 +00:00
oharboe
8b2b0071a9 David Brownell <david-b@pacbell.net>
Fix docs on ARM11 MCR and MRC coprocessor commands:
correct read-vs-write; and describe the params.

(ARM920 and ARM926 have cp15-specific commands; this
approach is more generic.  MCR2, MRC2, MCRR, MCRR2,
MRRC, and MRRC2 instructions could also get exposed.)

git-svn-id: svn://svn.berlios.de/openocd/trunk@2679 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-09 06:27:47 +00:00
mlu
857c06ca8b Report correct core instruction state for ARMv/A targets
git-svn-id: svn://svn.berlios.de/openocd/trunk@2678 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-08 15:32:18 +00:00
mlu
f6a5749c1b Load PC with bit 0 set to 1 when resuming to say in Thumb instruction state.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2677 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-08 15:31:24 +00:00
oharboe
5dae4753ff David Brownell <david-b@pacbell.net>
Provide an "armv7a disassemble" command.  Current omissions include
VFP (except as coprocessor instructions), Neon, and various Thumb2
opcodes that are not available in ARMv7-M processors.

git-svn-id: svn://svn.berlios.de/openocd/trunk@2676 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-08 06:18:45 +00:00
oharboe
57e12b7e45 David Brownell <david-b@pacbell.net>
lean up some loose ends with the ARM disassembler

 - Add a header comment describing its current state and uses
   and referencing the now-generally-available V7 arch spec

 - Support some mode switch instructions:
    * Thumb to Jazelle (BXJ)
    * Thumb to ThumbEE (ENTERX)
    * ThumbEE to Thumb (LEAVEX)

 - Improve that recent warning fix (and associated whitespace goof)

 - Declare the rest of the internal code and data "static".  A
   compiler may use this, and it helps clarify the scope of these
   routines (e.g. what changes to them could affect).


git-svn-id: svn://svn.berlios.de/openocd/trunk@2675 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-08 06:17:33 +00:00
mlu
2c76cd7171 Improved handling of instruction set state, helps for debugging Thumb state.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2674 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-07 20:19:17 +00:00
oharboe
a690ee3c0c Mahr, Stefan <Stefan.Mahr@sphairon.com> removes the endianness swapping in mips_m4k.c Swapping is already done in target.c
git-svn-id: svn://svn.berlios.de/openocd/trunk@2673 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-04 19:35:10 +00:00
oharboe
0b11e4dbb4 use "armv4_5 core_state arm" instead of soft_reset_halt, fewer side effects
git-svn-id: svn://svn.berlios.de/openocd/trunk@2672 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-04 11:03:26 +00:00
oharboe
b13dbc80e0 Dirk Behme <dirk.behme@googlemail.com> retire jtag_speed usage
git-svn-id: svn://svn.berlios.de/openocd/trunk@2671 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-04 08:27:27 +00:00
oharboe
982ac083f0 Dirk Behme <dirk.behme@googlemail.com> Add default fall back freqency.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2670 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-04 08:27:08 +00:00
oharboe
2e29131f2b set ARM mode using explicit command rather than soft_reset_halt which has lots of side effects.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2669 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-04 08:23:24 +00:00
oharboe
81b57a3fb6 Matt Hsu <matt@0xlab.org> This patch simply enables the halting debug mode.
By enabling this bit, the processor halts when a debug event
such as breakpoint occurs.

git-svn-id: svn://svn.berlios.de/openocd/trunk@2668 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-04 08:22:02 +00:00
oharboe
ee329275d3 more debug output for breakpoints
git-svn-id: svn://svn.berlios.de/openocd/trunk@2667 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-04 08:21:18 +00:00
oharboe
51be978b43 Matt Hsu <matt@0xlab.org> Tidy up the bit-offset operation for DSCR register
git-svn-id: svn://svn.berlios.de/openocd/trunk@2666 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-04 05:20:45 +00:00
oharboe
ce89c7bf65 David Brownell <david-b@pacbell.net> "set _TARGETNAME ..." cleanup
git-svn-id: svn://svn.berlios.de/openocd/trunk@2665 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-04 05:17:03 +00:00
oharboe
76b78feef1 David Claffey <dnclaffey@gmail.com> get rid of reset recursion
git-svn-id: svn://svn.berlios.de/openocd/trunk@2664 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-04 05:14:32 +00:00
oharboe
a89dd2ca65 David Brownell
Abstract the orion_nand_fast_block_write() routine into a separate
routine -- arm_nandwrite() -- so that other ARM cores can reuse it.

Have davinci_nand do so.  This faster than byte-at-a-time ops by a
factor of three (!), even given the slowish interactions to support
hardware ECC (1-bit flavor in that test) each 512 bytes; those could
be read more efficiently by on-chip code.

NOTE that until there's a generic "ARM algorithm" structure, this
can't work on newer ARMv6 (like ARM1136) or ARMv7A (like Cortex-A8)
cores, though the downloaded code itself would work just fine there.

git-svn-id: svn://svn.berlios.de/openocd/trunk@2663 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-03 08:23:39 +00:00
oharboe
3878b12793 David Claffey <dnclaffey@gmail.com> tested with the Atheros reference design "PB44"
git-svn-id: svn://svn.berlios.de/openocd/trunk@2662 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-02 17:34:35 +00:00
duane
cde17a42e9 Crusty Code fixes from the tcl directory re-arragements
git-svn-id: svn://svn.berlios.de/openocd/trunk@2661 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-02 00:17:39 +00:00
ntfreak
f7f38fa70d - fixes the incorrect info msg displayed during stellaris flash programming.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2660 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-01 10:08:41 +00:00
ntfreak
fbf775c0b7 - fix a regression when using cortex_m3 emulated dcc channel
git-svn-id: svn://svn.berlios.de/openocd/trunk@2659 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-01 10:08:00 +00:00
duane
a41725c788 Warning fix
git-svn-id: svn://svn.berlios.de/openocd/trunk@2658 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-31 12:21:12 +00:00
oharboe
bb5f713e44 Gary Carlson <gcarlson@carlson-minot.com> config file
git-svn-id: svn://svn.berlios.de/openocd/trunk@2657 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-31 09:06:01 +00:00
oharboe
0dd669f2a7 Ferdinand Postema <ferdinand@postema.eu> config script for the MMnet1001 module from Propox.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2656 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-31 06:02:01 +00:00
oharboe
2a86a53c3f David Brownell <david-b@pacbell.net> Minor code bugfix: check right variable.
Via code review by Steve Grubb <sgrubb@redhat.com> 

Almost innocuous; this is value is checked later, this
check being wrong would make it check stack garbage.

git-svn-id: svn://svn.berlios.de/openocd/trunk@2655 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-30 21:12:50 +00:00
oharboe
072d6d3db6 Dirk Behme <dirk.behme@googlemail.com> Fix typo in help text. It has to be 'production_test' instead of 'production' here.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2654 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-30 20:08:07 +00:00
oharboe
fbe1c23c12 David Brownell <david-b@pacbell.net> Fix Sandstorm revision checking: right bits, right value!
git-svn-id: svn://svn.berlios.de/openocd/trunk@2653 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-30 20:05:40 +00:00
oharboe
98ae6c24f0 David Brownell <david-b@pacbell.net> Remove duplicate check for flash write status.
Via code review by Steve Grubb <sgrubb@redhat.com> 

Also minor fixes for the message from "fill":  the byte
count is unsigned, not signed; and more importantly,
print the real number of bytes written

git-svn-id: svn://svn.berlios.de/openocd/trunk@2652 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-30 20:04:17 +00:00
oharboe
ab30d5203c David Brownell <david-b@pacbell.net> Minor doc updates:
- Itemize the list of private customization examples
  for openocd.cfg

 - Add "override defaults" as a customization, specifically
  for the work area (back it up or relocate it)

 - Highlight some work area location issues

git-svn-id: svn://svn.berlios.de/openocd/trunk@2651 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-30 17:32:56 +00:00
oharboe
d879faa3cb David Brownell <david-b@pacbell.net> start phasing out integers as target IDs
git-svn-id: svn://svn.berlios.de/openocd/trunk@2650 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-30 17:30:14 +00:00
oharboe
4b9bdd664a David Brownell <david-b@pacbell.net> Be sure the built-in search paths always go *after* ones provided
on the command line ... matching comment in add_default_dirs().

Without this it's impossible to use a private config file which
happens to have the same name as an installed one.  Say, because
you're bugfixing a private copy...

git-svn-id: svn://svn.berlios.de/openocd/trunk@2649 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-30 17:27:50 +00:00
oharboe
69b8b5e0aa David Brownell <david-b@pacbell.net> fix warnings
git-svn-id: svn://svn.berlios.de/openocd/trunk@2648 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-28 17:18:36 +00:00
oharboe
ed8fd94d7c added arm11 timeout error messages
git-svn-id: svn://svn.berlios.de/openocd/trunk@2647 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-28 13:43:26 +00:00
oharboe
efef05870d restore ICE watchpoint registers when the *last* software breakpoint is removed
git-svn-id: svn://svn.berlios.de/openocd/trunk@2646 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-28 09:47:19 +00:00
oharboe
a5d02116a6 David Brownell <david-b@pacbell.net> The Stellaris eval boards don't have TRST signals, so
defining ntrst_delay is pointless; don't.

At least the LM3S3748 eval board doesn't need nsrst_delay
either; remove that too.

git-svn-id: svn://svn.berlios.de/openocd/trunk@2645 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-28 06:53:35 +00:00
oharboe
997d5284cb David Brownell <david-b@pacbell.net> ARM disassembly support for about five dozen non-Thumb instructions
that were added after ARMv5TE was defined:

 - ARMv5J "BXJ" (for Java/Jazelle)
 - ARMv6 "media" instructions (for OMAP2420, i.MX31, etc)

Compile-tested.  This might not set up the simulator right for the
ARMv6 single step support; only BXJ branches though, and docs to
support Jazelle branching are non-public (still, sigh).

ARMv6 instructions known to be mis-handled by this disassembler
include:  UMAAL, LDREX, STREX, CPS, SETEND, RFE, SRS, MCRR2, MRRC2

git-svn-id: svn://svn.berlios.de/openocd/trunk@2644 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-28 06:52:08 +00:00
oharboe
ae17ce23eb arm11 hardware step using simulation + breakpoint. Use "hardware_step enable" command to revert to hardware stepping. Ideally we could retire the "hardware_step enable" command once we no longer believe it to be necessary.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2643 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-27 10:37:01 +00:00
oharboe
c5145ceb19 arm11 single stepping wip - at least we know the next PC now
git-svn-id: svn://svn.berlios.de/openocd/trunk@2642 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-27 07:37:07 +00:00
oharboe
bb000a6f77 arm11 single stepping wip
git-svn-id: svn://svn.berlios.de/openocd/trunk@2641 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-27 07:35:47 +00:00
oharboe
32a2c70d3e refactor arm simulator to allow arm11 code to use it as well - no observable changes otherwise.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2640 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-27 06:50:36 +00:00
oharboe
641c574425 some arm11 stuff that isn't done yet.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2639 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-26 19:27:33 +00:00
oharboe
327ba6cb0a Matt Hsu <matt@0xlab.org> and Holger Hans Peter Freyther <zecke@selfish.org> cortex-a8: Wait for the CPU to be halted/started
With DCCR we are asking the CPU to halt, we should wait until
the CPU has halted before proceeding with the operation.

git-svn-id: svn://svn.berlios.de/openocd/trunk@2638 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-26 19:25:44 +00:00
oharboe
e921fead94 Matt Hsu <matt@0xlab.org> and Holger Hans Peter Freyther <zecke@selfish.org> Print the value that the method didn't like
git-svn-id: svn://svn.berlios.de/openocd/trunk@2637 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-26 19:24:45 +00:00
oharboe
01000e988a Matt Hsu <matt@0xlab.org> and Holger Hans Peter Freyther <zecke@selfish.org> Only dap_ap_select when we are going to do a memory access
in the fast reg case.

git-svn-id: svn://svn.berlios.de/openocd/trunk@2636 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-26 19:23:35 +00:00
oharboe
fc7cd1d85e Matt Hsu <matt@0xlab.org> cortex-a8: Copy some more registers from the documentation
git-svn-id: svn://svn.berlios.de/openocd/trunk@2635 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-26 19:22:28 +00:00
oharboe
56a04a3413 Matt Hsu <matt@0xlab.org> cortex_a8_exec_opcode is writing the ARM instruction into
the ITR register but it will only be executed when the DSCR[13]
bit is set. The documentation is a bit weird as it classifies
the DSCR as read-only but the pseudo code is writing to it as
well. This is working on a beagleboard.

git-svn-id: svn://svn.berlios.de/openocd/trunk@2634 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-26 19:21:26 +00:00
oharboe
f36d0083de Matt Hsu <matt@0xlab.org> Wait for the DTRRX to be full before reading it. Remove the trans_mode change as it is done in the mem_ap_read_atomic_u32 function.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2633 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-26 19:20:25 +00:00
oharboe
56b346447b Matt Hsu <matt@0xlab.org> and Holger Hans Peter Freyther <zecke@selfish.org> Before executing a new instruction wait for the previous
instruction to be finished. This comes from the pseudo code
of the cortex a8 trm.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2632 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-26 19:16:08 +00:00
oharboe
dce1cdc9fb David Brownell <david-b@pacbell.net> Fix segv in jtag_examine_chain(): exit loop on no-tap. Keep
"next iteration" step with the rest of the loop overhead.

Cleanup:  remove spurious whitespace, and an overlong line;
only assign "tap->hasidcode" once.

git-svn-id: svn://svn.berlios.de/openocd/trunk@2631 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-26 19:06:56 +00:00
oharboe
0de530067f added missing check on jtag_execute
git-svn-id: svn://svn.berlios.de/openocd/trunk@2630 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-26 10:13:51 +00:00
oharboe
c87357a33f Remove bogus "BUG:". If the PC is pointing to an invalid instruction, then simulation will fail. This is expected.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2629 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-26 10:03:54 +00:00
oharboe
9a9ebfb924 reduce arm11 output noise
git-svn-id: svn://svn.berlios.de/openocd/trunk@2628 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-26 08:32:03 +00:00
oharboe
11856bcffc Michael Schwingen <rincewind@discworld.dascon.de> news about xscale
git-svn-id: svn://svn.berlios.de/openocd/trunk@2627 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-26 07:11:16 +00:00
oharboe
a5354ff5cb David Brownell <david-b@pacbell.net> Clock updates/fixes for the Stellaris flash driver:
- Bugfixes:
   * internal osc: it's *12* MHz (not 15 MHz) on _current_ chips
      + except new Tempest parts where it's 16 MHz (and calibrated!)
      + or some old Sandstorm ones, where 15 MHz was valid
   * crystal config:
      + read and use the crystal config, don't assume 6 MHz
      + know when that field is 4 bits vs 5
   * an RCC2 register may be overriding the original RCC
      + more clock source options
      + bigger dividers
      + fractional dividers on Tempest (NYET handled)
   * there's a 30 KHz osc on newer chips (for deep sleep)
   * there's a 32768 Hz osc on newer chips (for hibernation)

 - Cosmetic
   * say "rev A0" not "vA.0", to match vendor docs
   * don't always report master clock as an "estimate":
      + give the error bound if it's approximate, like "±30%"
      + else don't say anything
   * fix whitespace and caps in some messages
   * these are not AT91SAM chips!!

Those clock issues might explain problems sometimes reported when
writing to Stellaris flash banks; they affect write timings.

That 12-vs-15 MHz issue is problematic; there's no consolidated doc
showing which chips (and revs!) have which internal oscillator speed.
It's clear that only older silicon had the faster-and-less-accurate
flavor.  What's less clear is which chips are "old" like that.

Lightly tested, on a DustDevil part.

git-svn-id: svn://svn.berlios.de/openocd/trunk@2626 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-26 06:26:29 +00:00
oharboe
34e8c67b1f David Brownell <david-b@pacbell.net> Various updates to 0.3.0 NEWS
git-svn-id: svn://svn.berlios.de/openocd/trunk@2625 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-25 20:03:35 +00:00
oharboe
bc075606b7 David Brownell <david-b@pacbell.net> Tweak disassembly commands:
For ARMv4/ARMv5:
  - better command parameter error checking
  - don't require an instruction count; default to one
  - recognize thumb function addresses
  - make function static
  - shorten some too-long lines
 For Cortex-M3:
  - don't require an instruction count; default to one

With the relevant doc updates.
---
Nyet done:  invoke the thumb2 disassembler on v4/v5,
to better handle branch instructions.

git-svn-id: svn://svn.berlios.de/openocd/trunk@2624 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-25 20:02:19 +00:00
oharboe
24f011ebb4 David Brownell <david-b@pacbell.net> More jtag_add_reset() cleanup:
Unify the handling of the req_srst parameter, and rip out a
large NOP branch and its associated FIXME.  (There didn't seem
to be anything that needs fixing; but that was unclear since
the constraints were scattered all over the place not unified.)

git-svn-id: svn://svn.berlios.de/openocd/trunk@2623 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-25 19:59:55 +00:00
oharboe
86b49612a6 David Brownell <david-b@pacbell.net> More jtag_add_reset() cleanup:
Unify the handling of the req_tlr_or_trst parameter.  Basically,
JTAG TMS+TCK ops ("TLR") is always used ... unless TRST is a safe
option in this system configuration.

git-svn-id: svn://svn.berlios.de/openocd/trunk@2622 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-25 19:58:06 +00:00
oharboe
6f359fba68 David Brownell <david-b@pacbell.net> Some jtag_add_reset() cleanup:
- Track whether TRST and/or SRST actually change:

    * If they're not changing, don't ask the JTAG adapter to do anything!
      (JTAG TCK/TMS ops might still be used to enter TAP_RESET though.)
    * Don't change their recorded values until after the adapter says it
      did so ... so fault paths can't leave corrupt state.
    * Detect and report jtag_execute_queue() failure mode
    * Only emit messages saying what really changed; this includes adding
      an omitted "deasserted TRST" message.
    * Only apply delays after deasserting SRST/TRST if we *DID* deassert!

 - Messages say "TLR" not "RESET", to be less confusing; there are many
   kinds of reset.  (Though "TLR" isn't quite ideal either, since it's
   the name of the TAP state being entered by TMS+TCK or TRST; it's at
   least non-ambiguous in context.)

So the main effect is to do only the work this routine was told to do;
and to have debug messaging make more sense.

git-svn-id: svn://svn.berlios.de/openocd/trunk@2621 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-25 19:55:32 +00:00
oharboe
bd7cbd01e8 David Brownell <david-b@pacbell.net> Accomodate targets which don't support various target-specific
reset operations.  Maybe they can't; or it's a "not yet" thing.

Note that the assert/deassert operations can't yet trigger for
OMAP3 because resets currently include JTAG reset in all cases,
resetting the ICEpick and thus disabling the TAP for Cortex-A8.

git-svn-id: svn://svn.berlios.de/openocd/trunk@2620 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-25 19:52:02 +00:00
oharboe
0c41395fc3 Michael Schwingen <rincewind@discworld.dascon.de> fix previous doc patch
git-svn-id: svn://svn.berlios.de/openocd/trunk@2619 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-25 13:00:45 +00:00
ntfreak
7a1ac49ac9 - fix build warnings
- add svn props to recently added files armv7a.[ch]

git-svn-id: svn://svn.berlios.de/openocd/trunk@2618 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-25 12:19:44 +00:00
oharboe
8e1d516927 Michael Schwingen <rincewind@discworld.dascon.de> a small CFI cleanup
git-svn-id: svn://svn.berlios.de/openocd/trunk@2617 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-25 08:21:11 +00:00
oharboe
696ed5fdc4 strange.... the code build and links w/Linux GCC target but fails w/arm-elf. The code was clearly broken as it was missing two extern's in the .h file...
git-svn-id: svn://svn.berlios.de/openocd/trunk@2616 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-25 07:17:19 +00:00
oharboe
d11c8e3c8e Ferdinand Postema <ferdinand@postema.eu> fix warnings
git-svn-id: svn://svn.berlios.de/openocd/trunk@2615 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-25 07:14:05 +00:00
oharboe
14f2189e1a Ferdinand Postema <ferdinand@postema.eu> increase reset delay to fix regression from 2600 to 2604
git-svn-id: svn://svn.berlios.de/openocd/trunk@2614 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-25 07:12:57 +00:00
oharboe
fd4c0f33b1 Michael Schwingen <rincewind@discworld.dascon.de> The attached patch adds a "xscale vector_table" command that allows to set
the values that are written in the mini-IC (plus documentation updates that
describe why this is needed).

git-svn-id: svn://svn.berlios.de/openocd/trunk@2613 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-25 07:09:48 +00:00
oharboe
ae4c224459 Audrius Urmanavičius <didele.deze@gmail.com> Latest source (R2606) does not compile under Windows+Cygwin - fails with error about possibly uninitialized use of variable 'ch'.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2612 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-25 07:04:25 +00:00
oharboe
41bb41bb93 Brian Findlay <findlaybrian@gmail.com> finalize mini2440.cfg
git-svn-id: svn://svn.berlios.de/openocd/trunk@2611 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-25 07:02:50 +00:00
oharboe
9df861b0c0 use cortex_a8 instead of cortex_m3
git-svn-id: svn://svn.berlios.de/openocd/trunk@2610 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-25 06:59:42 +00:00
oharboe
1d0b276c9f David Brownell The rest of the Cortex-A8 support from Magnus: replace the previous
nonfunctional cortex_a8 code with something that at least basically
works (for halt/step/resume, without MMU) even if it is incomplete.
(With tweaks from Øyvind, and cleanup from Dave.)

This code has mainly been developed and tested against R1606, it has 
been built and tested against R2294 where it runs but step and resume 
commands are broken due to regression (which should be fixed now).

This code is really written for OMAP3530.  It doesn't identify debug
resources using generic DAP calls to scan the ROM table, or perform
topology detection.  The OMAP3530 DAP exposes two memory access ports:

 - Port #0 is connected to L3 interconnect (the main bus) with
   passthrough to the L4 EMU bus ... so it will be used for most
   memory accesses.

 - Port #1 is connected to a dedicated debug bus (L4 EMU), with
   access to L4 Wakeup, and holds the ROM table ... so it must
   be used for most debug and control operations.

The are some defines to handle this in cortex_a8.c, which should be
replaced with more general code.  Having access to another Cortex-A8
implementation would help get that right.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2609 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-25 06:58:34 +00:00
oharboe
6f7491c1c1 David Brownell Subset of Cortex-A8 support from Magnus: create an armv7a file
and seed it with DAP access support using the current ADIv5 code.
(With tweaks and cleanup from Øyvind and Dave.)

The ARMv7-AR architecture manual is not publicly available (even
in subset form like the ARMv7-M spec), so it's hard to distinguish
between the Cortex-A8 implementation and the ARMv7-A architecture.

The register set presumably is architectural, and so it's stored
here; it's like earlier ARMs, with small additions.  Ditto the
instruction set, though Thumb2 support is used (extending Thumb
support from ARMv6 with more 32-bit instructions) and there's this
ThumbEE thing too.  There is a new "debug monitor" mode, not yet
fully addressed here, to support debugging in environments (like
motor control) where halting debug mode is inadvisable.

git-svn-id: svn://svn.berlios.de/openocd/trunk@2608 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-25 06:57:26 +00:00
oharboe
0ed5f5afd9 add missing isblank() for eCos
git-svn-id: svn://svn.berlios.de/openocd/trunk@2607 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-25 06:45:40 +00:00
oharboe
bf5f21e39a Steve Grubb <sgrubb@redhat.com> fix various and sundry leaks
git-svn-id: svn://svn.berlios.de/openocd/trunk@2606 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-24 07:53:46 +00:00
oharboe
332c8d78d8 Jonas Horberg <jhorberg@sauer-danfoss.com>
The trunk is currently broken for interfaces without
the speed_div function (interface specific clock speed
value to kHz conversion). Example: parport.

git-svn-id: svn://svn.berlios.de/openocd/trunk@2605 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-24 07:26:05 +00:00
oharboe
6336ebb05c Pieter Conradie <Pieter.Conradie@psitek.com> shuffle things around to the right spots. Should have been done in previous commit.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2604 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-21 11:23:24 +00:00
oharboe
5c50cf802c native line endings
git-svn-id: svn://svn.berlios.de/openocd/trunk@2603 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-21 09:01:00 +00:00
oharboe
0a7158140a Pieter Conradie <Pieter.Conradie@psitek.com> Scripts for Atmel AT91SAM7S256 and AT91SAM9260
git-svn-id: svn://svn.berlios.de/openocd/trunk@2602 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-21 08:58:49 +00:00
oharboe
8b73ec8d64 Florian Boor <florian.boor@kernelconcepts.de> fixes a segfault executing commands from the web interface using the
"Run Command" tab.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2601 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-21 06:22:01 +00:00
oharboe
afae28fb2c Piotr Ziecik <kosmo@semihalf.com> This patch adds handling blank characters between hex digits in
SVF file, making OpenOCD compatible with files generated by
Altera Quatrus II 9.0.

git-svn-id: svn://svn.berlios.de/openocd/trunk@2600 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-20 08:55:34 +00:00
ntfreak
ef30f22fd3 - remove enable-ft2232-highspeed configure option, high speed ftdi support is now detected during the configure stage
- warning now issued if high speed ftdi device found and openocd was built using an old driver

git-svn-id: svn://svn.berlios.de/openocd/trunk@2599 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-20 07:54:49 +00:00
oharboe
028e535604 David Brownell <david-b@pacbell.net>More Thumb2 disassembly:
ARMv7-M: A5.3.6 Load/store dual or exclusive, table branch

GCC will generate the table branch instructions, usually with inlined
tables that will confuse this disassembler.  LDREX and STREX are not
issued by GCC without inline assembly.

This means all Thumb2 instructions implemented by Cortex-M3 can now
be disassembled.  Cortex-A8 cores support more Thumb2 instructions,
but most of those aren't yet publicly documented.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2598 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-20 07:15:46 +00:00
ntfreak
c2f593bdc1 Jonas Horberg [jhorberg@sauer-danfoss.com]:
Fix small typo in ftd2xx type detection

git-svn-id: svn://svn.berlios.de/openocd/trunk@2597 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-19 08:39:06 +00:00
oharboe
18d8ac5267 David Brownell <david-b@pacbell.net>Fix some command helptext:
- spell "address" right
 - list bp/wp params as optional

And make those source lines wrap at sane margins.

git-svn-id: svn://svn.berlios.de/openocd/trunk@2596 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-19 06:31:44 +00:00
oharboe
57578b4ea3 David Brownell <david-b@pacbell.net> Clean up some Cortex-M3 reset handling.
- AIRCR_SYSRESETREQ is generic; use it on any system where
  SRST won't fly, not just on Stellaris-based ones.

 - Reformat and improve comments about the Stellaris quirk; and
  xref the only public docs (an email) about the issue.

It seems that *most* Stellaris chips have this problem.  Tempest
parts aren't yet in general sampling; and if rev B silicon for
earlier chips exists, it's not very visible yet.

git-svn-id: svn://svn.berlios.de/openocd/trunk@2595 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-19 06:30:08 +00:00
ntfreak
69dd81dcf8 David Brownell [david-b@pacbell.net]:
Simplify dumping of register lists by only printing cached values
if they are marked as valid.  Most of the time, they are invalid;
so printing *any* value is just misleading.

Note that for ARM7 and ARM9 most EmbeddedICE registers (except for
debug status) could be cached most of the time; and their register
cache isn't maintained properly (many accesses seem to bypass that
cache code).

git-svn-id: svn://svn.berlios.de/openocd/trunk@2594 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-18 19:55:01 +00:00
oharboe
1b092a27f0 Brian Findlay <findlaybrian@gmail.com> Board support for mini2440 (friendlyARM) samsung s3c2440 based board
git-svn-id: svn://svn.berlios.de/openocd/trunk@2593 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-18 17:57:19 +00:00
ntfreak
a6f9c5a796 - add cfg file for Amontec JTAGKey2 jtag interface
git-svn-id: svn://svn.berlios.de/openocd/trunk@2592 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-18 16:46:48 +00:00
ntfreak
a634b5d52e Jonas Horberg [jhorberg@sauer-danfoss.com]
https://lists.berlios.de/pipermail/openocd-development/2009-August/009939.html

1. It can only be built with the FTD2XX driver. libftdi supports FT2232H/FT4232H 
since version 0.16 

2. A speed value of 0 is used as a RTCK request indicator. This clashes with the 
valid clock division value 0 that provide the highest fixed clock frequency. 

3. The ft2232_speed_div function return the maximum selectable frequency (30MHz) 
when RTCK is activated. It should return 0. 

4. The ft2232_khz function return ERROR_OK when RTCK is requested even for 
devices lacking RTCK support. It should return ERROR_FAIL so the upper driver layers 
can detect this and try to fallback to a fixed frequency. 

5. FT2232H/FT4232H have a backward compatibility function that divide the clock 
by 5 to get the same frequency range as FT2232D. There is no code that disable 
this functionality. I can not find anything about if this is enabled or disabled by default. 
I think it is safest to actively disable it. 


git-svn-id: svn://svn.berlios.de/openocd/trunk@2591 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-18 14:41:58 +00:00
ntfreak
bb5086b83e Jonas Horberg [jhorberg@sauer-danfoss.com]
Change jtag_rclk behaviour so it can be called before the interface init function

git-svn-id: svn://svn.berlios.de/openocd/trunk@2590 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-18 12:14:01 +00:00
oharboe
7b4428df97 David Brownell <david-b@pacbell.net> Cleanup the Stellaris target configs:
- remove endianness options; these chips hard-wire "little"
 - $_TARGETNAME updates:
    * don't pass $_TARGETNAME where a TAP label is required
    * flash config uses $_TARGETNAME (it might not be target #0)
    * simplify one $_TARGETNAME construction
 - update work area setup:
    * remove VM spec; these chips have no VM!
    * fix some wrong sizes (0x4000 == 16K, not 4K)
    * simplify: take defaults
 - comment fixups


git-svn-id: svn://svn.berlios.de/openocd/trunk@2589 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-18 10:27:24 +00:00
oharboe
ed22097a55 David Brownell <david-b@pacbell.net> Add "cortex_m3 vector_catch" command and docs. One minor
issue with this is that the core debug support uses this
mechanism, then trashes its state over reset.  Users can
Work around that (for now) by re-assigning the desired
config after reset.

Also fixes "target halted due to target-not-halted" goof.
When we can't describe the reason using OpenOCD's limited
vocabulary, say "reason undefined" instead of saying it's
not halted.

git-svn-id: svn://svn.berlios.de/openocd/trunk@2588 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-18 10:25:28 +00:00
oharboe
a4c7e2dd96 David Brownell <david-b@pacbell.net> Clean up ARM7/ARM9 EmbeddedICE register handling ... don't use parallel
arrays (error prone) or assume all registers are 32-bits wide (they can
have fewer bits); don't use spaces in register names, so they can be
passed more easily to the "reg" command.

Minor updates for ARM9 vector_catch support:  it's an 8-bit value.  This
seems to help this core's vector_catch command work a bit better; but its
behavior wih the register cache is still goofy.

git-svn-id: svn://svn.berlios.de/openocd/trunk@2587 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-18 10:22:44 +00:00
oharboe
5badd9b29a David Brownell <david-b@pacbell.net> Several of the ARMv7M registers are 8 bits or less; don't
display them as 32 bits unless that's their true size.
(Removes some confusion.

git-svn-id: svn://svn.berlios.de/openocd/trunk@2586 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-18 10:20:25 +00:00
oharboe
35e5e07127 Piotr Ziecik <kosmo@semihalf.com> Due to errors in chipselect management in davinci_nand driver
OpenOCD was able to access only to chips attached to first EMIF
chipselect. This patch fixes chipselect management code and allows
OpenOCD to access to NAND devices attached to any EMIF CS line.

git-svn-id: svn://svn.berlios.de/openocd/trunk@2585 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-18 10:18:18 +00:00
oharboe
1d96a84f06 Xiaofan Chen <xiaofanc@gmail.com> Split LM3S811 config file into target file and board file
git-svn-id: svn://svn.berlios.de/openocd/trunk@2584 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-16 12:08:35 +00:00
oharboe
ad23cb97b2 michal smulski <michal.smulski@ooma.com> arm11 target config files
git-svn-id: svn://svn.berlios.de/openocd/trunk@2583 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-16 11:58:40 +00:00
oharboe
2a0e491d9a Xiaofan Chen <xiaofanc@gmail.com> Add config file for TI-Luminary LM3S1968 chip and EK-LM3S1968 board
git-svn-id: svn://svn.berlios.de/openocd/trunk@2582 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-16 11:54:56 +00:00
oharboe
a33e272abd Ferdinand Postema <ferdinand@postema.eu> cygwin 32 bit warning
git-svn-id: svn://svn.berlios.de/openocd/trunk@2581 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-16 11:52:50 +00:00
oharboe
b747da2663 added note w/reference to discussion on whether or not arm11 code is broken or not.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2580 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-16 11:49:21 +00:00
ntfreak
59b295dbbe Audrius Urmanavičius [didele.deze@gmail.com]:
Add flash programming support for NXP LPC1700 cortex_m3 based family


git-svn-id: svn://svn.berlios.de/openocd/trunk@2579 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-13 13:54:53 +00:00
ntfreak
720c39ba2f David Brownell <david-b@pacbell.net>:
Warn about anyone using "jtag_speed" commands; that command is obsolete, and will someday be removed.

git-svn-id: svn://svn.berlios.de/openocd/trunk@2578 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-07 09:37:59 +00:00
ntfreak
732df6fea0 David Brownell <david-b@pacbell.net>:
Better explanation for the TAP "-ircapture" parameter.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2577 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-07 09:29:41 +00:00
ntfreak
ad800b1c02 Ferdinand Postema [ferdinand@postema.eu]
- fix vector catch issues with certain ARM9 cores - AT91SAM9260 and STR9

git-svn-id: svn://svn.berlios.de/openocd/trunk@2576 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-07 09:19:06 +00:00
ntfreak
84903467ec - fix segfault introduced during cortex reg cleanup
git-svn-id: svn://svn.berlios.de/openocd/trunk@2575 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-07 09:09:06 +00:00
ntfreak
d40fd9e0f4 Gary Carlson [gcarlson@carlson-minot.com]:
- revert patch from rev1507 as it was causing reset issues with arm9 cores

git-svn-id: svn://svn.berlios.de/openocd/trunk@2574 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-06 23:34:34 +00:00
ntfreak
1ee32a8fa1 - Bring all the ftdi names inline in the cfg scripts. scripts will now work for either ftd2xx or libftdi drivers.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2573 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-06 21:44:18 +00:00
zwelch
398f60af56 michal smulski <michal.smulski@ooma.com>:
Fix ARM11 half-word bulk memory read and write.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2572 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-06 19:52:56 +00:00
ntfreak
9b29b729f3 - add configure error if building parport interface under cygwin and sys/io.h missing
git-svn-id: svn://svn.berlios.de/openocd/trunk@2571 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-31 08:52:03 +00:00
oharboe
5a824c934f Fix NPE in GDB_EVENT_END as logforwarding was not disabled early enough
git-svn-id: svn://svn.berlios.de/openocd/trunk@2570 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-27 18:56:43 +00:00
oharboe
e9b919fbc6 add "dummy" interface trick to the BUGS reporting suggestions
git-svn-id: svn://svn.berlios.de/openocd/trunk@2569 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-27 14:46:49 +00:00
oharboe
e31e6a10de David Brownell <david-b@pacbell.net> More testcase work:
A5.3.11 Data processing (shifted register)

The usual kinds of problems; the most noteworthy were that
the "S"et flags bit was mis-handled in these instructions.
---
This is the last patch from a quickie set of tests covering all
encodings of the instructions with 32-bit opcodes.  There may
be some corner cases left, plus the instructions that aren't
yet handled, but the Thumb2 disassembler is no longer just
"lightly" tested with GCC output ... the new code paths have
mostly been verified.

git-svn-id: svn://svn.berlios.de/openocd/trunk@2568 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-26 20:00:39 +00:00
oharboe
49e2267f1f More instruction decoding fixes:
A5.3.5 Load/store multiple
       A5.3.7 Load word

There was a longstanding bug in Thumb-1 LDM; the rest of the LDM/STM
fixes are just using width specs to match UAL syntax, except for two
opcode name typos.  Load word had two bitmask goofs.

git-svn-id: svn://svn.berlios.de/openocd/trunk@2567 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-26 19:59:33 +00:00
oharboe
3bcf8a8a25 David Brownell <david-b@pacbell.net> More fixes from test cases:
A5.3.8 Load halfword, unallocated memory hints

It's mostly the usual sort of bitmasking goofage and getting the
width specs right.  In one case an older x86 GCC generated bad code
unless I structred a conditional differently (sigh).

git-svn-id: svn://svn.berlios.de/openocd/trunk@2566 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-26 19:58:25 +00:00
oharboe
fc318c0298 David Brownell <david-b@pacbell.net> More instruction decoding fixes:
A5.3.5 Load/store multiple
       A5.3.7 Load word

There was a longstanding bug in Thumb-1 LDM; the rest of the LDM/STM
fixes are just using width specs to match UAL syntax, except for two
opcode name typos.  Load word had two bitmask goofs.

git-svn-id: svn://svn.berlios.de/openocd/trunk@2565 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-26 19:56:58 +00:00
oharboe
67dbf35896 David Brownell <david-b@pacbell.net> More instruction decoding fixes based on test cases, covering
ARMv7-M arch manual:

 A5.3.1 Data processing (modified immediate)
 A5.3.3 Data processing (plain binary immediate)
 A5.3.4 Branches and miscellaneous control

and other (immediate) encodings referenced there.  Several of
these just tweak the new syntax ("Unified" ARM/Thumb: UAL) but
there were a few bugs too.

git-svn-id: svn://svn.berlios.de/openocd/trunk@2564 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-24 16:49:44 +00:00
oharboe
ad3a24f944 David Brownell <david-b@pacbell.net> Bugfix some instruction decoding ... I've crafted asm files
with testcases covering several new encodings in these sections
of the ARMv7-M arch manual:

 A5.3.12 Data processing (register)
 A5.3.13 Miscellaneous operations
 A5.3.14 Multiply, and multiply accumulate
 A5.3.15 Long multiply, long multiply accumulate, and divide

The issues were mostly in '12 and '13; some new related 16-bit
opcodes had issues too.

git-svn-id: svn://svn.berlios.de/openocd/trunk@2563 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-24 16:48:12 +00:00
oharboe
431925a452 Andreas Fritiofson <andreas.fritiofson@gmail.com> I noticed there are a few checks for (rt == 0xf) even though that case
is handled with an early return at the top of the function.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2562 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-24 05:42:45 +00:00
oharboe
50aa561796 David Brownell <david-b@pacbell.net> thumb2 disassembly for Load halfword
git-svn-id: svn://svn.berlios.de/openocd/trunk@2561 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-23 15:35:16 +00:00
oharboe
31b520c379 David Brownell <david-b@pacbell.net> thumb2 disassembly for Load byte, memory hints
git-svn-id: svn://svn.berlios.de/openocd/trunk@2560 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-23 15:34:03 +00:00
oharboe
c7565cc381 Ferdinand Postema <ferdinand@postema.eu> fix cygwin warnings
git-svn-id: svn://svn.berlios.de/openocd/trunk@2559 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-23 07:04:21 +00:00
oharboe
30b1bbceea David Brownell <david-b@pacbell.net> fix warnings
git-svn-id: svn://svn.berlios.de/openocd/trunk@2558 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-23 07:02:43 +00:00
oharboe
7986ed5ac2 Jonathan Cameron <jic23@cam.ac.uk> fix regression from 1836 when the reset_config command was removed from pxa270.cfg
git-svn-id: svn://svn.berlios.de/openocd/trunk@2557 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-22 19:35:23 +00:00
oharboe
a7a1ae032b Stefano Voulaz <s.voulaz@projecktstudio.com> first cut samsung_s3c2450
git-svn-id: svn://svn.berlios.de/openocd/trunk@2556 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-22 14:25:56 +00:00
ntfreak
d460a7cd6c David Brownell <david-b@pacbell.net>:
Dump SP on poll, and show whether it's MSP or PSP.

Thread mode can use either stack pointer, so this is
part of the state that's not yet displayed.

Shrink some lines.

git-svn-id: svn://svn.berlios.de/openocd/trunk@2555 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-21 20:19:02 +00:00
ntfreak
4da019edeb David Brownell <david-b@pacbell.net>:
Clean up treatment of registers in ARMv7-M and Cortex-M3. 

 - At the arch level:
    * Just list registers and names; don't impose core-specific
      policy about how they are accessed.
    * Each register has a symbol.
    * Remove the register mode field (irrelevant to debugger)

 - At the core/implementation level:
    * Just map the registers to their relevant access methods;
      don't require the arch level to say how that should work
      (cores other than Cortex-M3 could do it differently).
    * Don't use undefined bits from register 20.
    * Use register IDs that are part of the ARMv7-M interface.

In short, there's now a real distinction between the arch
and core layers.

git-svn-id: svn://svn.berlios.de/openocd/trunk@2554 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-21 20:15:11 +00:00
ntfreak
eea0486263 David Brownell <david-b@pacbell.net>:
Minor updates to the Thumb2 disassembly:

 - Bugfixes:
    * Distinguish branch from misc via "!=" not "=="
    * MRS register shift is 8 bits (vs MSR being 16)
 - Format tweaks:
    * CPS needed tab (not space)
    * add commma before some shifts
    * add space after comma in LDM/STM
    * use ".W" width spec on various instructions

git-svn-id: svn://svn.berlios.de/openocd/trunk@2553 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-21 20:05:05 +00:00
ntfreak
cd0ca916b3 David Brownell <david-b@pacbell.net>:
Revert parts of the previous ARMv7-M register patch.
It turns out that part of the issue is a documentation
problem for the Cortex-M3 r1 parts. So for the rest,
simpler fixes are possible (in followup patch).

git-svn-id: svn://svn.berlios.de/openocd/trunk@2552 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-21 20:03:17 +00:00
ntfreak
55b1ea1d8e - fix issue with reading device id, bug appeared when flash_address code was added
- fix issue when multiple flash chips are connected, eg. x16 x 2 on 32bit mcu bus

git-svn-id: svn://svn.berlios.de/openocd/trunk@2551 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-20 07:03:11 +00:00
oharboe
f703322b3f aduc flash problems have been resolved
git-svn-id: svn://svn.berlios.de/openocd/trunk@2550 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-19 19:31:54 +00:00
oharboe
8b994145b8 Andreas Fritiofson <andreas.fritiofson@gmail.com> UTF8 fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@2549 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-17 19:54:25 +00:00
oharboe
14cbd545bf added item to come up with slick new 32 bit jtag_add_xxx() API
git-svn-id: svn://svn.berlios.de/openocd/trunk@2548 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-16 10:44:42 +00:00
oharboe
bd4377194e microscopic whitespace cleanup
git-svn-id: svn://svn.berlios.de/openocd/trunk@2547 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-16 10:43:15 +00:00
oharboe
4deb8530c6 microscopic white space fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@2546 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-16 10:30:50 +00:00
ntfreak
4ebd353ae1 - disable using parport ppdev under win32 hosts
git-svn-id: svn://svn.berlios.de/openocd/trunk@2545 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-16 10:03:33 +00:00
zwelch
1af6b72fc1 Magnus Lundin <lundin@mlu.mine.nu>, Oyvind Harboe <oyvind.harboe@zylin.com>, David Brownell <david-b@pacbell.net>:
Move the dap command handler implementations to arm_adi_v5.c,
leaving just thin wrappers in armv7m.c.  There should be no
change in functionality here.  (From Magnus.)

Minor style cleanup:  whitespace, line length, etc.  Update spec
references to use docs which are currently available.  (From Dave.)


git-svn-id: svn://svn.berlios.de/openocd/trunk@2544 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-16 00:08:36 +00:00
zwelch
16e17ab1b3 Magnus Lundin <lundin@mlu.mine.nu>, Oyvind Harboe <oyvind.harboe@zylin.com>, David Brownell <david-b@pacbell.net>:
Some cleanup of the ARMv7-M support:

 - Reference the relevant ARMv7-M ARM doc (DDI 0405C to non-Vendors), and
   update the Cortex-M3 doc refs (DDI 0337C is no longer available).

 - Those registers aren't actually general, and some are incorrect (per all
   public docs anyway).  Update comments and code accordingly.

     * What the Core Debug facility exposes is *implementation-specific*
       not architectural.  These values aren't fully portable.  They match
       Cortex-M3 ... so no current implementation will make trouble, but
       the next v7m implementation might.

     * Four of the registers are actually not exposed that way.  Before
       Cortex-M3 r2p0 they are read/written through MRS/MSR instructions.
       In that newest silicon, they are four bytes in one register, not
       four separate registers.

 - Update the CM3 code to report when that one register is available,
   and not try to access it when it isn't.  Also declare the register
   numbers that an eventual MRS/MSR solution will need to be using.

 - Stop line wrapping the exception labels.

So for parts before r2p0 OpenOCD behavior is effectively unchanged, and
still buggy; but for those newer parts a few things might now be correct.

Most current Cortex-M3 parts use r1p1 (or earlier); this seems to include
most LM3S parts and all STM32 parts.  Parts using r2p0 are available, and
include fourth generation LM3S parts ("Tempest") plus AT91SAM3 and LPC17xx
parts which are now sampling.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2543 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-16 00:08:21 +00:00
zwelch
0c2ff267aa David Brownell <david-b@pacbell.net>:
More 32-bit Thumb2 instruction decoding:

	A5.3.7 Load word 


git-svn-id: svn://svn.berlios.de/openocd/trunk@2542 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-15 23:49:12 +00:00
zwelch
fdfd434c24 David Brownell <david-b@pacbell.net>:
More 32-bit Thumb2 instruction decoding:

	A5.3.12 Data processing (register)


git-svn-id: svn://svn.berlios.de/openocd/trunk@2541 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-15 23:49:05 +00:00
zwelch
00adcc773a David Brownell <david-b@pacbell.net>:
More 32-bit instruction decoding:

	A5.3.11 Data processing (shifted register)


git-svn-id: svn://svn.berlios.de/openocd/trunk@2540 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-15 23:49:00 +00:00
zwelch
930269b483 David Brownell <david-b@pacbell.net>:
More instructions decoded:

	A5.3.5 Load/store multiple 

The preferred PUSH/POP syntax is shown when appropriate.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2539 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-15 23:48:54 +00:00
zwelch
421b8e133a David Brownell <david-b@pacbell.net>:
More instructions decoded:

	A5.3.14 Multiply, and multiply accumulate 
	A5.3.15 Long multiply, long multiply accumulate, divide

The EABI requires *adjacent* register pairs, but the long multiply
ops can use any pair of registers; interesting.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2538 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-15 23:48:43 +00:00
zwelch
889bd3e716 David Brownell <david-b@pacbell.net>:
More Thumb2 32-bit opcode support:

	 A5.3.10 Store single data item 

Byte, word, halfword.  Offset, pre-index, post-index.  And
a "make like you're unprivileged" option when using small
immediate offsets.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2537 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-15 23:48:37 +00:00
zwelch
84e86e9aee David Brownell <david-b@pacbell.net>:
Print old-style Thumb NOP instructions as such.  (GCC uses "mov r8, r8"
instead of the architected NOP which is new in Thumb2.)


git-svn-id: svn://svn.berlios.de/openocd/trunk@2536 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-15 23:48:32 +00:00
zwelch
d2088f0d29 David Brownell <david-b@pacbell.net>:
Make disassembly of the Thumb load-literal instruction show the
address of the literal being loaded (so users can avoid doing
that math themselves).  Add and use an Align(PC,4) utility.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2535 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-15 23:48:27 +00:00
zwelch
f163d0009d David Brownell <david-b@pacbell.net>:
Make the Thumb2 disassembler handle more 32-bit instructions:

  A5.3.3 Data processing (plain binary immediate)

These use mostly twelve bit literals, but there are also bitfield
and saturated add primitives.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2534 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-15 23:48:21 +00:00
zwelch
0165ae4405 David Brownell <david-b@pacbell.net>:
Make the Thumb2 disassembler handle more 32-bit instructions:

  A5.3.1 Data processing (modified immediate)

My small sample shows GCC likes to use many of these instructions.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2533 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-15 23:48:16 +00:00
zwelch
8b89224c6e David Brownell <david-b@pacbell.net>:
Make the Thumb2 disassembler handle a bunch of 32-bit instructions:

  A5.3.4 Branches and miscellaneous control
 
Note that this shifts some responsabililty out of helper functions,
making the code and layout simpler for 32-bit decoders:  they only
need to know how to format the instruction and its parameters.

Also, technical note:  with this patch, Thumb1 decoders could now
call the Thumb2 decoder if they wanted to get nicer treatment of
the exiting 32-bit B/BLX instructions.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2532 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-15 23:48:11 +00:00
zwelch
b71e3aff6d David Brownell <david-b@pacbell.net>:
Change layout of Thumb disassembly to work better with Thumb2:

 - Move opcode to the left, allowing space for four hex bytes:
    * after address, two spaces not one tab (taking 6 spaces)
    * after 2-byte opcode, four spaces before tab
 - Also, after opcode mnemonic use a tab not a space, to make
   operands line up

Sample output (after some patches decoding a few 32-bit instructions):

0x00003e5a  0xf4423200	ORR	r2, r2, #131072	; 0x20000
0x00003e5e  0x601a    	STR 	r2, [r3, #0x0]
0x00003e60  0x2800    	CMP	r0, #0x00
0x00003e62  0xd1f3    	BNE	0x00003e4c
0x00003e64  0xf008fa38	BL	0x0000c2d8

The affected lines of code now wrap at sane margins too.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2531 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-15 23:39:48 +00:00
zwelch
309870e414 David Brownell <david-b@pacbell.net>:
Initial support for disassembling Thumb2 code.  This works only for
Cortex-M3 cores so far.  Eventually other cores will also need Thumb2
support ... but they don't yet support any kind of disassembly.

 - Update the 16-bit Thumb decoder:
 
     * Understand CPS, REV*, SETEND, {U,S}XT{B,H} opcodes added
       by ARMv6.  (It already seems to treat CPY as MOV.)

     * Understand CB, CBNZ, WFI, IT, and other opcodes added by
       in Thumb2.

 - A new Thumb2 instruction decode routine is provided.
 
     * This has a different signature:  pass the target, not the
       instruction, so it can fetch a second halfword when needed.  
       The instruction size is likewise returned to the caller.

     * 32-bit instructions are recognized but not yet decoded.
   
 - Start using the current "UAL" syntax in some cases.  "SWI" is
   renamed as "SVC"; "LDMIA" as "LDM"; "STMIA" as "STM".

 - Define a new "cortex_m3 disassemble addr count" command to give
   access to this disassembly.

Sanity checked against "objdump -d" output; a bunch of the new
instructions checked out fine.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2530 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-15 23:39:37 +00:00
oharboe
2ff59c9aaf print errno when parport fails to open.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2529 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-15 12:30:06 +00:00
oharboe
e76fe13a95 retire Eclipse settings, charset will be set elsewhere.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2528 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-15 06:43:28 +00:00
oharboe
d78d79aff6 Eclipse settings include charset.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2527 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-14 18:30:00 +00:00
oharboe
8b82de60c7 David Brownell <david-b@pacbell.net> mention udev, and correct D2XX speed mentions
git-svn-id: svn://svn.berlios.de/openocd/trunk@2526 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-14 18:24:59 +00:00
ntfreak
1df358855a - fix small typo in documentation
git-svn-id: svn://svn.berlios.de/openocd/trunk@2525 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-14 11:57:59 +00:00
oharboe
197a195191 1.54 snapshot
git-svn-id: svn://svn.berlios.de/openocd/trunk@2523 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-14 10:38:26 +00:00
zwelch
4eb2e50e4d Archive released NEWS file: NEWS -> NEWS-0.2.0
Create new NEWS file from release script template.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2522 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-14 09:02:00 +00:00
zwelch
f9c65b5cd5 Bump minor version and add tag:
Bump minor package version number: 0.2.0 -> 0.3.0
Add '-in-development' version tag: 0.3.0 -> 0.3.0-in-development

git-svn-id: svn://svn.berlios.de/openocd/trunk@2521 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-14 08:54:36 +00:00
zwelch
64d998e584 Remove '-in-development' version tag: 0.2.0-in-development -> 0.2.0
git-svn-id: svn://svn.berlios.de/openocd/trunk@2517 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-14 08:53:40 +00:00
zwelch
e057491d3c Improve the release script before 0.2.0:
1) Only archive NEWS file on major and minor relesae, not bug-fixes.
2) Switch back to correct development branch during final release step.
3) Add do_svn_switch helper to ensure package variables are reloaded.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2516 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-14 08:52:28 +00:00
zwelch
ff5170a979 Split Windows README instructions into new file, with a few fixes.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2515 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-14 07:35:29 +00:00
zwelch
6d20e27f9a Make the parport-ppdev option enabled by default. This may require
giving --disable-parport-ppdev to configure on some platform(s).


git-svn-id: svn://svn.berlios.de/openocd/trunk@2514 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-14 06:39:55 +00:00
ntfreak
ebd46e23b3 Gary Carlson <gcarlson@carlson-minot.com>
Spencer Oliver <spen@spen-soft.co.uk>

- fix jlink win32/linux/darwin startup issues
- see https://lists.berlios.de/pipermail/openocd-development/2009-July/009438.html

git-svn-id: svn://svn.berlios.de/openocd/trunk@2513 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-13 06:36:51 +00:00
oharboe
b1ccc35323 Xiaofan Chen <xiaofanc@gmail.com> document my experiment
with MinGW cross build.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2512 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-12 19:32:22 +00:00
oharboe
baa63aa608 Xiaofan Chen <xiaofanc@gmail.com> retire obsolete patch. OpenOCD only supports 0.14 and newer and the patch was for 0.14.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2511 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-12 19:31:13 +00:00
oharboe
5198968116 Magnus Lundin Thc cortex_m3_poll function does not identify that a target is running unless we transition from RESET.
This patch correctly identifies a running target.

Patch made a tad more palatable by David Brownell <david-b@pacbell.net>


git-svn-id: svn://svn.berlios.de/openocd/trunk@2510 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-12 19:29:08 +00:00
oharboe
14ed84fdbe Peter Denison <openwrt@marshadder.org> workaround for broken USBprog w/short tms sequences
git-svn-id: svn://svn.berlios.de/openocd/trunk@2509 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-12 14:11:43 +00:00
oharboe
6996e628f8 David Brownell <david-b@pacbell.net> Mention how parallel clock voting implementations of RTCK work,
and reference TI's free VHDL code.

git-svn-id: svn://svn.berlios.de/openocd/trunk@2508 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-12 14:08:16 +00:00
duane
5627e841e3 Simple warning fix
git-svn-id: svn://svn.berlios.de/openocd/trunk@2507 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-11 02:01:22 +00:00
oharboe
c05cb61b32 wrote up workaround for xscale/debug_handler.bin bug
git-svn-id: svn://svn.berlios.de/openocd/trunk@2506 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-10 08:47:10 +00:00
oharboe
ef7722e6af noted XScale (or USBProg) problem
git-svn-id: svn://svn.berlios.de/openocd/trunk@2505 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-10 08:46:12 +00:00
oharboe
e4cff09137 David Brownell <david-b@pacbell.net> split EK board support out
from the target CPU support .

git-svn-id: svn://svn.berlios.de/openocd/trunk@2504 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-10 07:21:12 +00:00
zwelch
3cf4717a2a Add style rule to avoid combining assignment and logical tests.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2503 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-08 22:26:42 +00:00
zwelch
eaa895a0b2 Add section to provide some documentation for cross-compiling.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2502 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-08 22:26:36 +00:00
zwelch
adae530eb7 Add microscopic style guide at the end of the PATCH primer.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2501 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-08 22:26:29 +00:00
zwelch
deda6ea509 Add comments to top-level files to "excuse" their Doxygen markup.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2500 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-08 22:26:20 +00:00
oharboe
1ee66e0ce7 Fix SEGFAULTs and broken error handling for flash programming w/working area
git-svn-id: svn://svn.berlios.de/openocd/trunk@2499 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-08 18:29:03 +00:00
oharboe
13e6aa6e03 fix formatting of xscale bug entry(learning every day)
git-svn-id: svn://svn.berlios.de/openocd/trunk@2498 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-08 10:38:50 +00:00
oharboe
f19565b226 Xscale installation regression entered
git-svn-id: svn://svn.berlios.de/openocd/trunk@2497 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-08 10:25:39 +00:00
oharboe
d68096dcf2 typo in comment
git-svn-id: svn://svn.berlios.de/openocd/trunk@2496 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-08 10:25:23 +00:00
oharboe
51c0ef94d1 some TODO notes on aduc702x which clearly needs more work & testing
git-svn-id: svn://svn.berlios.de/openocd/trunk@2495 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-08 08:05:21 +00:00
oharboe
5c1ae65f8e i.MX27 reset problems fixed & update remaining reset problems notes
git-svn-id: svn://svn.berlios.de/openocd/trunk@2494 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-08 06:49:15 +00:00
oharboe
3ce038baa3 sharpen reset_config for imx27 - use both trst & srst. srst pulls trst.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2493 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-08 06:32:27 +00:00
oharboe
b80f6f96d3 srst pulls trst according to Freescale docs for i.mx27
git-svn-id: svn://svn.berlios.de/openocd/trunk@2492 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-07 16:50:28 +00:00
oharboe
561502ae31 Zach Welch: move bugs into the right section
git-svn-id: svn://svn.berlios.de/openocd/trunk@2491 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-07 11:39:04 +00:00
oharboe
8ba6f13067 Use reference to mailing list for known arm926ejs bugs rather fill The List with lots of details
git-svn-id: svn://svn.berlios.de/openocd/trunk@2490 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-07 11:32:58 +00:00
oharboe
f56c2db5a7 fixed a small typo in howto create doxygen docs
git-svn-id: svn://svn.berlios.de/openocd/trunk@2489 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-07 11:29:34 +00:00
oharboe
f4a9db660b fix return value for "reset" and "runtest" command. Found by code inspection.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2488 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-07 10:47:23 +00:00
oharboe
fc889f0357 delete long retired commented out code (daemon_startup)
git-svn-id: svn://svn.berlios.de/openocd/trunk@2487 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-07 10:43:44 +00:00
oharboe
587aa64850 more arm926ejs bugs
git-svn-id: svn://svn.berlios.de/openocd/trunk@2486 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-07 10:33:20 +00:00
oharboe
f21026e2f5 added known arm926ejs regressions
git-svn-id: svn://svn.berlios.de/openocd/trunk@2485 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-07 06:54:14 +00:00
oharboe
42115c0997 David Brownell <david-b@pacbell.net> Update docs to say that "arm7_9 dbgrq enable" is the default
on ARM9 cores, and update the DaVinci config files so they
no longer explicitly specify it.

git-svn-id: svn://svn.berlios.de/openocd/trunk@2484 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-06 21:16:11 +00:00
ntfreak
cd1b2c15ab - change sleep to usleep - fixes issue under win32 build
git-svn-id: svn://svn.berlios.de/openocd/trunk@2483 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-06 15:41:55 +00:00
ntfreak
d41f2bfb14 - fix build when using a cross compiler - do not try and run any host tools
- add missing types.h when platform does not contain elf.h

git-svn-id: svn://svn.berlios.de/openocd/trunk@2482 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-06 15:19:10 +00:00
oharboe
26b60a6ade more debug output for translation of arm mode number to enum
git-svn-id: svn://svn.berlios.de/openocd/trunk@2481 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-06 15:04:20 +00:00
oharboe
6128c515db a bit more debug output for translation of invalid mode numbers
git-svn-id: svn://svn.berlios.de/openocd/trunk@2480 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-06 14:58:13 +00:00
oharboe
d5e183c31f Fix certain arm926ejs targets(e.g. i.MX27) which report an unknown MOE(method of entry) - interpret this as dbgrq. "reset run" + "halt" + "step" now works.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2479 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-06 14:25:25 +00:00
oharboe
56944ac1c8 Fix regression in "step" command introduced in 2190
git-svn-id: svn://svn.berlios.de/openocd/trunk@2478 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-06 13:42:11 +00:00
oharboe
a4081acc51 revert svn 1679 - fixes cp15 read/write timeout. Single stepping still broken.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2477 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-06 12:03:55 +00:00
zwelch
164c9c75d8 Update Release Script documentation to reflect current implementation.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2476 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-06 11:26:34 +00:00
zwelch
df25617e54 The late birth of the NEWS file also caused me to revisit the release
process once again and reconsider it in some detail.  In doing so,
some further revisions to the process were required:
1) The URL of the repository is embedded in the released code.
   - The packages need to be created from the tagged branch.
   - The URL then points to where to get the tagged code.
2) Improve the instructions for NEWS handling.
   - NEWS file must be updated for each release; describe that process.
   - The NEWS file should be archived an recreated for each release.
3) Add detail steps for the berliOS release process.
4) Minor cleanups to release process doxygen markup.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2475 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-06 11:26:28 +00:00
zwelch
1930e08b99 Add NEWS file for the 0.2.0 release.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2474 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-06 11:26:21 +00:00
zwelch
ce0824868c Add script to automate most of the release process.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2473 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-06 11:21:28 +00:00
zwelch
d6a686c852 Ferdinand Postema <ferdinand@postema.eu>:
Updates to private TAP state tables in amtjtagaccel interface driver.

The first change is the neccesary one to correct a long-standing bug that
caused the IDCODE to be shifted by one bit too many.  This was caused by
an incorrect path from state RESET to state DRSHIFT.

The value of those 2 bytes were 0x8a and 0x04. This means that the
bitstream to do this transition is 0b 00100 01010 (send LSB first). This
will bring you from the reset state to the shift state; however, you
enter the shift-state twice, which explains why the ID-CODE that will be
read next will be shifted 1 bit.  The fix changes these to 0x05 and 0x00.
This will send the bitstream 0b 00101 (send LSB first).  This will bring
the TAP controller from the RESET state to the DRSHIFT state directly,
without entering the DRSHIFT state twice.

After checking the whole table, two other transitions were found that
could be optimized (5 bits in stead of 10 bits).

Summary off all changes:
  From   To       Old values  Old Bitstream  New values  New Bitstream  Remarks
  ----   -------  ----------  -------------  ----------  -------------  -------
  RESET  DRSHIFT  0x8a 0x04   0b00100 01010  0x05 0x00   0b00101        1,2
  IDLE   DRSHIFT  0x85 0x08   0b01000 00101  0x04 0x00   0b00100        2
  IDLE   IRSHIFT  0x8b 0x08   0b01000 01011  0x06 0x00   0b00110        2

[1] Fixes the IDCODE bug
[2] Optimization


git-svn-id: svn://svn.berlios.de/openocd/trunk@2472 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-06 10:34:49 +00:00
zwelch
a604b570da Gary Carlson <gcarlson@carlson-minot.com>:
Fix intermittent J-Link interface startup failures:
- Use usb_reset to ensure selected dongle is in known good state.
- Assert emulator reset durning status check to prevent supurious failures.
- Eliminate status check loop; not needed due to other fixes.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2471 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-06 10:34:33 +00:00
oharboe
e48e7000b0 10ms timeout check on cp15 read/write
git-svn-id: svn://svn.berlios.de/openocd/trunk@2470 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-06 09:32:22 +00:00
oharboe
83655bf49b simplify debug_reason check
git-svn-id: svn://svn.berlios.de/openocd/trunk@2469 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-06 09:28:37 +00:00
zwelch
96ff1d278b Fix maintainer-clean target in doc directory.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2468 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-06 08:45:31 +00:00
oharboe
0ab8e710db bitrot: fix numerous syntax errors
added correct jtag device id

git-svn-id: svn://svn.berlios.de/openocd/trunk@2467 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-06 08:05:58 +00:00
oharboe
e2dd1dbab9 added known problem w/line number's being off in syntax errors for target reset events
git-svn-id: svn://svn.berlios.de/openocd/trunk@2466 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-06 08:04:57 +00:00
oharboe
5fe4500e50 try to use tabs instead of spaces
git-svn-id: svn://svn.berlios.de/openocd/trunk@2465 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-06 08:01:22 +00:00
oharboe
fca8cddc26 human readable error message upon invalid arguments
git-svn-id: svn://svn.berlios.de/openocd/trunk@2464 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-06 07:33:38 +00:00
oharboe
07f13dff2a zy1000 now listens for port 1234. Upon accepting connection reboot zy1000.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2463 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-06 07:31:46 +00:00
zwelch
153270fea3 Major update to release process documentation:
- Provide overview of OpenOCD versioning schema.
- Outline responsibilities and authority of the release manager.
- Explain the need for flexibility in the release schedule.
- Add and refine the release process steps.
- Include tutorials for using new release script.
- Many more improvements, too numerous to list.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2462 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-04 03:47:54 +00:00
oharboe
bb363c77e8 more files to svn:ignore
git-svn-id: svn://svn.berlios.de/openocd/trunk@2460 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-03 07:19:18 +00:00
oharboe
c946358a06 Xiaofan Chen <xiaofanc@gmail.com> With this patch, OpenOCD can talk to my
Analog Device Eval-ADuC7060 eval board.

git-svn-id: svn://svn.berlios.de/openocd/trunk@2459 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-02 17:47:10 +00:00
zwelch
c33a1d764c Add AUTHORS.ChangeLog file suitable to be passed to 'svn2cl --authors'.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2458 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-02 11:18:45 +00:00
zwelch
f16a603506 Add AUTHORS for 0.2.0 release.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2457 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-02 11:17:21 +00:00
zwelch
00fad24996 Remove --enable-release option; if guess-rev.sh is missing, it is a release.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2456 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-02 11:17:14 +00:00
zwelch
f1f54a0fc5 Remove vim editor commands from TCL files.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2455 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-02 11:17:04 +00:00
zwelch
a239d6b334 Fix FTD2XX build for CygWin.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2454 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-02 11:16:57 +00:00
zwelch
fc240afcac Commit first draft of release process documentation.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2453 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-02 10:54:30 +00:00
oharboe
e755b0eb86 add svn:ignore to INSTALL file (it's generated)
git-svn-id: svn://svn.berlios.de/openocd/trunk@2452 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-02 09:12:43 +00:00
oharboe
12c13acdf8 zy1000 1.53 snapshot
git-svn-id: svn://svn.berlios.de/openocd/trunk@2451 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-02 09:11:18 +00:00
oharboe
35000e10d0 David Brownell <david-b@pacbell.net> Fix two texinfo formatting bugs. The first was visible by
reading the output, and both were reported in openocd.log
after making the PDF.

git-svn-id: svn://svn.berlios.de/openocd/trunk@2449 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-02 07:12:59 +00:00
zwelch
14fb875e8f David Brownell <david-b@pacbell.net>:
More minor improvements to README to help polish the 0.2.0 release:
- Add note about Ubuntu 8.04 (in lieu of starting a README.Linux file).
- Fix introductory paragraph to Bulding OpenOCD
- Remove some vestigial texinfo markup.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2448 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-02 04:55:46 +00:00
zwelch
6d08c1800c David Brownell <david-b@pacbell.net>:
Prepare the DaVinci PLL code to support the version 0x0E module
used in newer chips (e.g. dm365):  rename the original code so
it's specific to version 0x02 PLL modules, and update the dm355evm
code to use that new name.

Fix two minor bugs in that version 2 code:  sysclk3 setup used
the sysclk2 divider address (affecting video processing on dm355,
no worry for now) and sysclk2 setup had a syntax error.

Also minor fixups to dm355evm, mostly to permit use of RTCK.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2447 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-02 04:55:35 +00:00
zwelch
b3e6cb6d56 David Brownell <david-b@pacbell.net>:
Restore some whitespace that got clobbered by over-aggressive
whitepace eradication patches a while back.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2446 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-02 04:55:10 +00:00
zwelch
59a3df127e Minor fixes to Developer Manual pages.
- Fix cosmetic bug on main page
- Add missing JTAG list item.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2445 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-01 19:55:52 +00:00
zwelch
a13d08bced Add missing copyright header to target_type.h.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2444 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-01 19:55:46 +00:00
zwelch
f7c85c42a0 Add missing copyright header and fix @page direction in membuf.h.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2443 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-01 19:55:39 +00:00
zwelch
44f72dbdb2 Update TODO list to relect 0.2.0 release.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2442 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-01 19:55:34 +00:00
zwelch
3731bc5877 Add comments to README about compiler and library dependencies.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2441 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-01 19:55:28 +00:00
ntfreak
917f92f052 - add stm32 connectivity line tapid to stm32.cfg
git-svn-id: svn://svn.berlios.de/openocd/trunk@2440 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-01 10:29:10 +00:00
ntfreak
f486f86c6c - correct stm32 connectivity line programming as per latest manual
git-svn-id: svn://svn.berlios.de/openocd/trunk@2439 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-01 10:15:53 +00:00
zwelch
3eb441bbcc Remove at91sam3.h from flash.c; use extern like other drivers.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2438 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-30 22:25:09 +00:00
zwelch
7d3706c980 Extend 'make dist' to produce both .tar.bz2 and .zip archives, to
complement to the standard .tar.gz package.  Now, pick your poison!


git-svn-id: svn://svn.berlios.de/openocd/trunk@2437 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-30 21:45:34 +00:00
zwelch
92ddc0266b Provide some useful information in README file, rather than punting.
Add some text to introduce the project to new users.

Move packaging, configuration, and compilation of OpenOCD out of
the User's Guide and into README, where it can be used by users
before configuring and compiling the documentation.

Improve notes about required Subversion repository build steps.
Add reference to the standard GNU INSTALL file.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2436 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-30 21:45:26 +00:00
zwelch
ef733b48e9 Switch automake handling to use --gnu mode, not --foreign.
Remove INSTALL file; automake generates a copy of the latest version.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2435 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-30 21:44:48 +00:00
ntfreak
2afb46ab34 - remove cygwin build warnings in at91sam3.c
git-svn-id: svn://svn.berlios.de/openocd/trunk@2434 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-30 21:13:53 +00:00
zwelch
ad50a99d6a Add svn:eol-style native property to TCL files that are missing it.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2433 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-30 20:44:21 +00:00
zwelch
2eff86ab23 Remove executable bits from at91sam3 configuration files.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2432 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-30 20:39:02 +00:00
oharboe
d3c77fdbb2 freddie_chopin@op.pl fix handling of workarea
git-svn-id: svn://svn.berlios.de/openocd/trunk@2431 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-30 11:50:04 +00:00
zwelch
41057944b5 Add svn:eol-style properties missed in last commit.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2430 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-30 09:11:10 +00:00
zwelch
f130f95d45 Marcel Jost <marcel.jost@bfh.ch>:
This patch adds support for the Luminary Micro LM3S9B90 target and
LM3S9B92 Evaluation Kit.  These kits include a new ft2232 adapter, the
Luminary In-Circuit Debug Interface (ICDI) Board, so this is added as a
new ft2232 layout called "luminary_icdi".


git-svn-id: svn://svn.berlios.de/openocd/trunk@2429 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-30 09:09:30 +00:00
zwelch
0894ae214a David Brownell <david-b@pacbell.net>:
Add "jtag names" command, mirroring "target names" but returning
TAP names instead of target names.  This starts letting TAPs be
manipulated in scripts ... much like what works now for targets.

It's a bit limited just yet, since "jtag cget $TAPNAME" doesn't
expose all TAP attributes.  "$TARGETNAME cget" is more functional.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2428 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-30 09:03:59 +00:00
zwelch
5195405da8 Improve BUGS file wording and layout.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2427 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-30 05:34:44 +00:00
zwelch
1d61e34e1e Fix doxygen 'undocumented parameter' warnings in membuf.h.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2426 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-30 05:34:36 +00:00
zwelch
48b3b3afba Fix search and replace casualty in flash.h doxygen block.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2425 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-30 05:34:28 +00:00
zwelch
0c9d86b273 Fix doxygen warning in jtag.h caused by a changed parameter name.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2424 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-30 05:34:21 +00:00
zwelch
54b32f4cd6 Fix doxygen warnings in new at91sam3 source file; normalize style.
Remove editor configuration from end of file.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2423 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-30 05:34:07 +00:00
zwelch
44b06db783 Fix @file documentation blocks in new interfaces source files.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2422 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-30 05:33:57 +00:00
zwelch
4d26afdf5c Make bug reporting output at program start-ups use fewer new lines:
- Move repository URL output associate it with the version; they relate.
- 'openocd --version' output now appears much more terse, as expected.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2421 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-30 05:33:41 +00:00
zwelch
557cafcc70 Fix logger.pl script to avoid spurious empty line in some cases.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2420 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-30 05:33:17 +00:00
oharboe
f8cc725e0e Kevin Bortis <stm32@bortis.ch> fix worksize
git-svn-id: svn://svn.berlios.de/openocd/trunk@2419 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-29 22:08:34 +00:00
zwelch
3d9551241b David Brownell <david-b@pacbell.net>:
Minor bugfix ... previous version was tested *with* ICEpick active.
The "-disable" can swap with "-enable"; but not with an empty string.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2418 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-29 20:04:21 +00:00
zwelch
d3315c4183 David Brownell <david-b@pacbell.net>:
Remove some bogus warnings during server startup for ARM926ejs
targets that were already halted for debug ... e.g. started up
a freshly built instance.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2417 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-29 20:04:14 +00:00
zwelch
95da247b40 David Brownell <david-b@pacbell.net>:
Improve the PXA255 target config:  move all that board-specific
setup to the pxa255_sst board.cfg, to which it evidently belongs
(it's the only PXA255 board now included).

Provide the PXA255 JTAG id from Intel docs, and add a comment
about how this chip is now EOL'd (last orders taken).

Note that I still can't get my old PXA255 board to work.  There's
something broken in the reset sequence, which is preventing the
TAP from coming up at all.  Old mailing list posts suggest this
is a longstanding bug...


git-svn-id: svn://svn.berlios.de/openocd/trunk@2416 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-29 20:04:08 +00:00
zwelch
f0fd28a66c David Brownell <david-b@pacbell.net>:
Warn when people (or scripts) use numeric identifiers for TAPs,
instead of dotted.name values.  We want this usage to go away,
so that for example adding more TAPs doesn't cause config scripts
to break because some sequence number changed.

It's been deprecated since late 2008, but putting a warning on
this should help us remove it (say, in June 2010) by helping to
phase out old (ab)usage in config scripts.

Other than in various config files, the only code expecting such
a number was the almost unused str9xpec driver.  This code was
changed to use the TAP it was passed, instead of making its own
dubious lookup and ignoring that TAP.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2415 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-29 20:03:59 +00:00
zwelch
54ffd82a1a David Brownell <david-b@pacbell.net>:
Minor fixup to the User's Guide, primarily related to the
handful of commands defined in "startup.tcl"; "help" was
not previously documented.

Also, be more consistent about "Config Command" definitions
(and to be explicit about that doc convention).


git-svn-id: svn://svn.berlios.de/openocd/trunk@2414 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-29 20:03:52 +00:00
zwelch
c2cecc74b0 Move JTAG interface list to new files.
- Adds new source files to encapsulate static/dynamic module handling.
- Further work should implement the jtag_interface_modules_load routine,
  to populate the jtag_interfaces list from shared libraries in a path.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2413 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-29 00:00:50 +00:00
oharboe
445fef39fb David Brownell <david-b@pacbell.net> various missing commands
git-svn-id: svn://svn.berlios.de/openocd/trunk@2412 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-28 18:46:51 +00:00
duane
2378eaadef Remove extra newline from debug log message
git-svn-id: svn://svn.berlios.de/openocd/trunk@2411 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-28 03:09:15 +00:00
duane
261e04466d A bit more log detail about connections comming and going
git-svn-id: svn://svn.berlios.de/openocd/trunk@2410 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-28 02:54:19 +00:00
duane
9ab9786f67 Refactor code, create target_state_name()
git-svn-id: svn://svn.berlios.de/openocd/trunk@2409 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-28 02:40:08 +00:00
duane
78c0e873d2 Add Breakpoint/Watchpoint unique ID to help debug hardware debug register leakage
git-svn-id: svn://svn.berlios.de/openocd/trunk@2408 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-27 17:25:07 +00:00
duane
f538794bf6 Change from alloca() to malloc()
git-svn-id: svn://svn.berlios.de/openocd/trunk@2407 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-27 16:51:41 +00:00
duane
9c05c92c14 Switch to strotk() grr....
git-svn-id: svn://svn.berlios.de/openocd/trunk@2406 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-27 16:44:35 +00:00
oharboe
92db0c58b0 zy1000 rev C work
git-svn-id: svn://svn.berlios.de/openocd/trunk@2405 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-26 12:57:56 +00:00
oharboe
37b15fb2c4 David Brownell <david-b@pacbell.net> Add a short chapter on boundary scan support, which currently
just documents the SVF and XSVF commands.

git-svn-id: svn://svn.berlios.de/openocd/trunk@2404 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-26 07:30:21 +00:00
ntfreak
374f6c8b70 - fix issue when using gdb_port cmd
- bug introduced in r2240

git-svn-id: svn://svn.berlios.de/openocd/trunk@2403 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-25 15:11:57 +00:00
oharboe
1e8225c738 Oleksandr Tymoshenko <gonzo@bluezbox.com> simple watchpoint support
for MIPS32/EJTAG (no value comparation yet).

git-svn-id: svn://svn.berlios.de/openocd/trunk@2402 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-25 12:18:07 +00:00
duane
8adda07ed1 Fixes from Oleksandr Tymoshenko "gonzo@bluezbox.com"
git-svn-id: svn://svn.berlios.de/openocd/trunk@2401 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-25 00:12:40 +00:00
oharboe
5505b8fa63 David Brownell <david-b@pacbell.net> Fix formatting bug in at91sam7 doc added with the at91sam3 support;
and some formatting issues with sam7 and stm32 keyword params.

Tweak at91sam3 docs.  Remove ninth nibble from flash bank addresses,
clarify "at91sam3 show" variants and that the flash bank layout is
not needed as a parameter (unlike with sam7); formatting fixes.

git-svn-id: svn://svn.berlios.de/openocd/trunk@2400 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-24 16:56:11 +00:00
zwelch
997df70f6e Minor fixes to new at91sam3 files for x86-32/64 compilation problems.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2399 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-24 09:38:28 +00:00
zwelch
fddbc58091 Remove whitespace at end of lines, step 2.
- Replace '\s*$' with ''.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2398 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-24 09:38:21 +00:00
zwelch
2428bc2a5c - Replace '){' with ') {'.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2397 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-24 09:38:15 +00:00
zwelch
f11b1ff485 Remove whitespace that occurs before ')'.
- Replace '[ \t]*[)]' with ')'.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2396 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-24 09:38:08 +00:00
zwelch
1793150091 Remove whitespace that occurs after '('.
- Replace '([ \t]*' with '('.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2395 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-24 09:38:01 +00:00
zwelch
dbb0f31abb - Fixes '[<>]' whitespace
- Replace '\(\w\)\([<>]\)\(\w\)' with '\1 \2 \3'.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2394 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-24 09:37:56 +00:00
zwelch
3e538f9248 - Fixes '[|]' whitespace
- Replace '\(\w\)\([|]\)\(\w\)' with '\1 \2 \3'.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2393 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-24 09:37:50 +00:00
zwelch
9cd160608c - Fixes '+' whitespace
- Replace '\(\w\)\(+\)\(\w\)' with '\1 \2 \3'.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2392 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-24 09:37:44 +00:00
zwelch
5e53d488dc - Fixes '=' whitespace
- Replace '\(\w\)\(=\)\(\w\)' with '\1 \2 \3'.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2391 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-24 09:37:37 +00:00
zwelch
e47be43ed1 - Fixes '==' whitespace
- Replace '\(\w\)\(==\)\(\w\)' with '\1 \2 \3'.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2390 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-24 09:37:31 +00:00
zwelch
c3e7d33b54 - Replace 'for(' with 'for ('.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2389 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-24 09:37:23 +00:00
zwelch
2a4223dc68 - Replace 'switch(' with 'switch ('.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2388 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-24 09:37:18 +00:00
zwelch
eee3b0c2a8 - Replace 'while(' with 'while ('.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2387 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-24 09:37:12 +00:00
zwelch
cb3429570c - Replace 'if(' with 'if ('.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2386 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-24 09:37:05 +00:00
ntfreak
38a1ae7281 - correct configure ftd2xx highspeed test
git-svn-id: svn://svn.berlios.de/openocd/trunk@2385 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-24 08:12:45 +00:00
zwelch
3324841558 Fix end-of-line style properties on newly added files.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2384 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-24 07:43:18 +00:00
duane
0ace4d24db Add support for ATMEL AT91SAM3U - CortexM3 Family
git-svn-id: svn://svn.berlios.de/openocd/trunk@2383 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-24 02:01:14 +00:00
duane
30814c2904 Add quick target - full cygwin builds take a long long long time, this shortens the edit/build/debug cycle
git-svn-id: svn://svn.berlios.de/openocd/trunk@2382 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-24 02:00:19 +00:00
duane
176b5600ed Add a growable sprintf memory buffer library
git-svn-id: svn://svn.berlios.de/openocd/trunk@2381 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-24 01:54:25 +00:00
zwelch
c97caebccd Remove whitespace at end of lines, step 2.
- Replace '\s*$' with ''.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2380 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-23 22:50:08 +00:00
zwelch
2e77919853 Remove whitespace at end of lines, step 1.
- Replace '\s*$' with ''.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2379 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-23 22:49:23 +00:00
zwelch
c493543fc9 - Replace '){' with ') {'.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2378 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-23 22:49:06 +00:00
zwelch
dc575dc5bf Remove whitespace that occurs before ')'.
- Replace '[ \t]*[)]' with ')'.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2377 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-23 22:47:42 +00:00
zwelch
f90d8fa45f Remove whitespace that occurs after '('.
- Replace '([ \t]*' with '('.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2376 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-23 22:46:23 +00:00
zwelch
6d1d58a1fc - Fixes '[<>]' whitespace
- Replace ')\([<>]\)(' with ') \1 ('.
- Replace ')\([<>]\)\(\w\)' with ') \1 \2'.
- Replace '\(\w\)\([<>]\)(' with '\1 \2 ('.
- Replace '\(\w\)\([<>]\)\(\w\)' with '\1 \2 \3'.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2375 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-23 22:45:47 +00:00
zwelch
fb1a9b2cb2 - Fixes '[|]' whitespace
- Replace ')\([|]\)(' with ') \1 ('.
- Replace ')\([|]\)\(\w\)' with ') \1 \2'.
- Replace '\(\w\)\([|]\)(' with '\1 \2 ('.
- Replace '\(\w\)\([|]\)\(\w\)' with '\1 \2 \3'.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2374 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-23 22:45:15 +00:00
zwelch
8959de9f67 - Fixes '+' whitespace
- Replace ')\(+\)(' with ') \1 ('.
- Replace ')\(+\)\(\w\)' with ') \1 \2'.
- Replace '\(\w\)\(+\)(' with '\1 \2 ('.
- Replace '\(\w\)\(+\)\(\w\)' with '\1 \2 \3'.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2373 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-23 22:44:17 +00:00
zwelch
84df52f9ea - Fixes '=' whitespace
- Replace ')\(=\)\(\w\)' with ') \1 \2'.
- Replace '\(\w\)\(=\)(' with '\1 \2 ('.
- Replace '\(\w\)\(=\)\(\w\)' with '\1 \2 \3'.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2372 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-23 22:42:54 +00:00
zwelch
3813fda44a - Fixes '==' whitespace
- Replace ')\(==\)\(\w\)' with ') \1 \2'.
- Replace '\(\w\)\(==\)\(\w\)' with '\1 \2 \3'.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2371 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-23 22:42:03 +00:00
zwelch
aea6815462 - Fixes '<<' whitespace
- Replace ')\(<<\)\(\w\)' with ') \1 \2'.
- Replace '\(\w\)\(<<\)(' with '\1 \2 ('.
- Replace '\(\w\)\(<<\)\(\w\)' with '\1 \2 \3'.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2370 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-23 22:41:13 +00:00
zwelch
0e2c2fe1d1 - Fixes '>>' whitespace
- Replace ')\(>>\)\(\w\)' with ') \1 \2'.
- Replace '\(\w\)\(>>\)(' with '\1 \2 ('.
- Replace '\(\w\)\(>>\)\(\w\)' with '\1 \2 \3'.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2369 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-23 22:40:42 +00:00
zwelch
6319ea33f7 - Fixes '<=' whitespace
- Replace '\(\w\)\(<=\)\(\w\)' with '\1 \2 \3'.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2368 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-23 22:40:33 +00:00
zwelch
4ce93ac479 - Fixes '>=' whitespace
- Replace ')\(>=\)\(\w\)' with ') \1 \2'.
- Replace '\(\w\)\(>=\)\(\w\)' with '\1 \2 \3'.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2367 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-23 22:40:10 +00:00
zwelch
128a733428 - Fixes '&&' whitespace
- Replace ')\(&&\)(' with ') \1 ('.
- Replace '\(\w\)\(&&\)(' with '\1 \2 ('.
- Replace '\(\w\)\(&&\)\(\w\)' with '\1 \2 \3'.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2366 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-23 22:39:47 +00:00
zwelch
319fdecb76 - Fixes '[*]=' whitespace
- Replace '\(\w\)\([*]=\)\(\w\)' with '\1 \2 \3'.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2365 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-23 22:39:34 +00:00
zwelch
d61714f4d5 - Fixes '[+]=' whitespace
- Replace '\(\w\)\([+]=\)(' with '\1 \2 ('.
- Replace '\(\w\)\([+]=\)\(\w\)' with '\1 \2 \3'.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2364 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-23 22:39:18 +00:00
zwelch
53d605e12c - Fixes '!=' whitespace
- Replace ')\(!=\)\(\w\)' with ') \1 \2'.
- Replace '\(\w\)\(!=\)(' with '\1 \2 ('.
- Replace '\(\w\)\(!=\)\(\w\)' with '\1 \2 \3'.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2363 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-23 22:38:12 +00:00
zwelch
5e98c71436 - Fixes '-=' whitespace
- Replace '\(\w\)\(-=\)(' with '\1 \2 ('.
- Replace '\(\w\)\(-=\)\(\w\)' with '\1 \2 \3'.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2362 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-23 22:37:56 +00:00
zwelch
0ab650293a - Replace 'do{' with 'do {'.
- Replace '}while' with '} while'.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2361 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-23 22:37:49 +00:00
zwelch
95d2a23724 - Replace 'for(' with 'for ('.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2360 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-23 22:37:21 +00:00
zwelch
9af5e445b7 - Replace 'switch(' with 'switch ('.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2359 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-23 22:36:56 +00:00
zwelch
50c086ffb9 - Replace 'while(' with 'while ('.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2358 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-23 22:36:11 +00:00
zwelch
e43979e702 - Replace 'if(' with 'if ('.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2357 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-23 22:35:09 +00:00
oharboe
8591335ba6 update w/missing eCos definitions after latest round of compiler formatting warnings fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@2356 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-23 07:38:01 +00:00
zwelch
5a6f218a9c David Brownell <david-b@pacbell.net>:
Move the short chapter about JIM-Tcl earlier, so that we
can reasonably assume it's been introduced before we start
presenting things that presume such an introduction.
Plus a few minor typo-level fixes.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2355 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-22 22:37:04 +00:00
zwelch
1017e62c97 David Brownell <david-b@pacbell.net>:
This should be my last significant update of the User's Guide for
this release.  Mostly it's a rework of the config file chapter's
presentation of board and target config files.

 - Give the new path for scripts!
 - Move board-config material out of the target-config section
 - Add more board-config info, notably for reset-init events
 - Link out of the board-config section to NAND, NOR, and Reset chapters
 - Emphasize target input vs. output naming conventions
 - Other textual improvements

Plus some other updates, like adding my copyright (now that I've
basically rewritten much of this).


git-svn-id: svn://svn.berlios.de/openocd/trunk@2354 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-22 22:36:53 +00:00
oharboe
974d5f8391 fix eol native
git-svn-id: svn://svn.berlios.de/openocd/trunk@2353 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-22 19:22:10 +00:00
oharboe
1f28b934ce David Brownell <david-b@pacbell.net> Make the Hitex STM32-PerformanceStick board config behave better:
source the STM32 target config instead of using a private clone

git-svn-id: svn://svn.berlios.de/openocd/trunk@2352 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-22 17:32:17 +00:00
oharboe
26807d1935 David Brownell <david-b@pacbell.net> target config file for newish DM365 chip. Think of this as
an improved DM355, integrating much better HD video support,
Ethernet, and other goodies.

git-svn-id: svn://svn.berlios.de/openocd/trunk@2351 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-22 17:31:12 +00:00
ntfreak
1d9ce8d2b3 - fix break caused by r2208 when using --pipe option
- issue is gdb stdin buffer gets full before we redirect openocd output

git-svn-id: svn://svn.berlios.de/openocd/trunk@2350 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-21 21:20:10 +00:00
oharboe
bc9df17e42 Paulius Zaleckas <paulius.zaleckas@gmail.com> Add config for CS351x CPUs
git-svn-id: svn://svn.berlios.de/openocd/trunk@2349 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-21 21:06:23 +00:00
zwelch
bed9c62f9e Oleksandr Tymoshenko <gonzo@bluezbox.com>:
Resume command works only if resume address is provided.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2348 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-21 04:58:53 +00:00
duane
2004f2be41 C99 printf() -Werror fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@2347 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-21 03:24:35 +00:00
duane
9e343a4102 C99 printf() -Werror fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@2346 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-21 03:24:12 +00:00
duane
90d6c8f0a0 C99 printf() -Werror fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@2345 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-21 03:23:28 +00:00
duane
4486321dd9 C99 printf() -Werror fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@2344 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-21 03:22:10 +00:00
duane
4f79ba3ca0 C99 printf() -Werror fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@2343 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-21 03:22:04 +00:00
duane
ac05113f7a C99 printf() -Werror fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@2342 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-21 03:21:59 +00:00
duane
b96052d591 C99 printf() -Werror fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@2341 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-21 03:21:55 +00:00
duane
68f30a77f1 C99 printf() -Werror fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@2340 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-21 03:21:50 +00:00
duane
97856dc8b1 C99 printf() -Werror fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@2339 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-21 03:20:46 +00:00
duane
991a5311c6 C99 printf() -Werror fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@2338 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-21 03:20:41 +00:00
duane
940703e16c C99 printf() -Werror fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@2337 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-21 03:20:35 +00:00
duane
f6dcfac679 C99 printf() -Werror fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@2336 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-21 03:20:31 +00:00
duane
96c8ff3d08 C99 printf() -Werror fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@2335 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-21 03:20:26 +00:00
duane
aa0b69ad5f C99 printf() -Werror fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@2334 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-21 03:20:17 +00:00
duane
db4daee44f C99 printf() -Werror fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@2333 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-21 03:20:12 +00:00
duane
cbc3543247 C99 printf() -Werror fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@2332 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-21 03:20:06 +00:00
duane
92aa05c105 C99 printf() -Werror fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@2331 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-21 03:20:00 +00:00
duane
bf509dbafa C99 printf() -Werror fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@2330 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-21 03:19:55 +00:00
duane
a388736c41 C99 printf() -Werror fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@2329 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-21 03:19:51 +00:00
duane
3bb216f112 C99 printf() -Werror fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@2328 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-21 03:17:52 +00:00
duane
9218d4be9b C99 printf() -Werror fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@2327 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-21 03:17:46 +00:00
duane
99e8c9fccb C99 printf() -Werror fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@2326 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-21 03:17:40 +00:00
duane
afc3eb1dc1 C99 printf() -Werror fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@2325 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-21 03:17:33 +00:00
duane
f0bd9e1083 C99 printf() -Werror fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@2324 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-21 03:17:28 +00:00
duane
19a678834d C99 printf() -Werror fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@2323 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-21 03:17:23 +00:00
duane
5c82587a1e C99 printf() -Werror fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@2322 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-21 03:17:16 +00:00
duane
de39cb7724 C99 printf() -Werror fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@2321 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-21 03:17:10 +00:00
duane
610f4e9522 C99 printf() -Werror fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@2320 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-21 03:17:03 +00:00
duane
6e2bdc3e68 C99 printf() -Werror fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@2319 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-21 03:16:52 +00:00
duane
c25d4d4f30 C99 printf() -Werror fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@2318 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-21 03:16:46 +00:00
duane
d3a6ae5442 C99 printf() -Werror fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@2317 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-21 03:16:38 +00:00
duane
b6fe525580 C99 printf() -Werror fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@2316 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-21 03:16:29 +00:00
duane
19bab50773 C99 printf() -Werror fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@2315 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-21 03:16:22 +00:00
duane
57be9774bf C99 printf() -Werror fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@2314 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-21 03:16:18 +00:00
duane
75bb37056a C99 printf() -Werror fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@2313 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-21 03:16:14 +00:00
duane
0f9c1bfd82 C99 printf() -Werror fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@2312 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-21 03:16:09 +00:00
duane
be680ada77 C99 printf() -Werror fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@2311 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-21 03:16:05 +00:00
duane
819944fb28 C99 printf() -Werror fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@2310 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-21 03:15:59 +00:00
duane
e06e22dbbd C99 printf() -Werror fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@2309 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-21 03:15:51 +00:00
duane
aabee7e8ca C99 printf() -Werror fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@2308 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-21 03:15:47 +00:00
duane
05f0e6e9d5 C99 printf() -Werror fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@2307 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-21 03:15:42 +00:00
duane
b9feaddd75 C99 printf() -Werror fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@2306 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-21 03:15:36 +00:00
duane
b54f4c5cb6 C99 printf() -Werror fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@2305 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-21 03:15:32 +00:00
duane
be1ab108f3 C99 printf() -Werror fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@2304 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-21 03:15:28 +00:00
duane
7b97e5b1cc C99 printf() -Werror fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@2303 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-21 03:15:24 +00:00
duane
fde4f37f6a C99 printf() -Werror fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@2302 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-21 03:15:16 +00:00
duane
f2f612aa69 C99 printf() -Werror fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@2301 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-21 03:15:10 +00:00
duane
b521037509 C99 printf() -Werror fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@2300 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-21 03:15:03 +00:00
duane
d84bba66ae C99 printf() -Werror fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@2299 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-21 03:14:58 +00:00
duane
7e07b9abf1 C99 printf() -Werror fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@2298 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-21 03:01:21 +00:00
duane
245b0213f5 C99 printf() -Werror fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@2297 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-21 03:00:43 +00:00
duane
836b6c18f0 C99 Type updates, include inttypes.h - it is catagorically required
git-svn-id: svn://svn.berlios.de/openocd/trunk@2296 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-21 02:59:39 +00:00
mifi
5f48cefb10 Set default for want_ftd2xx_highspeed to "no" instead of "maybe"
git-svn-id: svn://svn.berlios.de/openocd/trunk@2295 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-20 18:19:21 +00:00
zwelch
580a05a07f Remove editor preferences from source files.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2294 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-19 23:56:52 +00:00
duane
40d7e81c45 printf() warning fixes due to uint32_t change-over
git-svn-id: svn://svn.berlios.de/openocd/trunk@2293 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-19 23:15:58 +00:00
zwelch
9eb3181cc8 Paulius Zaleckas <paulius.zaleckas@gmail.com>:
This is minimal patch to support FA526 ARMv4 compatible core.
Since it is very similar to ARM920T I tried to reuse as much
code as possible.

CPU and board configs will follow soon.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2292 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-19 22:39:35 +00:00
oharboe
13e592f9f6 less warnings
git-svn-id: svn://svn.berlios.de/openocd/trunk@2291 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-19 09:09:25 +00:00
oharboe
333642fcff fix jtag_add_callback() args. The first argument is nothing special, it's just another generic argument.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2290 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-19 08:18:36 +00:00
duane
a1c14646cb commit test from Duane
git-svn-id: svn://svn.berlios.de/openocd/trunk@2289 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-19 06:05:46 +00:00
oharboe
01823f5e0b less warnings
git-svn-id: svn://svn.berlios.de/openocd/trunk@2288 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-18 13:40:38 +00:00
oharboe
8f87f8945e less warnings
git-svn-id: svn://svn.berlios.de/openocd/trunk@2287 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-18 13:35:18 +00:00
zwelch
e8ba53ef6f Oyvind Harboe <oyvind.harboe@zylin.com>:
Ecos uses sys/types.h not stdint.h.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2286 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-18 10:42:40 +00:00
zwelch
592e080690 Cast 64-bit trace hit_counter to long long; fixes format warning.
What is the correct way to handle this?


git-svn-id: svn://svn.berlios.de/openocd/trunk@2285 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-18 10:40:33 +00:00
zwelch
c5de7b6bd7 Update Style Guide documentation to explain basic type rules.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2284 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-18 07:11:55 +00:00
zwelch
4cf8d5ec17 Remove redundant typedefs in types.h; include stdint.h unconditionally.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2283 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-18 07:11:48 +00:00
zwelch
0ca97d82d8 Transform 'u64' to 'uint64_t'
- Replace '\([^_]\)u64' with '\1uint64_t'.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2282 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-18 07:11:40 +00:00
zwelch
86e4324f1b Finish transforming 'u32' to 'uint32_t'.
- Replace '\([^_]\)u32' with '\1uint32_t'.
- Replace '^u32' with 'uint32_t'.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2281 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-18 07:11:11 +00:00
zwelch
1840226d55 Transform 'u32' to 'uint32_t' in src/flash.
- Replace '\([^_]\)u32' with '\1uint32_t'.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2280 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-18 07:10:25 +00:00
zwelch
3c2eabd20f Transform 'u32' to 'uint32_t' in src/target
- Replace '\([^_]\)u32' with '\1uint32_t'.
- Replace '^u32' with 'uint32_t'.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2279 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-18 07:09:35 +00:00
zwelch
db7e77237c Transform 'u32' to 'uint32_t' in src/target/arm*
- Replace '\([^_]\)u32' with '\1uint32_t'.
- Replace '^u32' with 'uint32_t'.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2278 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-18 07:08:52 +00:00
zwelch
f876d5e9c7 Transform 'u16' to 'uint16_t'
- Replace '\([^_]\)u16' with '\1uint16_t'.
- Replace '^u16' with 'uint16_t'.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2277 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-18 07:07:59 +00:00
zwelch
c18947b947 Transform 'u8' to 'uint8_t'
- Replace '\([^_]\)u8' with '\1uint8_t'.
- Replace '^u8' with 'uint8_t'.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2276 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-18 07:07:12 +00:00
zwelch
310be8a838 Transform 'u8' to 'uint8_t' in src/flash
- Replace '\([^_]\)u8' with '\1uint8_t'.
- Replace '^u8' with 'uint8_t'.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2275 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-18 07:06:25 +00:00
zwelch
86173cdbdd Transform 'u8' to 'uint8_t' in src/target
- Replace '\([^_]\)u8' with '\1uint8_t'.
- Replace '^u8' with 'uint8_t'.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2274 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-18 07:04:08 +00:00
zwelch
8f9f5c189b David Brownell <david-b@pacbell.net>:
The PLD stuff hasn't been documented yet.  It's just Virtex2 for now,
but it looks like adding others would be easy.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2273 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-18 04:08:51 +00:00
zwelch
1642dd2ea0 David Brownell <david-b@pacbell.net>:
Clean up the PLD files:

 - Get rid of some extraneous whitespace
 - Make various functions static
 - Wrap overlong lines


git-svn-id: svn://svn.berlios.de/openocd/trunk@2272 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-18 00:29:45 +00:00
zwelch
6f4d876c88 David Brownell <david-b@pacbell.net>:
Various bits of cleanup, mostly to match the style hints
I just got around to writing up.

 - Various @cindex improvements

 - Cross reference the command line options in a few spots,
   notably for @command{debug_level}

 - Clean the config file guidelines a bit:
    * They're for all users, not just integrators
    * Reference the interface config chapter
    * Don't emphasize command line usage here
    * Tweak board and target config introductory text

Plus two minor bits of cleanup:  remove most date references,
and refer to the reader as "you" not "the user".


git-svn-id: svn://svn.berlios.de/openocd/trunk@2271 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-18 00:29:39 +00:00
zwelch
8ab9b6d39e David Brownell <david-b@pacbell.net>:
Take a whack at providing some texinfo style docs.
Mostly it's just basic "how 2 write sane dox" stuff.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2270 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-18 00:29:33 +00:00
oharboe
1a400f8b8e Freddie Chopin <freddie_chopin@op.pl> makes lpc2478.cfg file more "standard" and - what is most important - correct (it's working [; ). I've also added some comments which try to clarify the meaning of all that's in there.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2269 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-17 20:49:55 +00:00
oharboe
8d8937f1a6 dummy driver now works under eCos
git-svn-id: svn://svn.berlios.de/openocd/trunk@2268 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-17 10:51:34 +00:00
zwelch
d727e31af9 David Brownell <david-b@pacbell.net>:
Update the Beagle setup:

 - OMAP3530 updates:
    * split ICEpick TAP enable support to its own file, for
      reuse and eventually for storing other utility code
      like emulation reset
    * clean up, including labeling the tap as for DAP not
      for the Cortex-A8 and making endianness non-variable
    * add a few FIXMEs

 - BeagleBoard cleanup:  there's no SRST, "endstate" is gone, etc

I'm not sure I'd say it's further than "barely limping" just yet.
Key issues remain lack of Cortex-A8 support, and more complete
support for resetting.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2267 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-17 06:44:29 +00:00
zwelch
7ddc6c3d55 David Brownell <david-b@pacbell.net>:
Fix for a goofy "board" config ... reuse target/pxa270.cfg
instead of using a private copy.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2266 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-17 06:41:05 +00:00
zwelch
10e435c961 David Brownell <david-b@pacbell.net>:
DM6446 config updates:

 - List two more TAPs, as disabled, mostly for doc purposes
 - Included basic ICEpick support, still disabled by default
 - Shorten line lengths
 - Use $_TARGETNAME to configure the ETM and ETB
 - This ARM core don't support endianness overriding

For now, boards that can't jumper EMU0/EMU1 will need to tweak
a variable's setting.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2265 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-17 06:40:58 +00:00
zwelch
d31e57a10d David Brownell <david-b@pacbell.net>:
Let jtag_call_event_callbacks() behave when the callback removes itself.
Oddly, this crashed on x86_32 but not x86_64.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2264 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-17 06:40:50 +00:00
zwelch
6ba0b46cec David Brownell <david-b@pacbell.net>:
Fix parsing bugs for "$target_name mww addr data [count]" ... it was
always requiring the count, instead of just defaulting it to one.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2263 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-17 06:40:39 +00:00
zwelch
ed5b5b834e Fix compilation for Ubuntu 9.04 on x86-64 when using --enable-httpd.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2262 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-17 06:10:10 +00:00
zwelch
e2cacd4368 Set svn:eol-style native on ZY1000 minidriver header file.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2261 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-17 01:59:59 +00:00
zwelch
2d0afa36a8 Ensure range errors are reported only when errno indicates one occurred.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2260 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-17 00:31:06 +00:00
zwelch
c0f4495d5e Change parse_type macros to be sed-friendly.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2259 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-17 00:30:52 +00:00
zwelch
d579befc07 Add argument parsing errors in command.h, use in parse_type routines.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2258 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-17 00:30:44 +00:00
zwelch
0e28997989 Move definition of parse_type helpers to command.c:
- Add declarations in header file.
- Improve wrapper implementations to check for underflow.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2257 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-17 00:30:36 +00:00
zwelch
06a1bb335e Convert core parse_type implementations to check for underflow errors.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2256 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-17 00:30:29 +00:00
zwelch
a830197f59 Add improved support for parsing signed integers.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2255 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-17 00:30:20 +00:00
zwelch
a3ec1e1f94 Update parse_type macro definitions to allow re-use with signed types.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2254 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-17 00:30:11 +00:00
zwelch
8b16068941 Improve definitions of parse_ulong and parse_ullong:
- Use macro to eliminate duplicate body definitions.
- Rename okay as is_okay; add parenthesis to help "clarify" logic.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2253 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-17 00:29:56 +00:00
zwelch
c928fe0fa0 David Brownell <david-b@pacbell.net>:
Fix a bug preventing ICEpick "enable that TAP" code from working:
the "runtest" command wrongly finished with a JTAG reset, discarding
the work the TAP enable handler just finished!  Instead, JTAG should
stay in RUN/IDLE state.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2252 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-16 12:17:26 +00:00
zwelch
a0c10dd29b David Brownell <david-b@pacbell.net>:
Extend the internal JTAG event handlers to cover enable/disable,
and use those events to make sure that targets get "examined" if
they were disabled when the scan chain was first set up:

 - Remove "enum jtag_tap_event", merge with "enum jtag_event",
   so C code can now listen for TAP enable/disable events.

 - Report those events so they can trigger callbacks.

 - During startup, make target_examine() register a handler to
   catch ENABLE events for any then-disabled targets.

This fixes bugs like "can't halt target after enabling its TAP".

One class of unresolved bugs:  if the target has an ETM hooked
up to an ETB, nothing activates the ETB.  But starting up the
ETM without access to the ETB registers fails...


git-svn-id: svn://svn.berlios.de/openocd/trunk@2251 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-16 12:17:18 +00:00
zwelch
491083a248 David Brownell <david-b@pacbell.net>:
Tighten error handling on TAP enable/disable paths a bit:

 - Don't enable/disable unless it's necessary.  Those event
   handlers could have nasty side effects...

 - Don't *succeed* enables/disables if there was no code which
   could have implemented that action.  This prevents bugs like
   wrongly acting as if the scan chain changed.

 - Minor whitespace cleanup in enable/disable command code.

The big problem is still the lack of code to verify scan chains
were actually updated as requested; this adds a comment on that.
I suspect the best we can do near term will be to verify IDCODE.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2250 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-16 12:17:12 +00:00
zwelch
0de478618a David Brownell <david-b@pacbell.net>:
Fix bug in a warning.  It warned about "huge IRlength" for an
older JRC with a two bit instruction register ... wrong!


git-svn-id: svn://svn.berlios.de/openocd/trunk@2249 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-16 00:23:32 +00:00
zwelch
011e9b85b1 David Brownell <david-b@pacbell.net>:
Distributing FTDI's "ftd2xx" library with OpenOCD violates the
OpenOCD license (GNU GPLv2 with no exceptions).

Make that clear where that build option is presented, and don't
describe the FTDI libraries as an option for any packager.  (It's
fine for personal use, of course.)

Plus some related clarifications:  libftdi version 0.16 for the
new FT2232H chips (for RTCK and high speed USB); the Amontec
drivers are just ftd2xx variants.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2248 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-16 00:23:22 +00:00
zwelch
14f88acaf6 David Brownell <david-b@pacbell.net>:
Fix some polling issues:

 - Don't background-poll disabled TAPs ... this was just a bug
   waiting to happen.  (And then it happened!)

 - Don't fail command line polls of disabled taps; that's not any
   kind of error, it's just that you can't do much.  But do show
   that tap-disabled status.

 - Spell "continuous" correctly in the variable name.  ;)

Not resolved by this patch:  the need for an interlock whereby
other code (like the JTAG layer) can block all other access to
the JTAG layer, e.g. while enabling or disabling TAPs.  And
that interlock needs to be timer-safe...


git-svn-id: svn://svn.berlios.de/openocd/trunk@2247 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-16 00:23:13 +00:00
zwelch
5f9b74d055 David Brownell <david-b@pacbell.net>:
Doc update:  say "jtag newtap ... -disable" records the
state after exiting the RESET state, matching the only
implementation we're working with so far (TI ICEpick-C).

Matching code updates.  Now we can be sure that the
"enabled" flag value is correct after JTAG resets.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2246 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-16 00:23:00 +00:00
zwelch
03803a9d79 David Brownell <david-b@pacbell.net>:
Fix a memory leak in jtag_tap_free():  unregister the event
callback too.

Also fix the associated conceptual bug in unregistering JTAG
event callbacks:  since the same callback procedure is used
many times with different callback data (a TAP handle), that
data must be considered when unregistering any callback.

This could fix some crashes after TAP registration errors,
by making sure the reset event handler doesn't scribble over
memory that's now used by something else.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2245 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-16 00:22:52 +00:00
zwelch
c7cfb3417b David Brownell <david-b@pacbell.net>:
Minor jtag cleanup:

 - remove hidden assumption about JTAG event numbering
 - move function declarations to a header
 - some end'o'line whitespace
 - use "calloc" not "malloc + memset"


git-svn-id: svn://svn.berlios.de/openocd/trunk@2244 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-16 00:22:40 +00:00
zwelch
cc9488008a David Brownell <david-b@pacbell.net>:
Minor updates to the text about reset configuration:

 - Mention a new point that it interacts with JTAG routers;

 - Talk about a "user" config file not a "system" one;

 - Remove text from the "reset_config" description; instead,
   cross-reference the more extensive text earlier.
   


git-svn-id: svn://svn.berlios.de/openocd/trunk@2243 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-16 00:22:12 +00:00
zwelch
1ac220df71 David Brownell <david-b@pacbell.net>:
Add another board ... OMAP2420 "H4" board.  This won't be very widely
used with OpenOCD, but with mainline support in both U-Boot and Linux
it at least makes for a more complete set (and another testcase).

This is incomplete support in several respects.  The ARM11 support is
not very deep yet; most registers aren't available, and the ETM can't
be hooked up.  Plus, there's no script for OMAP-specific stuff like
setting up the SDRAM controller.  Eventually the same NAND controller
driver should work with OMAP2 and OMAP3.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2242 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-15 23:54:09 +00:00
oharboe
588a17da43 fix eCos build problems w/latest parse_ulong() stuff
git-svn-id: svn://svn.berlios.de/openocd/trunk@2241 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-15 14:22:13 +00:00
zwelch
4f4592539d David Brownell <david-b@pacbell.net>:
OpenOCD doesn't actually *need* to be keeping all TCP ports
active ... creating security issues in some network configs.

Instead, let config file specify e.g. "tcl_port 0" (or gdb_port,
telnet_port) to disable that particular remote access method.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2240 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-13 08:38:57 +00:00
zwelch
0ffbc60333 Factor load_image argument parsing to parse_load_image_command_args:
- Make fast_load_image use the helper coverage the standard load_image.
- Improve whitespace in the moved lines.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2239 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-13 00:34:31 +00:00
zwelch
af52480a45 Improve handle_profile_command argument parsing:
- Use parse_uint to ensure timeout value parses properly.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2238 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-13 00:34:24 +00:00
zwelch
b7c5e630ea Improve handle_virt2phys_command argument parsing:
- Use parse_u32 to ensure virtual address parses properly.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2237 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-13 00:34:17 +00:00
zwelch
f7afcfe23f Cleanup and improve handle_wp_command and handle_rwp_command:
- Simplify argument parsing logic using switch statement.
- Use parse_u32 to ensure all values parse properly.
- Return syntax error when mode argument fails to parse.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2236 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-13 00:34:10 +00:00
zwelch
d0a300e0a0 Improve and simplify handle_bp_command and handle_rbp_command:
- Bug fix: return syntax error if remove called without one argument.
- Use parse_u32 to ensure address and length arguments parse properly.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2235 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-13 00:34:03 +00:00
zwelch
16c77cf3ca Improve handle_verify_image_command_internal command argument handling:
- Use parse_u32 to ensure address parses properly.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2234 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-13 00:33:55 +00:00
zwelch
890973acc4 Improve handle_dump_image_command argument parsing:
- Use parse_u32 to ensure address and size parse properly.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2233 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-13 00:33:48 +00:00
zwelch
bb37adadab Improve handle_load_image_command argument parsing:
- Use parse_u32 to ensure base/min/max addresses parse properly.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2232 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-13 00:33:42 +00:00
zwelch
6f9aac1892 Improve handle_mw_command argument handling:
- Change: All local variable types are now unsigned.
- Use parse_u32 to ensure address and value parse properly.
- Use parse_uint to ensure count parses properly.
- Move variables to location of first use.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2231 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-13 00:33:34 +00:00
zwelch
08128b572a Improve handle_md_command argument handling:
- Use parse_u32 and parse_uint for address and count, respectively.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2230 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-13 00:33:25 +00:00
zwelch
71f95de8a6 Use parse_u32 in handle_resume_command and handle_step_command.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2229 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-13 00:33:18 +00:00
zwelch
5d0cdf4d94 Cleanup and improve handle_halt_command:
- Make argument check use parse_uint to ensure value parses properly.
- Move variable declarations to location of first use.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2228 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-13 00:33:11 +00:00
zwelch
fad8521a87 Cleanup and fi handle_wait_halt_command:
- Use unsigned type for delay variable.
- Use parse_uint to ensure delay argument parses properly.
- Bug fix: Return syntax error if more than one argument is given.
- Bug fix: Return syntax error when argument fails to parse.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2227 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-13 00:33:01 +00:00
zwelch
45ec363c4a Use parse_uint in handle_reg_command to ensure reg number parses properly.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2226 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-13 00:32:54 +00:00
zwelch
2343245090 Use parse_uint in get_target to ensure target id is parsed properly.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2225 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-13 00:32:40 +00:00
zwelch
cdd8f23b9b David Brownell <david-b@pacbell.net>:
Currently the "debug_level 3" command tracing ignores commands
that could return values to TCL scripts (by plugging in to a
slightly lower level of the interpreter stack).

Fix that by abstracting the tracing command and starting to
make some of those previously-untraced commands use this new
mechanism.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2224 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-12 22:06:02 +00:00
zwelch
7b65cb367f David Brownell <david-b@pacbell.net>:
Move the discussion of the "scan_chain" command up to go with
the presentation of that topic in the TAP declaration chapter.

This makes the presentation of the TAP and target lists be
parallel, which will be something of an aid to understanding
that they are different (and how).


git-svn-id: svn://svn.berlios.de/openocd/trunk@2223 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-12 21:53:17 +00:00
zwelch
8551803eb5 David Brownell <david-b@pacbell.net>:
Partial fix to the "long IR length" problems.

 - Current code could handle up to 32 bit IR lengths with
   full functionality, if it didn't just reject may of them
   out of hand.  So only reject clear errors, where the IR
   mask (or capture instruction) needs more than IrLen bits.

 - Longer IR lengths can only be handled in BYPASS mode
   for now.  Example:  TI's DSPs use 38-bit IR lengths.
   So we can't issue their IDCODE instructions...

A more complete fix would be able to issue longer instructions;
or minimally, would fail cleanly for the non-BYPASS case.

Note that this *could* make some currently broken scripts fail,
since the previous code accepted garbage values so long as
they didn't use more than 16 bits.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2222 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-12 21:43:53 +00:00
zwelch
a92cc405ac unsik Kim <donari75@gmail.com>:
Improve error handling in mflash driver.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2221 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-12 21:31:11 +00:00
zwelch
7fdce0e8bc Further cleanup to MIPS target read/write memory function:
- Move the mips32_..._read_mem calls to top-level of read_mem function.
- Change: Only perform mips_m4k_read_mem conversion when retval == ERROR_OK.  
   - Prevents pointless conversions of bogus read values after failures.
- Eliminate retval variable from mips_m4k_write_mem; return directly.
- Move declaration of retval variable to point of first use.
- Remove the now redundant switch statements testing size:
  - argument sanitizing already covers these cases.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2220 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-12 04:14:28 +00:00
zwelch
c6e80f63a3 David Claffey <dnclaffey@gmail.com>:
This patch helps fix MIPS big endian (elf32-tradbigmips) targets.
If "-endian big" is not set in target create, the endianess defaults to
little.  mw and md commands will still work, but binary file loads will
have the incorrect word order loaded into memory.

The EJTAG processor access data register (PrAcc) is little endian
regardless of the CPU endianness; it is always loaded LSB first. This
is confirmed by the fact that mips_ejtag_drscan_32() uses buf_set_u32()
to load the scan field; buf_set_u32() is a little-endian formatter. For
big endian targets, data buffers have to be modified so the LSB of each
u32 or u16 is at the lower (first) memory location.  If the drscan
out_value word order is set using buf_set_u32() then it makes sense to
also fixup the in_value with buf_get_u32(); a symmetry argument. This
has no affect on little endian hosts.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2219 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-12 04:14:18 +00:00
zwelch
a351c57261 Fix unitialized use of cur_speed in handle_jtag_khz_command:
- Use the default KHz speed setting, in case interface is not initialized.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2218 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-12 01:41:07 +00:00
zwelch
f5e4511701 Improve vsllink command argument handling:
- Bug fix: Always clear high bit of USB bulk out endpoint.
- Use parse_ulong helpers to ensure numeric strings are parsed properly.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2217 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-12 01:41:00 +00:00
zwelch
a9d5119825 Improve handle_runtest_command:
- Use parse_uint helper to ensure argument is parsed properly.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2216 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-12 01:40:54 +00:00
zwelch
ea95cdb8e2 Improve VID/PID command argument handling in FTDI driver:
- Bug fix: Return a syntax error when less than two arguments are given.
- Bug fix: Use parse_u16 helper to ensure vales are parsed properly.
- Simplify loop termination logic by ensuring argc is always even.
- Move loop induction variable declaration to where it is used.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2215 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-12 01:40:48 +00:00
zwelch
70d853b9fa Improve handle_irscan_command:
- Use parse_u32 helper to ensure scan values are parsed properly.
- Clear the fields buffer to ensure partial cleanup occur correctly.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2214 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-12 01:40:42 +00:00
zwelch
82403fe644 Improve JTAG reset, speed, and khz handlers to use parse_uint helper.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2213 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-12 01:40:35 +00:00
zwelch
5d657571cb Use parse_uint helper to replace strtoul call in jtag_tap_by_string.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2212 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-12 01:40:29 +00:00
zwelch
d5339d2eb4 Simplify and improve gw16012_handle_parport_command:
- Show the port number to the user when asking for it or setting it.
- Print an error if the parport_port has already been set.
- Use parse_u16 helper to ensure the parport_port string parses correctly.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2211 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-12 01:40:23 +00:00
zwelch
f218f36df5 Simplify and improve amt_jtagaccel_handle_parport_port_command:
- Show the port number to the user when asking for it or setting it.
- Print an error if the amt_jtagaccel_port has already been set.
- Use parse_u16 helper to ensure amt_jtagaccel_port string parses correctly.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2210 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-12 01:40:17 +00:00
zwelch
ae28b96ab9 Simplify and improve parport_handle_parport_port_command:
- Show the port number to the user when asking for it or setting it.
- Print an error if the parport_port has already been set.
- Use parse_u16 helper to ensure the parport_port string parses correctly.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2209 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-12 01:40:03 +00:00
zwelch
0f6a47837e Simplify and improve handle_debug_level_comamnd:
- Bug fix: Return a syntax error if more than one argument is given.
- Bug fix: Use new parse_uint helper ensure debug_level parses correctly.
- Change: Display the debug_level after it has been set.
- Simplify bounds checking of debug_level.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2208 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-12 01:39:57 +00:00
zwelch
5af1bdcff4 Simplify handle_sleep_command:
- Use new parse_ulong to ensure duration parses as a valid number.
- Rework logic to improve readability and seliminate uperfluous braces.
- Change whitespace to improve style.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2207 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-12 01:39:51 +00:00
zwelch
5c123481a1 Add new parse_uinttype wrappers for strtoul in src/helper/command.[ch].
- Used to improve command argument parsing of unsigned integers values.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2206 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-12 01:39:44 +00:00
zwelch
5bb0f1d29a David Brownell <david-b@pacbell.net>:
Minor bugfix:  command_print_sameline() is what the
headers declare; make the code match.

Minor improvement:  make the printf format params always be const.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2205 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-11 21:55:43 +00:00
zwelch
72687f227a David Brownell <david-b@pacbell.net>:
Rework the "Simple Configuration Files" chapter so it's more
of a quick-start "how to set up your project" tutorial:

 - Say how to hook up the JTAG adapter.  This will help new
   users, and in any case is worth spelling out somewhere.

 - Streamline the previous rather haphazard presentation,
   filling in some missing holes along the way:

     * Suggest "project directory" structure
     * Introduce new term, "user config" file (openocd.cfg)
     * Talk about more options for openocd.cfg contents
     * ... and about creating new config files
     * Add new topic, project-specific utilities (+examples)

 - Remove too-short, yet duplicative, chapter 19

Nudge packagers a bit more strongly to send patches (including
config files) upstream.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2204 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-11 21:48:36 +00:00
zwelch
b3edde7b7d David Brownell <david-b@pacbell.net>:
Update "arm9tdmi vector_catch" command description to highlight both
use cases (display configuration, or first change that config) and
to explain a bit more about what this is:  an alternative to using
hardware breakpoint resources.

Note that I tried this on an arm920t, but it didn't work.  Set bits,
then examined them and they weren't set.  And it didn't seem to act
as if vector triggering was noticed, either.

Also some minor unrelated tweaks:  @ignore some unused or don't-use
event names; fix a few typos; tweak chip-specific reset descriptions.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2203 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-11 21:23:24 +00:00
ntfreak
2e0be4e18b - fix bug introduced during r1962
- Original patch submitted by David Claffey [dnclaffey@gmail.com].



git-svn-id: svn://svn.berlios.de/openocd/trunk@2202 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-11 19:32:10 +00:00
oharboe
eb9ecb8224 embedded host: launch telnet server even if configuration fails
git-svn-id: svn://svn.berlios.de/openocd/trunk@2198 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-11 13:03:32 +00:00
oharboe
1b2c1c6ff0 fix ordering of arguments to fwrite()
git-svn-id: svn://svn.berlios.de/openocd/trunk@2197 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-11 13:00:08 +00:00
zwelch
538050c146 Factor handle_bp_command into pieces:
- Bug fix: return a syntax error if the wrong number of arguments are given.
- Add handle_bp_command_list() and handle_bp_command_set().
- Use temporary addr variable to eliminate redundant strtoul() calls.
- Place variable declarations at their point of first use.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2196 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-11 11:43:07 +00:00
zwelch
8e899d43ef Factor target_timer_callbacks_check_time into pieces:
- Add target_timer_callback_periodic_restart and target_call_timer_callback.
- Clean up and simplify logic that determines whether to call each callback. 
- Move variable declarations to location of first use.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2195 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-11 11:43:00 +00:00
zwelch
7c892082c9 Simplify and clean handle_virt2phys_command:
- Add a doxygen block to simplify logic.
- Move declarations to point of first use.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2194 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-11 11:42:54 +00:00
zwelch
57612ecf1d Simplify and fix target handle_rwp_command routine:
- Return syntax error unless exactly one argument is passed.
- Move variable declaration to point of first use.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2193 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-11 11:42:47 +00:00
zwelch
d7ada2457e Simplify and fix handle_reset_command:
- Return syntax error if more than one argument is given.
- Move variables to location of first use.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2192 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-11 11:42:40 +00:00
zwelch
e4850d7159 Simplify handle_resume_command:
- Eliminate redundant calls to target_resume with addr temp variable.
- Place variables at location of first use.
- Fix minor whitespace issues.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2191 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-11 11:42:33 +00:00
zwelch
78cf92166a Simplify and fix handle_step_command:
- Bug fix: return syntax error when more than one argument is given.
- Eliminate redundant calls to step callback with addr temp variable.
- Place variables at location of first use.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2190 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-11 11:42:26 +00:00
zwelch
4c31d5d179 Move jtag_get_flush_queue_count near jtag_execute_queue (fix its docs).
git-svn-id: svn://svn.berlios.de/openocd/trunk@2189 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-11 07:08:45 +00:00
zwelch
128ff94226 Improve grouping of JTAG KHz and verification accessors in header file.
Add some quick Doxygen comments for these routines.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2188 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-11 07:08:34 +00:00
zwelch
28fa603eff Group JTAG reset configuration and accessor APIs together in header file.
Remove unused reset_line_mode enumerated type.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2187 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-11 07:08:28 +00:00
zwelch
5208481fb3 Move jtag_error helper declarations to the end of the header.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2186 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-11 07:08:21 +00:00
zwelch
08382e0601 Out-of-line jtag_tap_next_enabled and simplify its logic.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2185 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-11 07:08:14 +00:00
zwelch
04cb121073 Move jtag_add_statemove decl/body nearer jtag_add_pathmove.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2184 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-11 07:08:03 +00:00
oharboe
c1995bb08f disable polling continuous polling during reset
git-svn-id: svn://svn.berlios.de/openocd/trunk@2183 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-11 06:19:37 +00:00
ntfreak
6dc8bbdc2b - update openocd online doc url's
git-svn-id: svn://svn.berlios.de/openocd/trunk@2182 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-10 22:22:49 +00:00
ntfreak
79d80e40bd - fix texi/pdf issue created in svn r2039
git-svn-id: svn://svn.berlios.de/openocd/trunk@2181 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-10 21:30:48 +00:00
oharboe
ba0f4a254c added pathmove command
git-svn-id: svn://svn.berlios.de/openocd/trunk@2180 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-10 07:19:14 +00:00
zwelch
8b7f813b23 David Brownell <david-b@pacbell.net>:
Tweak the csb337 code so that it doesn't enable alignment traps when
it completes the "reset init" sequence.  It turns out that the current
CFI code reliably triggers such traps.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2179 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-10 04:08:32 +00:00
zwelch
bdb7dd5e0f Move the documentation for the "poll" command up with
other server configuration.  Explain what it's about;
reference the related "$target_name curstate" method.

Update "poll" output to report whether background polling
is enabled or not.

Also fix a small typo; PC's have "complementary" tools.
Some have also "complimentary" ones; but not all.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2178 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-10 04:06:25 +00:00
zwelch
82aa9af1ad Improve use of automake conditionals for FTDI-based JTAG drivers:
- Remove once-used XXX_FTD2XX symbols; replace with XXX_DRIVER symbols.
- Enabled when either libftdi or FTD2xx driver should be built.
- Eliminates redundant DRIVERSFILE assignment in JTAG automake input.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2177 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-09 14:18:28 +00:00
zwelch
0bc53e73cc Simplify JTAG automake input file:
- Consolidate all individual driver variables into DRIVERFILES.
  - Eliminates all empty 'else' conditional clauses.
- Move minidriver files to top of file.
- Use MINIDRIVER conditional to build only driver(s) that will be linked.
- Eliminate superfluous whitespace.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2176 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-09 14:18:23 +00:00
zwelch
b8034bd9ee Rename jtag_driver.c as driver.c to remove duplicate name component.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2175 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-09 12:47:49 +00:00
zwelch
9d19468502 Add a rule to rebuild libtool if ltmain.sh changes (from libtool docs).
git-svn-id: svn://svn.berlios.de/openocd/trunk@2174 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-09 12:01:56 +00:00
oharboe
e582ea9776 reset to eol native for now. guess-rev.sh was broken by eol native, but it was a red herring that these two files were affected.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2173 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-09 11:05:45 +00:00
zwelch
00228aa839 Fix make maintainer-clean for out-of-tree builds.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2172 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-09 10:28:16 +00:00
zwelch
e8febc2255 Encapsulate the core jtag interface pointer:
- Add new jtag_config_khz to increase encapsulation of jtag->khz call.
- Add new jtag_get_speed_readable to encapsulate of jtag->speed_div call.
- Make definition of jtag static in core.c, remove extern from tcl.c.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2171 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-09 10:07:07 +00:00
oharboe
5f4ecc60a9 dos2unix
git-svn-id: svn://svn.berlios.de/openocd/trunk@2170 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-09 08:59:54 +00:00
zwelch
15974a0eeb Continue encapsulation of JTAG event callback sub-API:
- Move jtag_event_callbacks struct to core.c; it's an implementation detail.
- Move jtag_*_event_callbacks next to the definition of the new function type.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2169 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-09 08:41:36 +00:00
zwelch
aabb31d571 Add jtag_event_handler_t:
- Define the function signature used by the JTAG event callback mechanism.
- Provide Doxygen block for new type, including TODO for its return value.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2168 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-09 08:41:29 +00:00
zwelch
ae52de5ad5 Expose jtag_unregister_event_callback with related API declarations.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2167 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-09 08:41:23 +00:00
zwelch
a485ded4bf Improve encapsulation of JTAG event handling:
- Move nvp_jtag_tap_event and jtag_tap_handle_event to tcl.c.
- Change both to be static; remove declaration of function from jtag.h.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2166 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-09 08:41:14 +00:00
zwelch
a2d18e9111 Properly encapsulate core hasKHZ variable.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2165 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-09 08:41:08 +00:00
zwelch
55be316dbf Cleanup and encapsulate IR Capture verification:
- Add accessors for setting the jtag_verify_capture_ir flag.
- Use them in handle_verify_ircapture_cpmmand
- Change variable type to bool; make it static.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2164 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-09 08:41:00 +00:00
zwelch
a70d77aec3 Add missing static keywords to a few variables in JTAG core module.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2163 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-09 08:40:54 +00:00
zwelch
f9596e96c9 Move the jtag_error helper routines out of header file:
- Makes jtag_error static, add new get helper function for completeness.
- Improve and add documentation and style for these helpers.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2162 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-09 08:40:46 +00:00
zwelch
6dc2c2ce97 Encapsulate jtag_reset_config using accessors:
- Update handle_reset_config_command in tcl.c to use new helpers.
- Replace direct accesses in JTAG interface and target drivers.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2161 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-09 08:40:31 +00:00
zwelch
2a8e37173a Remove superfluous extern for non-existant global variable.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2160 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-09 08:40:23 +00:00
zwelch
cd7f89f6bc Add get and set accessors for jtag_speed:
- Setter calls the interface driver callback to improve core encapsulation.
- Use getter in standard JTAG interface drivers and ZY1000 minidriver.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2159 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-09 08:40:10 +00:00
zwelch
bcad121d2b Encapsulate the jtag_event_callback list; add helper functions if needed.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2158 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-09 08:40:02 +00:00
zwelch
175867ea32 Encapsulate the jtag_trst and jtag_srst variables:
- Add accessor functions to return their value.
- Use new SRST accessor in cortex_m3.c and mips_m4k.c


git-svn-id: svn://svn.berlios.de/openocd/trunk@2157 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-09 08:39:50 +00:00
zwelch
92a102c2d5 Move extern of nvp_jtag_tap_event from jtag.h to tcl.c.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2156 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-09 08:39:44 +00:00
zwelch
d19643f774 Remove superfluous extern of jtag_event_strings from jtag.h.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2155 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-09 08:39:37 +00:00
oharboe
7a53ff6633 remove native line style
git-svn-id: svn://svn.berlios.de/openocd/trunk@2154 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-09 07:51:47 +00:00
oharboe
f5d2e29763 removed native line end style - breaks cygwin
git-svn-id: svn://svn.berlios.de/openocd/trunk@2153 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-09 06:53:26 +00:00
zwelch
133a616572 Replace 'jtag.c' with 'core.c' in code comments.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2152 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-09 04:54:09 +00:00
zwelch
8e081cf401 Remove accidental duplicate of hasKHz; fixes pre-init speed setup.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2151 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-09 04:39:54 +00:00
zwelch
aed24a5946 Provide brief description of newly factored TCL layer in The Manual.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2150 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-09 04:35:16 +00:00
zwelch
66707c94d7 Split main jtag.c file into two layers:
- src/jtag/core.c: contains the low-level JTAG TAP and scanning routines.
- src/jtag/tcl.c: contains high-level JTAG TCL commands that use the core.
- Remove static keywords from routines in core.c, extern from tcl.c:
  - jtag, jtag_interface global variables
  - jtag_{examine,validate}_chain and jtag_tap_{init,free} functions
- Added myself to the copyright header in both of these files.
- Used 'svn cp' to add files, so versioning was preserved for both.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2149 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-09 04:15:13 +00:00
zwelch
03b2b345ed Merge documentation for jtag_add_statemove from source into header block.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2148 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-09 02:48:28 +00:00
zwelch
cf08b00376 Move Doxygen documentation for IR/DR scan routines to header file.
- Move plain IR scan declaration closer to the other IR scan declarations.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2147 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-09 02:48:18 +00:00
zwelch
3cd428ffdb - Replace 'jtag_tap_by_abs_position' with 'jtag_tap_by_position'.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2146 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-09 02:24:05 +00:00
zwelch
f7216ffa33 Remove non-existant jtag_tap_by_position API declaration.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2145 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-09 02:24:00 +00:00
zwelch
2410d4b2b9 Use unsigned type for jtag_tap_count and jtag_tap_by_abs_position.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2144 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-09 02:23:53 +00:00
zwelch
0c3e5b5069 Cleanup jtag_tap_by_abs_position:
- Remove unused orig_n local variable.
- Merge variable declaration with first use.
- Update code to use current style guidelines.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2143 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-09 02:23:44 +00:00
zwelch
009034f56c Simplify jtag_tap_by_jim_object:
- Merge declarations of temporary variables with first use.
- Restructure logic to simplify conditional logic.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2142 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-09 02:23:35 +00:00
zwelch
9f185eef7d Simplify and fix bug in jtag_tap_by_string:
- Bug fix: Use unsigned type and strtoul when parsing for position number.
- Simplify logic by returning directly when a tap is found by name.
- Reduce scope: declare temporary variables with first use.
- Bring code up to current style guidelines.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2141 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-09 02:23:27 +00:00
zwelch
1c74d0e3a4 Allow jtag_tap_add to be called from other JTAG code modules.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2140 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-09 02:23:16 +00:00
zwelch
d706eb206e Cleanup jtag_tap_count_enabled.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2139 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-09 02:23:03 +00:00
zwelch
ff85ad7c12 Change jtag_add_pathmove to set jtag_error rather than call exit():
- Add new error codes to encode the possible failure conditions.
- Add documentation to describe the routine's possible error codes.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2138 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-09 01:16:35 +00:00
zwelch
731d2d0cb6 Reduce scope or eliminate temporary variables in jtag_add_statemove:
- Change types of tms_bits and tms_count to unsigned, eliminates a cast.
- Use moves[] only if needed; a single move can use goal_state directly.
- Declare loop induction variable inside its control statement.
- Remove retval in favor of direct returns.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2137 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-09 01:16:19 +00:00
zwelch
b3121aac76 Move documentation in jtag_add_statemove body to Doxygen block.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2136 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-09 01:16:13 +00:00
zwelch
ec274b2707 Revert changes from r2134 that snuck into the commit. Mea culpa.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2135 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-09 01:01:13 +00:00
zwelch
594abeb82b David Brownell <david-b@pacbell.net>:
Add configuration for an old AT91rm9200 board, the Cogent CSB 337.
Worth noting from the OpenOCD perspective:

 - It got a real hardware trace port connector; wired up here as
   much as we can, lacking inexpensive trace-aware dongles.

 - This is the first in-tree use of the "arm920t cp15" command.
   It adjusts the CPU clocking and enables i-cache, which gives
   more than 4x speedup after booting Linux; it's visible even
   just running U-Boot.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2134 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-09 00:58:23 +00:00
kc8apf
f0bb29b9d9 Fix eol-style on guess-rev.sh
git-svn-id: svn://svn.berlios.de/openocd/trunk@2133 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-08 22:18:16 +00:00
oharboe
3245a0cd5f update zy1000 to latest minidriver work
git-svn-id: svn://svn.berlios.de/openocd/trunk@2132 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-08 14:13:32 +00:00
oharboe
76d9c3d5b8 Zach Welch wrote a fix for configure problems under Cygwin.
ltmain.sh is added to svn ignore

git-svn-id: svn://svn.berlios.de/openocd/trunk@2131 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-08 13:57:13 +00:00
zwelch
6dc00b00a4 Add documentation for new interface_list command to user guide.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2130 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-08 13:16:57 +00:00
zwelch
51d158c410 Factor interface list to its own command:
- Add handle_interface_list_command, used by handle_interface_command.
- Display output of new list to command console.
- Change first index of displayed drivers to 1; it's only cosmetic.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2129 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-08 13:12:17 +00:00
zwelch
7bcd2e6854 Cleanup and simplify handle_interface_command:
- Reduce indent: invert logic of strcmp test.
- Reduce scope: declare variables upon first use in loops.
- Reduce unsaid: compare end of table with NULL.
- Remove superfluous braces around blocks with one statment.
- Improve language that introduces the list of built-in drivers.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2128 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-08 13:12:12 +00:00
zwelch
8290a05c2b Simplify jtag_add_sleep:
- Add todo for removing keep_alive: is this a layering violation?
- Use jtag_set_error instead of accessing jtag_error directly.
- Remove superfluous retval temporary variable and empty return.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2127 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-08 10:58:28 +00:00
zwelch
8c21ca7e81 Simplify jtag_add_reset:
- Use jtag_set_error instead of accessing jtag_error directly.
- Remove superfluous retval temporary variable.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2126 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-08 10:58:13 +00:00
zwelch
6f4de887f7 Simplify jtag_add_clocks:
- Use jtag_set_error instead of accessing jtag_error directly.
- Improve error language and whitespace.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2125 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-08 10:57:51 +00:00
zwelch
d76c63431f Simplify jtag_add_runtest:
- Use jtag_set_error instead of accessing jtag_error directly.
- Eliminate superfluous comment and temporary variable.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2124 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-08 10:57:39 +00:00
zwelch
521d8d5bfa Simplify jtag_add_pathmove:
- Use jtag_set_error instead of accessing jtag_error directly.
- Eliminate superfluous retval temporary variable.
- Reduce scope of loop induction variable.
- Wrap to fit within 80 columns.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2123 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-08 10:57:18 +00:00
zwelch
8a89899860 Simplify jtag_add_tlr:
- Use jtag_set_error instead of accessing jtag_error directly.
- Eliminate superfluous temporary variable.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2122 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-08 10:57:10 +00:00
zwelch
d3d0f662ef Simplify jtag_add_plain_dr_scan:
- Use jtag_set_error instead of accessing jtag_error directly.
- Wrap function arguments to fit everything in 80 columns.
- Move retval variable to location of first use.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2121 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-08 10:56:49 +00:00
zwelch
1497e6699a Simplify jtag_add_dr_scan:
- Use jtag_set_error instead of accessing jtag_error directly.
- Wrap function arguments to fit everything in 80 columns.
- Move retval variable to location of first use.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2120 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-08 10:56:36 +00:00
zwelch
e3b1937aaf Simplify jtag_add_plain_ir_scan:
- Use jtag_set_error instead of accessing jtag_error directly.
- Wrap function arguments to fit everything in 80 columns.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2119 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-08 10:56:25 +00:00
zwelch
9bdbe70ceb Simplify jtag_add_ir_scan_noverify:
- Use jtag_set_error instead of accessing jtag_error directly.
- Wrap and rename function arguments to fit everything in 80 columns.
- Move retval variable to location of first use.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2118 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-08 10:56:18 +00:00
zwelch
4cff9dc0c1 Simplify jtag_execute_queue:
- Add static inline jtag_error_clear helper to return and clear jtag_error.
- Use new helper to shrink body of function to two lines.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2117 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-08 10:56:07 +00:00
zwelch
f418fcbff0 Simplify jtag_execute_queue_noclear:
- Replace jtag_error logic with equivalent call to jtag_set_error.
- Remove superfluous comment and temporary return variable.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2116 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-08 10:55:54 +00:00
zwelch
791701165c Cleanup handle_runtest_command:
- Make command argument require exactly one argument; do not allow extras.
- Remove superfluous whitespace at end of function.
- Wrap function arguments to fit in 80 columns.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2115 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-08 10:55:44 +00:00
zwelch
5c9221ce61 Clean up handle_jtag_reset_command:
- Make command require exactly two arguments; do not allow more than two.
- Move temporary variable declarations closer to point of first use.
- Remove superfluous braces around single statments.
- Wrap to 80 column width.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2114 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-08 10:55:36 +00:00
zwelch
c75ef1cd37 Extend handle_jtag_n{s,t}rst_delay_command routines:
- Add support to display the reset delays too, like the other commands.
- Always show the values, so users can see if they are being redundant.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2113 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-08 10:55:24 +00:00
zwelch
ae0ba6f355 Add accessors to retrieve values of jtag_n{s,t}rst_delay variables.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2112 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-08 10:55:13 +00:00
zwelch
d7c4e1ec93 Update JTAG reset delay command handlers:
- Fixes for error handling:
  - Return a syntax error instead of calling exit(-1).
  - Return error when more than one argument is provided too.
- Remove useless braces and indent after the if/return statements.
- Wrap function arguments to fit in 80 columns.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2111 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-08 10:54:52 +00:00
zwelch
47a1185d5d Cleanup the handle_jtag_khz_command routine:
- Separate retval assignments from logical tests.
- Simplify logical tests.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2110 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-08 10:54:41 +00:00
zwelch
620ecedf42 Simplify logic in handle_jtag_speed_command.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2109 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-08 10:54:06 +00:00
oharboe
e468797e41 David Brownell <david-b@pacbell.net> Bugfix: $target_name cget/configure -work-area-backup commands
should return the "is it backed up?" flag, not the work area size.

git-svn-id: svn://svn.berlios.de/openocd/trunk@2108 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-08 06:18:13 +00:00
oharboe
a405fd1581 David Brownell <david-b@pacbell.net>
- Don't let disabled TAPs be set as the current target

 - Improve "targets" output:
    * Remove undesirable "chain position" number; we discourage using them
    * TAP and Target column updates:
       + make them long enough for current usage
       + improve labels, removing guesswork
       + "TapName" label patches scan_chain output
    * Highlight the "current" target
    * Display "tap disabled" as a new pseudo-state
    * Update docs accordingly

git-svn-id: svn://svn.berlios.de/openocd/trunk@2107 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-08 06:16:43 +00:00
zwelch
a221892f60 Adjust whitespace in configure script: use two spaces for indent.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2106 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-08 04:35:19 +00:00
zwelch
5ee0379be1 Reorder configure script macros:
- Check for a compiler before looking for libraries or header files.
- Initialize automake before calling other AM_ macros.
- Disable libtool shared libraries by default.
- Remove checks for unused C++, Fortran, and Java compilers.
- Remove redundant AC_CANONICAL_HOST; called by AC_PROG_LIBTOOL.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2105 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-08 04:35:05 +00:00
zwelch
35f7c4e478 Rework parallel port configure script option handling:
- Move AC_ARG_ENABLE for secondary parallel port options:
  - These macros cause their configure options to appear unconditionally,
    so they should not be placed inside conditional logic.
  - Groups them with primary parallel port driver option.
- Update these options to show '-' instead of '_'; both still work.
- Update command help text to show host architecture/OS requirements.
- Display a warning when these options have been provided and the
  configure script will ignore the setting that the user specified.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2104 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-08 04:34:45 +00:00
zwelch
1419a72892 Move minidummy source file, as was supposed to happen in last commit.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2103 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-08 01:14:04 +00:00
zwelch
f84c78a2e1 Finish off the dummy minidriver integration:
- Try to disambiguates minidriver options from "standard" driver options.
  - Make minidummy symbols more explict about being a minidriver.
  - Move minidummy.c into minidummy directory to put it with its header.

In configure.in:
- Improve configuration option to allow new minidriver implementations:
  - Change option from --enable-minidummy to --enable-minidriver-dummy.
  - Move it to the end of the list of options.
  - Provides a clear pattern for future minidrivers.
- Update handling of HAVE_JTAG_MINIDRIVER_H:
  - Check for external jtag_minidriver.h only with --enable-ecosboard.
  - Otherwise, define it when --enable-minidriver-dummy is provided.
- Add check to ensure only one minidriver is enabled.
- When a minidriver is enabled, warn user that standard drivers are not built.
- Use proper AC_DEFINE semantics with MINIDRIVER_DUMMY.

In src/jtag/Makefile.am:
- Restructure handling of minidummy source files.
- Include minidummy driver header in the distribution.

In src/jtag/jtag.c:
- Restructure preprocessor logic to include:
  - only one minidriver, or
  - all configured standard drivers.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2102 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-08 00:42:15 +00:00
zwelch
b770ad5b19 Fix reference warning in JTAG primer, add another external reference.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2101 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-07 23:49:14 +00:00
zwelch
695c6c0960 David Brownell <david-b@pacbell.net>:
Let disabled targets be ignored during normal operation:

 - In target_examine(), ignore disabled TAPs

 - Reset handling must not poke at them either:
     * fail $target_name arp_* operations on disabled TAPs
     * in startup.tcl, don't even issue the arp_* wait ops 

ZW: removed superfluous braces from the patch to target.c.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2100 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-07 23:35:29 +00:00
zwelch
d512fe71ea David Brownell <david-b@pacbell.net>:
Clarify docs for the evb_lm3s811 layout:  works in
two modes, not just one.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2099 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-07 23:21:41 +00:00
zwelch
733dfb288f Fix regression in mdw output; identified by Magnus Lundin.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2098 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-07 23:20:30 +00:00
zwelch
a8d621325b David Brownell <david-b@pacbell.net>:
Rework chapter 12 (CPU configuration) to use @deffn, match
the code more closely, and present things more clearly.

Includes the *current* list of targets.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2097 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-07 23:14:58 +00:00
zwelch
1edd16dc3c David Brownell <david-b@pacbell.net>:
Various minor tweaks for the User's guide.

 - Fix various minor (but repeated) typographic goofs;
 - Talk about TAP "declaration" not "creation" (they exist
   even if OpenOCD never learns about their board);
 - Encourage board.cfg for reset config, not target.cfg
 - Fill in some missing information (e.g. x16_as_x8)
 - Add a cross reference to the FAQ on TAP ordering;
 - Unclutter the concept index a bit (re core-specific commands)
 - Provide a bit more info about TAP states


git-svn-id: svn://svn.berlios.de/openocd/trunk@2096 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-07 23:10:50 +00:00
oharboe
c28efd0a0e retire endstate command
git-svn-id: svn://svn.berlios.de/openocd/trunk@2095 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-07 19:10:51 +00:00
zwelch
b90d7d12f1 Set svn:eol-style properties on new minidummy driver files.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2094 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-07 18:39:11 +00:00
zwelch
3363851781 Fix regressions in previous series of cleanp, caused by r2092.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2093 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-07 18:38:13 +00:00
oharboe
14d6605cc9 minidriver build test driver "minidriver"
git-svn-id: svn://svn.berlios.de/openocd/trunk@2092 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-07 13:55:29 +00:00
zwelch
7dd8754575 Factoring of jtag_examine_chain for maintainability:
- Improve variable type: change device_count to unsigned.
- Improves jtag_tap_count_enabled() API too (now returns unsigned).


git-svn-id: svn://svn.berlios.de/openocd/trunk@2091 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-07 05:24:27 +00:00
zwelch
b550f70100 Factoring of jtag_examine_chain for maintainability:
- Limit scope: move tap and bit_count variables to point of first use.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2090 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-07 05:24:20 +00:00
zwelch
63c4848d11 Factoring of jtag_examine_chain for maintainability:
- Factor TAP ID matching into new helper function.
- Simplifies the main jtag_examine_chain loop logic considerably.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2089 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-07 05:24:12 +00:00
zwelch
f106382055 Factoring of jtag_examine_chain for maintainability:
- Minor whitespace and style cleanups in body of jtag_examine_chain.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2088 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-07 05:24:03 +00:00
zwelch
9eefd4d7e5 Factoring of jtag_examine_chain for maintainability:
- Add helper to check for the terminating ID during jtag_examine_chain.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2087 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-07 05:23:50 +00:00
zwelch
d8421f2766 Factoring of jtag_examine_chain for maintainability:
- Factor end-of-chain verfication into new helper routine.
- Change 'unexpected' local variable name to 'triggered' and type to bool.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2086 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-07 05:23:40 +00:00
zwelch
feb865f9ee Factoring of jtag_examine_chain for maintainability:
- Factor output of accepted/incorrect/expected TAP IDs into static helper.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2085 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-07 05:23:30 +00:00
zwelch
c318068839 Factoring of jtag_examine_chain for maintainability:
- Factor initial chain examination check into new static helper.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2084 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-07 05:23:13 +00:00
zwelch
90dbfcea7d Factoring of jtag_examine_chain for maintainability:
- Factor JTAG chain examination into static helper function.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2083 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-07 05:23:03 +00:00
zwelch
861f52ff16 Factoring of jtag_examine_chain for maintainability:
- Reduce indent: invert logical test of expected_id count.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2082 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-07 05:22:53 +00:00
zwelch
15ae1ac678 Factoring of jtag_examine_chain for maintainability:
- Reduce indent: invert logic test for unexpected TAP (no IDs).


git-svn-id: svn://svn.berlios.de/openocd/trunk@2081 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-07 05:22:42 +00:00
zwelch
32350a5006 Factoring of jtag_examine_chain for maintainability:
- Reduce indent: invert logic test for tap in jtag_examine_chain.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2080 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-07 05:22:34 +00:00
zwelch
401d6472cc Factoring of jtag_examine_chain for maintainability:
- Move definition of maximum JTAG chain size closer to its only uses.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2079 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-07 05:22:25 +00:00
zwelch
0b08845e3f Factoring of jtag_examine_chain for maintainability:
- Move JTAG EXTRACT macros out from the middle of jtag_examine_chain.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2078 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-07 05:22:09 +00:00
zwelch
43e1ed244f Clean up handle_endstate_command():
- Merge declaration of state with first use.
- Unindent and remove unnecessary 'else' block.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2077 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-07 03:48:21 +00:00
oharboe
f92b104d8d David Brownell <david-b@pacbell.net> target/at91rm9200.cfg cleanup
git-svn-id: svn://svn.berlios.de/openocd/trunk@2075 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-05 08:35:24 +00:00
oharboe
aee65603ee remove hacks no longer required to build OpenOCD w/eCos
git-svn-id: svn://svn.berlios.de/openocd/trunk@2074 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-05 06:43:09 +00:00
oharboe
af838b03a0 remove unused include file: strings.h
git-svn-id: svn://svn.berlios.de/openocd/trunk@2073 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-05 06:42:20 +00:00
oharboe
3b3a5b642c remove unused include file: inttypes.h
git-svn-id: svn://svn.berlios.de/openocd/trunk@2072 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-05 06:41:54 +00:00
oharboe
a49faa206d remove unused include file: inttypes.h
git-svn-id: svn://svn.berlios.de/openocd/trunk@2071 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-05 06:37:21 +00:00
zwelch
0eb5c7509d Eliminate MixedCaps symbol from public JTAG TAP API:
- Purely mechanical transformations to the source files.
- Rename 'jtag_NextEnabledTap' as 'jtag_tap_next_enabled.'


git-svn-id: svn://svn.berlios.de/openocd/trunk@2069 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-05 00:43:43 +00:00
zwelch
0d39db1109 Eliminate MixedCaps symbol from public JTAG TAP API:
- Purely mechanical transformations to the source files.
- Rename 'jtag_NumEnabledTaps' as 'jtag_tap_count_enabled.'


git-svn-id: svn://svn.berlios.de/openocd/trunk@2068 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-05 00:43:32 +00:00
zwelch
92cf94295e Eliminate MixedCaps symbol from public JTAG TAP API:
- Purely mechanical transformations to the source files.
- Rename 'jtag_NumTotalTaps' as 'jtag_tap_count.'


git-svn-id: svn://svn.berlios.de/openocd/trunk@2067 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-05 00:43:23 +00:00
zwelch
7db5839608 Eliminate MixedCaps symbol from public JTAG TAP API:
- Purely mechanical transformations to the source files.
- Rename 'jtag_TapByJimObj' as 'jtag_tap_by_jim_obj.'


git-svn-id: svn://svn.berlios.de/openocd/trunk@2066 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-05 00:43:12 +00:00
zwelch
689e9664b0 Eliminate MixedCaps symbol from public JTAG TAP API:
- Purely mechanical transformations to the source files.
- Rename 'jtag_TapByString' as 'jtag_tap_by_string.'


git-svn-id: svn://svn.berlios.de/openocd/trunk@2065 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-05 00:42:52 +00:00
zwelch
473dc89c24 Eliminate MixedCaps symbol from public JTAG TAP API:
- Purely mechanical transformations to the source files.
- Rename 'jtag_TapByAbsPosition' as 'jtag_tap_by_abs_position.'


git-svn-id: svn://svn.berlios.de/openocd/trunk@2064 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-05 00:42:39 +00:00
zwelch
05eb8d8c13 Eliminate MixedCaps symbol from public JTAG TAP API:
- Purely mechanical transformations to the source files.
- Rename 'jtag_TapByPosition' as 'jtag_tap_by_position.'


git-svn-id: svn://svn.berlios.de/openocd/trunk@2063 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-05 00:42:32 +00:00
zwelch
dd89964ae0 Eliminate MixedCaps symbol from public JTAG TAP API:
- Purely mechanical transformations to the source files.
- Rename 'jtag_AllTaps' as 'jtag_all_taps.'


git-svn-id: svn://svn.berlios.de/openocd/trunk@2062 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-05 00:42:25 +00:00
zwelch
eaf37cf9e8 Eliminate MixedCaps symbol from public JTAG TAP API:
- Purely mechanical transformations to the source files.
- Rename 'jtag_all_taps' as '__jtag_all_taps.'
- Frees original symbol name to rename the accessor function.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2061 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-05 00:42:17 +00:00
zwelch
499f30f693 Add accessors for jtag_verify; use them in jim command handler.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2060 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-05 00:06:34 +00:00
zwelch
99fd479503 Add accessors for reset delays; use them in jim command handlers.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2059 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-05 00:04:12 +00:00
zwelch
d530313866 Add accessors for speed_khz; use them in jim command handler.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2058 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-05 00:02:00 +00:00
zwelch
8580c70172 Add jtag_get_flush_queue_count accessor to help future factoring.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2057 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-04 23:52:58 +00:00
zwelch
a847326216 Clean up the JTAG TAP creation handler:
- Factor jtag_tap_init() helper out of the end of jim_newtap_cmd.
- Factor jtag_tap_free() helper out of the error case in jim_newtap_cmd.
- Invert test to improve indentation at the end of jim_newtap_cmd.
- Improve whitespace in the newly factored functions.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2056 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-04 23:49:52 +00:00
zwelch
d3d02f4789 Clean up the core JTAG TAP APIs:
- Move jtag_tap_name to same location as other TAP functions; export it.
- Factor new jtag_tap_add() from jim_newtap_cmd(); appends TAP to global list.
- Move static chain position counter to global; use in jtag_NumTotalTaps().
- Use jtag_AllTaps for reading tap list, instead of accessing global directly.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2055 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-04 23:26:58 +00:00
zwelch
82a5f6ff3e Change hasKHz to use bool type.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2054 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-04 22:43:34 +00:00
zwelch
c0f9fbcca5 Add missing static keywords in JTAG source file.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2053 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-04 22:41:21 +00:00
oharboe
01801e3f45 unbreak arm11. TAP_INVALID is used to communicate inband that a special state should be used to lower level fn's in ARM11 code.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2052 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-04 20:05:32 +00:00
ntfreak
f7d3fdb195 - add support for different TAR autotincrement sizes as per ARM ADI spec.
- set TAR size to 12 bits for Cortex-M3.
- Original patch submitted by Magnus Lundin [lundin@mlu.mine.nu].


git-svn-id: svn://svn.berlios.de/openocd/trunk@2051 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-04 13:45:50 +00:00
oharboe
d861002612 Rename jtag_add_end_state to jtag_set_end_state since "add" implies that
this fn has something to do with the queue, which it does not as such.

git-svn-id: svn://svn.berlios.de/openocd/trunk@2050 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-04 13:18:07 +00:00
oharboe
f133158175 Introduce jtag_get_end_state() fn to clarify code a bit.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2049 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-04 13:14:07 +00:00
oharboe
310a9eabff tiny bit of encapsulation of global end state. No longer expose it as a global variable.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2048 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-04 13:05:57 +00:00
oharboe
9e8dce64fc do not modify global end state from jtag_add_xxx()
git-svn-id: svn://svn.berlios.de/openocd/trunk@2047 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-04 12:52:54 +00:00
oharboe
89e9d86a56 remove unused code.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2046 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-04 12:42:21 +00:00
oharboe
040e6cef41 no longer use jtag_add_xxx() to set end state to TAP_DRPAUSE
git-svn-id: svn://svn.berlios.de/openocd/trunk@2045 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-04 12:12:38 +00:00
oharboe
f499341558 no longer use jtag_add_xxx() to set end state to TAP_IDLE. Same must be done for TAP_DRPAUSE
git-svn-id: svn://svn.berlios.de/openocd/trunk@2044 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-04 12:06:31 +00:00
oharboe
f86f2ab3f8 use assert() to catch TAP_INVALID passed to jtag_add_xxx() fn's.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2043 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-04 11:42:34 +00:00
oharboe
6468859389 remove TAP_INVALID as argument to jtag_add_xxx() fn's
git-svn-id: svn://svn.berlios.de/openocd/trunk@2042 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-04 11:33:36 +00:00
oharboe
bb1a1ddb54 jtag_add_end_state() now returns the value of the global variable and does not modify the global variable if passed TAP_INVALID. This patch has no effect on the current code and is just to prepare upcoming patches.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2041 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-04 07:05:22 +00:00
oharboe
9ab49135c6 JTAG_TRST_ASSERTED event cleanup. More clear where and when it is invoked and some duplicate(harmless) invocations avoided.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2040 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-04 06:56:22 +00:00
zwelch
de7cb1c76b David Brownell <david-b@pacbell.net>:
Update the "General Commands" (a.k.a. "random stuff") chapter,
and associated chunks of other text:

 - Switch to @deffn and review everything that's documented

 - Improve descriptions of reset events, with reference to
   the setup.tcl code which issues them.

 - Move one zy1000-specific command to that driver's doc.

 - There is no "script" command; remove its doc.

NOTE:  Some things missing from this bit of work are:

 1- Reviewing the code to catch various *missing* functions,
    mostly from "target.c"

 2- Alphabetizing and organizing.  This chapter is a real
    grab-bag with no evident focus or structural principle.

 3- Hole-filling and bugfixing with respect to messaging/logging.
    Example, what principle could possibly justify the tcl command
    output going into the server output/log instead of just the
    telnet session?

 4- Not just for this chapter ... but there should be a section
    with descriptions of all the supported image file formats,
    so every image command can just reference that section.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2039 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-04 01:22:23 +00:00
zwelch
e7d6306b23 David Brownell <david-b@pacbell.net>:
Remove pernicious whitespace from ft2232 driver; as usual,
end-of-line noise, but here also much line-internal stuff.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2038 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-04 01:17:27 +00:00
zwelch
ec2bc2259c David Brownell <david-b@pacbell.net>:
Minor cleanup of FT2232:
  - make Olimex glue warn about Olimex issues instead of JTAGkey issues;
  - make some data static+const;
  - don't export some internal symbols.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2037 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-04 01:16:43 +00:00
zwelch
4123f08263 David Brownell <david-b@pacbell.net>:
Remove pernicious whitespace from src/jtag/*c files; mostly
the end-of-line flavor for now, although there's more.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2036 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-04 00:56:41 +00:00
zwelch
99fbbdc9c4 David Brownell <david-b@pacbell.net>:
Convert the Interface/Dongle Config chapter's section
on drivers to use the @deffn syntax, and integrate the
presentation of the driver-specific commands with the
relevant driver.  Alphabetize.

Cross-checked against the code ... several adapters were
not listed, and a few commands weren't.

(Maintainers for the versaloon and zy1000 drivers would be
good candidates to add the commands missing from those
sections...)


git-svn-id: svn://svn.berlios.de/openocd/trunk@2035 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-04 00:54:25 +00:00
zwelch
b619b7466f David Brownell <david-b@pacbell.net>:
Convert the str9xpec driver info to use @deffn; alphabetize;
add the missing part_id command.

Convert the mflash support to use @deffn; alphabetize.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2034 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-04 00:51:02 +00:00
oharboe
976f13d27b use assert() for obscure check on illegal arguments upon trst being asserted while commands are queued
git-svn-id: svn://svn.berlios.de/openocd/trunk@2033 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-03 16:36:01 +00:00
oharboe
0c57bc8be2 remove unused code path.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2032 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-03 12:12:21 +00:00
oharboe
c68684c2e6 catchup with jtag refactoring.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2031 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-03 07:55:56 +00:00
zwelch
80d66c9fcb Move JTAG command handling implementation into its own source file.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2030 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-03 07:06:37 +00:00
zwelch
a3e84343e2 Finish JTAG header file modularization; command factoring follows.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2029 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-03 06:29:09 +00:00
oharboe
4a6adee17e added missing extern to jtag_command_queue definition.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2028 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-03 06:27:57 +00:00
zwelch
4bc3af0374 Move JTAG command APIs into new jtag/commands.h header file.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2027 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-03 06:08:07 +00:00
zwelch
2d0e1dbc02 Improve remaining documentation that was causing Doxygen warnings.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2026 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-03 04:44:38 +00:00
zwelch
9a5acdc161 Improve in-source documentation that was causing Doxygen warnings.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2025 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-03 04:37:51 +00:00
zwelch
6c39b5dd52 Add architectural introduction to the JTAG module in The Manual.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2024 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-03 02:57:55 +00:00
zwelch
58c19285e2 Improve logger script to expose warnings and errors in the output.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2023 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-03 02:56:20 +00:00
zwelch
b344ea9b97 Improve doxygen markup of PATCHES file, link to new primer.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2022 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-03 02:17:26 +00:00
zwelch
003318b911 Add draft of Patching Primer in The Manual; update primer page.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2021 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-03 02:12:44 +00:00
zwelch
c41db358a0 Update TODO file with more content and better style.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2020 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-03 02:11:09 +00:00
zwelch
36432c9ba6 Enable or add doxygen comments to the public JTAG API.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2019 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-03 01:51:04 +00:00
zwelch
41018ff44b Update documentationf or jtag_interface structure members.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2018 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-03 01:39:04 +00:00
zwelch
0d5da4bccb Remove vestigal tap_transition type from public jtag API.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2017 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-03 01:29:01 +00:00
zwelch
67caf323f7 Remove interface.h from public JTAG header, include it where required.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2016 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-03 01:26:01 +00:00
zwelch
c275cfd3da Expose tap_state_by_name TAP helper available in public API.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2015 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-03 01:23:48 +00:00
zwelch
49a22dbf98 David Brownell <david-b@pacbell.net>:
Update docs for most of the remaining commands in jtag.c:

 - switch to @deffn
 - these are just the "low level" JTAG commands
 - resolve much goofage!
    * remove docs for non-existent commands
    * add missing docs for some existing commands
    * fix incorrect docs for some commands
 - just index TAP states overall, not individually
 - current name is "RUN/IDLE" not "IDLE"

Cross checked against the source.

This also creates an "Interface Drivers" section, analagous to how
(NOR) Flash and NAND drivers are presented; that's not yet sorted.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2014 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-03 00:59:13 +00:00
zwelch
5ca513a097 David Brownell <david-b@pacbell.net>:
Rework the TAP creation documentation.

 - Try to use "TAP" not "tap" everywhere; it's an acronym.

 - Update the associated "target config files" section:
     * reference the "TAP Creation" chapter for details
     * simplify:  reference interesting multi-tap config files
     * let's not forget CPU configuration (*before* workspace setup)
     * streamline it a bit
     * move that workspace-vs-mmu issue to a better location

 - Clean up TAP creation doc mess
     * switch to @deffn
     * (re)organize the remaining stuff
     * reference the "Config File Guidelines" chapter

 - Tweak the "Target Configuration" chapter
     * rename as "CPU configuration"; unconfuse vs. target/*.cfg
     * bring out that it's not just there for GDB
     * move TAP events to the TAP chapter, where they belong (bugfix)


git-svn-id: svn://svn.berlios.de/openocd/trunk@2013 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-03 00:56:50 +00:00
zwelch
4ecf2c7dd8 Move the JTAG cable interface API implementation
- Cloned the src/jtag/jtag.c file to src/jtag/interface.c.
- For each for of those files, deleted the contents of the other.
- Add new source file to automake input.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2012 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-03 00:45:21 +00:00
zwelch
f7d011a955 Add missed accessor for checking the current TMS table.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2011 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-03 00:33:22 +00:00
zwelch
f0b1b206cd Split and simplify handle_tms_sequence_command for further factoring.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2010 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-03 00:24:21 +00:00
zwelch
2c69be13ea Make tap_state_by_name available in new JTAG interface API header.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2009 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-03 00:17:42 +00:00
zwelch
def4ed3b2a Add private src/jtag/interface.h for use by JTAG interface drivers:
- Move the jtag_interface structure definition.
- Move the Cable API declarations.
- Add new header file to automake input.

The next patch will move the implementation to interface.c.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2008 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-02 23:59:13 +00:00
zwelch
84d88ef9d7 Finish removing '#ifdef HAVE_JTAG_MINIDRIVER_H' from jtag.h:
- Wraps JTAG callback API functions:
  - Outlines jtag_add_callback() and jtag_add_callback4().
  - Adds interface_ prefix to existing in-tree driver implementation.
  - Declare the driver interfaces routines in miniheader.h file.

This patch requires renaming the equivalent macros in out-of-tree
jtag_minidriver.h implementations.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2007 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-02 23:21:18 +00:00
zwelch
a546729609 Add header file for JTAG minidriver:
- Wraps all minidriver API functions using API front-ends:
  - Outlines jtag_add_dr_out() and jtag_alloc_in_value32().
  - Adds interface_ prefix to existing jtag_alloc_invalue_32 routines.
  - Re-inline these interface definitions in new header file.
- Re-inline parts of the (mini)driver implementations in minidriver.h.
- Replace INCLUDE_JTAG_MINIDRIVER_H with #include directives.

The next patch will finish removing '#ifdef HAVE_JTAG_MINIDRIVER_H'
from jtag.h.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2006 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-02 23:15:12 +00:00
ntfreak
7dc29156fe - change signature for adi_jtag_dp_scan and adi_jtag_dp_scan_u32 to use swjdp_common_t *swjdp instead of arm_jtag_t *jtag_info
- change SWJDP_IR/DR_APACC to DAP_IR/DR_APACC to conform with ARM_ADI docs.
- add swjdp->memaccess_tck field and code for extra tck clocks before accessing memory bus
- Set default memaccess value to 8 for Cortex-M3.
- Add dap memaccess command.
- document all armv7 dap cmds.
- Original patch submitted by Magnus Lundin [lundin@mlu.mine.nu].

git-svn-id: svn://svn.berlios.de/openocd/trunk@2005 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-02 21:06:12 +00:00
ntfreak
88b5c6da2a - hack added to fix a issue with v5/6 jlink
v5/6 jlink seems to have an issue if the first tap move is not divisible by 8, so we send a TLR on first power up

git-svn-id: svn://svn.berlios.de/openocd/trunk@2004 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-02 16:07:31 +00:00
oharboe
339dc0bcd0 remove unecessary #ifdef as file is only built when minidriver is enabled.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2003 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-02 13:37:06 +00:00
oharboe
b7a133bd48 some trivial minidriver fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@2002 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-02 10:09:53 +00:00
oharboe
cd5e09303c more missing eCos types
git-svn-id: svn://svn.berlios.de/openocd/trunk@2001 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-02 10:07:47 +00:00
zwelch
34b6fc3ce4 Only include jtag_driver.c in the build when minidriver is not in use.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2000 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-02 08:29:03 +00:00
zwelch
1d230b88d2 Move interface_jtag_add_scan_check_alloc implementations to their
respective implementation files.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1999 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-02 08:04:21 +00:00
zwelch
6625e926fd Add high-speed device support in FT2232 driver:
- Initial support for FT2232H/FT4232H devices from FTDI.
- Add --enable-ftd2xx-highspeed option to configure script.
- Original patch submitted by Joern Kaipf <lists@joernline.de>.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1998 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-02 07:51:16 +00:00
oharboe
8dab0ecf23 Remove unused code, TAP_INVALID is never passed to drivers.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1997 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-02 07:21:44 +00:00
zwelch
a372074d21 Continue clean-up of JTAG driver interface:
- Move all interface_jtag_* functions to jtag_driver.c.
- Extern command queue routines in jtag.h (with INCLUDE_JTAG_INTERFACE_H).
- Add new source file to automake inputs.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1996 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-02 07:05:54 +00:00
zwelch
4a70eeffb0 More JTAG interface driver cleanup:
- Moves references to global jtag interface to default core implementation.
- Missed this reference in the earlier "pointless" patch.  Mea culpa.

Important: this has a side-effect.  Previously, the error return inside
the interface routine short-circuited the remainder of that function
when 'init' has not been called.  With this patch, the command queue
will be cleared in the case that 'init' has been called.  Since that
case indicates a buggy script, this does not seem to be a problem.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1995 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-02 06:49:53 +00:00
zwelch
c10d4d9a00 More JTAG interface driver cleanup:
- Add jtag_callback_queue_reset() to reset the callback queue.
- Make interface_jtag_execute_queue() use new helper function.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1994 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-02 06:33:19 +00:00
zwelch
e733ac36bf More JTAG interface driver cleanup:
- Make interface_jtag_execute_queue call new helper function.
- Add default_interface_jtag_execute_queue to wrap jtag interface access.

This patch may look useless on its own, but it helps to isolate the core
JTAG variables from the interface_jtag_* routines, so the later can be
moved into jtag_driver.c in a pending patch.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1993 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-02 06:21:49 +00:00
zwelch
6ef5a622af Clean up jtag command queue handling:
- Rename last_command_pointer as next_command_pointer, because this variable
  stores the address where jtag_queue_command() will store a command pointer.
- Make that variable static, since it is only used internally in jtag.c.
- Remove superfluous accessor for that now-static variable.
- Deobfuscate use of variables in jtag_command_queue.
- Add jtag_command_queue_reset helper function.
- Use it in interface_jtag_execute_queue.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1992 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-02 05:47:00 +00:00
zwelch
76bd16e9e3 Encapsulate JTAG command interfaces for moving to jtag_interface.h.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1991 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-02 04:55:05 +00:00
zwelch
d0a6db31a3 Remove the useless invalidstruct from jtag.h.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1990 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-02 04:31:49 +00:00
zwelch
deed7fb56c Start clean-up of JTAG driver interface:
- Factor jtag_add_scan_check to call new jtag_add_scan_check_alloc helper.
- Use conditional logic to define two versions of the helper.
- These helpers will be moved to other files in future patches.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1989 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-02 03:38:50 +00:00
zwelch
a8f3ba8f5f David Brownell <david-b@pacbell.net>:
Make the TCL "drscan" and "irscan" commands finish in RUN/IDLE
unless the user specifies otherwise ... usually they'd choose
something like DRPAUSE or IRPAUSE, avoiding RUN/IDLE.

The current "end" state is whatever the preceding commands left
in "cmd_queue_end_state", which to TCL scripts isn't knowable.
This change should forestall various surprises/bugs.

Also check that any "end" state specified is safe in case this
adapter's JTAG clock is free-running.  For now, just issue a
warning; eventually a hard failure is probably correct.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1988 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-01 23:30:58 +00:00
zwelch
5120d1263b David Brownell <david-b@pacbell.net>:
Whitespace fixes in jtag.c ... mostly end-of-line crap.
Flag "jtag_device" command as obsolete in its helptext.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1987 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-01 23:13:24 +00:00
zwelch
4caa72b988 David Brownell <david-b@pacbell.net>:
Remove two sections about deprecated/removed commands, documenting
them briefly in the chapter on deprecated/removed commands.  The
"working_area" command just duplicated text; "jtag_device" wasn't
listed in that chapter before.

Also start de-emphasizing those commands.  Don't index them, and
include a disclaimer that their documentation may start to vanish
about a year after the code does (e.g. in January 2010).


git-svn-id: svn://svn.berlios.de/openocd/trunk@1986 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-01 23:09:19 +00:00
zwelch
7da3c2cda2 David Brownell <david-b@pacbell.net>:
This is the missing half of the r1974 patch:
OSK5912 board support, which was split out from
the omap5912 target config.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1985 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-01 23:06:17 +00:00
zwelch
a88871bc6a Encapsulate JTAG Cable API and interface structure, plan for new header file.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1984 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-01 23:01:24 +00:00
zwelch
35082f788b Encapsulate JTAG minidriver functions, plan for new header file.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1983 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-01 22:54:42 +00:00
zwelch
41565073c5 Remove unused in_handler_t type definition from jtag.h
git-svn-id: svn://svn.berlios.de/openocd/trunk@1982 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-01 21:54:35 +00:00
zwelch
337017d626 Scrub final vestiges of in_handler from mips target APIs.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1981 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-01 21:53:19 +00:00
oharboe
7662bbeaa5 added jtag_add_statemove() helper fn(actual fn written by Dick Hollonbeck, I just moved it).
git-svn-id: svn://svn.berlios.de/openocd/trunk@1980 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-01 19:58:20 +00:00
oharboe
414245c9ce fix warning for a variable that GCC thought might be uninitialized(which it can't be).
git-svn-id: svn://svn.berlios.de/openocd/trunk@1979 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-01 19:06:11 +00:00
oharboe
cf04b59517 simon qian <simonqian.openocd@gmail.com> stop incestious communication with lower jtag.c layers
git-svn-id: svn://svn.berlios.de/openocd/trunk@1978 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-01 19:00:54 +00:00
zwelch
ddc9fd7274 David Brownell <david-b@pacbell.net>:
Uplevel the arch commands to be a chapter; they really
don't fit in the "general commands" category.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1977 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-01 03:06:46 +00:00
zwelch
30fca8e531 David Brownell <david-b@pacbell.net>:
Fix minor goofage in previous doc updates:

 * The ETM dummy driver name is "dummy" not "etm_dummy";
   re-alphabetize.

 * DCC trace message mode "charmsg" is a format type
   (and what Linux needs)


git-svn-id: svn://svn.berlios.de/openocd/trunk@1976 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-01 03:06:25 +00:00
zwelch
a066529fa5 David Brownell <david-b@pacbell.net>:
Various updates, mostly small/formatting changes:

 * Small content tweaks:
    - Re-title:  "OpenOCD User's Guide".
    - For users, URLS for latest doc and SparkFun forum
    - Mention GIT-SVN
 * Fix some front-matter goofage, matching texinfo docs:
    - "paragraphintent" location matters
    - put release version/date description with the copyright
 * Fix some other stuff matching texinfo docs:
    - no tabs
    - tweak some refs and anchors
 * whitespace-at-end-o-line fixes


git-svn-id: svn://svn.berlios.de/openocd/trunk@1975 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-01 03:06:11 +00:00
zwelch
878d0cb043 David Brownell <david-b@pacbell.net>:
Split out OSK5912 board support from the omap5912 target config, and make
it pass sanity checks on my (Rev C/original) hardware:

 - Fix syntax error ("-irlen" not "irlen")
 - Provide real TAP ids for the ARM926ejs and the C55x dsp
 - Label both CPUs appropriately (DSP, ARM)
 - List both flash chips

The scan chain looks like this (note truncated DSP instruction code):

      TapName            | Enabled |   IdCode      Expected    IrLen IrCap  IrMask Instr
 ---|--------------------|---------|------------|------------|------|------|------|---------
  0 | omap5912.dsp       |    Y    | 0x03df1d81 | 0x03df1d81 | 0x26 | 0x00 | 0x00 | 0xffffffff
  1 | omap5912.arm       |    Y    | 0x0692602f | 0x0692602f | 0x04 | 0x01 | 0x00 | 0x0c
  2 | omap5912.unknown   |    Y    | 0x00000000 | 0x00000000 | 0x08 | 0x00 | 0x00 | 0xff

I still don't know what that third TAP is; maybe an early version of
an ICEpick JTAG router.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1974 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-01 03:05:59 +00:00
zwelch
b3d797699c David Brownell <david-b@pacbell.net>:
Whitespace fixes.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1973 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-01 03:05:42 +00:00
zwelch
278ca633da David Brownell <david-b@pacbell.net>:
Remove broken whitespace ... mostly at end of line, but
also in some cases blocks of inappropriate empty lines.

And spell "comamnd" right. :)


git-svn-id: svn://svn.berlios.de/openocd/trunk@1972 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-01 03:05:26 +00:00
zwelch
74df79d4d8 Final step in isolating target_type_s structure:
- Move definition of 'struct target_type_s' into new 'target_type.h' file.
- Forward delclaration remains in target.h, with comment pointing to new file.
- Replaces #define with #include in source files.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1971 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-31 12:38:28 +00:00
zwelch
e8e0af3956 Whitespace-only updates to automake input files:
- use continuations to break long lines of variable assignments
- makes these variables more patch-friendly and conform to style guide


git-svn-id: svn://svn.berlios.de/openocd/trunk@1970 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-31 12:10:57 +00:00
zwelch
818aa27a9d First step in hiding target_type_s from public interface:
- Add DEFINE_TARGET_TYPE_S symbol in files that need it defined.
- Forward declare 'struct target_type_s' only, unless that symbol is defined.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1969 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-31 11:32:28 +00:00
zwelch
4deb42ed00 Add target_examine_one wrapper:
- replaces all calls to target->type->examine.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1968 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-31 11:32:10 +00:00
zwelch
d00ac17e8e Add target breakpoint and watchpoint wrapper:
- replaces all calls to target->type->{add,remove}_{break,watch}point.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1967 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-31 11:31:52 +00:00
zwelch
0de78ed02c Add target_get_name wrapper:
- replaces all accesses to target->type->name.
- add documentation in target_s to warn not to access field directly.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1966 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-31 11:31:27 +00:00
zwelch
17fa4de854 Add target_step wrapper:
- replaces all calls to target->type->step.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1965 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-31 11:31:11 +00:00
zwelch
df4cf0615f Add target_get_gdb_reg_list wrapper:
- replaces all calls to target->type->get_gdb_reg_list.
- add documentation in target_s to warn not to invoke callback directly.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1964 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-31 11:30:59 +00:00
zwelch
11edf22776 Add target_bulk_write_memory wrapper:
- replaces all calls to target->type->bulk_write_memory.
- add documentation in target_s to warn not to invoke callback directly.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1963 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-31 09:39:04 +00:00
zwelch
9cb3af610a Add wrappers for target->type->examined:
- replace all checks of target->type->examined with target_was_examined().
- replace all setting of target->type->examined with target_set_examined().
- replace clearing of target->type->examined with target_reset_examined().
- add documentation in target_s to warn not to access field directly.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1962 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-31 09:38:43 +00:00
zwelch
fbe8cf72a5 Add target_run_algorithm wrapper:
- replaces all calls to target->type->run_algorithm.
- add documentation in target_s to warn not to invoke callback directly.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1961 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-31 09:38:20 +00:00
zwelch
95e13054ca Add target_write_memory wrapper:
- replaces all calls to target->type->write_memory.
- add documentation in target_s to warn not to invoke callback directly.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1960 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-31 09:37:57 +00:00
zwelch
b6db182c00 Add target_read_memory wrapper:
- replaces all calls to target->type->read_memory.
- add documentation in target_s to warn not to invoke callback directly.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1959 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-31 09:37:35 +00:00
zwelch
6785193118 Simplify the handle_md_command routine in target.c:
- fix buffer overrun in mdw; final '\0' would overflow the output buffer.
 - return ERROR_COMMAND_SYNTAX_ERROR instead of ERROR_OK if:
   - less than one argument is provided
   - the command is called with a name other than mdb, mdh, or mdw.
 - factor all command output into new handle_md_output function


git-svn-id: svn://svn.berlios.de/openocd/trunk@1958 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-31 06:00:28 +00:00
zwelch
55f21192b0 Make nvp_target_event static; remove its external declaration.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1957 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-31 04:58:51 +00:00
zwelch
12df0f0090 Make target_buffer_get_uXX interfaces work with constant buffers.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1956 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-31 02:18:26 +00:00
zwelch
79cec48ba2 Peter Denison <openwrt@marshadder.org>:
The debugging code in jlink_tap_execute() called when _DEBUG_USB_COMMS_ is 
defined was using the entire cached scan length to print the results 
buffers, and not the correct length of each individual buffer.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1955 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-31 01:07:43 +00:00
zwelch
cc639cc44c Add new JTAG boundary scan primer, with links to BSDL information.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1954 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-31 00:49:03 +00:00
zwelch
58e31916de Eliminate duplicated code in the handle_mw_command memory write loop.
- wordsize will always be 1, 2, or 4 due to preceeding switch statement.
- move call to keep_alive after successful writes, not upon failures


git-svn-id: svn://svn.berlios.de/openocd/trunk@1953 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-30 23:57:30 +00:00
zwelch
335fee3f36 Encapsulate the global "jtag" jtag_interface pointer:
- Add jtag_interface_quit, factored from exit_handler() in openocd.c.
- Remove its extern declaration.
- Add static keyword to its definition.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1952 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-30 22:23:12 +00:00
zwelch
77015d5ae3 Remove unused jlink_execute_end_state (unreferenced after r1949).
git-svn-id: svn://svn.berlios.de/openocd/trunk@1951 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-30 21:53:10 +00:00
oharboe
9557d8a9b1 remove unused JTAG_END_STATE part 2
git-svn-id: svn://svn.berlios.de/openocd/trunk@1950 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-30 11:55:14 +00:00
oharboe
7992eaf0fc remove unused JTAG_END_STATE
git-svn-id: svn://svn.berlios.de/openocd/trunk@1949 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-30 11:37:21 +00:00
oharboe
d12a47d558 added some comments on meminfo command
git-svn-id: svn://svn.berlios.de/openocd/trunk@1948 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-30 07:56:14 +00:00
oharboe
aea132ca48 more reset_config texts
git-svn-id: svn://svn.berlios.de/openocd/trunk@1947 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-30 07:53:40 +00:00
zwelch
2327b8603c Remove trailing whitespace from oocd_trace source file.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1946 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-30 01:44:22 +00:00
zwelch
91d55c0e50 David Brownell <david-b@pacbell.net>:
Provide basic documentation on the ARM ETM and ETB trace commands.

Fix minor goofs in registration of the ETM commands; and whitespace
issues in the proof-of-concept oocd_trace code.  (Plus include a
ref to Dominic's email saying that it's just proof-of-concept code.)

Note that I'm still not sure whether the ETM support works.  But
documenting how it's expected to work should help sort out which
behaviors are bugs, which will help get bugs patched.

ZW: whitespace changes were split out of this patch but will follow.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1945 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-30 01:43:21 +00:00
zwelch
d00a5cfe97 David Brownell <david-b@pacbell.net>:
Make it so the magic "reset_config" keywords can be provided in any
order.  This eliminates needless error paths, and makes it easier
to define things at the right level (adapter, board, target).
It also includes two other behavioral changes:

  (1)	When "handle_reset_config" sees a parameter error, it
  	exits without changing anything.   This is best viewed
	as a bugfix.  (Old behavior:  restore defaults, even if
	they weren't previously active.)

  (2)	Only the behaviors that were explicitly specified get
  	changed.  (Old behavior:  everything else gets reset to
	the "default".)  So for example you can now specify SRST
	drive requirements without saying anything about the
	three unrelated topics you previously had to specify.

That second one might cause confusion for any configs that end
up calling "reset_config" twice, so it will deserve to be called
out in the release notes.  (There were no such configurations in
the current OpenOCD source tree.)

Update docs accordingly.  Note that at least some versions of
the texi-to-html tools can't handle "@xref{with spaces}", but
those work properly in PDF and in the info files.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1944 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-30 01:32:19 +00:00
zwelch
ebcde562d9 Remove error_handler_t type definition; it was unused in the tree.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1943 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-29 05:50:01 +00:00
zwelch
188cf8d960 Add documentation to flash.h:
- provides low-level information about each flash API interface,
- gives driver authors some documentation about the driver interface,
- updated extensively from the original patch provided by Duane Ellis.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1942 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-29 04:00:51 +00:00
zwelch
80856c1e34 David Brownell <david-b@pacbell.net>:
Provide basic documentation for some of the other flash drivers.

 avr ... looks incomplete, may work with one AVR8 microcontroller
 ecosflash ... can't find docs
 lpc288x ... an NXP part, driver seems lpc2888-specific
 ocl ... some arm7/arm9 thing, can't find docs
 pic32mx ... looks incomplete, for PIC32MX (MIPS 4K) devices
 tms470 ... for TI TMS470 parts

Still seems to be mostly arm7tdmi... several of these have no
users in the current tree.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1941 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-29 01:33:04 +00:00
zwelch
3aa4e9ebf6 Remove redundant call to autoheader in bootstrap script.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1940 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-28 23:47:37 +00:00
zwelch
ea62c7964a David Brownell <david-b@pacbell.net>:
Start converting the architecture-specific commands to @deffn format,
reviewing against the code.

  * armv4_5 disassemble ... now documented; although Jazelle code
    is not handled

  * It's "armv4_5 core_state" not "core_mode"; although Jazelle state
    is not handled

  * arm7/9 "debug" commands ... now with other arm7_9 commands, no
    longer in a separate section

  * arm926ejs cp15 ... previous description was broken, it matched
    the code for arm920t instead

  * Have separate subsections for ARMv4/ARMv5, ARMv6, and ARMv7; the
    latter are new
    
  * Move core-specific descriptions into sub-subsections under those
    architectures; XScale and ARM11 descriptions are new

The new XScale and ARM11 command descriptions surely need elaboration
and review.  ARM CP15 operation descriptions in general seem to be
confused and incomplete.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1939 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-28 23:13:32 +00:00
zwelch
6149c509ca David Brownell <david-b@pacbell.net>:
Continue updating the NOR flash coverage to use @deffn syntax, so the
commands have more consistent presentation and formatting.  This
reorganizes information and updates its presentation, except where
the information didn't really match the code.

This patch updates the main commands, and finishes making the section
structure parallel the NAND presentation.  Of note:

 - The "flash fill[whb] addr value length" commands are now documented.

 - The "flash bank" command is now presented much earlier

 - Explicit mention is made that NOR flash should be read using just
   standard memory access commands, like "mdw" and "dump_image".



git-svn-id: svn://svn.berlios.de/openocd/trunk@1938 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-28 01:18:47 +00:00
zwelch
f37a8136fe David Brownell <david-b@pacbell.net>:
Start updating the NOR flash coverage to use @deffn syntax, so the
commands have more consistent presentation and formatting.  This
reorganizes information and updates its presentation, except where
the information didn't really match the code.

This patch updates most of the driver specific support, creating one
new (and alphabetized!) section just for driver-specific data, where
previously that data was split over up to three sections.  Of note:

 - The at91sam7 docs were a bit out of date with respect to the code.

 - The "str9xpec" stuff still deserves some work.  For now, it sits
   in its own subsection; pretty messy.

 - Likewise the "mflash" stuff.  That's a parallel infrastructure,
   and is now in a section of its own.

 - The "mass_erase" commands for the Cortex M3 chips got turned into
   footnotes.  IMO, they should vanish sometime; they're superfluous.

 - There are still a bunch of undocumented NOR drivers.  Examples:
   avr(8), tms470, pic32mx, more.

Plus there are a handful of minor tweaks to the NAND docs (to help make
the NOR and NAND presentations be parallel); the "Command Index" has
been renamed as the "Command and Driver Index"; reference TI instead
of Luminary Micro in several places.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1937 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-28 01:11:10 +00:00
zwelch
d9284c0611 David Brownell <david-b@pacbell.net>:
Fix a bunch of PDF generation bugs in the texi:

 * The "overfull" warnings are basically complaints about lines
   that are too long, so they ran off the right margin of the
   PDF documentation and turn into a "black blot".

 * The "underfull" warnings are basically complaints about lines
   that look ugly when they get filled, because the tokens are
   so long that the line-break algorithm can't do anything good.

In a few cases the simplest fix seemed to be to use more appropriate
texi commands.

In other cases the fix was a content bugfix:  "ocd_" not "openocd_";
and many of those "target variants" actually aren't recognized.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1936 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-28 00:47:30 +00:00
zwelch
19124a34f3 Fix potentialyl unaligned memory accesses in mflash driver.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1935 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-27 23:54:16 +00:00
kc8apf
9a8650ec05 Author: Nicolas Pitre <nico@cam.org>
- cut out the "unknown EmbeddedICE version" message with Feroceon


git-svn-id: svn://svn.berlios.de/openocd/trunk@1934 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-27 21:03:51 +00:00
kc8apf
35d8b2bf77 Author: Nicolas Pitre <nico@cam.org>
- Silence errors about keep_alive() not being called frequently enough unless
	a gdb session is active or debugging is enabled


git-svn-id: svn://svn.berlios.de/openocd/trunk@1933 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-27 20:30:17 +00:00
zwelch
afa77f8672 Numerous minor updates and fixes for The Manual:
- Link Scripting Overview into the TCL Primer; both need more work.
- Remove redundant OpenOCD from Scripting Overview subpage title.
- Fix incorrect tag in Doxygen style guide example.
- Fix minor typo in first introductory paragraph of main page.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1932 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-27 15:15:06 +00:00
zwelch
3d79669c5e unsik Kim <donari75@gmail.com>:
Add large bank write/dump support in mflash driver.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1931 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-27 12:34:02 +00:00
zwelch
ee9766f1db unsik Kim <donari75@gmail.com>:
Add mflash configuration code, updating relevant documentation.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1930 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-27 12:30:42 +00:00
zwelch
d2089dbae0 unsik Kim <donari75@gmail.com>:
Remove unused mflash driver 'prove' field.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1929 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-27 12:21:28 +00:00
zwelch
2caf8655b5 unsik Kim <donari75@gmail.com>:
Remove unused mflash bank command options.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1928 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-27 12:20:13 +00:00
zwelch
5c478a2cab unsik Kim <donari75@gmail.com>:
Change prefix of mflash driver routines to mg_.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1927 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-27 12:16:07 +00:00
zwelch
df60933321 SimonQian <simonqian@SimonQian.com>:
This patch allows the vsllink to support very large scan sizes in DMA mode.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1926 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-27 12:06:51 +00:00
ntfreak
ff2737b429 - add support for cortino jtag interface
git-svn-id: svn://svn.berlios.de/openocd/trunk@1925 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-27 11:58:19 +00:00
zwelch
edab91e576 Add new Style Guides for languages used (and to be used) by project.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1924 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-27 10:44:03 +00:00
zwelch
43ea8d9179 Link new Primer pages into the main list of Primers.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1923 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-27 10:40:52 +00:00
zwelch
c71f891f2e Add Documentation Primer to The Manual.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1922 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-27 10:35:20 +00:00
zwelch
eedfcb2cbe Add draft of Autotools Primer to The Manual.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1921 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-27 10:27:32 +00:00
zwelch
dd86b54e6e Update build system to find moved scripts -- Step 3 of 2:
- Update references from using PKGLIBDIR to PKGDATADIR.
- Update built-in script search paths to reflect new install location:
  - $(pkgdatadir)       =>   $(pktdatadir)/site
  - $(pkglibdir)        =>   $(pktdatadir)/scripts
- Update installed location of httpd files:
  - $(pkglibdir)/httpd   =>   $(pkgdatadir)/httpd


git-svn-id: svn://svn.berlios.de/openocd/trunk@1920 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-27 07:49:58 +00:00
zwelch
dbbc9c41f7 Move TCL script files -- Step 2 of 2:
- Move src/tcl to tcl/.
- Update top Makefile.am to use new path name.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1919 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-27 06:49:24 +00:00
zwelch
140d6c8e79 Move TCL script files -- Step 1 of 2:
- Move src/target/{interface,target,board,test}/ into src/tcl/
- Remove existing rules in src/Makefile.am and src/target/Makefile.am.
- Add Makefile.am handling of *.cfg and *.tcl files in top Makefile.am:
  - Add dist-hook to include such files under src/tcl in the distribution.
  - Add install-data-hook to install contents of '$(top_srcdir)/src/tcl/'.
  - Add uninstall-hook to remove the installed script files.
- Change paths to (un)install script files in '$(pkgdatadir)/scripts'.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1918 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-27 06:44:43 +00:00
zwelch
7c0e823d0a Add warning to generated Doxyfile to edit Doxyfile.in.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1917 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-27 02:01:15 +00:00
zwelch
f1f0d5e2d5 Update Doxygen markup in PATCHES, BUGS, and TODO:
- In the File List, these files are listed and link to empty pages.
- This patch adds @file blocks to reference the pages each file contains.
- Remove redundant "OpenOCD" from PATCHES title; it clutters the tree view.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1916 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-26 23:58:01 +00:00
zwelch
3848774d33 SimonQian <simonqian@SimonQian.com>, reported by R.Doss:
This patch fixes a segfault when TDO was not received in XXR command:
- allocate space for the value and mask anyway
- clear the mask to zero to effectively skip the output comparison step


git-svn-id: svn://svn.berlios.de/openocd/trunk@1915 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-26 01:27:56 +00:00
zwelch
fe465bd33e SimonQian <simonqian@SimonQian.com>:
Add svf_get_mask_u32 to generate a mask according to bitlen.
Fix this bug in other functions except for svf_check_tdo.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1914 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-26 01:22:23 +00:00
zwelch
83902cc984 David Brownell <david-b@pacbell.net>:
Update the "Reset Configuration" information in the User's guide:

 - Convert to @deffn syntax
 - Move tutorial text from command descriptions into new sections
 - Describe several different types of JTAG-visible reset
 - Expand descriptions of configuration tweaks for SRST and TRST 
 - Link to the "reset" command, and vice versa
 - Bugfix the "reset_config" description (it didn't match the code)

Plus, be more proscriptive:  do it in board config files, except for
the oddball cases where that won't work. (Current target.cfg files
seem to have much goofage there; several seem board-specific.)


git-svn-id: svn://svn.berlios.de/openocd/trunk@1913 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-26 00:23:23 +00:00
kc8apf
29bff0929c Author: Simon Qian <simonqian@SimonQian.com>
- add tap_state_svf_name since tap_state_name doesn't use SVF standard names


git-svn-id: svn://svn.berlios.de/openocd/trunk@1912 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-25 15:56:15 +00:00
kc8apf
3c27bc8774 Author: Raúl Sánchez Siles <rsanchezs@infoglobal.es>
- cfi flash_address coding style fix


git-svn-id: svn://svn.berlios.de/openocd/trunk@1911 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-25 15:51:30 +00:00
zwelch
ad8f1b4295 David Brownell <david-b@pacbell.net>:
Doc (mostly) update for jtag_khz:
 - switch to @deffn syntax
 - add entry for "jtag_rclk"
 - move deprecated "jtag_speed" into collection of deprecated calls

And for ft2232, don't be the only adapter to *log* an error if RTCK
is requested; it's already reported properly, like any other nonfatal
command parameter.  "jtag_rclk" just works as expected, without any
scarey messages.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1910 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-24 21:13:29 +00:00
zwelch
5ecae346cc David Brownell <david-b@pacbell.net>:
Make startup for the various server ports be quiet, unless
debugging is active:  don't emit needless scarey messages.
Update the relevant documentation and its references:

 - For these port commands ... cover the default values;
   convert to @deffn syntax; include their use outside of
   the configuration stage; and alphabetize.

Similar updates to the rest of that small chapter:

 - Highlight that there even *IS* a configuration stage, after
   which some command functionality is no longer available.

 - For GDB commands ... convert to @deffn syntax; alphabetize;
   include a missing command (!); add missing helptext (!) for
   one non-missing command; update relevant cross-references
   and index entries.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1909 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-24 21:08:42 +00:00
zwelch
2e55b68360 David Brownell <david-b@pacbell.net>:
The "Illegal mode for command" diagnostic is deeply useless.
Say "Command '%s' only runs during configuration stage" instead,
letting users know what the real issue is.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1908 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-24 20:57:53 +00:00
zwelch
e046954d53 David Brownell <david-b@pacbell.net>: minor davinci_nand bugfix
Fix a bug that joined us at the last minute, when an efficient
alloca() call got swapped out for a more portable malloc().

Also log one error, to give a clue in case it appears "in the wild".


git-svn-id: svn://svn.berlios.de/openocd/trunk@1907 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-24 20:56:13 +00:00
mifi
42c009e2be Added the options calc_checksum to the flash driver.
This was forgotten here. All other LPC targets use
this option.

git-svn-id: svn://svn.berlios.de/openocd/trunk@1906 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-24 11:24:14 +00:00
zwelch
76d3131f48 Nicolas Pitre <nico@cam.org>: Update sheevaplug interface script:
When the CPU is in the WFI state, the JTAG interface simply doesn't 
respond at all and initial tap examination simply fails.  Let's simply
do it again when we come around to assert nSRST.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1905 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-24 02:08:17 +00:00
zwelch
eb385b2e70 David Brownell <david-b@pacbell.net>:
Update two oddball NAND commands to work with {offset, length}
instead of block numbers, matching the other commands as well
as usage in U-Boot and the Linux-MTD utilities.

Document them accordingly.  Update the single in-tree use of
those commands (sheevaplug).

ALSO:

 (a) Document the current 2 GByte/chip ceiling for NAND chipsize.
     (32 bit offset/length values can't represent 4 GBytes.)  Maybe
     after the upcoming release, the code can switch to 64-bits.

 (b) The "nand check_bad_blocks" should report "bad" blocks.  They
     are not "invalid" blocks; they're "bad" ones.

 (c) Tweak the "nand info" command to handle the "no arguments"
     case sanely (show everything, instead of showing garbage) and
     not listing the blocksize in hex kbytes (duh).


git-svn-id: svn://svn.berlios.de/openocd/trunk@1904 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-24 01:57:13 +00:00
zwelch
c0fc8f93f1 David Brownell <david-b@pacbell.net>:
NAND support for DaVinci-family drivers, with HW ECC support.
Declare the NAND chip on the DM355 EVM board.

Currently tested on DM355 for Linux interop using the standard
large page (2KB) chip in the EVM socket; "hwecc1" and "hwecc4"
work fine.  (Using hwecc4 relies on patches that haven't quite
made it through the Linux-MTD bottlenecks yet.)

Not yet tested:  1-bit on small-page (although it's hard to see
how that could fail); 4-bit on small page (picky layout issues);
the "hwecc_infix" mode (primarily for older boot ROMs; testing
there is blocked on having new bootloader code).


git-svn-id: svn://svn.berlios.de/openocd/trunk@1903 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-24 01:38:19 +00:00
zwelch
67dd29a4af Fix two problems with openocd.texi:
- Fix minor issues with xrefs not liking parentheses around them.
- Change 'Building' section to 'Building OpenOCD'.  It reads better.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1902 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-24 01:33:54 +00:00
zwelch
a6f7ca1a3a Properly fix doxygen out-of-tree build process:
- move Doxyfile to Doxyfile.in: type 'make Doxyfile' to recreate it
- create Doxyfile from Doxyfile.in with make rule:
  - use sed substitution of $(srcdir) to location directories
- delete all doxygen created files with 'make distclean'
- include all required files (including logger.pl) in distribution


git-svn-id: svn://svn.berlios.de/openocd/trunk@1901 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-24 01:08:16 +00:00
zwelch
8717ed04aa SimonQian <simonqian@SimonQian.com>:
Changes svf_check_tdo function (checks tdo output matches desired values):
- call buf_cmp_mask function to do comparison instead of using a loop.
- fixes a bug when data length is equal to sizeof(int).


git-svn-id: svn://svn.berlios.de/openocd/trunk@1900 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-24 00:47:49 +00:00
zwelch
7e11f08a77 Freddie Chopin <freddie_chopin@op.pl>:
- add reset delay settings for LPC2103, LPC2124, and LPC2129.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1899 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-24 00:16:04 +00:00
zwelch
045362d74a Add section identifiers to developer scripting introduction.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1898 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-23 22:53:39 +00:00
zwelch
08d5f114c9 Update main page of doxygen developer documentation:
- Rewrite copy to give a better introduction and overview.
- Add subpages: The List, Style Guide, Patch Policies, and Bug Reporting.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1897 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-23 22:52:47 +00:00
zwelch
3131636492 Add extended doxygen-based style guide draft; requires more work.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1896 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-23 22:39:03 +00:00
zwelch
a0f9869030 Update user guide documentation:
- Remove style guide from user guide; moved to doxygen manual.
- Replace with improved introduction for developers and packagers.
- Move introductory paragraph about the project under the About page.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1895 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-23 22:37:19 +00:00
zwelch
b3a8f5dc2a Include the PATCHES file in Doxygen developer manual.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1894 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-23 22:05:05 +00:00
zwelch
ce55905fb7 Submitted by Magnus Lundin <lundin@mlu.mine.nu>:
- Remove FTDI driver tap_set_state call; performed by jtag_add_reset.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1893 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-23 20:52:18 +00:00
zwelch
b6d87ad03d Submitted by Magnus Lundin <lundin@mlu.mine.nu>:
- Add jtag_execute_queue in jtag_add_reset after interface_jtag_add_reset.
- Use tap_set_state to demark TAP_RESET, instead of cmd_queue_cur_state
  - cmd_queue_cur_state needs to be retired.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1892 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-23 20:50:06 +00:00
zwelch
d305e2c35b Fix make docs rule to work with out-of-tree builds.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1891 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-23 20:29:53 +00:00
mifi
2a6c215c45 Change the setting for the sam7se512 and sam7x256
flash driver because of the new at91sam7 version.

git-svn-id: svn://svn.berlios.de/openocd/trunk@1890 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-23 18:26:06 +00:00
zwelch
b11a5b07c6 Submitted by Magnus Lundin <lundin@mlu.mine.nu>:
Updates to the J-Link interface driver to support more device versions:
- Add capability detection:
  - if capable, detect protocol version; otherwise, assume v2 protocol.
  - if capable, detect buffer size; otherwise, assume minimal.
- Disable command result queries for devices using v2 protocol.
- Defined and use JTAG2 command with v2 protocol; JTAG3 is v3 protocol.
- Add TCL command to allow explicit setting of J-Link protocol version.

With approval, I revised the patch to make the following changes:
- add static keywords to new jlink-specific variables
- factor calculation of major_version to be more readable
- remove braces around simple one-line statements in if/else clauses
- remove (rather than #if 0) duplicate reset code; it is in SVN
- use &function to be clearer when passing function pointers
- add symbols for EMU_CMD_GET_CAPS bits; do not hard-code constants!
- almost renamed jlink_handle_jlink_hw_jtag_command  (seriously?!?!)
  - rewrote that function using a switch statement.
  - made version request processing easier to understand and modify
- improve alternate endpoint detection:
  - make code easier to read by using temporary variables
  - eliminate extra level of indentation and redundant logging
- use ternary conditional to select JTAG2 or JTAG3 command
- reverse version test in jlink_usb_message to reduce indentation
  - this had the biggest effect in cleaning up this patch
- use C99's ability to declare new/changed variables with less scope
- add spaces around binary operators in new/changed code
- revert other superfluous whitespace/comment style changes


git-svn-id: svn://svn.berlios.de/openocd/trunk@1889 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-23 03:42:13 +00:00
zwelch
96d3de002d More printf fixes stemming from format string change in r1882.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1888 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-23 01:25:39 +00:00
zwelch
7d96440435 Change doxygen configuration to show code comments in documentation.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1887 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-23 00:51:13 +00:00
kc8apf
aaa6dd927f Author: Raúl Sánchez Siles <rsanchezs@infoglobal.es>
- Fix multi-byte reads on x16 devices used as x8


git-svn-id: svn://svn.berlios.de/openocd/trunk@1886 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-22 17:49:28 +00:00
kc8apf
c48ad46aa3 Author: Raúl Sánchez Siles <rsanchezs@infoglobal.es>
- Fix calculation of flash_address for x16 devices used as x8


git-svn-id: svn://svn.berlios.de/openocd/trunk@1885 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-22 17:48:26 +00:00
kc8apf
da5c37517a Author: Raúl Sánchez Siles <rsanchezs@infoglobal.es>
- Consistently use flash_address


git-svn-id: svn://svn.berlios.de/openocd/trunk@1884 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-22 17:47:07 +00:00
kc8apf
c78ad57bb7 Author: David Brownell <david-b@pacbell.net>
Remove un-implemented and dubious "nand copy" command.

Doing this efficiently would mean doing the copying on
the target CPU, instead of back and forth through JTAG.
If anyone ever needs this functionality, that's what
they should implement.

Also, update on-line "help" for "nand dump" to display
its two optional flags; and for "nand write" to display
a recently added flag.



git-svn-id: svn://svn.berlios.de/openocd/trunk@1883 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-22 17:44:04 +00:00
kc8apf
1be7374c28 Author: Rick Altherr <kc8apf@kc8apf.net>
- printf conversion fixes for variably-sized types


git-svn-id: svn://svn.berlios.de/openocd/trunk@1882 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-22 17:41:54 +00:00
zwelch
3d0b474da9 Submitted by David Brownell <david-b@pacbell.net>:
Improve support for the DM355 EVM board, and eventually other boards based
on DaVinci chips:

 - Provide generic "davinci.cfg" to hold utilities that can be reused by
   different chips in this family.  Start with PINMUX, PSC, and PLL setup.

 - DM355 chip support updates:  provide a dictionary with chip-specific
   symbols, load those utilities.

 - Create a new dm355evm board file, with a reset-init event handler
   which uses those utilities to set up PLLs and clocks, configure the
   pins, and improve the JTAG speed limit.

Also a minor tweak:  provide a virtual address for the work area, matching
what the very latest kernels do.  It's probably unwise to use OpenOCD while
the MMU is active though.

The DRAM isn't yet accessible, but NAND access is mostly ready.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1881 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-22 02:32:31 +00:00
zwelch
ebd3f88798 Submitted by Dean Glazeski <dnglaze@gmail.com>:
Add doxygen comments in arm7_9_common source and header files.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1880 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-22 02:27:30 +00:00
zwelch
61c77af0ab Submitted by David Brownell <david-b@pacbell.net>:
Add a "NAND Commands" section to to the TEXI docs, covering the basic
commands except for those previously discussed as being due for removal
("nand copy") or switching to use byte offsets not block numbers.

This uses the "@deffn..." syntax for defining commands, as somewhat
suggested by the TEXI documentation, and adds a new "Command Index".
We might prefer to merge those indexes for the near term, but I think
the "@deffn" approch is probably worth switching to.

Updates a few other bits to clarify that "flash" doesn't just mean NOR.  
And to fix one niggling falsity:  the "reset-init" event *is* used, and
in fact it's quite important.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1879 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-22 02:25:18 +00:00
oharboe
2f8c6015ba delete unused code
git-svn-id: svn://svn.berlios.de/openocd/trunk@1878 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-21 17:44:04 +00:00
oharboe
576b8a8a48 fix warning. Use %p for pointers
git-svn-id: svn://svn.berlios.de/openocd/trunk@1877 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-21 17:42:19 +00:00
kc8apf
0ce234491a Author: Michael Bruck <mbruck@digenius.de>
-jtag.c, interface_jtag_add_ir_scan() [2/2] (version without goto):
    	- change 'found' to bool
    	- add comments on loops



git-svn-id: svn://svn.berlios.de/openocd/trunk@1876 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-21 17:20:05 +00:00
oharboe
e2abb325df Dirk Behme <dirk.behme@googlemail.com> Minor updates for OMAP3 scripts
git-svn-id: svn://svn.berlios.de/openocd/trunk@1875 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-21 16:15:41 +00:00
zwelch
08c11a4c70 Additional format warning fixes in ioutil, required by r1873 changes.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1874 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-21 09:49:19 +00:00
zwelch
570631454d David Brownell <david-b@pacbell.net>: This patch adds annotations to
the key command_*() helper functions, fixng the bugs that turned up.

Several of these bugs were from misuse of PRIi64; that's for 64-bit
integers, NOT for "long long" or "u64" (which work best with %lld).


git-svn-id: svn://svn.berlios.de/openocd/trunk@1873 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-21 09:28:57 +00:00
kc8apf
5982d4eca8 Author: David Brownell <david-b@pacbell.net>
- Update PATCHES to better describe the policies in place


git-svn-id: svn://svn.berlios.de/openocd/trunk@1872 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-21 05:46:29 +00:00
kc8apf
988d6a49a9 Author: Thomas Kindler <mail@t-kindler.de>
- Increase DTC status retry count to avoid problems with STM Primer


git-svn-id: svn://svn.berlios.de/openocd/trunk@1871 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-21 05:33:36 +00:00
kc8apf
4b992717b5 Author: Øyvind Harboe <oyvind.harboe@zylin.com>
- Allow target_read/write_buffer of size 0


git-svn-id: svn://svn.berlios.de/openocd/trunk@1870 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-21 05:12:32 +00:00
kc8apf
869ef01f3c Author: Holger Schurig <hs4233@mail.mn-solutions.de>
-Prevent freezing of target when doing a 'shutdown'.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1869 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-21 05:07:06 +00:00
kc8apf
788cad7244 Author: Michael Bruck <mbruck@digenius.de>
-jtag.c, interface_jtag_add_ir_scan() [1/2]:
    	- remove temporary scan_size and use tap->ir_length instead
    	- slight loop restructuring to reduce indentation level




git-svn-id: svn://svn.berlios.de/openocd/trunk@1868 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-21 04:54:38 +00:00
kc8apf
73e31653fc Author: Michael Bruck <mbruck@digenius.de>
-jtag.c, interface_jtag_add_dr_out():
        - use pointer 'field' instead of scan->fields[field_count]
        - restructure the main loop to clearly separate the two cases: TAP is not bypassed / TAP is bypassed
          (this is to keep the function similar to interface_jtag_add_dr_scan())
        - fix bug where only the first output field has its tap field set
        - add asserts to verify that target_tap points to the one not bypassed TAP



git-svn-id: svn://svn.berlios.de/openocd/trunk@1867 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-21 04:53:07 +00:00
kc8apf
e007342669 Author: Michael Bruck <mbruck@digenius.de>
-jtag.c, interface_jtag_add_dr_scan():
            - use pointer 'field' instead of scan->fields[field_count]
            - restructure the main loop to clearly separate the two cases: TAP is not bypassed / TAP is bypassed
            - add an assert that each non-bypassed TAP receives at least one field
            - add an assert that checks that no superfluous input fields were passed



git-svn-id: svn://svn.berlios.de/openocd/trunk@1866 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-21 04:50:00 +00:00
kc8apf
7e3fd48b6a Author: Michael Bruck <mbruck@digenius.de>
-jtag.c, interface_jtag_add_ir_scan():
        - use pointer 'field' instead of scan->fields[nth_tap]
        - add assertion to ensure that input data has correct size for TAP's IR



git-svn-id: svn://svn.berlios.de/openocd/trunk@1865 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-21 04:48:15 +00:00
kc8apf
d7dccfbf82 Author: Michael Bruck <mbruck@digenius.de>
- jtag.c: consolidate output scan field initialization in scan functions
    - jtag.c: add cmd_queue_scan_field_clone() to handle 1:1 field copies
    - jtag.c: fix bug where only the first output field in a dr scan has its tap field set



git-svn-id: svn://svn.berlios.de/openocd/trunk@1864 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-21 04:45:57 +00:00
kc8apf
2783a940e2 Author: Michael Bruck <mbruck@digenius.de>
- jtag.c: remove unused variable 'nth_tap' from DR scan functions



git-svn-id: svn://svn.berlios.de/openocd/trunk@1863 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-21 04:43:48 +00:00
kc8apf
8cb3e95b39 Author: Michael Bruck <mbruck@digenius.de>
- jtag.c: Use single 'for' statement to iterate over list of TAPs in scan functions



git-svn-id: svn://svn.berlios.de/openocd/trunk@1862 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-21 04:43:01 +00:00
kc8apf
3bc0997e28 Author: Michael Bruck <mbruck@digenius.de>
- jtag.c: consolidate all memory allocations in scan functions in one block, add out_fields pointer to set stage for further changes



git-svn-id: svn://svn.berlios.de/openocd/trunk@1861 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-21 04:41:50 +00:00
kc8apf
f96077ec8d Author: Michael Bruck <mbruck@digenius.de>
- add 'const' qualifier to function parameters in jtag.c that are not to be modified or freed by the function



git-svn-id: svn://svn.berlios.de/openocd/trunk@1860 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-21 04:39:41 +00:00
kc8apf
d14b6ca015 Author: Michael Bruck <mbruck@digenius.de>
- add doxygen comments to scan commands in jtag.c
    - move jtag_add_dr_scan next to interface_jtag_add_dr_scan to keep these function pairs together




git-svn-id: svn://svn.berlios.de/openocd/trunk@1859 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-21 04:37:31 +00:00
zwelch
e666807a6f Add 'docs' and 'doxygen' targets to top-level Makefile.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1858 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-20 20:52:14 +00:00
zwelch
8686a33807 Add initial OpenOCD server documentation (Duane Ellis and myself).
git-svn-id: svn://svn.berlios.de/openocd/trunk@1857 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-20 09:01:01 +00:00
zwelch
5a080c8f6e Add new TCL Primer under the main Technical Primer page.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1856 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-20 08:58:09 +00:00
zwelch
c46dc5ba2d Move TCL overview from source tree to doxygen manual.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1855 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-20 08:48:19 +00:00
zwelch
5545aca4d7 Fix doc/Makefile.am dist-hook to include all sections of manual.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1854 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-20 08:44:37 +00:00
zwelch
ed294121ef Move non-arm target overview from source tree to doxygen manual.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1853 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-20 08:43:18 +00:00
zwelch
2cca6fcb8b Move scripting overview from source tree to doxygen manual.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1852 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-20 08:16:50 +00:00
oharboe
64faff8f9c Spencer Oliver <spen@spen-soft.co.uk> use 7 tms out of reset
git-svn-id: svn://svn.berlios.de/openocd/trunk@1851 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-20 06:18:40 +00:00
kc8apf
30268bc40f Author: Spencer Oliver <spen@spen-soft.co.uk>
- Bring the mips step/resume interrupt handling inline with the
rest of openocd.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1850 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-20 05:07:34 +00:00
kc8apf
b7b0452517 Author: Michael Bruck <mbruck@digenius.de>
- simplify code in interface_jtag_add_plain_dr_scan() by adding a local variable 'scan' to hold the scan_command_t



git-svn-id: svn://svn.berlios.de/openocd/trunk@1849 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-20 04:55:01 +00:00
kc8apf
1ed16c57bc Author: Michael Bruck <mbruck@digenius.de>
- move scan_size in interface_jtag_add_dr_out() into the scope of the inner loop and change it to unsigned
    - move loop variable j into for scope



git-svn-id: svn://svn.berlios.de/openocd/trunk@1848 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-20 04:54:15 +00:00
kc8apf
955d6af47a Author: Michael Bruck <mbruck@digenius.de>
- simplify code in interface_jtag_add_dr_out() by adding a local variable 'scan' to hold the scan_command_t



git-svn-id: svn://svn.berlios.de/openocd/trunk@1847 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-20 04:53:34 +00:00
kc8apf
645bde6e57 Author: Michael Bruck <mbruck@digenius.de>
- move scan_size in interface_jtag_add_dr_scan() into the scope of the inner loop and change it to unsigned



git-svn-id: svn://svn.berlios.de/openocd/trunk@1846 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-20 04:53:00 +00:00
kc8apf
fe54d5f5e6 Author: Michael Bruck <mbruck@digenius.de>
- simplify code in interface_jtag_add_dr_scan() by adding a local variable 'scan' to hold the scan_command_t



git-svn-id: svn://svn.berlios.de/openocd/trunk@1845 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-20 04:52:26 +00:00
kc8apf
044e3a4904 Author: Michael Bruck <mbruck@digenius.de>
- simplify code in interface_jtag_add_plain_ir_scan() by adding a local variable 'scan' to hold the scan_command_t



git-svn-id: svn://svn.berlios.de/openocd/trunk@1844 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-20 04:51:46 +00:00
kc8apf
c1b397e48c Author: Michael Bruck <mbruck@digenius.de>
- move scan_size in interface_jtag_add_ir_scan() into the scope of the inner loop and change it to unsigned



git-svn-id: svn://svn.berlios.de/openocd/trunk@1843 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-20 04:51:08 +00:00
kc8apf
8632901e7d Author: Michael Bruck <mbruck@digenius.de>
- simplify code in interface_jtag_add_ir_scan() by adding a local variable 'scan' to hold the scan_command_t




git-svn-id: svn://svn.berlios.de/openocd/trunk@1842 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-20 04:49:53 +00:00
kc8apf
98e3541333 Author: Michael Bruck <mbruck@digenius.de>
- rename local variable x to num_taps in interface_jtag_add_ir_scan



git-svn-id: svn://svn.berlios.de/openocd/trunk@1841 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-20 04:48:11 +00:00
kc8apf
5c9c7af198 Author: Michael Bruck <mbruck@digenius.de>
- rename input parameters 'num_fields' and 'fields' to 'in_num_fields' and 'in_fields' in all jtag.c interface functions



git-svn-id: svn://svn.berlios.de/openocd/trunk@1840 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-20 04:47:20 +00:00
zwelch
5fe786f166 Wookey <wookey@wookware.org>: add user documentation for echo command.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1839 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-19 18:30:01 +00:00
mifi
d78df28121 Added jtag_nsrst_delay 200 and jtag_ntrst_delay 200 to the LPC2294 target.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1838 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-19 17:57:44 +00:00
oharboe
208fda15d5 fix warnings
git-svn-id: svn://svn.berlios.de/openocd/trunk@1837 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-19 14:36:04 +00:00
oharboe
b19c48c6c8 Wookey <wookey@wookware.org> update syntax
git-svn-id: svn://svn.berlios.de/openocd/trunk@1836 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-19 11:53:05 +00:00
oharboe
1464742d74 David Brownell <david-b@pacbell.net> NAND: update ids, "nand list" bugfix
git-svn-id: svn://svn.berlios.de/openocd/trunk@1835 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-19 10:04:41 +00:00
oharboe
4147156707 added tms_sequence command to allow switching between old/new tms sequence
git-svn-id: svn://svn.berlios.de/openocd/trunk@1834 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-19 06:59:20 +00:00
oharboe
7ad67c8b34 use tap_get_tms_path_len() instead of fix # of 7. Not tested if this builds, but at least we're looking at a build error instead of a runtime error.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1833 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-18 20:25:19 +00:00
zwelch
23fd80f2b6 Update BUGS file, adapting its content for the doxygen manual.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1832 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-18 20:22:55 +00:00
oharboe
5b9c07e918 use tap_get_tms_path_len() instead of fix # of 7.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1831 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-18 20:21:53 +00:00
oharboe
fd780d43f5 removed solved mem2array problem.
Added questions regarding ideas on making tcl-less builds of OpenOCD

git-svn-id: svn://svn.berlios.de/openocd/trunk@1830 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-18 19:33:00 +00:00
oharboe
ccee6fa702 updated w/jtag_add_end_state() note.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1829 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-18 19:28:26 +00:00
zwelch
efd74e6fb5 Update The List with recent progress; remove developer list from TODO.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1828 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-18 19:06:43 +00:00
kc8apf
378c29bfe5 Enable non-7-cycle state table for FT2232 and JLink
git-svn-id: svn://svn.berlios.de/openocd/trunk@1827 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-18 17:43:26 +00:00
kc8apf
10923655d6 JLink support for non-7-cycle state moves by Dick Hollenbeck <dick@softplc.com>
git-svn-id: svn://svn.berlios.de/openocd/trunk@1826 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-18 17:42:36 +00:00
kc8apf
9a990a3591 FT2232 support for non-7-cycle state moves by Dick Hollenbeck <dick@softplc.com>
git-svn-id: svn://svn.berlios.de/openocd/trunk@1825 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-18 17:41:27 +00:00
kc8apf
a8b104aa74 Fix fallout from r1818
git-svn-id: svn://svn.berlios.de/openocd/trunk@1824 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-18 17:40:42 +00:00
kc8apf
15f2c37207 Change last_comand_pointer to last_command_pointer by Michael Bruck <mbruck@digenius.de>
git-svn-id: svn://svn.berlios.de/openocd/trunk@1823 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-18 17:29:59 +00:00
kc8apf
204a360602 Add jtag_queue_command() by Michael Bruck <mbruck@digenius.de> [8/8]
git-svn-id: svn://svn.berlios.de/openocd/trunk@1822 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-18 17:29:18 +00:00
kc8apf
f9d861d357 Add jtag_queue_command() by Michael Bruck <mbruck@digenius.de> [7/8]
git-svn-id: svn://svn.berlios.de/openocd/trunk@1821 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-18 17:29:01 +00:00
kc8apf
48838d5193 Add jtag_queue_command() by Michael Bruck <mbruck@digenius.de> [6/8]
git-svn-id: svn://svn.berlios.de/openocd/trunk@1820 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-18 17:28:42 +00:00
kc8apf
89fd953cc8 Add jtag_queue_command() by Michael Bruck <mbruck@digenius.de> [5/8]
git-svn-id: svn://svn.berlios.de/openocd/trunk@1819 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-18 17:28:21 +00:00
kc8apf
7ea76ffdbc Add jtag_queue_command() by Michael Bruck <mbruck@digenius.de> [4/8]
git-svn-id: svn://svn.berlios.de/openocd/trunk@1818 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-18 17:28:00 +00:00
kc8apf
0e98ab34b3 Add jtag_queue_command() by Michael Bruck <mbruck@digenius.de> [3/8]
git-svn-id: svn://svn.berlios.de/openocd/trunk@1817 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-18 17:27:46 +00:00
kc8apf
373cbc01d0 Add jtag_queue_command() by Michael Bruck <mbruck@digenius.de> [2/8]
git-svn-id: svn://svn.berlios.de/openocd/trunk@1816 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-18 17:27:30 +00:00
kc8apf
39e9278ffc Add jtag_queue_command() by Michael Bruck <mbruck@digenius.de>
git-svn-id: svn://svn.berlios.de/openocd/trunk@1815 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-18 17:27:00 +00:00
kc8apf
9b4295b059 ftdi_set_interface correctness by Strontium <strntydog@gmail.com>
git-svn-id: svn://svn.berlios.de/openocd/trunk@1814 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-18 17:23:52 +00:00
kc8apf
4528fa49f5 PATCHES updates from David Brownell <david-b@pacbell.net>
git-svn-id: svn://svn.berlios.de/openocd/trunk@1813 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-18 17:20:51 +00:00
kc8apf
4925bdd4d9 JTAG state table updates (short table still disabled). Provided by Dick Hollenbeck <dick@softplc.com>
git-svn-id: svn://svn.berlios.de/openocd/trunk@1812 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-18 17:06:36 +00:00
oharboe
a8daf2251d Remove unecessary(and poptentially harmful?) "" around arguments
passed in to "eval" in command.c


git-svn-id: svn://svn.berlios.de/openocd/trunk@1811 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-18 13:55:38 +00:00
oharboe
7eaed436c6 less weird error messages for unknown commands. Check if command exists before trying it.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1810 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-18 13:07:37 +00:00
oharboe
a63361f982 Dean Glazeski <dnglaze@gmail.com> fixed bug in checking of clocked back data in arm7_9_execute_fast_sys_speed. Not reported. There is a chance that this bug hid a deeper problem since it only partially disabled the check(mask & value were equal).
git-svn-id: svn://svn.berlios.de/openocd/trunk@1809 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-18 07:10:48 +00:00
ntfreak
0958051391 - add missing svn props from svn 1798 commit
git-svn-id: svn://svn.berlios.de/openocd/trunk@1808 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-18 07:04:58 +00:00
oharboe
350f608256 Michael Bruck <mbruck@digenius.de> ARM11 cleanup stale dependencies with generic arm code; added comments and whitespace fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@1807 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-18 07:02:12 +00:00
kc8apf
6416474891 Relocate documentation on working area to better align with use of new syntax. Provided by David Brownell <david-b@pacbell.net>
git-svn-id: svn://svn.berlios.de/openocd/trunk@1806 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-18 04:47:06 +00:00
kc8apf
da34c09128 Fix logically inverted comment
git-svn-id: svn://svn.berlios.de/openocd/trunk@1805 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-18 04:45:42 +00:00
kc8apf
c977616cda Consolidate target selection code into single get_target() that handles both names and numbers. Provided by David Brownell <david-b@pacbell.net>
git-svn-id: svn://svn.berlios.de/openocd/trunk@1804 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-18 04:44:28 +00:00
kc8apf
cafad4969c ETM/ETB documentation from David Brownell <david-b@pacbell.net>
git-svn-id: svn://svn.berlios.de/openocd/trunk@1803 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-18 04:40:11 +00:00
kc8apf
a931baa619 Whitespace cleanup from David Brownell <david-b@pacbell.net>
git-svn-id: svn://svn.berlios.de/openocd/trunk@1802 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-18 04:37:33 +00:00
oharboe
41826d5bd9 fix array2mem/mem2array when used as a "method" on a target.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1801 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-17 13:00:36 +00:00
oharboe
231a71b7fb Michael Bruck <mbruck@digenius.de> change 'ir_scan' from 'int' to 'bool' to document its semantics
git-svn-id: svn://svn.berlios.de/openocd/trunk@1800 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-16 20:09:07 +00:00
oharboe
1bcbd44ed3 fix naming of at91sam7 driver
git-svn-id: svn://svn.berlios.de/openocd/trunk@1799 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-16 14:59:10 +00:00
oharboe
72f5449e4b Freddie Chopin <freddie_chopin@op.pl> move files about to where they belong
git-svn-id: svn://svn.berlios.de/openocd/trunk@1798 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-16 14:57:02 +00:00
zwelch
ea3ddc7e4f Initialize a more variables in jim.c to allow gcc-4.4 to build.
Fix provided by Benjamin Schmidt <DeMonk@gmx.net>.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1797 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-15 23:35:27 +00:00
zwelch
5cff9997c5 Initialize value of objPtr local variable; prevents warning w/ gcc-4.4.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1796 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-15 22:10:32 +00:00
oharboe
21c8284233 fix -fno-common/Mac build problems.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1795 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-15 21:10:35 +00:00
oharboe
4dcd58724a Less wrong handling of JIM_EMBEDDED, follow Jim Tcl doc's and only use JIM_EMBEDDED in a single .c file. Still broken w/-fno-common(i.e. Mac OS).
git-svn-id: svn://svn.berlios.de/openocd/trunk@1794 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-15 20:35:53 +00:00
oharboe
b9522f0e78 revert to 1775. 1790 causes SEGFAULT w/Cygwin.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1793 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-15 09:03:52 +00:00
zwelch
c102397e9f Update Doxyfile to build The List into the doxygen manual.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1792 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-15 02:22:27 +00:00
zwelch
8ed887456d Add current draft of The List of Pending and Open Tasks.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1791 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-15 00:49:30 +00:00
zwelch
789b639a39 Remove JIM_EMBEDDED symbol; not appropriate or necessary.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1790 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-14 22:20:00 +00:00
zwelch
30f6b1ebbc Several minor fixes for the new doxygen manual.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1789 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-14 22:16:20 +00:00
zwelch
ca7ec066b2 Paul Thomas <pthomas8589@gmail.com>: new board cfg for Linuxstamp-mx27
git-svn-id: svn://svn.berlios.de/openocd/trunk@1788 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-14 21:55:56 +00:00
oharboe
adf3a2ce7b use TAP_INVALID enum instead of -1
git-svn-id: svn://svn.berlios.de/openocd/trunk@1787 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-14 21:00:30 +00:00
oharboe
b3b0ff60c2 take #2: dump_image now works for addresses not divisible by 4
git-svn-id: svn://svn.berlios.de/openocd/trunk@1786 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-14 19:00:35 +00:00
oharboe
a74d911412 dump_image now works for addresses not divisible by 4
git-svn-id: svn://svn.berlios.de/openocd/trunk@1785 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-14 18:56:41 +00:00
oharboe
651cb917e7 fix broken ir/drscan -endstate option. The statemachine now actually ends up in said state.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1784 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-14 18:45:19 +00:00
oharboe
0bb9c5de63 selftest wip
git-svn-id: svn://svn.berlios.de/openocd/trunk@1783 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-14 10:52:41 +00:00
oharboe
c5e51bca0a propagate error in dump_image. If an error occurs during dump_image, a tcl exception is thrown.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1782 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-14 08:44:09 +00:00
zwelch
3d4e32bc9a Update configure script test for net/if.h to work on MacOS.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1781 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-13 23:38:38 +00:00
zwelch
53b67960a2 Fix bootstrap typo noticed by Edgar Grimberg <edgar.grimberg@zylin.com>.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1780 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-13 23:37:29 +00:00
zwelch
3df27e5ce5 Fix bootstrap script to support MacOS glibtoolize oddity.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1779 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-13 21:55:16 +00:00
oharboe
ba66ccea35 zy1000 1.52 snapshot
git-svn-id: svn://svn.berlios.de/openocd/trunk@1777 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-13 18:58:55 +00:00
zwelch
7626139950 Add JTAG Primer to doxygen manual, contributed by Strontium.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1776 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-13 11:10:35 +00:00
zwelch
9c2468eee4 Include types.h in command.h to make stdint.h available through it.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1775 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-13 10:50:32 +00:00
oharboe
709fd9d6b4 added verify_jtag command
git-svn-id: svn://svn.berlios.de/openocd/trunk@1774 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-13 10:21:50 +00:00
zwelch
233ab439c7 Include files required to rebuild the HTTP web pages in distribution.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1773 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-13 10:14:40 +00:00
oharboe
c860600c6a shuffled comments about for jtag_add_dr_out() fn.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1772 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-13 09:53:23 +00:00
zwelch
624aa80f84 Commit skeleton files for high-level developer manual using doxygen.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1771 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-13 08:58:08 +00:00
oharboe
23a0704451 irscan now also works correctly in addition to not crashing :-)
git-svn-id: svn://svn.berlios.de/openocd/trunk@1770 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-12 19:31:50 +00:00
ntfreak
b7b586ac6b - add missing svn props from svn 1768 commit
git-svn-id: svn://svn.berlios.de/openocd/trunk@1769 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-12 18:32:57 +00:00
oharboe
cbfa0304f9 4-bit ECC support for Marvell Kirkwood SOC
git-svn-id: svn://svn.berlios.de/openocd/trunk@1768 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-12 17:29:16 +00:00
oharboe
f34386ee32 Nicolas Pitre <nico@cam.org> lower JTAG clock for SheevaPlug
git-svn-id: svn://svn.berlios.de/openocd/trunk@1767 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-12 17:14:10 +00:00
oharboe
0ecb96cc1b move eCos type definition to types.h where it belongs.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1766 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-12 12:16:31 +00:00
zwelch
46d13ccc3b Add stdint.h to types.h to provide intptr_t.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1765 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-12 10:52:01 +00:00
ntfreak
14f3548ff2 - fix build issue when HAVE_ELF_H is not defined
git-svn-id: svn://svn.berlios.de/openocd/trunk@1764 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-12 10:47:48 +00:00
oharboe
75f89c5cb6 eCos fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@1763 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-12 10:02:47 +00:00
zwelch
7d81ab69e1 Include project doxygen configuration with distribution tarballs.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1762 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-12 08:56:22 +00:00
zwelch
f976af56a4 Audit and remove redundant uses of replacements.h in the tree.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1761 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-12 08:35:17 +00:00
zwelch
5136270920 Make replacements.h private by including it from config.h autoheader.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1760 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-12 08:33:18 +00:00
zwelch
dd85eebf22 Make system.h private by including it from config.h autoheader.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1759 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-12 08:24:47 +00:00
zwelch
85f9734103 Audit and reduce #include directives in jim source files.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1758 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-12 07:44:57 +00:00
zwelch
4c71ca6b5f Define _GNU_SOURCE in config.h, remove definitions from source files.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1757 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-12 07:35:00 +00:00
zwelch
61cba7e0e6 Remove config.h from types.h; all .c files are required to include it.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1756 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-12 07:22:07 +00:00
zwelch
591a23ec8d Include config.h in pregenerated rlink_speed_table.c source.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1755 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-12 07:13:12 +00:00
zwelch
e29ed183fc Update rlink_make_speed_table.pl script to add config.h to its output.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1754 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-12 07:12:10 +00:00
oharboe
a28fdee804 fix memory corruption introduce in 1730
git-svn-id: svn://svn.berlios.de/openocd/trunk@1753 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-12 07:03:50 +00:00
oharboe
71d76b0a74 added jtag_alloc_in_value32 - not used in this commit.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1752 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-12 06:59:21 +00:00
oharboe
9bbd933eae fix ancient bug & SEGFAULT in irscan
git-svn-id: svn://svn.berlios.de/openocd/trunk@1751 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-12 06:17:22 +00:00
zwelch
30a17f0bb4 Include assert.h in system.h to promote tree-wide use of assertions.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1750 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-12 04:52:15 +00:00
zwelch
f5e028bc46 Remove duplicate definition of encode in httpd.tcl.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1749 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-11 22:37:52 +00:00
oharboe
3e58929e62 now builds on 64 and 32 bit systems
git-svn-id: svn://svn.berlios.de/openocd/trunk@1748 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-11 21:05:51 +00:00
oharboe
f17bb0cf1e fix jtag_add_dr_scan() usage a bit... avoid lots of malloc()'s.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1746 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-11 12:03:40 +00:00
zwelch
ce23eb7e3a Update jim helper files to use proper configure script support:
- configure.in: Add AC_TYPE_LONG_LONG_INT to detect 'long long int' support.
- configure.in: Add AC_C_CONST to provide equivalent support as jim.h.
- jim*.c: include config.h when HAVE_CONFIG_H is defined.
- jim*.{h,c}: use HAVE_LONG_LONG_INT definition from config.h.
- jim.h: Remove hard-coded const and HAVE_LONG_LONG definitions.
- jim.h: -DJIM_NO_CONST has been obsoleted; -Dconst is equivalent.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1744 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-11 11:20:45 +00:00
oharboe
e170938ae8 fix USB performance regression for verify_ircapture
git-svn-id: svn://svn.berlios.de/openocd/trunk@1743 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-11 10:10:11 +00:00
oharboe
6dd335ed24 USB performance regression fix
git-svn-id: svn://svn.berlios.de/openocd/trunk@1742 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-11 09:43:50 +00:00
oharboe
fac70d7292 retire jtag_add_dr_scan_now
git-svn-id: svn://svn.berlios.de/openocd/trunk@1741 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-11 09:36:55 +00:00
oharboe
a6713a5c62 switch to jtag_add_dr_scan() from the synchronous version - USB performance fix
git-svn-id: svn://svn.berlios.de/openocd/trunk@1740 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-11 09:18:02 +00:00
oharboe
6e1b0ba9ac switch to jtag_add_dr_scan_check() - USB performance fix
git-svn-id: svn://svn.berlios.de/openocd/trunk@1739 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-11 09:14:47 +00:00
oharboe
f5b8fecf2e switch to jtag_add_dr_scan_check() - USB performance fix
git-svn-id: svn://svn.berlios.de/openocd/trunk@1738 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-11 09:12:32 +00:00
oharboe
55d89826aa switch to jtag_add_dr_scan_check() - USB performance fix
git-svn-id: svn://svn.berlios.de/openocd/trunk@1737 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-11 09:10:03 +00:00
oharboe
8c77f7c69c change jtag_add_callback API to be able to support check_value/mask
git-svn-id: svn://svn.berlios.de/openocd/trunk@1735 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-11 08:39:49 +00:00
zwelch
265b0a9fca Fix ft2232 for CygWin, provided by Michael Bruck <mbruck@digenius.de>.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1734 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-11 08:26:42 +00:00
oharboe
4fe5a010c2 switch to jtag_add_callback() - USB performance fix
git-svn-id: svn://svn.berlios.de/openocd/trunk@1733 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-11 07:48:26 +00:00
oharboe
978a4bb4b4 switch to jtag_add_callback() - USB performance fix
git-svn-id: svn://svn.berlios.de/openocd/trunk@1732 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-11 07:47:53 +00:00
oharboe
84ca1a9ef0 switch to jtag_add_callback() - USB performance fix
git-svn-id: svn://svn.berlios.de/openocd/trunk@1731 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-11 07:47:21 +00:00
oharboe
68cea6e952 switch to jtag_add_callback() - USB performance fix
git-svn-id: svn://svn.berlios.de/openocd/trunk@1730 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-11 07:40:42 +00:00
oharboe
4e477364fd switch to jtag_add_callback() - USB performance fix
git-svn-id: svn://svn.berlios.de/openocd/trunk@1729 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-11 07:39:36 +00:00
oharboe
9eb2deee06 switch to jtag_add_callback() - USB performance fix
git-svn-id: svn://svn.berlios.de/openocd/trunk@1728 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-11 07:38:10 +00:00
oharboe
3f05aebe4c switch to jtag_add_callback() - USB performance fix
git-svn-id: svn://svn.berlios.de/openocd/trunk@1727 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-11 07:36:16 +00:00
oharboe
b840546895 switch to jtag_add_callback() - USB performance fix
git-svn-id: svn://svn.berlios.de/openocd/trunk@1726 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-11 07:35:05 +00:00
oharboe
1524e3c4aa switch to jtag_add_callback() - USB performance fix
git-svn-id: svn://svn.berlios.de/openocd/trunk@1725 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-11 07:33:43 +00:00
oharboe
a79945b7a9 switch to jtag_add_callback() - USB performance fix
git-svn-id: svn://svn.berlios.de/openocd/trunk@1724 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-11 07:26:59 +00:00
oharboe
dda225b7b3 leave eCos include file issues alone for now.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1723 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-11 07:26:11 +00:00
zwelch
6cb7d00a03 Add svn:eol-style property to recently added system.h.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1722 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-11 07:04:25 +00:00
oharboe
ea627cc8f6 used by upcoming commits
git-svn-id: svn://svn.berlios.de/openocd/trunk@1721 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-11 06:55:00 +00:00
oharboe
6b48a77141 add to svn ignore
git-svn-id: svn://svn.berlios.de/openocd/trunk@1720 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-11 06:54:00 +00:00
zwelch
f8e31c2dc1 Update Doxyfile configuration for doxygen 1.5.8:
- Enable doxygen's C language optimizations.
- Use dot command (from graphviz package) to generate visual graphs.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1719 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-11 06:32:59 +00:00
zwelch
6411b69af9 Mark API layering violations in the helper module with @todo notes.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1718 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-11 05:50:21 +00:00
zwelch
e2598f06fd Remove redundant config.h from replacements.h, obtained from types.h.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1717 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-11 05:33:39 +00:00
zwelch
f532c7faf8 Audit and eliminate redundant #include directives in main src/ files.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1716 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-11 05:00:17 +00:00
zwelch
56504fdd73 Audit and eliminate redundant #include directives in other target files.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1715 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-11 04:56:37 +00:00
zwelch
68b05c5575 Audit and eliminate redundant #include directives in arm target files.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1714 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-11 04:46:21 +00:00
zwelch
03f3296046 Audit and eliminate redundant #include directives in core target files.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1713 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-11 04:38:18 +00:00
zwelch
fbcb57baf8 Audit and eliminate redundant #include directives in src/flash sources.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1712 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-11 04:30:41 +00:00
zwelch
0643263d68 Audit and eliminate redundant #include directives in src/flash headers.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1711 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-11 04:28:24 +00:00
zwelch
0b6c73ae83 Audit and eliminate redundant #include directives in src/{pld,svf,xsvf}.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1710 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-11 04:25:09 +00:00
zwelch
164cb6d04e Audit and eliminate redundant #include directives from src/server.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1709 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-11 04:22:15 +00:00
zwelch
7c7fed0283 Fix compilation of target_request.h when it is included first.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1708 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-11 04:21:24 +00:00
zwelch
004c7124c4 Audit and eliminate redundant #include directives from src/jtag.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1707 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-11 04:04:58 +00:00
zwelch
8a5b25790f Audit and eliminate redundant helper #include directives.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1706 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-11 03:59:02 +00:00
zwelch
5a818f71d7 Simplify #include directives in ioutil.c, use new header checks.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1705 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-11 03:48:32 +00:00
zwelch
ee22f119de Add remaining header checks to be used in subsequent patches.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1704 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-11 03:47:56 +00:00
zwelch
6a8583ebc4 Add --enable-malloc-logging configure option and update log.c to match.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1703 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-11 03:35:25 +00:00
zwelch
af7cdfd82b Factor system #includes out of replacements.h into new system.h.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1702 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-11 02:52:00 +00:00
zwelch
4e7ec08939 Finish portability support for AC_HEADER_STDBOOL configure macro.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1701 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-11 02:29:53 +00:00
zwelch
490e271290 Remove redundant sys/types.h #include directives (now in types.h).
git-svn-id: svn://svn.berlios.de/openocd/trunk@1700 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-11 02:27:16 +00:00
zwelch
eb6da244cb Add configure check for sys/types.h; include in our types.h.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1699 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-11 02:24:58 +00:00
zwelch
55342151a3 Add AC_HEADER_ASSERT macro to configure; provides --disable-assert option.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1698 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-11 00:57:19 +00:00
zwelch
bf25d3edf7 Use AC_HEADER_STDBOOL macro instead of AC_CHEACK_HEADERS(stdbool.h).
git-svn-id: svn://svn.berlios.de/openocd/trunk@1697 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-11 00:49:51 +00:00
zwelch
76c0dcb324 OpenOCD now requires autoconf 2.60 to process AC_PROG_CC_C99 macro.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1696 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-11 00:44:59 +00:00
zwelch
647e61cc6d Extend autotools build to create shared library libopenocd with libtool:
- Add libtoolize step too bootstrap script; creates ltmain.sh script.
- Add AC_PROG_LIBTOOL to configure.in to add libtool support to build.
- Change Makefile.am library rules from static (_a) to libtool (_la).
- Install libopenocd.{la,so,a} in $(libdir); update openocd link rules.
- Extend MAINTAINERCLEANFILES in top-level Makefile.am to remove ltmain.sh.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1695 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-10 22:03:57 +00:00
zwelch
104580e0bf Reverse revision 1691: all of its functionality has migrated elsewhere.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1694 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-10 21:33:53 +00:00
zwelch
a24ab3ae38 Extend configure script to check for environ declaration in stdlib.h.
Patch contributed by Martin Thomas <mthomas@rhrk.uni-kl.de>.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1693 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-10 20:10:11 +00:00
oharboe
26526a80ea Wrote up post processing JTAG API. Not used yet, but reference implementation will be used in subsequent explanations of new scheme + patches to use it.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1692 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-10 19:48:09 +00:00
zwelch
72acdac71a Revive tclapi.c from r1650:
* Remove superfluous #include directives.
* Fix warnings and API usage to cure its bit rot.
* Build into libhelper library (for now).
Add tclapi.h to export tclapi_register_commands().
Register tclapi commands in openocd.c:setup_command_handler().



git-svn-id: svn://svn.berlios.de/openocd/trunk@1691 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-10 19:44:38 +00:00
oharboe
90465379e5 David Brownell <david-b@pacbell.net> whitespace fixes.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1690 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-10 19:02:07 +00:00
oharboe
64e5467ca7 David Brownell <david-b@pacbell.net> whitespace fixes. Testing out on one file first...
git-svn-id: svn://svn.berlios.de/openocd/trunk@1689 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-10 19:01:03 +00:00
oharboe
62d610f2b7 David Brownell <david-b@pacbell.net> fix warnings
git-svn-id: svn://svn.berlios.de/openocd/trunk@1688 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-10 18:01:50 +00:00
oharboe
3ac5d073dc Michael Bruck <mbruck@digenius.de> use more const
git-svn-id: svn://svn.berlios.de/openocd/trunk@1687 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-10 12:55:16 +00:00
oharboe
79d515c347 Michael Bruck <mbruck@digenius.de> use more const
git-svn-id: svn://svn.berlios.de/openocd/trunk@1686 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-09 09:30:00 +00:00
oharboe
0c9a2e99ca Michael Bruck <mbruck@digenius.de> ARM11 C99 updates
git-svn-id: svn://svn.berlios.de/openocd/trunk@1685 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-09 07:36:19 +00:00
oharboe
00fd07336e whitespace fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@1684 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-08 21:03:28 +00:00
oharboe
96509c764a plugged bug w/irlen > 32 introduce in 1672
git-svn-id: svn://svn.berlios.de/openocd/trunk@1683 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-08 20:48:28 +00:00
oharboe
d7f71e7fe9 whitespace fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@1682 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-08 20:44:52 +00:00
oharboe
de8430d3c3 David Brownell <david-b@pacbell.net> DaVinci dm6446
git-svn-id: svn://svn.berlios.de/openocd/trunk@1680 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-08 20:27:19 +00:00
oharboe
060f61ef24 sync up zy1000 interface to bitbang driver's handling of exiting the shift state
git-svn-id: svn://svn.berlios.de/openocd/trunk@1679 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-08 19:24:40 +00:00
oharboe
5f7791474b Michael Fischer <fischermi@t-online.de> fix compile problems on Mac
git-svn-id: svn://svn.berlios.de/openocd/trunk@1678 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-08 18:54:59 +00:00
oharboe
5ff0317aa3 fix gaffe in 1672
git-svn-id: svn://svn.berlios.de/openocd/trunk@1677 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-08 18:12:43 +00:00
oharboe
820da73f79 stm32 profiling wip
git-svn-id: svn://svn.berlios.de/openocd/trunk@1676 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-08 13:30:45 +00:00
oharboe
dbf69e3625 profiling numbers
git-svn-id: svn://svn.berlios.de/openocd/trunk@1675 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-08 12:26:50 +00:00
oharboe
49e286509b add flush_count jtag queue profiling feature
git-svn-id: svn://svn.berlios.de/openocd/trunk@1674 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-08 11:46:01 +00:00
oharboe
8a58fb9402 fix (old?) bug in jtag_add_ir_scan()
git-svn-id: svn://svn.berlios.de/openocd/trunk@1673 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-08 11:18:41 +00:00
oharboe
57bc9f37c9 in_handler in_check_mask and in_check_value now removed from field. Last big patch in the series of JTAG API cleanup.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1672 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-08 09:48:00 +00:00
oharboe
4df87471ca fix one gaffe in previous commit.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1671 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-08 09:37:25 +00:00
oharboe
84dfdd4de6 use assert instead of adding code that always runs
git-svn-id: svn://svn.berlios.de/openocd/trunk@1670 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-08 08:49:24 +00:00
oharboe
4f19ef3cce pull up verify_capture_ir one level in api stack
git-svn-id: svn://svn.berlios.de/openocd/trunk@1669 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-08 08:46:28 +00:00
oharboe
bf4da345ec retire jtag_set_check_value
git-svn-id: svn://svn.berlios.de/openocd/trunk@1668 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-08 07:28:00 +00:00
oharboe
fe629829f4 retire jtag_set_check_value
git-svn-id: svn://svn.berlios.de/openocd/trunk@1667 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-08 07:22:31 +00:00
oharboe
8173e02272 retire jtag_set_check_value
git-svn-id: svn://svn.berlios.de/openocd/trunk@1666 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-08 07:14:23 +00:00
oharboe
101ec4eae1 retire jtag_set_check_value
git-svn-id: svn://svn.berlios.de/openocd/trunk@1665 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-08 07:09:32 +00:00
oharboe
dd673b0b5f first jtag_check_value_mask usage. tested by using "arm7_9 fast_memory_access enable" & "mdw 0 0x10"
git-svn-id: svn://svn.berlios.de/openocd/trunk@1664 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-08 06:45:27 +00:00
oharboe
75f98d1649 added comments w.r.t. potential performance problems
git-svn-id: svn://svn.berlios.de/openocd/trunk@1663 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-08 06:14:08 +00:00
zwelch
f2676adb3c Fix typo from hurrying the last commit. Nothing to see here.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1662 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-08 05:33:08 +00:00
zwelch
6d60d22687 Fix loadFile to return file length once again.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1661 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-08 05:30:37 +00:00
zwelch
641919d491 Re-order and extend header file tests in configure script.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1660 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-08 04:59:05 +00:00
zwelch
d209029ca8 Fix warnings in httpd.c; builds with libmicrohttpd-0.4.1.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1659 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-08 04:49:27 +00:00
zwelch
1000674d1c Fix warnings in ioutil.c; improves loadFile inteface.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1658 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-08 04:46:00 +00:00
oharboe
f6ed7cb271 more in_handler typo fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@1657 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-07 23:00:28 +00:00
oharboe
15f15cdddb ouch - typo in last commit
git-svn-id: svn://svn.berlios.de/openocd/trunk@1656 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-07 22:59:51 +00:00
zwelch
b36db3036c Remove unreferenced tcpapi.c source file.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1655 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-07 22:59:20 +00:00
oharboe
597ec356e3 in_handler removal typo fixed
git-svn-id: svn://svn.berlios.de/openocd/trunk@1654 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-07 22:55:28 +00:00
oharboe
8f41f7c7d5 fix copy & paste error when retiring in_handler
git-svn-id: svn://svn.berlios.de/openocd/trunk@1653 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-07 22:45:17 +00:00
oharboe
e37669c3d0 refactor to be able to remove more in_handler stuff
git-svn-id: svn://svn.berlios.de/openocd/trunk@1652 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-07 20:53:32 +00:00
oharboe
bb4e592b5b verified that an argument is unused
git-svn-id: svn://svn.berlios.de/openocd/trunk@1651 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-07 20:24:23 +00:00
oharboe
47c5230c4a fix c99 compile errors
git-svn-id: svn://svn.berlios.de/openocd/trunk@1650 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-07 20:19:04 +00:00
oharboe
bb994f53cc marker for in_handler to remove
git-svn-id: svn://svn.berlios.de/openocd/trunk@1649 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-07 14:22:15 +00:00
oharboe
d6c34316b1 remove usage of in_handler
git-svn-id: svn://svn.berlios.de/openocd/trunk@1648 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-07 14:20:25 +00:00
oharboe
a229f21432 remove in_handler usage
git-svn-id: svn://svn.berlios.de/openocd/trunk@1647 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-07 14:02:21 +00:00
oharboe
cee9970c98 remove in_handler usage
git-svn-id: svn://svn.berlios.de/openocd/trunk@1646 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-07 13:57:43 +00:00
oharboe
391e1b0a57 remove in_handler usage
git-svn-id: svn://svn.berlios.de/openocd/trunk@1645 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-07 13:54:41 +00:00
oharboe
7e546bb91f remove in_handler usage
git-svn-id: svn://svn.berlios.de/openocd/trunk@1644 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-07 13:50:37 +00:00
oharboe
dbe008302a remove in_handler usage
git-svn-id: svn://svn.berlios.de/openocd/trunk@1643 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-07 13:40:11 +00:00
oharboe
b1364c5f9c remove in_handler usage
git-svn-id: svn://svn.berlios.de/openocd/trunk@1642 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-07 13:36:35 +00:00
oharboe
f5f33771be remove in_handler usage
git-svn-id: svn://svn.berlios.de/openocd/trunk@1641 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-07 13:31:34 +00:00
oharboe
7bb5f2124b remove in_handler usage
git-svn-id: svn://svn.berlios.de/openocd/trunk@1640 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-07 13:26:35 +00:00
oharboe
7eeb3cfc47 stop using in_handler
git-svn-id: svn://svn.berlios.de/openocd/trunk@1639 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-07 13:23:14 +00:00
oharboe
c4ee880715 jtag API error handling refactoring.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1638 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-07 13:04:13 +00:00
oharboe
146b6462a3 remove in_handler usage
git-svn-id: svn://svn.berlios.de/openocd/trunk@1637 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-07 12:33:26 +00:00
oharboe
a1777c6bcf remove in_handler usage
git-svn-id: svn://svn.berlios.de/openocd/trunk@1636 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-07 12:29:31 +00:00
oharboe
b227b5eb76 David Brownell david-b at pacbell.net fix warnings
git-svn-id: svn://svn.berlios.de/openocd/trunk@1635 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-07 10:59:06 +00:00
oharboe
fac4032d88 fix line endings
git-svn-id: svn://svn.berlios.de/openocd/trunk@1634 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-07 09:57:13 +00:00
oharboe
25828959d3 David Brownell <david-b@pacbell.net> DaVinci DM355 SoC support
git-svn-id: svn://svn.berlios.de/openocd/trunk@1633 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-07 08:19:07 +00:00
oharboe
950f7e3cd9 Deleted at9sam7_old driver. Nobody has complained about the new one yet.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1632 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-07 06:58:52 +00:00
oharboe
8d10b757c0 slightly increase readability of code
git-svn-id: svn://svn.berlios.de/openocd/trunk@1631 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-07 06:51:27 +00:00
oharboe
cb97efc46b another example of removing in_handler usage
git-svn-id: svn://svn.berlios.de/openocd/trunk@1630 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-07 06:47:09 +00:00
oharboe
9c96811168 added template for removing in_handler
git-svn-id: svn://svn.berlios.de/openocd/trunk@1629 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-07 06:29:08 +00:00
zwelch
0cc7e5b0b7 Fix most pointer cast alignment warnings in arm11.c; fix u16 memory reads..
git-svn-id: svn://svn.berlios.de/openocd/trunk@1628 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-07 01:26:56 +00:00
zwelch
92bae0b1df Fix pointer cast alignment warnings in arm_adi_v5.c
git-svn-id: svn://svn.berlios.de/openocd/trunk@1627 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-07 00:58:38 +00:00
zwelch
fdf114ab0a Fix stm32x and pic32mx flash pointer cast alignment warnings, simplify their last word handling.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1626 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-07 00:21:59 +00:00
zwelch
a3b6236289 Fix pointer cast alignment warning in XScale miniIC loader parity calc.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1625 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-06 23:31:50 +00:00
zwelch
5f45a3d1df Fix pointer cast alignment warnings in target/image.c.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1624 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-06 23:28:38 +00:00
zwelch
41638e0a09 Change reg_s value field from u8 * to void *; it must always be cast.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1623 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-06 23:25:27 +00:00
zwelch
8cbb2ae7f4 Fix pointer cast alignment issues in svf.c
git-svn-id: svn://svn.berlios.de/openocd/trunk@1622 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-06 23:05:57 +00:00
zwelch
5c1cb131e9 Add configure script check to enable C99 build option.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1621 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-06 21:48:39 +00:00
zwelch
4b127e229b Fix pointer cast alignment warnings in jim.c.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1620 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-06 21:21:18 +00:00
mlu
b33779fbbe Added (BUILD_JLINK==1) condition to us new tables with JLink
git-svn-id: svn://svn.berlios.de/openocd/trunk@1619 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-06 18:47:15 +00:00
oharboe
c8e52f9e15 Dick Hollenbeck <dick@softplc.com> comments & 7 clock TMS reset for good measure
git-svn-id: svn://svn.berlios.de/openocd/trunk@1618 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-06 18:24:24 +00:00
oharboe
cd0512befd Dick Hollenbeck <dick@softplc.com> part deux of previous changes just committed.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1617 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-06 18:18:00 +00:00
mlu
0317db97cd Small changes that might improve stability.
Implemented new jtag sequences tap_get_tms_path and tap_get_tms_path_len

git-svn-id: svn://svn.berlios.de/openocd/trunk@1616 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-06 17:28:39 +00:00
oharboe
a2a71fe705 transition more directly to the end state + reuse more of the state move code/paths
git-svn-id: svn://svn.berlios.de/openocd/trunk@1615 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-06 17:25:14 +00:00
oharboe
b4fbd4abe4 Dick Hollenbeck <dick@softplc.com> simplifies XSTATE handling, and protects against illegal state
transitions that might be in an SVF file.

git-svn-id: svn://svn.berlios.de/openocd/trunk@1614 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-06 13:32:43 +00:00
oharboe
8161adafd3 log noise reduction
git-svn-id: svn://svn.berlios.de/openocd/trunk@1613 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-06 11:22:30 +00:00
zwelch
f719306f68 Fix enviorn configure test failure message (thanks to Anders Montonen).
git-svn-id: svn://svn.berlios.de/openocd/trunk@1612 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-06 08:30:50 +00:00
oharboe
e86dee3200 remove unecessary setting of deprecated fields to NULL
git-svn-id: svn://svn.berlios.de/openocd/trunk@1611 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-06 07:21:46 +00:00
zwelch
7e50a39773 Add autoconf check to determine where environ should be declared.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1610 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-06 07:17:57 +00:00
oharboe
213368e21f add warnings about not using in_handler
git-svn-id: svn://svn.berlios.de/openocd/trunk@1609 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-06 06:40:56 +00:00
oharboe
4d88c124b1 retire out_mask - not used anywhere
git-svn-id: svn://svn.berlios.de/openocd/trunk@1608 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-06 06:20:52 +00:00
oharboe
b6f268c113 mark usage of in_handler that can be converted into user code
git-svn-id: svn://svn.berlios.de/openocd/trunk@1607 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-05 19:30:13 +00:00
oharboe
e03658ee07 made warning about keep_alive() not being invoked more helpful
git-svn-id: svn://svn.berlios.de/openocd/trunk@1606 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-05 12:07:02 +00:00
oharboe
a83583e926 remove extra newline before prompt
git-svn-id: svn://svn.berlios.de/openocd/trunk@1605 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-05 12:06:26 +00:00
oharboe
6fd394811c Gabor Juhos juhosg at openwrt.org MIPS: fix a shift value in the MIPS32_R_INST macro
git-svn-id: svn://svn.berlios.de/openocd/trunk@1604 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-05 06:49:55 +00:00
oharboe
eb51d4f68b Oleksandr Tymoshenko <gonzo@bluezbox.com> "resume" command fix for EJTAG
git-svn-id: svn://svn.berlios.de/openocd/trunk@1603 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-05 05:55:14 +00:00
oharboe
7a93100c2d Dirk Behme <dirk.behme@googlemail.com> Add minimalist Cortex A8 file
git-svn-id: svn://svn.berlios.de/openocd/trunk@1602 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-04 18:44:12 +00:00
oharboe
03fdabaaac Mariano Alvira <mar@devl.org> fixes warnings
git-svn-id: svn://svn.berlios.de/openocd/trunk@1601 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-04 11:06:21 +00:00
oharboe
1f378efbf0 Mariano Alvira <mar@devl.org> fixes warning as error about a signed vs. unsigned comparison by casting the local unsigned variable as (long long).
git-svn-id: svn://svn.berlios.de/openocd/trunk@1600 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-04 11:03:40 +00:00
kc8apf
53b7ce5b22 Fix environ declaration for non-glibc systems
git-svn-id: svn://svn.berlios.de/openocd/trunk@1599 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-04 06:22:49 +00:00
oharboe
ea3e49f4e2 fix embedded builds
git-svn-id: svn://svn.berlios.de/openocd/trunk@1598 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-03 20:48:20 +00:00
oharboe
832af8c1b0 Backed out change to solve Mac OS compilation problems.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1597 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-03 20:21:32 +00:00
zwelch
6f449ff098 Fix compilation when HAVE_UNISTD_H is not defined.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1596 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-03 15:21:40 +00:00
oharboe
ca3d4db1e3 Piotr Esden-Tempski <piotr@esden.net> Mac OS X compile fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@1595 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-03 15:11:17 +00:00
oharboe
1f84e5ac57 Piotr Esden-Tempski <piotr@esden.net> Mac OS X compile fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@1594 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-03 15:10:16 +00:00
zwelch
caf14c53db Fix build when enabling presto+ftd2xx driver only.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1593 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-03 03:35:01 +00:00
zwelch
85ecae2875 Add configure check for usb.h; required by a USB drivers.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1592 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-02 22:46:14 +00:00
zwelch
66add57aa5 Update autotools scripts to require automake 1.6. The configure.in script
already required autoconf 2.59 (circa 2006), so there is no reason to
support versions of automake older than 1.6 (circa 2002).

The first part of this patch upgrades the configure.in script:

     1. Use current calling conventions for the AC_INIT and
        AM_INIT_AUTOMAKE macros, bringing their usage up-to-date with
        the version of autoconf already specified by AC_PREREQ.
     2. Add AC_CONFIG_SRCDIR macro, required by new version of AC_INIT.
     3. Automatically enable all of automake's warnings except Makefile
        portability (which OpenOCD violates by using GNU make's $(wildcard)).
        [[ While automake has its own -Werror option, I did not enabled it
        due to existing warnings. ]]
     4. Add the missing AM_PROG_C_O check, required by the build rules for
        openocd.o in src/Makefile.am.
     5. Adjust version number to show progress toward the next release.
     6. Include a bug reporting e-mail address to direct users to this list.

This patch makes the following adjustments to the Makefile.am files:

     1. Update AUTOMAKE_OPTIONS to require automake version 1.6
     2. Rewrite all deprecated INCLUDES assignments as AM_CPPFLAGS
     3. Clean-up all AM_CPPFLAGS declarations to be patch-friendly.
     4. Remove vestigial references to $(all_includes)
     5. Remove erroneous references to @CPPFLAGS@ (only use AM_CPPFLAGS)
     6. Remove unused -I and -D directives in helper/, flash/, target/


git-svn-id: svn://svn.berlios.de/openocd/trunk@1591 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-02 22:35:02 +00:00
oharboe
6cacbd9575 Dick Hollenbeck <dick@softplc.com> moved stuff into openocd.c - should never have been in main.c in the first place. DLL will now build.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1590 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-02 19:31:30 +00:00
oharboe
e69b222d53 Zach Welch <zw@superlucidity.net> fix warnings
git-svn-id: svn://svn.berlios.de/openocd/trunk@1589 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-02 12:26:10 +00:00
zwelch
2fb13f9b65 Remove superflous spaces from new JTAG table to fix formatting.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1588 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-01 23:42:43 +00:00
zwelch
dee85e5a00 Add static keywords to main application helper functions.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1587 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-01 03:07:32 +00:00
zwelch
1743395250 Dick Hollenbeck <dick@softplc.com>: move OPENOCD_VERSION to use config.h
git-svn-id: svn://svn.berlios.de/openocd/trunk@1586 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-01 01:18:05 +00:00
zwelch
214407d9c7 Uwe Hermann <uwe@hermann-uwe.de>: Support both rev -A1 and -A2 of Hitex STR9-comStick.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1585 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-30 23:19:46 +00:00
zwelch
0682afece8 Uwe Hermann <uwe@hermann-uwe.de>: Make ICEbear look like other targets
git-svn-id: svn://svn.berlios.de/openocd/trunk@1584 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-30 21:04:34 +00:00
oharboe
39363e4e01 zy1000 1.51
git-svn-id: svn://svn.berlios.de/openocd/trunk@1582 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-30 10:08:11 +00:00
oharboe
c7bbd9ac71 list board's as well as target config files.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1581 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-30 10:07:39 +00:00
oharboe
c4d172da76 lpc2478 target config
git-svn-id: svn://svn.berlios.de/openocd/trunk@1580 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-30 09:50:14 +00:00
zwelch
8c1ec4f0e1 Add static keywords to core target source file data and functions.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1579 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-30 09:49:38 +00:00
oharboe
d70dac5e49 Print out warning when LPC calc_checksum will cause verification to fail.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1578 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-30 09:39:24 +00:00
zwelch
20f0744f39 Fix signed/unsigned comparison.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1577 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-30 09:14:01 +00:00
oharboe
a975b925ba no change
git-svn-id: svn://svn.berlios.de/openocd/trunk@1576 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-30 08:15:27 +00:00
oharboe
2ae1f18d1f flash fillX now has a verify stage
git-svn-id: svn://svn.berlios.de/openocd/trunk@1575 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-30 08:08:49 +00:00
oharboe
01f25b5aeb use jtag_rclk 500 to avoid proliferation of target scripts
git-svn-id: svn://svn.berlios.de/openocd/trunk@1574 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-30 06:26:22 +00:00
zwelch
850121f255 Michael Bruck <mbruck@digenius.de>: sys/select.h must preceed windows.h.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1573 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-30 00:59:46 +00:00
zwelch
6f73d44fab Michael Bruck <mbruck@digenius.de>: use HAVE_UNISTD_H for environ decl.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1572 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-30 00:57:58 +00:00
mlu
7d61acebd8 Clear FLASH_SR error flags after flash errors to avoid reset befor further flash operations.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1571 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-29 21:08:39 +00:00
zwelch
851f9b2d6c Add udev rules for USB ICEbear interface.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1570 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-29 18:26:11 +00:00
mlu
9f9c56d6bc More error logging for DAP errors
git-svn-id: svn://svn.berlios.de/openocd/trunk@1569 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-29 18:17:51 +00:00
ntfreak
d019dcf195 - add missing svn props from svn 1565 commit
git-svn-id: svn://svn.berlios.de/openocd/trunk@1568 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-29 13:24:05 +00:00
oharboe
0d327e9e40 comments and debug code
git-svn-id: svn://svn.berlios.de/openocd/trunk@1567 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-29 11:37:33 +00:00
zwelch
3ccbaf336d Sten <debian@sansys-electronic.com>: add support for Olimex LPC2378STK eval board.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1566 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-29 07:40:07 +00:00
zwelch
3368bb5a81 Sten <debian@sansys-electronic.com>: add support for ICEbear FDTI-based interface.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1565 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-29 07:38:35 +00:00
zwelch
ae719b2706 Fix jlink usb_bulk_with_retries to return actual error codes.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1564 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-29 06:30:44 +00:00
zwelch
5ee99a7e80 Remove vestigial last_tms variable from jlink driver.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1563 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-29 05:22:14 +00:00
zwelch
2f3dc12ad7 Add -Wredundant-decls to prevent unwanted duplicate declarations.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1562 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-29 03:28:12 +00:00
zwelch
a8f1307992 Fix jlink for Debian/Ubuntu (by Ben Dooks <ben-openocd@fluff.org>).
git-svn-id: svn://svn.berlios.de/openocd/trunk@1561 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-29 02:18:50 +00:00
zwelch
1de959ca1c Remove redundant declarations to allow building with -Wredundant-decls.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1560 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-29 01:43:01 +00:00
zwelch
55c39bae67 Add missing header files to fix C99 compatibility.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1559 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-29 00:33:35 +00:00
oharboe
18b5a88a8a more docs on jtag_add_pathmove()
git-svn-id: svn://svn.berlios.de/openocd/trunk@1558 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-28 20:59:52 +00:00
oharboe
abeee8b4c2 Dick Hollenbeck <dick@softplc.com> and Jeff Williams tap_get_tms_path_len()
git-svn-id: svn://svn.berlios.de/openocd/trunk@1557 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-28 19:02:29 +00:00
mlu
f1864e3e92 Correctedout buffer size and missing jlink_tap_init() call.
Expanded JLink adapter info at startup.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1556 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-28 17:40:02 +00:00
ntfreak
154d8241c9 - fix win32 build
git-svn-id: svn://svn.berlios.de/openocd/trunk@1555 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-28 13:40:06 +00:00
oharboe
c5ad875a79 fix checksum memory. By failing the fallback code will handle checksum calculation
git-svn-id: svn://svn.berlios.de/openocd/trunk@1554 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-28 08:42:09 +00:00
oharboe
de6d69cc60 Zach Welch <zw@superlucidity.net> fix gw16012 with --enable-parport_ppdev
git-svn-id: svn://svn.berlios.de/openocd/trunk@1553 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-28 07:34:43 +00:00
oharboe
e8240209fe convert some LOG_INFO()'s during stepping into LOG_DEBUG()
git-svn-id: svn://svn.berlios.de/openocd/trunk@1552 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-28 07:33:50 +00:00
oharboe
9ba80f08f4 Michael Bruck <mbruck@digenius.de> macros for error handling
git-svn-id: svn://svn.berlios.de/openocd/trunk@1551 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-28 07:29:18 +00:00
oharboe
5df0a88e01 eol-style native
git-svn-id: svn://svn.berlios.de/openocd/trunk@1550 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-28 06:29:32 +00:00
oharboe
adbe3ac817 eol-style native
git-svn-id: svn://svn.berlios.de/openocd/trunk@1549 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-28 06:28:39 +00:00
oharboe
b2a13907a8 SimonQian <simonqian@simonqian.com> fix warnings(which stops compilation) and some bugs
git-svn-id: svn://svn.berlios.de/openocd/trunk@1548 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-27 19:35:31 +00:00
mlu
a644bc11a5 Added dap baseaddr and dap apid commands
git-svn-id: svn://svn.berlios.de/openocd/trunk@1547 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-27 16:08:25 +00:00
oharboe
c4ac70570a Dick Hollenbeck <dick@softplc.com> Collect some macros, add DIM()
git-svn-id: svn://svn.berlios.de/openocd/trunk@1546 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-27 16:03:39 +00:00
oharboe
9d5921443c SimonQian <simonqian@simonqian.com> patch for error compiling vsllink if --enable-verbose-jtag-io is set
git-svn-id: svn://svn.berlios.de/openocd/trunk@1545 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-27 13:00:29 +00:00
oharboe
88c91b4663 clean up debug/info output to be in line with other targets
git-svn-id: svn://svn.berlios.de/openocd/trunk@1544 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-27 12:12:44 +00:00
oharboe
bd7d019b56 more error handling
git-svn-id: svn://svn.berlios.de/openocd/trunk@1543 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-27 12:02:07 +00:00
oharboe
4866c8ed25 a little bit more error handling in ARM11
git-svn-id: svn://svn.berlios.de/openocd/trunk@1542 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-27 11:24:01 +00:00
oharboe
e784db4fdd SimonQian <simonqian@simonqian.com> AVR wip
git-svn-id: svn://svn.berlios.de/openocd/trunk@1540 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-27 10:32:13 +00:00
oharboe
18fd79e578 SimonQian <simonqian@simonqian.com> AVR support
git-svn-id: svn://svn.berlios.de/openocd/trunk@1539 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-27 10:16:16 +00:00
mlu
510ad74ea9 Deleted depreciated files ( new versions are arm_adi_v5.c/h )
git-svn-id: svn://svn.berlios.de/openocd/trunk@1538 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-27 10:05:15 +00:00
oharboe
1c28cbab02 Some devices such as AVR will return 0xffffffff instead of the TDI
data at the end of the chain. Added kludge to handle this. 

git-svn-id: svn://svn.berlios.de/openocd/trunk@1537 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-27 09:12:18 +00:00
mlu
b0d04ab6c6 Changed armv7m and cortexm3 to use nev arm_adi_v5 instead of cortex_swjdp.
Added support for accessport ROM table identification, dap command. 

git-svn-id: svn://svn.berlios.de/openocd/trunk@1536 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-27 08:29:28 +00:00
mlu
573d9a0368 Added arm_adi_v5.c/h, to replace cortex_swjdp.c/h. Better conformance to ARM Debug Interface rev 5 documentation and remoed code specific to the Cortex-M3 targets.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1535 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-27 08:21:35 +00:00
oharboe
c34a854465 Philippe Vachon <philippe@cowpig.ca> 64 bit host fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@1534 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-27 05:40:52 +00:00
oharboe
60fdeb057a Zach Welch <zw@superlucidity.net> add -Wcast-align and -Wbad-function-cast
git-svn-id: svn://svn.berlios.de/openocd/trunk@1533 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-27 05:30:15 +00:00
oharboe
70d80bba5a Zach Welch <zw@superlucidity.net> wrap _GNU_SOURCE defines
git-svn-id: svn://svn.berlios.de/openocd/trunk@1532 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-27 05:29:30 +00:00
oharboe
b0acd78511 Zach Welch <zw@superlucidity.net> fix typo
git-svn-id: svn://svn.berlios.de/openocd/trunk@1531 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-26 20:05:08 +00:00
oharboe
dd91692fee R.Doss <doss@gmx.de> AT91SAM9260
git-svn-id: svn://svn.berlios.de/openocd/trunk@1530 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-26 20:03:41 +00:00
oharboe
8f56912fc2 Zach Welch <zw@superlucidity.net> add TAP_SCAN_BYTES macro
git-svn-id: svn://svn.berlios.de/openocd/trunk@1529 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-26 20:02:15 +00:00
mlu
39f76220a8 Corrected statement order
git-svn-id: svn://svn.berlios.de/openocd/trunk@1528 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-25 02:53:07 +00:00
mlu
773ebb6bba Fix ft2232 TX buffer overflow
git-svn-id: svn://svn.berlios.de/openocd/trunk@1527 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-25 00:58:49 +00:00
mlu
4b9f6fcdb7 Break ft2232_execute_quie into smaller functions, follows restructure of jlink.c
git-svn-id: svn://svn.berlios.de/openocd/trunk@1526 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-25 00:54:21 +00:00
oharboe
479a65e946 add jtag_debug_state_machine
git-svn-id: svn://svn.berlios.de/openocd/trunk@1525 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-24 18:10:04 +00:00
oharboe
447a615dc3 Zach Welch <zw@superlucidity.net> add TAP_SCAN_BYTES macro (1 of 2)
git-svn-id: svn://svn.berlios.de/openocd/trunk@1524 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-24 16:24:55 +00:00
oharboe
002fdcf016 Zach Welch <zw@superlucidity.net> add --enable-maintainer-mode reminder
git-svn-id: svn://svn.berlios.de/openocd/trunk@1523 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-24 16:14:21 +00:00
oharboe
843023f9ff Uwe Hermann <uwe@hermann-uwe.de> Update udev file
git-svn-id: svn://svn.berlios.de/openocd/trunk@1522 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-24 12:12:36 +00:00
oharboe
caf214935a Zach Welch <zw@superlucidity.net> use memcpy
git-svn-id: svn://svn.berlios.de/openocd/trunk@1521 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-24 11:05:21 +00:00
oharboe
fa2fcbe416 Nicolas Pitre <nico@cam.org> update SheevaPlug interface cfg file
git-svn-id: svn://svn.berlios.de/openocd/trunk@1520 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-24 06:04:40 +00:00
oharboe
666167138f Uwe Hermann <uwe@hermann-uwe.de> drop unecessary BSTAPIDs
git-svn-id: svn://svn.berlios.de/openocd/trunk@1519 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-24 06:02:02 +00:00
duane
7372da95be Remove warning
git-svn-id: svn://svn.berlios.de/openocd/trunk@1518 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-24 02:13:02 +00:00
oharboe
2fb843773b Michael Bruck <mbruck@digenius.de> include file fix
git-svn-id: svn://svn.berlios.de/openocd/trunk@1517 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-23 18:55:13 +00:00
oharboe
9b7bd65883 stm32.cfg can expect one of 4 id's.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1516 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-23 14:03:42 +00:00
oharboe
90ff84a2dd unbreak zy1000
git-svn-id: svn://svn.berlios.de/openocd/trunk@1515 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-23 13:24:56 +00:00
oharboe
ee8a080cea Laurentiu Cocanu - fix typo
git-svn-id: svn://svn.berlios.de/openocd/trunk@1514 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-23 12:21:39 +00:00
ntfreak
5fbfbec86b - fix win32 build after svn 1511 changes
git-svn-id: svn://svn.berlios.de/openocd/trunk@1513 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-22 19:54:03 +00:00
oharboe
23de60e6bd Michael Bruck <mbruck@digenius.de> ARM11 various updates + fix formatting.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1512 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-22 18:39:59 +00:00
oharboe
a247833a5a Michael Bruck <mbruck@digenius.de> signed/unsigned incompatibility warning
git-svn-id: svn://svn.berlios.de/openocd/trunk@1511 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-22 17:36:00 +00:00
oharboe
0ebf92b45c Michael Bruck spotted a typo in help messages
git-svn-id: svn://svn.berlios.de/openocd/trunk@1510 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-22 17:10:12 +00:00
oharboe
779c44125a Zach Welch <zw@superlucidity.net> do not pad TMS
git-svn-id: svn://svn.berlios.de/openocd/trunk@1509 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-22 13:54:04 +00:00
oharboe
f6fd9bc823 Zach Welch <zw@superlucidity.net> set speed in init
git-svn-id: svn://svn.berlios.de/openocd/trunk@1508 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-22 11:37:27 +00:00
oharboe
7395ca92d4 Zach Welch <zw@superlucidity.net> fix jlink reset
git-svn-id: svn://svn.berlios.de/openocd/trunk@1507 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-22 10:59:23 +00:00
oharboe
efa79144f3 Zach Welch <zw@superlucidity.net> reorder enum tap_state
git-svn-id: svn://svn.berlios.de/openocd/trunk@1506 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-22 10:46:37 +00:00
mlu
f29b2da658 Fix str_to_buf problem, thanks Andy Chenee
git-svn-id: svn://svn.berlios.de/openocd/trunk@1505 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-22 10:09:15 +00:00
kc8apf
2b90372b79 Shrink JLink buffer sizes to specified 2KB courtesy of Jeff Williams <jeffw@gadgetworks.com> and Zach Welch <zw@superlucidity.net>
git-svn-id: svn://svn.berlios.de/openocd/trunk@1504 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-22 07:34:47 +00:00
kc8apf
6be91c28ca Add D2XX support for OS X courtesy of Piotr Esden-Tempski <piotr@esden.net>
git-svn-id: svn://svn.berlios.de/openocd/trunk@1503 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-22 07:32:09 +00:00
kc8apf
0f3ab30087 Fix use of wrong format conversion for size_t (%zu instead of %u)
git-svn-id: svn://svn.berlios.de/openocd/trunk@1502 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-22 07:31:16 +00:00
kc8apf
d35a4b005e fix jtag run/idle state name courtesy of Jeff Williams <jeffw@gadgetworks.com> and Zach Welch <zw@superlucidity.net>
git-svn-id: svn://svn.berlios.de/openocd/trunk@1501 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-22 06:56:59 +00:00
kc8apf
f13f52d303 refactor jlink_execute_queue courtesy of Zach Welch <zw@superlucidity.net>
git-svn-id: svn://svn.berlios.de/openocd/trunk@1500 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-22 06:55:34 +00:00
oharboe
5376bfd21c Uwe Hermann <uwe@hermann-uwe.de> Drop non-A variants of ft2232 targets
git-svn-id: svn://svn.berlios.de/openocd/trunk@1499 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-22 06:16:53 +00:00
oharboe
66db8e7bb4 Zach Welch <zw@superlucidity.net> refactor
git-svn-id: svn://svn.berlios.de/openocd/trunk@1498 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-21 15:39:49 +00:00
oharboe
97a5e7a608 Zach Welch <zw@superlucidity.net> fix ft2232 usb io format warning
git-svn-id: svn://svn.berlios.de/openocd/trunk@1497 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-21 12:10:29 +00:00
oharboe
16d497449a Zach Welch <zw@superlucidity.net> add --enable-verbose* options
git-svn-id: svn://svn.berlios.de/openocd/trunk@1496 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-21 12:09:35 +00:00
oharboe
5b4679618a Zach Welch <zw@superlucidity.net> add --enable-verbose* options
git-svn-id: svn://svn.berlios.de/openocd/trunk@1495 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-21 11:37:15 +00:00
oharboe
837555ab24 Nico Coesel <ncoesel@dealogic.nl> MIPS32 speedup patches
git-svn-id: svn://svn.berlios.de/openocd/trunk@1494 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-21 11:35:58 +00:00
oharboe
48d9f3bbde Zach Welch <zw@superlucidity.net> fix jlink format warning
git-svn-id: svn://svn.berlios.de/openocd/trunk@1493 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-21 11:33:29 +00:00
oharboe
2c89a1ec5f Zach Welch <zw@superlucidity.net> factor jlink usb_bulk_*_ex functions
git-svn-id: svn://svn.berlios.de/openocd/trunk@1492 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-21 09:41:41 +00:00
ntfreak
e5afb14241 - vsllink update from SimonQian [simonqian@SimonQian.com]
git-svn-id: svn://svn.berlios.de/openocd/trunk@1491 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-21 09:08:43 +00:00
oharboe
605c791cb2 Zach Welch <zw@superlucidity.net> improve Linux ftd2xx configure-time support
git-svn-id: svn://svn.berlios.de/openocd/trunk@1490 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-21 09:05:02 +00:00
ntfreak
dcdf71c21b - fix signed/unsigned build errors under win32. Thanks Zach Welch <zw@superlucidity.net>
git-svn-id: svn://svn.berlios.de/openocd/trunk@1489 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-21 09:02:42 +00:00
ntfreak
9997362a2a - remove environ warning under win32 build
git-svn-id: svn://svn.berlios.de/openocd/trunk@1488 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-21 08:51:07 +00:00
oharboe
09a3cc0980 Zach Welch <zw@superlucidity.net> add static keywords to at91rm9200
git-svn-id: svn://svn.berlios.de/openocd/trunk@1487 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-21 06:23:47 +00:00
oharboe
24243b2b7a Zach Welch <zw@superlucidity.net> fix unused return value warnings (2 of 4)
git-svn-id: svn://svn.berlios.de/openocd/trunk@1486 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-21 05:42:18 +00:00
oharboe
6f7d3c9d5b Zach Welch <zw@superlucidity.net> fix at91sam7 uninitialized variable warnings
git-svn-id: svn://svn.berlios.de/openocd/trunk@1485 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-21 05:39:36 +00:00
oharboe
40b806bfe7 Zach Welch <zw@superlucidity.net> fix str9x type-punned pointer
git-svn-id: svn://svn.berlios.de/openocd/trunk@1484 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-21 05:36:53 +00:00
oharboe
713854f714 Zach Welch <zw@superlucidity.net> add -Wformat-security (4 of 4)
git-svn-id: svn://svn.berlios.de/openocd/trunk@1483 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-21 05:35:51 +00:00
oharboe
5dbf973910 Zach Welch <zw@superlucidity.net>fix unused return value warnings (3 of 4)
git-svn-id: svn://svn.berlios.de/openocd/trunk@1482 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-21 05:35:10 +00:00
oharboe
4f0bd8e8e1 Zach Welch <zw@superlucidity.net> fix -Wformat-security warnings (1 of 4)
git-svn-id: svn://svn.berlios.de/openocd/trunk@1481 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-21 05:33:47 +00:00
oharboe
55ebb067d1 Michael Schwingen <rincewind@discworld.dascon.de> add non-CFI SST flashs
git-svn-id: svn://svn.berlios.de/openocd/trunk@1480 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-21 05:31:18 +00:00
oharboe
d2d75efb39 Zach Welch <zw@superlucidity.net> use static keyword in jtag layer and drivers
git-svn-id: svn://svn.berlios.de/openocd/trunk@1479 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-21 05:29:23 +00:00
ntfreak
81f9e0a0bc - fix at91rm9200 warning. Thanks Zach Welch <zw@superlucidity.net>
- add missing svn props from previous commit

git-svn-id: svn://svn.berlios.de/openocd/trunk@1478 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-20 22:38:27 +00:00
oharboe
e6b164c685 Holger Freyther <zecke@selfish.org> Attempt to fix arm7_9 breakpoint handling
git-svn-id: svn://svn.berlios.de/openocd/trunk@1477 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-20 10:52:08 +00:00
oharboe
2710aba701 Zach Welch <zw@superlucidity.net> fix ft2232/presto warnings
git-svn-id: svn://svn.berlios.de/openocd/trunk@1476 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-20 06:40:45 +00:00
oharboe
c401b8dd4f Nikolay Shadrin whoney at gmail.com, Zach Welch <zw@superlucidity.net> unstable USB J-Link in OpenOCD (revised patch provided)
git-svn-id: svn://svn.berlios.de/openocd/trunk@1475 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-19 23:30:15 +00:00
oharboe
d1ab0a9698 Zach Welch <zw@superlucidity.net> use ARM4_5_MODE_ANY instead of -1
git-svn-id: svn://svn.berlios.de/openocd/trunk@1474 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-19 23:27:17 +00:00
oharboe
a2c1cbe3e3 Zach Welch <zw@superlucidity.net> treat warnings as errors
git-svn-id: svn://svn.berlios.de/openocd/trunk@1473 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-19 21:04:34 +00:00
oharboe
40580e2d71 Zach Welch <zw@superlucidity.net> fix -Werror warnings
git-svn-id: svn://svn.berlios.de/openocd/trunk@1472 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-19 20:51:16 +00:00
mifi
7989000e09 Partially fix USBprog and JLink adapters on XScale target
Thanks to Peter Denison <openwrt(at)marshadder.org> 

git-svn-id: svn://svn.berlios.de/openocd/trunk@1471 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-19 19:15:09 +00:00
mifi
486799e65b Added functionality to support jtag_khz for the jlink.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1470 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-19 14:51:51 +00:00
oharboe
f1bca5898c Michael Schwingen <rincewind@discworld.dascon.de> enhanced non-CFI flash support
git-svn-id: svn://svn.berlios.de/openocd/trunk@1469 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-19 12:06:49 +00:00
oharboe
8ac5bd7030 Zach Welch <zw@superlucidity.net> add missing initializers in nand.c
git-svn-id: svn://svn.berlios.de/openocd/trunk@1468 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-19 08:18:46 +00:00
oharboe
a6f953babc Zach Welch <zw@superlucidity.net> trim logic in tms470.c
git-svn-id: svn://svn.berlios.de/openocd/trunk@1467 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-19 08:18:01 +00:00
oharboe
a88532bc60 Zach Welch <zw@superlucidity.net> fix signed/unsigned comparisons
git-svn-id: svn://svn.berlios.de/openocd/trunk@1466 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-19 08:16:58 +00:00
oharboe
7d6b4b42f6 Zach Welch <zw@superlucidity.net> fix warnings in usbprog
git-svn-id: svn://svn.berlios.de/openocd/trunk@1465 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-19 08:15:32 +00:00
oharboe
dd6912b1e5 Zach Welch <zw@superlucidity.net> use tap_state_t
git-svn-id: svn://svn.berlios.de/openocd/trunk@1464 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-19 08:05:54 +00:00
oharboe
c1893c416b Zach Welch <zw@superlucidity.net> automake maintainer mode
git-svn-id: svn://svn.berlios.de/openocd/trunk@1463 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-19 08:04:23 +00:00
mifi
0bba832713 The following patches was applied:
- openocd-flash-static-keyword-v3.patch
- openocd-lpc2000-fix-erase-obo.patch
- openocd-jlink-fix-sign-ptr-warn.patch
- openocd-wextra-etm.patch
- openocd-wextra-jtag.patch
- openocd-add-new-tap-symbols-v6.patch

Many thanks to  Zach Welch <zw(at)superlucidity.net>

git-svn-id: svn://svn.berlios.de/openocd/trunk@1462 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-18 10:08:13 +00:00
oharboe
13de2d2fef Jesus Sanchez-Palencia <jesus.palencia@openbossa.org>
git-svn-id: svn://svn.berlios.de/openocd/trunk@1461 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-15 15:44:26 +00:00
oharboe
cfd1227e34 Piotr Esden-Tempski <piotr@esden.net> Corrected olimex_stm32_h103 board config
git-svn-id: svn://svn.berlios.de/openocd/trunk@1460 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-15 15:19:35 +00:00
oharboe
c257228048 Nico Coesel <ncoesel@dealogic.nl> Chip width / bus width bug in cfi driver
git-svn-id: svn://svn.berlios.de/openocd/trunk@1459 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-15 15:17:44 +00:00
oharboe
0bc7d2c692 Freddie Chopin <freddie_chopin@op.pl> LPC2378 config file
git-svn-id: svn://svn.berlios.de/openocd/trunk@1458 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-15 15:13:36 +00:00
oharboe
1552562b3a Dick Hollenbeck <dick@softplc.com> work in progress
git-svn-id: svn://svn.berlios.de/openocd/trunk@1457 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-14 19:17:17 +00:00
mlu
ba4e2c43fb Improved (for humans) error reporting for flash programming errors.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1456 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-14 17:17:38 +00:00
mlu
699d246b1c Solve problem with single stepping.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1455 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-14 16:33:52 +00:00
ntfreak
aed582e422 - add openocd coding style to texi
git-svn-id: svn://svn.berlios.de/openocd/trunk@1454 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-03 12:55:25 +00:00
mlu
47a81338a5 Slight improvement in run_algorithm register restore.
More debug info for cortex swjdp errors.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1453 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-03 10:10:12 +00:00
ntfreak
9646f21ad8 - add svn props from previous commit
git-svn-id: svn://svn.berlios.de/openocd/trunk@1452 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-03 08:16:47 +00:00
oharboe
3723558cbd Uwe Hermann <uwe@hermann-uwe.de> oocdlink file
git-svn-id: svn://svn.berlios.de/openocd/trunk@1451 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-03 05:36:54 +00:00
oharboe
d94163afc7 Piotr Esden-Tempski <piotr@esden.net> added a board file for the Olimex STM32-H103 eval board.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1450 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-03 05:36:00 +00:00
oharboe
8813a9ec16 Freddie Chopin <freddie_chopin@op.pl> I attach a config file for LPC2103
git-svn-id: svn://svn.berlios.de/openocd/trunk@1449 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-03 05:33:42 +00:00
oharboe
ffb73fe1d6 Nicolas Pitre nico at cam.org list the new flag in the "nand write" help line.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1448 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-03 05:32:28 +00:00
oharboe
bf41e298c5 Nicolas Pitre nico at cam.org write ECC data when reflashing u-Boot on the SheevaPlug
git-svn-id: svn://svn.berlios.de/openocd/trunk@1447 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-02 21:24:56 +00:00
oharboe
3725fded17 Nicolas Pitre nico at cam.org The ECC data is automatically computed and written to the OOB area
when the oob_softecc option is passed to the "nand write" command.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1446 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-02 21:24:08 +00:00
oharboe
c3d96a3a6e Nicolas Pitre nico at cam.org software ECC computation for NAND flash
git-svn-id: svn://svn.berlios.de/openocd/trunk@1445 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-02 21:23:16 +00:00
oharboe
f481deb58f Nicolas Pitre nico at cam.org software ECC computation for NAND flash
git-svn-id: svn://svn.berlios.de/openocd/trunk@1444 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-02 21:23:05 +00:00
oharboe
3f427b90e0 Nicolas Pitre nico at cam.org This at least should make the "nand info" command a little more useful.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1443 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-02 21:22:14 +00:00
oharboe
9a6c3cc87f Nicolas Pitre nico at cam.org Allocating a 6-byte memory location with malloc() is rather silly
when this can be allocated on the stack.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1442 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-02 21:20:35 +00:00
oharboe
25047d4980 Uwe Hermann <uwe@hermann-uwe.de> Add missing STM32 "0x06412041, Revision A" BSTAPID to list of available ones.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1441 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-02 21:17:27 +00:00
oharboe
1262735a0c Uwe Hermann <uwe@hermann-uwe.de> URL references
git-svn-id: svn://svn.berlios.de/openocd/trunk@1439 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-02 17:44:28 +00:00
mlu
c008618be9 Cortex-M3 cleanup and performance patch
git-svn-id: svn://svn.berlios.de/openocd/trunk@1438 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-02 12:16:19 +00:00
oharboe
923293928a fix keyword expansion
git-svn-id: svn://svn.berlios.de/openocd/trunk@1437 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-02 10:22:22 +00:00
oharboe
2b05549d59 zy1000 1.50 snapshot. fix problem with empty file names.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1436 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-02 10:17:36 +00:00
ntfreak
231b882022 - add missing usbprog config. patch from Uwe Hermann
https://lists.berlios.de/pipermail/openocd-development/2009-March/005145.html

git-svn-id: svn://svn.berlios.de/openocd/trunk@1435 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-03-30 19:52:30 +00:00
oharboe
03caa01ae5 a few words about motivation for standalone JTAG debugger.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1434 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-03-30 13:35:38 +00:00
ntfreak
d2189fdfe6 - fix typo's in last commit
git-svn-id: svn://svn.berlios.de/openocd/trunk@1433 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-03-24 12:09:54 +00:00
oharboe
f7f37ea289 Hiroshi Ito <ito@mlb.co.jp> Linux for arm has arm generic debug option which send debug messages via
DCC channel.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1432 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-03-24 11:27:49 +00:00
ntfreak
9d3d3297ae - update str9 and stm32 comstick configs
- add missing svn props

git-svn-id: svn://svn.berlios.de/openocd/trunk@1431 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-03-24 09:40:03 +00:00
oharboe
8a7a9bd17a Hiroshi Ito <ito@mlb.co.jp> disassemble Arm926ejs clz instruction
git-svn-id: svn://svn.berlios.de/openocd/trunk@1430 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-03-24 07:44:47 +00:00
oharboe
ea4b83332e Uwe Hermann <uwe@hermann-uwe.de> Add new board configs: Olimex LPC-H2148, Keil MCB2140.
Both boards use an LPC2148, no external flash or RAM.

git-svn-id: svn://svn.berlios.de/openocd/trunk@1429 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-03-24 06:24:23 +00:00
oharboe
4729bae363 Uwe Hermann <uwe@hermann-uwe.de> spelling fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@1428 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-03-24 06:23:00 +00:00
oharboe
bda849d033 Uwe Hermann <uwe@hermann-uwe.de> eal _CPUTAPID entry for the LPC2148. I don't know
if they're the same for all LPC214x, this number is from an Olimex
LPC-H2148. The chip on that board is LPC2148FBD64.

Also fix a few cosmetic issues and comments in the file and add
more docs and pointers to the datasheet.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1427 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-03-23 19:12:42 +00:00
oharboe
0cfcd0bc9b Uwe Hermann <uwe@hermann-uwe.de>
- Explicitly mention autoconf >= 2.59 as requirement (as per
  configure.in). Also automake >= 1.9 (though I'm not sure which
  if that's really the minimum requirement).

 - Document various missing configure options.

 - Fix various typos and inconsistencies.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1426 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-03-23 07:43:46 +00:00
oharboe
2b8aa1d058 Uwe Hermann <uwe@hermann-uwe.de> typo
git-svn-id: svn://svn.berlios.de/openocd/trunk@1425 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-03-23 07:38:38 +00:00
ntfreak
ec0303be34 - fix another typo in str9comstick.cfg
git-svn-id: svn://svn.berlios.de/openocd/trunk@1424 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-03-20 14:30:41 +00:00
ntfreak
8b7cd9322a - add missing svn props from previous commit
git-svn-id: svn://svn.berlios.de/openocd/trunk@1423 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-03-20 14:08:03 +00:00
ntfreak
39423e9856 - docs patch from Thomas Kindler
git-svn-id: svn://svn.berlios.de/openocd/trunk@1422 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-03-20 13:27:02 +00:00
oharboe
1297f6750d Alan Carvalho de Assis <acassis@gmail.com> adds support to i.MX35 processor.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1421 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-03-20 12:32:17 +00:00
ntfreak
0b26e59b01 - revert texi changes from rev 1418 as it breaks build
- original patch will be reviewed before next commit

git-svn-id: svn://svn.berlios.de/openocd/trunk@1420 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-03-20 10:29:12 +00:00
ntfreak
5af8bc1ac4 - fix incorrect str9comstick cfg
git-svn-id: svn://svn.berlios.de/openocd/trunk@1419 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-03-19 22:27:43 +00:00
oharboe
af6d1db2fb Thomas Kindler <mail+ocd@t-kindler.de> typos
git-svn-id: svn://svn.berlios.de/openocd/trunk@1418 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-03-19 15:51:28 +00:00
oharboe
9f2a76e7b6 Hiroshi Ito <ito@mlb.co.jp> typos
git-svn-id: svn://svn.berlios.de/openocd/trunk@1417 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-03-18 11:59:31 +00:00
oharboe
cf10427caa Hiroshi Ito <ito@mlb.co.jp> fix division by 0
git-svn-id: svn://svn.berlios.de/openocd/trunk@1416 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-03-18 11:43:09 +00:00
ntfreak
c13924e32c - remove build warnings
git-svn-id: svn://svn.berlios.de/openocd/trunk@1415 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-03-17 10:22:26 +00:00
ntfreak
ae62743a4c - fix incorrect stm32stick.cfg
git-svn-id: svn://svn.berlios.de/openocd/trunk@1414 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-03-17 09:48:46 +00:00
ntfreak
8ea1bc666d - fix issue with cortex_m3 reset run. Thanks Perry Hung
- https://lists.berlios.de/pipermail/openocd-development/2009-March/005028.html

git-svn-id: svn://svn.berlios.de/openocd/trunk@1413 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-03-16 22:42:29 +00:00
oharboe
90815705d7 Uwe Hermann <uwe@hermann-uwe.de> clean out stuff that doesn't belong in interface(telnet/gdb port).
git-svn-id: svn://svn.berlios.de/openocd/trunk@1412 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-03-14 18:39:05 +00:00
oharboe
cbc1f23758 Uwe Hermann <uwe@hermann-uwe.de> typos
git-svn-id: svn://svn.berlios.de/openocd/trunk@1411 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-03-12 14:48:51 +00:00
ntfreak
96413087dc - add support for standalone rlink
https://lists.berlios.de/pipermail/openocd-development/2009-March/004965.html

git-svn-id: svn://svn.berlios.de/openocd/trunk@1410 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-03-11 22:42:35 +00:00
duane
e841dfc149 Added eol-style props
git-svn-id: svn://svn.berlios.de/openocd/trunk@1409 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-03-11 01:53:23 +00:00
duane
f593dad542 Commit OMAP3530 and TI_BEAGLEBOARD config files from Kees, Dick, Derk, and others
git-svn-id: svn://svn.berlios.de/openocd/trunk@1408 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-03-11 01:48:54 +00:00
duane
9833ef8580 Added -endstate to irscan and drscan to support beagleboard (omap3530)
git-svn-id: svn://svn.berlios.de/openocd/trunk@1407 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-03-11 01:42:05 +00:00
ntfreak
7f1b58a5cd - fix small typo in texi (section HostOS)
git-svn-id: svn://svn.berlios.de/openocd/trunk@1406 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-03-09 21:04:33 +00:00
ntfreak
a861624233 - add svn props from previous commit
git-svn-id: svn://svn.berlios.de/openocd/trunk@1405 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-03-08 21:19:36 +00:00
duane
fb59d0fa55 Commands: reg, profile, ocd_mem2array, ocd_array2mem, fast_load, etc only work *IF* there is an actual target
git-svn-id: svn://svn.berlios.de/openocd/trunk@1404 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-03-08 21:14:35 +00:00
duane
b28d1cf0e4 Added VID/PID pair to olimex-jtag-tiny-a the non-a version already has the vid pid
git-svn-id: svn://svn.berlios.de/openocd/trunk@1403 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-03-08 20:29:54 +00:00
duane
e211e4c6d2 Patch from Dimitar Dimitrov adding support for Olimex ARM-JTAG-EW
git-svn-id: svn://svn.berlios.de/openocd/trunk@1402 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-03-08 15:14:18 +00:00
duane
0a85c3426b Accept/create both A and Non-A ft2232 based descriptions
git-svn-id: svn://svn.berlios.de/openocd/trunk@1401 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-03-07 15:51:26 +00:00
duane
7a731eb637 Added HostOS variable
git-svn-id: svn://svn.berlios.de/openocd/trunk@1400 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-03-07 15:19:21 +00:00
oharboe
0f3c9f8f06 Audrius Urmanavičius <didele.deze@gmail.com> cleanup flash fill
git-svn-id: svn://svn.berlios.de/openocd/trunk@1399 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-03-05 07:41:04 +00:00
oharboe
86c0f4cafc Nicolas Pitre <nico@cam.org> fix "halt 0" to only halt and not to poll/wait afterwards. This follows the intention in the docs.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1398 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-03-05 06:55:35 +00:00
oharboe
a8bd749d4e Nicolas Pitre <nico@cam.org> making reset+halt on the
SheevaPlug 100% reliable (needs patch in target.c to fix "halt 0").

git-svn-id: svn://svn.berlios.de/openocd/trunk@1397 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-03-04 21:28:50 +00:00
oharboe
8d772cad7a test code for elf parsing.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1396 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-03-03 12:05:49 +00:00
ntfreak
2f184a5008 - add missing svn props from previous commit
git-svn-id: svn://svn.berlios.de/openocd/trunk@1395 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-03-02 12:51:42 +00:00
oharboe
623100d59d Daniel Gimpelevich <daniel@gimpelevich.san-francisco.ca.us> Cosmetic OpenOCD patch for Flyswatter
git-svn-id: svn://svn.berlios.de/openocd/trunk@1394 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-03-01 21:07:44 +00:00
oharboe
260daf9d59 Kees Jongenburger <kees.jongenburger@gmail.com> rename description field of the jtag-tiny.cfg
git-svn-id: svn://svn.berlios.de/openocd/trunk@1393 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-03-01 21:06:06 +00:00
oharboe
6853abeb90 Nicolas Pitre nico at cam.org fix feroceon_bulk_write_memory() wrt uploaded code
git-svn-id: svn://svn.berlios.de/openocd/trunk@1392 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-03-01 21:04:00 +00:00
oharboe
9f1ba4b34b Nicolas Pitre nico at cam.org SheevaPlug board configuration
git-svn-id: svn://svn.berlios.de/openocd/trunk@1391 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-03-01 21:02:13 +00:00
oharboe
3822831792 Nicolas Pitre nico at cam.org add ft2232 layout for the Marvell SheevaPlug
git-svn-id: svn://svn.berlios.de/openocd/trunk@1390 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-03-01 21:01:11 +00:00
oharboe
f8c97a5d2e Nicolas Pitre nico at cam.org add Feroceon target config file
git-svn-id: svn://svn.berlios.de/openocd/trunk@1389 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-03-01 21:00:07 +00:00
oharboe
19ce96746d Nicolas Pitre nico at cam.org support for NAND flash used with Marvell Orion and Kirkwood SOCs
git-svn-id: svn://svn.berlios.de/openocd/trunk@1388 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-03-01 20:59:06 +00:00
oharboe
10edfff05a Nicolas Pitre nico at cam.org support for NAND controllers without explicit busy signal
git-svn-id: svn://svn.berlios.de/openocd/trunk@1387 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-03-01 20:57:34 +00:00
oharboe
2e8f1911d6 Nicolas Pitre nico at cam.org don't ignore bad options passed to the "nand write" command
git-svn-id: svn://svn.berlios.de/openocd/trunk@1386 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-03-01 20:56:18 +00:00
oharboe
857e9cb076 Nicolas Pitre nico at cam.org The code unconditionally writes into the oob area all the time.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1385 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-03-01 20:54:22 +00:00
oharboe
630af1be56 Nicolas Pitre nico at cam.org spelling
git-svn-id: svn://svn.berlios.de/openocd/trunk@1384 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-03-01 20:53:17 +00:00
ntfreak
58f4bd4a3c - stm32x flash driver - add support for stm32105/107 (connectivity line)
git-svn-id: svn://svn.berlios.de/openocd/trunk@1383 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-02-26 10:06:00 +00:00
oharboe
6874a83fed test files for stm32
git-svn-id: svn://svn.berlios.de/openocd/trunk@1382 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-02-24 06:38:04 +00:00
oharboe
39d80bad9b tinkered a bit with performance for Cortex flash programming. Mainly make it easier to profile as a start.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1380 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-02-23 21:26:11 +00:00
oharboe
ba9d608df3 Sergey Lapin <slapinid@gmail.com> fix typo
git-svn-id: svn://svn.berlios.de/openocd/trunk@1379 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-02-23 06:30:15 +00:00
oharboe
bde750291a John Woods <johnrw@gmail.com> fix newtap gaffe + rename
git-svn-id: svn://svn.berlios.de/openocd/trunk@1378 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-02-22 17:01:16 +00:00
oharboe
bb0d7ab12a John Woods <johnrw@gmail.com> fix checks for addresses at upper end of the universe
git-svn-id: svn://svn.berlios.de/openocd/trunk@1377 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-02-19 18:52:46 +00:00
oharboe
4d3b6e4163 Holger Schurig <hs4233@mail.mn-solutions.de> incorporate some comments from Rick
git-svn-id: svn://svn.berlios.de/openocd/trunk@1376 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-02-18 09:09:11 +00:00
oharboe
b7593457bc Holger Schurig <hs4233@mail.mn-solutions.de> fix warnings
git-svn-id: svn://svn.berlios.de/openocd/trunk@1375 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-02-18 07:39:20 +00:00
oharboe
2136238908 zy1000 1.49 snapshot
git-svn-id: svn://svn.berlios.de/openocd/trunk@1374 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-02-17 11:54:30 +00:00
oharboe
3fb2c6a6dd zy1000 1.49 snapshot
git-svn-id: svn://svn.berlios.de/openocd/trunk@1373 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-02-17 09:28:39 +00:00
ntfreak
ca8c6cf430 - guess-rev.sh now works as expected when build_dir is not the same as src_dir
git-svn-id: svn://svn.berlios.de/openocd/trunk@1372 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-02-13 09:56:51 +00:00
ntfreak
2e160c6bad - issue warning when flash image exceeds configured flash size.
- see https://lists.berlios.de/pipermail/openocd-development/2009-February/004680.html

git-svn-id: svn://svn.berlios.de/openocd/trunk@1371 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-02-12 15:35:03 +00:00
kc8apf
e77ae9096a Use C89/C99/C++ compliant boolean types
git-svn-id: svn://svn.berlios.de/openocd/trunk@1370 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-02-10 18:21:17 +00:00
kc8apf
725749de20 A few more usages of TRUE and FALSE to remove
git-svn-id: svn://svn.berlios.de/openocd/trunk@1369 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-02-10 16:11:07 +00:00
ntfreak
5a90a66aa3 - fix native win32 build issues
git-svn-id: svn://svn.berlios.de/openocd/trunk@1368 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-02-09 14:47:34 +00:00
oharboe
6d06c893d1 Andi <opencode@gmx.net> - better dram setup
git-svn-id: svn://svn.berlios.de/openocd/trunk@1367 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-02-09 10:01:09 +00:00
kc8apf
ab9dfffdb5 - Cable driver helper API courtesy of Dick Hollenbeck <dick@softplc.com>
- Formatting changes from uncrustify


git-svn-id: svn://svn.berlios.de/openocd/trunk@1366 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-02-03 05:59:17 +00:00
kc8apf
6c0e48248a Doxygen config file
git-svn-id: svn://svn.berlios.de/openocd/trunk@1365 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-02-03 04:30:33 +00:00
kc8apf
6c39552316 Add uncrustify config file and helper script
git-svn-id: svn://svn.berlios.de/openocd/trunk@1364 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-02-03 04:27:48 +00:00
oharboe
ce1a29725f chain position is now required when creating a target
git-svn-id: svn://svn.berlios.de/openocd/trunk@1363 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-01-28 13:08:06 +00:00
oharboe
51f8b70904 update symbols to match source file
git-svn-id: svn://svn.berlios.de/openocd/trunk@1362 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-01-26 07:38:08 +00:00
ntfreak
64e53c4fd8 - AC_CHECK_FILE not supported when cross-compiling
git-svn-id: svn://svn.berlios.de/openocd/trunk@1361 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-01-23 12:07:15 +00:00
kc8apf
d5209daeb1 xvsf player fixes by Dick Hollenbeck <dick@softplc.com>
git-svn-id: svn://svn.berlios.de/openocd/trunk@1360 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-01-23 07:10:11 +00:00
kc8apf
6f612fb959 Fixes for svf player by Simon Qian <simonqian@SimonQian.com>
git-svn-id: svn://svn.berlios.de/openocd/trunk@1359 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-01-23 07:08:18 +00:00
kc8apf
a79adf1383 Search path fixes for MinGW builds. Courtesy of Dimitar Dimitrov <dinuxbg@gmail.com>
git-svn-id: svn://svn.berlios.de/openocd/trunk@1358 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-01-23 07:07:02 +00:00
kc8apf
4dcad08940 Add TRST support to xsvf tools. Courtesy of Dick Hollenbeck <dick@softplc.com>
git-svn-id: svn://svn.berlios.de/openocd/trunk@1357 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-01-23 07:05:04 +00:00
kc8apf
44a7b25487 vsllink support for stable clocks by Simon Qian <simonqian@SimonQian.com>
git-svn-id: svn://svn.berlios.de/openocd/trunk@1356 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-01-23 07:02:47 +00:00
592 changed files with 97545 additions and 58456 deletions

65
.gitignore vendored Normal file
View File

@@ -0,0 +1,65 @@
# stuff "git status" should ignore
# build output
.libs
.deps
*.o
*.a
*.lo
*.la
*.in
# editor files
*.swp
startup_tcl.c
xscale_debug.h
bin2char
bin2char.exe
doc/openocd.aux
doc/openocd.cp
doc/openocd.cps
doc/openocd.fn
doc/openocd.fns
doc/openocd.html
doc/openocd.info
doc/openocd.info-1
doc/openocd.info-2
doc/openocd.ky
doc/openocd.log
doc/openocd.pdf
doc/openocd.pg
doc/openocd.toc
doc/openocd.tp
doc/openocd.vr
doc/texinfo.tex
doc/version.texi
src/openocd
src/openocd.exe
# configure/autotools output
aclocal.m4
autom4te.cache
compile
config.*
configure
depcomp
doxygen
doxygen.log
Doxyfile
install-sh
libtool
ltmain.sh
Makefile
mdate-sh
missing
stamp-h1
stamp-vti
INSTALL
NOTES
# Eclipse stuff
.project

3
.gitmodules vendored Normal file
View File

@@ -0,0 +1,3 @@
[submodule "tools/git2cl"]
path = tools/git2cl
url = git://repo.or.cz/git2cl.git

View File

@@ -5,3 +5,8 @@ Spencer Oliver <spen@spen-soft.co.uk>
Carsten Schlote <schlote@vahanus.net>
Øyvind Harboe <oyvind.harboe@zylin.com>
Duane Ellis <openocd@duaneellis.com>
Michael Schwingen <michael@schwingen.org>
Rick Altherr <kc8apf@users.berlios.de>
David Brownell <dbrownell@users.sourceforge.net>
Vincint Palatin <vpalatin@users.berlios.de>
Zachary T Welch <zw@superlucidity.net>

10
AUTHORS.ChangeLog Normal file
View File

@@ -0,0 +1,10 @@
drath:Dominic Rath <Dominic.Rath@gmx.de>
mlu:Magnus Lundin <lundin@mlu.mine.nu>
mifi:Michael Fischer <fischermi@t-online.de>
ntfreak:Spencer Oliver <spen@spen-soft.co.uk>
duane:Duane Ellis <openocd@duaneellis.com>
oharboe:Øyvind Harboe <oyvind.harboe@zylin.com>
kc8apf:Rick Altherr <kc8apf@users.berlios.de>
zwelch:Zachary T Welch <zw@superlucidity.net>
vpalatin:Vincent Palatin <vpalatin@users.berlios.de>
bodylove:Carsten Schlote <schlote@vahanus.net>

71
BUGS
View File

@@ -1,34 +1,67 @@
Please report bugs by posting a message to
// This file is part of the Doyxgen Developer Manual
/** @page bugs Bug Reporting
openocd-development@lists.berlios.de.
Please report bugs by subscribing to the OpenOCD mailing list and
posting a message with your report:
To minimize work for OpenOCD developers, you can include
all the information below. If you feel that some of the
items below are unecessary for a clear bug report, you
leave them out.
openocd-development@lists.berlios.de
To minimize work for OpenOCD developers, you should try to include
all of the information listed below. If you feel that some of the
items below are unnecessary for a clear bug report, you may leave
them out; likewise, feel free to include additional information
that may be important.
- Target PCB/board description
- Config scripts
- Configuration scripts
- OpenOCD command line
- List of commands issued or GDB operations performed
- Expected result
- Actual result
- debug_level 3 logs
- If this is a regression, include logs for working and broken
version
- If this is a regression, please find out the precise version
that caused the regression. This can be done via a binary
search. E.g. if version 550 worked and 600 failed, then try
575, etc.
- Logs using <code>debug_level 3</code> (or with '-d 3' on the command line)
- If the report is for a regression:
- Include logs for both working and broken versions.
- Find the precise version that caused the regression by binary search.
You can use "git bisect" to expedite this binary search.
- If OpenOCD is crashing, you can use GDB to get a trace:
If possible, please develop and attach a patch that helps to expose or
solve the reported problem. See the PATCHES file for more information
for that process.
gdb --args openocd ....
Attach all files directly to your posting. The mailing list knows to
transform attachments to links, but attachments must be less than 300KB
in total.
@section bugscrashdump Obtaining Crash Backtraces
If OpenOCD is crashing, there are two very effective things you can do to
improve your chances of getting help on the development mailing list.
Try to reproduce the problem using the dummy JTAG interface to allow other developers to replicate
your problem robustly and use GDB to get a trace:@par
@code
% OPENOCDSRC/configure --enable-dummy ...
% openocd -f interface/dummy.cfg -f target/xxx.cfg
=> SEGFAULT
% gdb --args openocd ....
(gdb) run
(gdb) bt
=> here a stack trace is dumped.
@endcode
attach files directly to the posting. The mailing list knows to
transform attachments to links so you will not be bloating anyones
mail box. Keep attachments to <100kBytes.
@section bugsintreedebug Running and Debugging In-Tree
To run or debug the in-tree executable (not recommended), you must
use libtool to set up the correct shared library paths:
@code
libtool gdb --args openocd ....
@endcode
or the more pedantic (and forward-compatible):
@code
libtool --mode=execute gdb --args openocd ....
@endcode
*/
/** @file
This file contains the @ref bugs page.
*/

1517
Doxyfile.in Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1 +0,0 @@
openocd.texi is the authoritative source of OpenOCD documentation

View File

@@ -1,6 +1,6 @@
# not a GNU package. You can remove this line, if
# have all needed files, that a GNU package needs
AUTOMAKE_OPTIONS = foreign 1.4
AUTOMAKE_OPTIONS = gnu 1.6
nobase_dist_pkgdata_DATA = \
contrib/libdcc/dcc_stdio.c \
@@ -11,13 +11,66 @@ nobase_dist_pkgdata_DATA = \
SUBDIRS = src doc
EXTRA_DIST = \
Doxyfile.in \
tools/logger.pl
libtool: $(LIBTOOL_DEPS)
$(SHELL) ./config.status --recheck
docs: pdf html doxygen
Doxyfile: $(srcdir)/Doxyfile.in
@echo "Creating $@ from $<..."
@( \
echo "### @@@ -= DO NOT EDIT THIS FILE =- @@@ ###" && \
echo "### @@@ Make changes to Doxyfile.in @@@ ###" && \
sed -e 's,@srcdir\@,$(srcdir),' $< \
) > $@
doxygen::
$(MAKE) Doxyfile
doxygen Doxyfile 2>&1 | perl $(srcdir)/tools/logger.pl > doxygen.log
TCL_PATH = tcl
# command to find paths of script files, relative to TCL_PATH
TCL_FILES = find $(srcdir)/$(TCL_PATH) -name '*.cfg' -o -name '*.tcl' | \
sed -e 's,^$(srcdir)/$(TCL_PATH),,'
dist-hook:
for i in $$($(TCL_FILES)); do \
j="$(distdir)/$(TCL_PATH)/$$i" && \
mkdir -p "$$(dirname $$j)" && \
$(INSTALL_DATA) $(srcdir)/$(TCL_PATH)/$$i $$j; \
done
install-data-hook:
for i in $$($(TCL_FILES)); do \
j="$(DESTDIR)$(pkgdatadir)/scripts/$$i" && \
mkdir -p "$$(dirname $$j)" && \
$(INSTALL_DATA) $(srcdir)/$(TCL_PATH)/$$i $$j; \
done
uninstall-hook:
rm -rf $(DESTDIR)$(pkgdatadir)/scripts
distclean-local:
rm -rf Doxyfile doxygen
DISTCLEANFILES = doxygen.log
MAINTAINERCLEANFILES = \
configure \
Makefile.in \
depcomp \
config.guess \
config.sub \
config.h.in \
missing \
aclocal.m4 \
install-sh
$(srcdir)/INSTALL \
$(srcdir)/configure \
$(srcdir)/Makefile.in \
$(srcdir)/depcomp \
$(srcdir)/config.guess \
$(srcdir)/config.sub \
$(srcdir)/config.h.in \
$(srcdir)/config.h.in~ \
$(srcdir)/compile \
$(srcdir)/ltmain.sh \
$(srcdir)/missing \
$(srcdir)/aclocal.m4 \
$(srcdir)/install-sh

59
NEWS
View File

@@ -1 +1,58 @@
This document is not in use. See mailing list - https://lists.berlios.de/pipermail/openocd-development
This file should include highlights of the changes made in the
OpenOCD openocd-0.3.0 source archive release. See the repository
history for details about what changed, including bugfixes and
other issues not mentioned here.
JTAG Layer:
FT2232H (high speed USB) support doesn't need separate configuration
New reset_config options for SRST gating the JTAG clock (or not)
TAP declaration no longer requires ircapture and mask attributes
New "post-reset" event handler for TAP-invariant setup code
Overridable Tcl "init_reset" and "jtag_init" procedures
Target Layer:
New commands for use with Cortex-M3 processors:
"cortex_m3 disassemble" ... Thumb2 disassembly (UAL format)
"cortex_m3 vector_catch" ... traps certain hardware faults
without tying up breakpoint resources
If you're willing to help debug it
VERY EARLY Cortex-A8 and ARMv7A support
Updated BeagleBoard.org hardware support
New commands for use with XScale processors: "xscale vector_table"
ARM9
name change: "arm9 vector_catch" not "arm9tdmi vector_catch"
ARM11
single stepping support for i.MX31
bugfix for missing "arm11" prefix on "arm11 memwrite ..."
ETM support
Unavailable registers are not listed
Flash Layer:
The lpc2000 driver handles the new NXP LPC1700 (Cortex-M3) chips
New lpc2900 driver for NXP LPC2900 chips (ARM968 based)
New "last" flag for NOR "flash erase_sector" and "flash protect"
The "nand erase N" command now erases all of bank N
Board, Target, and Interface Configuration Scripts:
Amontec JTAGkey2 support
Cleanup and additions for the TI/Luminary Stellaris scripts
LPC1768 target (and flash) support
Keil MCB1700 eval board
Samsung s3c2450
Mini2440 board
Numeric TAP and Target identifiers now trigger warnings
PXA255 partially enumerates
Documentation:
Capture more debugging and setup advice
Notes on target source code changes that may help debugging
Build and Release:
For more details about what has changed since the last release,
see the ChangeLog associated with this source archive. For older NEWS,
see the NEWS files associated with each release (i.e. NEWS-<version>).
For more information about contributing test reports, bug fixes, or new
features and device support, please read the new Developer Manual (or
the BUGS and PATCHES files in the source archive).

80
NEWS-0.2.0 Normal file
View File

@@ -0,0 +1,80 @@
The OpenOCD 0.2.0 source archive release includes numerous improvements
that were made since the initial 0.1.0 source archive release. Many
contributors helped make this release a great success, and the community
of developers and maintainers look forward to any response.
In addition to the list of changes below, countless bug fixing and
cleaning was performed across the tree. Various TCL command parameters
must past stricter value checks, and many more error conditions have
been handled correctly. These efforts helped to make the 0.2.0 release
more stable and robust, though some changes may expose latent bugs in
your existing configuration scripts.
This release does not maintain backward compatibility in all respects,
so some target or configuration scripts may need to be updated. In some
cases, you may also see warnings; resolve those, because they indicate
commands that will be removed in the future.
The following areas of OpenOCD functionality changed in this release:
JTAG Layer:
- Improves modularity: core, TCL, driver commands, and interface have
been separated, encapsulated, and documented for developers. Mostly.
- Improves JTAG TAP transition tables:
* Makes TAP paths variable length, rather than being fixed at 7 steps.
* Fixes problems with some targets that did not like longer paths.
- Improves JTAG driver/minidriver modularity and encapsulation.
- New drivers:
* Adds stub minidriver for developing new embedded JTAG interfaces.
- Improves drivers:
* ft2232+ftd2xx:
+ Adds initial high-speed device support: --enable-ftd2xx-highspeed
+ Supports more types of FTDI-based devices.
* jlink:
+ Works with more versions of the firmware (v3 and newer)
+ Supports dynamically detects device capabilities and limits
* vsllink:
+ Supports very long scan chains
* amtjtagaccel:
+ Fixes broken ID code detection problems.
Target Layer:
- New devices: AVR, FA526
- Improved support: ARM ADI, ARM11, MIPS
- Numerous other bug fixes and improvements
Flash Layer:
- Improved drivers: mflash
- New drivers: AT91SAM3, AVR, Davinci NAND
Board, Interface, and Target Configuration Scripts:
- Many new and improved targets and boards are now available.
- Better separation of "board" and "target" configuration
- Moved all TCL files to top-level "tcl" directory in the source tree
- Installation moved from '$pkglibdir/' to '$pkgdatadir/scripts/'.
- Site-specific files should be installed under '$pkgdatadir/site/';
files that exist this tree will be used in preference to default
distribution configurations in '$pkgdatadir/scripts/'.
Documentation:
- Updated User Guide: http://openocd.berlios.de/doc/html/index.html
* Partially re-written and re-organized.
* Standardized presentation for all commands.
* Covers many drivers and commands that were previously omitted.
* New index for commands and drivers.
- Added Developer Manual: http://openocd.berlios.de/doc/doxygen/index.html
* Now includes architecture, technical primers, style guides, and more.
* Available in-tree and on-line.
Build and Release:
- Increased configuration and compilation warning coverage.
* Use --disable-werror to work around build errors caused by warnings.
- Use libtool to produce helper libraries as a step toward "libopenocd".
- New processes and scripting to facilitate future source releases.
For more details about what has changed since 0.1.0, see the ChangeLog
associated with this release.
For more information about contributing test reports, bug fixes, or new
features and device support, please read the new Developer Manual (or
the BUGS and PATCHES files in the source archive).

75
PATCHES
View File

@@ -1,28 +1,47 @@
Please mail patches to:
openocd-development@lists.berlios.de
The patch should be against svn trunk using an SVN
diff.
Attach the patch to the email as a .txt file and
also write a short change log entry that maintainers
can copy and paste into the commit message
Add yourself to the GPL copyright for non-trivial changes.
To create a patch from the command line:
svn diff >mypatch.txt
http://svnbook.red-bean.com/en/1.0/re09.html
NB! remember to use "svn add" on new files first!
http://svnbook.red-bean.com/en/1.0/re01.html
If you have a decent SVN GUI, then that should be
able to create and apply patches as well...
// This file is part of the Doyxgen Developer Manual
/** @page patchguide Patch Guidelines
Please mail patches to: @par
openocd-development@lists.berlios.de
Note that you can't send patches to that list unless
you're a member, despite what the list info page says.
@section Patch Guidelines in a Nutshell
Your patches should be against git mainline. Submit output
of "git diff"; equivalently, quilt patches are OK.
It should be a "good patch": focus it on a single
issue, and make it be easily reviewable. Don't make
it so large that it's hard to review; split large
patches into smaller ones. (That can also help
track down bugs later on.) All patches should
be "clean", which includes preserving the existing
coding style and updating documentation as needed.j
Attach the patch to the email as a .txt file and
also write a short change log entry that maintainers
can copy and paste into the commit message
Say if it's a bugfix (describe the bug) or a new
feature. Don't expect patches to merge immediately
for the next release. Be ready to rework patches
in response to feedback.
Add yourself to the GPL copyright for non-trivial changes.
To create a patch from the command line:
@code
git diff >mypatch.txt
@endcode
@section More Information on Patching
The @ref primerpatches provides a more complete guide to creating,
managing, and contributing patches to the OpenOCD project.
*/
/** @file
This file contains the @ref patchguide page.
*/

422
README
View File

@@ -1,2 +1,422 @@
openocd.texi is the authoritative source of OpenOCD documentation
Welcome to OpenOCD!
===================
OpenOCD provides on-chip programming and debugging support with a
layered architecture of JTAG interface and TAP support, debug target
support (e.g. ARM, MIPS), and flash chip drivers (e.g. CFI, NAND, etc.).
Several network interfaces are available for interactiving with OpenOCD:
HTTP, telnet, TCL, and GDB. The GDB server enables OpenOCD to function
as a "remote target" for source-level debugging of embedded systems
using the GNU GDB program.
This README file contains an overview of the following topics:
- how to find and build more OpenOCD documentation,
- the build process
- packaging tips.
- configuration options
=====================
OpenOCD Documentation
=====================
In addition to in-tree documentation, the latest documentation may be
viewed on-line at the following URLs:
OpenOCD User's Guide:
http://openocd.berlios.de/doc/html/index.html
OpenOCD Developer's Manual:
http://openocd.berlios.de/doc/doxygen/index.html
These reflect the latest development versions, so the following section
introduces how to build the complete documentation from the package.
For more information, refer to these documents or contact the developers
by subscribing to the OpenOCD developer mailing list:
openocd-development@lists.berlios.de
Building the OpenOCD Documentation
----------------------------------
The OpenOCD User's Guide can be produced in two different format:
# If PDFVIEWER is set, this creates and views the PDF User Guide.
make pdf && ${PDFVIEWER} doc/openocd.pdf
# If HTMLVIEWER is set, this creates and views the HTML User Guide.
make html && ${HTMLVIEWER} doc/openocd.html/index.html
The OpenOCD Developer Manual contains information about the internal
architecture and other details about the code:
# NB! make sure doxygen is installed, type doxygen --version
make doxygen
# If HTMLVIEWER is set, this views the HTML Doxygen output.
${HTMLVIEWER} doxygen/index.html
The remaining sections describe how to configure the system such that
you can build the in-tree documentation.
==================
Installing OpenOCD
==================
On Linux, you may have permissions problems to address. The best
way to do this is to use the contrib/udev.rules file. It probably
belongs somewhere in /etc/udev/rules.d, but consult your operating
system documentation to be sure. In particular, make sure that it
matches the syntax used by your operating system's version of udev.
A Note to OpenOCD Users
-----------------------
If you would rather be working "with" OpenOCD rather than "on" it, your
operating system or JTAG interface supplier may provide binaries for
you in a convenient-enough package.
Such packages may be more stable than git mainline, where bleeding-edge
development takes place. These "Packagers" produce binary releases of
OpenOCD after the developers produces new "release" versions of the
source code. Previous versions of OpenOCD cannot be used to diagnose
problems with the current release, so users are encouraged to keep in
contact with their distribution package maintainers or interface vendors
to ensure suitable upgrades appear regularly.
Users of these binary versions of OpenOCD must contact their Packager to
ask for support or newer versions of the binaries; the OpenOCD
developers do not support packages directly.
A Note to OpenOCD Packagers
---------------------------
You are a PACKAGER of OpenOCD if you:
- Sell dongles: and include pre-built binaries
- Supply tools: A complete development solution
- Supply IDEs: like Eclipse, or RHIDE, etc.
- Build packages: RPM files, or DEB files for a Linux Distro
As a PACKAGER, you will experience first reports of most issues.
When you fix those problems for your users, your solution may help
prevent hundreds (if not thousands) of other questions from other users.
If something does not work for you, please work to inform the OpenOCD
developers know how to improve the system or documentation to avoid
future problems, and follow-up to help us ensure the issue will be fully
resolved in our future releases.
That said, the OpenOCD developers would also like you to follow a few
suggestions:
- Send patches, including config files, upstream.
- Always build with printer ports enabled.
- Use libftdi + libusb for FT2232 support.
Remember, the FTD2XX library cannot be used in binary distributions, due
to restrictions of the GPL v2.
================
Building OpenOCD
================
The INSTALL file contains generic instructions for running 'configure'
and compiling the OpenOCD source code. That file is provided by default
for all GNU automake packages. If you are not familiar with the GNU
autotools, then you should read those instructions first.
The remainder of this document tries to provide some instructions for
those looking for a quick-install.
OpenOCD Dependencies
--------------------
Presently, GCC is required to build OpenOCD. The developers have begun
to enforce strict code warnings (-Wall, -Werror, -Wextra, and more) and
use C99-specific features: inline functions, named initializers, mixing
declarations with code, and other tricks. While it may be possible to
use other compilers, they must be somewhat modern and could require
extending support to conditionally remove GCC-specific extensions.
Also, you need to install the appropriate driver files, if you want to
build support for a USB or FTDI-based interface:
- ft2232, jlink, rlink, vsllink, usbprog, arm-jtag-ew:
- libusb: required for portable communication with USB dongles
- ft2232 also requires:
- libftdi: http://www.intra2net.com/opensource/ftdi/ *OR*
- ftd2xx: http://www.ftdichip.com/Drivers/D2XX.htm,
or the Amontec version (from http://www.amontec.com), for
easier support of JTAGkey's vendor and product IDs.
Many Linux distributions provide these packages through their automated
installation and update mechanisms; however, some Linux versions include
older versions of libftdi. In particular, using Ubuntu 8.04 has been
problematic, but newer versions of Ubuntu do not have this problem.
Compiling OpenOCD
-----------------
To build OpenOCD (on both Linux and Cygwin), use the following sequence
of commands:
./configure [with some options listed in the next section]
make
make install
The 'configure' step generates the Makefiles required to build OpenOCD,
usually with one or more options provided to it. The first 'make' step
will build OpenOCD and place the final executable in ./src/. The
final (optional) step, ``make install'', places all of the files in the
required location.
Cross-Compiling Options
-----------------------
To cross-compile, you must specify both --build and --host options to
the 'configure' script. For example, you can configure OpenOCD to
cross-compile on a x86 Linux host to run on Windows (MinGW32), you could
use the following configuration options:
./configure --build=i686-pc-linux-gnu --host=i586-mingw32msvc ...
Likewise, the following options allow OpenOCD to be cross-compiled for
an ARM target on the same x86 host:
./configure --build=i686-pc-linux-gnu --host=arm-elf ...
Both must be specified to work around bugs in autoconf.
Scripts for producing ARM cross-compilers can be found on the web with a
little searching. A script to produce an x86 Linux-hosted MinGW32
cross-compiler can be downloaded from the following URL:
http://www.mingw.org/wiki/LinuxCrossMinGW
Configuration Options
---------------------
The configure script takes numerous options, specifying which JTAG
interfaces should be included (among other things). The following list
of options was extracted from the output of './configure --help'. Other
options may be available there:
--enable-maintainer-mode enable make rules and dependencies not useful
(and sometimes confusing) to the casual installer
NOTE: This option is *required* for GIT builds!
It should *not* be used to build a release.
--enable-dummy Enable building the dummy JTAG port driver
--enable-ft2232_libftdi Enable building support for FT2232 based devices
using the libftdi driver, opensource alternate of
FTD2XX
--enable-ft2232_ftd2xx Enable building support for FT2232 based devices
using the FTD2XX driver from ftdichip.com
--enable-gw16012 Enable building support for the Gateworks GW16012
JTAG Programmer
--enable-parport Enable building the pc parallel port driver
--disable-parport-ppdev Disable use of ppdev (/dev/parportN) for parport
(for x86 only)
--enable-parport-giveio Enable use of giveio for parport (for CygWin only)
--enable-presto_libftdi Enable building support for ASIX Presto Programmer
using the libftdi driver
--enable-presto_ftd2xx Enable building support for ASIX Presto Programmer
using the FTD2XX driver
--enable-amtjtagaccel Enable building the Amontec JTAG-Accelerator driver
--enable-arm-jtag-ew Enable building support for the Olimex ARM-JTAG-EW
Programmer
--enable-jlink Enable building support for the Segger J-Link JTAG
Programmer
--enable-rlink Enable building support for the Raisonance RLink
JTAG Programmer
--enable-usbprog Enable building support for the usbprog JTAG
Programmer
--enable-vsllink Enable building support for the Versaloon-Link JTAG
Programmer
--enable-oocd_trace Enable building support for the OpenOCD+trace ETM
capture device
--enable-ep93xx Enable building support for EP93xx based SBCs
--enable-at91rm9200 Enable building support for AT91RM9200 based SBCs
--enable-ecosboard Enable building support for eCos based JTAG debugger
--enable-zy1000 Enable ZY1000 interface
--enable-minidriver-dummy
Enable the dummy minidriver.
--enable-ioutil Enable ioutil functions - useful for standalone
OpenOCD implementations
--enable-httpd Enable builtin httpd server - useful for standalone
OpenOCD implementations
Miscellaneous Configure Options
-------------------------------
The following additional options may also be useful:
--disable-assert turn off assertions
--enable-verbose Enable verbose JTAG I/O messages (for debugging).
--enable-verbose-jtag-io
Enable verbose JTAG I/O messages (for debugging).
--enable-verbose-usb-io Enable verbose USB I/O messages (for debugging)
--enable-verbose-usb-comms
Enable verbose USB communication messages (for
debugging)
--enable-malloc-logging Include free space in logging messages (requires
malloc.h).
--disable-gccwarnings Disable extra gcc warnings during build.
--disable-wextra Disable extra compiler warnings
--disable-werror Do not treat warnings as errors
--disable-option-checking
Ignore unrecognized --enable and --with options.
--disable-dependency-tracking speeds up one-time build
--enable-shared[=PKGS] build shared libraries [default=no]
--enable-static[=PKGS] build static libraries [default=yes]
Parallel Port Dongles
---------------------
If you want to access the parallel port using the PPDEV interface you
have to specify both --enable-parport AND --enable-parport-ppdev, since the
the later option is an option to the parport driver (see
http://forum.sparkfun.com/viewtopic.php?t=3795 for more info).
The same is true for the --enable-parport-giveio option, you
have to use both the --enable-parport AND the --enable-parport-giveio
option if you want to use giveio instead of ioperm parallel port access
method.
FT2232C Based USB Dongles
-------------------------
There are 2 methods of using the FTD2232, either (1) using the
FTDICHIP.COM closed source driver, or (2) the open (and free) driver
libftdi.
Using LIBFTDI
-------------
The libftdi source code can be download from the following website:
http://www.intra2net.com/en/developer/libftdi/download.php
For both Linux and Windows, both libusb and libftdi must be built and
installed. To use the newer FT2232H chips, supporting RTCK and USB high
speed (480 Mbps), you need libftdi version 0.16 or newer. Many Linux
distributions provide suitable packages for these libraries.
For Windows, libftdi is supported with versions 0.14 and later.
With these prerequisites met, configure the libftdi solution like this:
./configure --prefix=/path/for/your/install --enable-ft2232_libftdi
Then type ``make'', and perhaps ``make install''.
Using FTDI's FTD2XX
-------------------
The (closed source) FTDICHIP.COM solution is faster on MS-Windows. That
is the motivation for supporting it even though its licensing restricts
it to non-redistributable OpenOCD binaries, and it is not available for
all operating systems used with OpenOCD. You may, however, build such
copies for personal use.
The FTDICHIP drivers come as either a (win32) ZIP file, or a (Linux)
TAR.GZ file. You must unpack them ``some where'' convient. As of this
writing FTDICHIP does not supply means to install these files "in an
appropriate place."
If your distribution does not package these, there are several
'./configure' options to solve this problem:
--with-ftd2xx-win32-zipdir
Where (CYGWIN/MINGW) the zip file from ftdichip.com
was unpacked <default=search>
--with-ftd2xx-linux-tardir
Where (Linux/Unix) the tar file from ftdichip.com
was unpacked <default=search>
--with-ftd2xx-lib Use static or shared ftd2xx libs on default static
If you are using the FTDICHIP.COM driver, download and unpack the
Windows or Linux FTD2xx drivers from the following location:
http://www.ftdichip.com/Drivers/D2XX.htm
Remember, this library is binary-only, while OpenOCD is licenced
according to GNU GPLv2 without any exceptions. That means that
_distributing_ copies of OpenOCD built with the FTDI code would violate
the OpenOCD licensing terms.
Linux Notes
***********
The Linux tar.gz archive contains a directory named libftd2xx0.4.16
(or similar). Assuming that you have extracted this archive in the same
directory as the OpenOCD package, you could configure with options like
the following:
./configure \
--enable-ft2232_ftd2xx \
--with-ft2xx-linux-tardir=../libftd2xx0.4.16 \
... other options ...
Note that on Linux there is no good reason to use these FTDI binaries;
they are no faster (on Linux) than libftdi, and cause licensing issues.
==========================
Obtaining OpenOCD From GIT
==========================
You can download the current GIT version with a GIT client of your
choice from the main repository:
git://openocd.git.sourceforge.net/gitroot/openocd/openocd
You may prefer to use a mirror:
http://repo.or.cz/r/openocd.git
git://repo.or.cz/openocd.git
Using the GIT command line client, you might use the following command
to set up a local copy of the current repository (make sure there is no
directory called "openocd" in the current directory):
git clone git://openocd.git.sourceforge.net/gitroot/openocd/openocd
Then you can update that at your convenience using
git pull
There is also a gitweb interface, which you can use either to browse
the repository or to downlad arbitrary snapshots using HTTP:
http://openocd.git.sourceforge.net/git/gitweb.cgi?p=openocd/openocd
http://repo.or.cz/w/openocd.git
Snapshots are compressed tarballs of the source tree, about 1.3 MBytes
each at this writing.
Tips For Building From a GIT Repository
---------------------------------------
Building OpenOCD from a repository requires a recent version of the GNU
autotools (autoconf >= 2.59 and automake >= 1.9).
1) Run './bootstrap' to create the 'configure' script and prepare
the build process for your host system.
2) Run './configure --enable-maintainer-mode' with other options.

98
README.Win32 Normal file
View File

@@ -0,0 +1,98 @@
Building OpenOCD for Windows
----------------------------
For building on Windows, you have to use CygWin. Make sure that your
PATH environment variable contains no other locations with Unix utilities
(like UnxUtils). Those tools can't handle the CygWin paths, resulting
in obscure dependency errors. This was an observation gathered from the
logs of one user; please correct us if this is wrong.
The following URL is a good reference if you want to build OpenOCD
under CygWin:
http://forum.sparkfun.com/viewtopic.php?t=11221
Alternatively you can build the Windows binary under Linux using
MinGW cross compiler. The following documents some tips of
using this cross build option.
libusb-win32
------------
You can choose to use the libusb-win32 binary distribution from
its SourceForge page. As of this writing, the latest version
is 0.1.12.2. This is the recommend version to use since it fixed
an issue with USB composite device and this is important for FTDI
based JTAG debuggers.
http://sourceforge.net/projects/libusb-win32/
You need to download the libusb-win32-device-bin-0.1.12.2.tar.gz
package. Extract this file into a temp directory.
Copy the file libusb-win32-device-bin-0.1.12.2\include\usb.h
to your MinGW include directory.
Copy the library libusb-win32-device-bin-0.1.12.2\lib\gcc\libusb.a
to your MinGW library directory.
Take note that different Linux distributions often have different MinGW
installation directory. Some of them also put the library and include
into a separate sys-root directory.
When the libusb-win32 repository is more current than its release code,
you could build that instead.
These are the instruction from the libusb-win32 Makefile:
# If you're cross-compiling and your mingw32 tools are called
# i586-mingw32msvc-gcc and so on, then you can compile libusb-win32
# by running
# make host_prefix=i586-mingw32msvc all
libftdi
-------
The author does not provide Windows binary. You can build it from a
released source tarball or the git tree.
If you are using the git tree, the following are the instructions from
README.mingw. You will need to have the cmake utility installed.
- Edit Toolchain-mingw32.cmake to point to the correct MinGW
installation.
- Create a build directory like "mkdir build-win32", e.g in ../libftdi/
- cd into that directory and run
"cmake -DCMAKE_TOOLCHAIN_FILE=../Toolchain-mingw32.cmake .."
- Copy src/ftdi.h to your MinGW include directory.
- Copy build-win32/src/*.a to your MinGW lib directory.
libftd2xx
---------
The Cygwin/Win32 ZIP file contains a directory named ftd2xx.win32.
After being extracted, the directory does not need further preparation.
Instead, its path must be provided to the --with-ftd2xx-win32-zipdir
configure option, as shown in the next section.
OpenOCD
-------
Now you can build OpenOCD under Linux using MinGW. You need to use
--build and --host configure options.
To use libftdi:
./configure --build=i686-pc-linux-gnu --host=i586-mingw32msvc \
--enable-ft2232_libftdi \
... other options ...
To use ftd2xx:
./configure --build=i686-pc-linux-gnu --host=i586-mingw32msvc \
--enable-ft2232_ftd2xx \
--with-ftd2xx-win32-zipdir=/path/to/libftd2xx-win32 \
... other options ...
If you are using the GIT repository, see the README file for additional
instructions about configuring and building OpenOCD.

337
TODO
View File

@@ -1,2 +1,337 @@
This document is not in use. See mailing list.
// This file is part of the Doyxgen Developer Manual
/** @page tasks Pending and Open Tasks
This page lists pending and open tasks being considered or worked upon
by the OpenOCD community.
@section thelist The List
Most items are open for the taking, but please post to the mailing list
before spending much time working on anything lists here. The community
may have evolved an idea since it was added here.
Feel free to send patches to add or clarify items on this list, too.
@section thelisttcl TCL
This section provides possible things to improve with OpenOCD's TCL support.
- Fix problem with incorrect line numbers reported for a syntax
error in a reset init event.
- organize the TCL configurations:
- provide more directory structure for boards/targets?
- factor configurations into layers (encapsulation and re-use)
- Fix handling of variables between multiple command line "-c" and "-f"
parameters. Currently variables assigned through one such parameter
command/script are unset before the next one is invoked.
- Isolate all TCL command support:
- Pure C CLI implementations using --disable-builtin-tcl.
- Allow developers to build new dongles using OpenOCD's JTAG core.
- At first, provide only low-level JTAG support; target layer and
above rely heavily on scripting event mechanisms.
- Allow full TCL support? add --with-tcl=/path/to/installed/tcl
- Move TCL support out of foo.[ch] and into foo_tcl.[ch] (other ideas?)
- See src/jtag/core.c and src/jtag/tcl.c for an example.
- allow some of these TCL command modules to be dynamically loadable?
@section thelistjtag JTAG
This section list issues that need to be resolved in the JTAG layer.
@subsection thelistjtagcore JTAG Core
The following tasks have been suggested for cleaning up the JTAG layer:
- use tap_set_state everywhere to allow logging TAP state transitions
- Encapsulate cmd_queue_cur_state and related varaible handling.
- add slick 32 bit versions of jtag_add_xxx_scan() that avoids
buf_set_u32() calls and other evidence of poor impedance match between
API and calling code. New API should cut down # of lines in calling
code by 100's and make things clearer. Also potentially be supported
directly in minidriver API for better embedded host performance.
The following tasks have been suggested for adding new core JTAG support:
- Improve autodetection of TAPs by supporting tcl escape procedures that
can configure discovered TAPs based on IDCODE value ... they could:
- Remove guessing for irlen
- Allow non-default irmask/ircapture values
- SPI/UART emulation:
- (ab)use bit-banging JTAG interfaces to emulate SPI/UART
- allow SPI to program flash, MCUs, etc.
@subsection thelistjtaginterfaces JTAG Interfaces
There are some known bugs to fix in JTAG adapter drivers:
- For JTAG_STATEMOVE to TAP_RESET, all drivers must ignore the current
recorded state. The tap_get_state() call won't necessarily return
the correct value, especially at server startup. Fix is easy: in
that case, always issue five clocks with TMS high.
- amt_jtagaccel.c
- arm-jtag-ew.c
- bitbang.c
- bitq.c
- gw16012.c
- jlink.c
- usbprog.c
- vsllink.c
- rlink/rlink.c
- bug: USBprog is broken with new tms sequence; it needs 7-clock cycles.
Fix promised from Peter Denison openwrt at marshadder.org
Workaround: use "tms_sequence long" @par
https://lists.berlios.de/pipermail/openocd-development/2009-July/009426.html
The following tasks have been suggeted for improving OpenOCD's JTAG
interface support:
- rework USB communication to be more robust. Two possible options are:
-# use libusb-1.0.1 with libusb-compat-0.1.1 (non-blocking I/O wrapper)
-# rewrite implementation to use non-blocking I/O
- J-Link driver:
- fix to work with long scan chains, such as R.Doss's svf test.
- FT2232 (libftdi):
- make performance comparable to alternatives (on Win32, D2XX is faster)
- make usability comparable to alternatives
- Autodetect USB based adapters; this should be easy on Linux. If there's
more than one, list the options; otherwise, just select that one.
The following tasks have been suggested for adding new JTAG interfaces:
- TCP driver: allow client/server for remote JTAG interface control.
This requires a client and a server. The server is built into the
normal OpenOCD and takes commands from the client and executes
them on the interface returning the result of TCP/IP. The client
is an OpenOCD which is built with a TCP/IP minidriver. The use
of a minidriver is required to capture all the jtag_add_xxx()
fn's at a high enough level and repackage these cmd's as
TCP/IP packets handled by the server.
@section thelistswd Serial Wire Debug
- implement Serial Wire Debug interface
@section thelistbs Boundary Scan Support
- add STAPL support?
- add BSDL support?
A few possible options for the above:
-# Fake a TCL equivalent?
-# Integrate an existing library?
-# Write a new C implementation a la Jim?
Once the above are completed:
- add support for programming flash using boundary scan techniques
- add integration with a modified gerber view program:
- provide means to view the PCB and select pins and traces
- allow use-cases such as the following:
- @b Stimulus
-# Double-click on a pin (or trace) with the mouse.
- @b Effects
-# The trace starts blinking, and
-# OpenOCD toggles the pin(s) 0/1.
@section thelisttargets Target Support
- Many common ARM cores could be autodetected using IDCODE
- general layer cleanup: @par
https://lists.berlios.de/pipermail/openocd-development/2009-May/006590.html
- regression: "reset halt" between 729(works) and 788(fails): @par
https://lists.berlios.de/pipermail/openocd-development/2009-July/009206.html
- ARM7/9:
- clean up "arm9tdmi vector_catch". Available for some arm7 cores? @par
https://lists.berlios.de/pipermail/openocd-development/2009-October/011488.html
https://lists.berlios.de/pipermail/openocd-development/2009-October/011506.html
- add reset option to allow programming embedded ice while srst is asserted.
Some CPUs will gate the JTAG clock when srst is asserted and in this case,
it is necessary to program embedded ice and then assert srst afterwards.
- ARM926EJS:
- reset run/halt/step is not robust; needs testing to map out problems.
- ARM11 improvements (MB?)
- add support for asserting srst to reset the core.
- Single stepping works, but should automatically
use hardware stepping if available.
- mdb can return garbage data if read byte operation fails for
a memory region(16 & 32 byte access modes may be supported). Is this
a bug in the .MX31 PDK init script? Try on i.MX31 PDK:
mdw 0xb80005f0 0x8, mdh 0xb80005f0 0x10, mdb 0xb80005f0 0x20. mdb returns
garabage.
- implement missing functionality (grep FNC_INFO_NOTIMPLEMENTED ...)
- thumb support is missing: ISTR ARMv6 requires Thumb.
ARM1156 has Thumb2; ARM1136 doesn't.
- Cortex A8 support (ML)
- add target implementation (ML)
- Generic ARM run_algorithm() interface
- tagged struct wrapping ARM instructions and metadata
- not revision-specific (current: ARMv4+ARMv5 -or- ARMv6 -or- ARMv7)
- usable with at least arm_nandwrite() and generic CFI drivers
- MC1322x support (JW/DE?)
- integrate and test support from JW (and DE?)
- get working with a known good interface (i.e. not today's jlink)
- AT91SAM92xx:
- improvements for unknown-board-atmel-at91sam9260.cfg (RD)
- STR9x: (ZW)
- improvements to str912.cfg to be more general purpose
- AVR: (SQ)
- independently verify implementation
- incrementally improve working prototype in trunk. (SQ)
- work out how to debug this target
- AVR debugging protocol.
- FPGA:
- Altera Nios Soft-CPU support
- Coldfire (suggested by NC)
- can we draw from the BDM project? @par
http://bdm.sourceforge.net/
or the OSBDM package @par
http://forums.freescale.com/freescale/board/message?board.id=OSBDM08&thread.id=422
@section thelistsvf SVF/XSVF
- develop SVF unit tests
- develop XSVF unit tests
@section thelistflash Flash Support
- finish documentation for the following flash drivers:
- avr
- ecosflash
- pic32mx
- ocl
- str9xpec
@subsection thelistflashcfi CFI
- finish implementing bus width/chip width handling (suggested by NC)
- factor vendor-specific code into separate source files
- add new callback interface for vendor-specific code
- investigate/implement "thin wrapper" to use eCos CFI drivers (ØH)
@section thelistdebug Debugger Support
- add support for masks in watchpoints? @par
https://lists.berlios.de/pipermail/openocd-development/2009-October/011507.html
- breakpoints can get lost in some circumstances: @par
https://lists.berlios.de/pipermail/openocd-development/2009-June/008853.html
- add support for masks in watchpoints. The trick is that GDB does not
support a breakpoint mask in the remote protocol. One way to work around
this is to add a separate command "watchpoint_mask add/rem <addr> <mask>", that
is run to register a list of masks that the gdb_server knows to use with
a particular watchpoint address.
- integrate Keil AGDI interface to OpenOCD? (submitted by Dario Vecchio)
@section thelisttesting Testing Suite
This section includes several related groups of ideas:
- @ref thelistunittests
- @ref thelistsmoketests
- @ref thelisttestreports
- @ref thelisttestgenerichw
@subsection thelistunittests Unit Tests
- add testing skeleton to provide frameworks for adding tests
- implement server unit tests
- implement JTAG core unit tests
- implement JTAG interface unit tests
- implement flash unit tests
- implement target unit tests
@subsection thelistsmoketests Smoke Test Tools
-# extend 'make check' with a smoketest app
- checks for OOCD_TEST_CONFIG, etc. in environment (or config file)
- if properly set, runs the smoke test with specified parameters
- openocd -f ${OOCD_TEST_CONFIG}
- implies a modular test suite (see below)
- should be able to run some minimal tests with dummy interface:
- compare results of baseline sanity checks with expected results
-# builds a more complete test suite:
- existing testing/examples/ look like a great start
- all targets should be tested fully and for all capabilities
- we do NOT want a "lowest common denominator" test suite
- ... but can we start with one to get going?
- probably requires one test configuration file per board/target
- modularization can occur here, just like with targets/boards/chips
- coverage can increase over time, building up bundles of tests
-# add new 'smoketest' Makefile target:
- calls 'make check' (and the smoketest app)
- gather inputs and output into a report file
@subsection thelisttestreports Test Feedback Tools
These ideas were first introduced here: @par
https://lists.berlios.de/pipermail/openocd-development/2009-May/006358.html
- provide report submission scripts for e-mail and web forms
- add new Makefile targets to post the report:
- 'checkreportsend' -- send to list via e-mail (via sendmail)
- 'checkreportpost' -- send web form (via curl or other script)
@subsection thelisttestgenerichw Generic Hardware Tester
- implement VHDL to use for FPGA-based JTAG TAP testing device
- develop test suite that utilizes this testing device
@section thelistautotools Autotools Build System
- make entire configure process require less user consideration:
- automatically detect the features that are available, unless
options were specifically provided to configure
- provide a report of the drivers that will be build at the end of
running configure, so the users can verify which driverswill be
built during 'make' (and their options) .
- eliminate sources of confusion in @c bootstrap script:
-# Make @c bootstrap call 'configure --enable-maintainer-mode \<opts\>'?
-# Add @c buildstrap script to assist with boostrap and configure steps.
- automatically build tool-chains required for cross-compiling
- produce mingw32, arm-elf, others using in-tree scripts
- build all required target code from sources
- make JTAG and USB debug output a run-time configuration option
@section thelistarchitecture Architectural Tasks
The following architectural tasks need to be accomplished and should be
fairly easy to complete:
- clean-up code to match style guides
- factor code to eliminate duplicated functionality
- rewrite code that uses casts to access 16-bit and larger types
from unaligned memory addresses
- libopenocd support: @par
https://lists.berlios.de/pipermail/openocd-development/2009-May/006405.html
- review and clean up interface/target/flash APIs
The following strategic tasks will require ambition, knowledge, and time
to complete:
- overhaul use of types to improve 32/64-bit portability
- types for both host and target word sizes?
- can we use GDB's CORE_TYPE support?
- Allow N:M:P mapping of servers, targets, and interfaces
- loadable module support for interface/target/flash drivers and commands
- support both static and dynamic modules.
- should probably use libltdl for dynamic library handing.
@section thelistadmin Documentation Tasks
- Develop milestone and release guidelines, processes, and scripts.
- Develop "style" guidelines (and scripts) for maintainers:
- reviewing patches
- committing to Subversion
- Review The Guide for OpenOCD Users for documentation errors or omissions
- Update The Manual for OpenOCD Developerrs:
- Add documentation describing the architecture of each module
- Provide more Technical Primers to bootstrap contributor knowledge
*/
/** @file
This file contains the @ref thelist page.
*/

View File

@@ -1,4 +1,26 @@
aclocal \
&& autoheader \
&& automake --foreign --add-missing --copy \
&& autoconf
#!/bin/sh -e
# Run the autotools bootstrap sequence to create the configure script
if libtoolize --version >/dev/null 2>&1; then
libtoolize="libtoolize"
elif glibtoolize --version >/dev/null 2>&1; then
libtoolize="glibtoolize"
else
echo "libtool is required" >&2
exit 1
fi
# bootstrap the autotools
(
set -x
aclocal
${libtoolize} --automake --copy
autoconf
autoheader
automake --gnu --add-missing --copy
)
# AM_MAINTAINER_MODE requires --enable-maintainer-mode from everyone using
# current source snapshots (working from GIT, or some source snapshot, etc)
# otherwise the documentation will fail to build due to missing version.texi
echo "Bootstrap complete; you can './configure --enable-maintainer-mode ....'"

File diff suppressed because it is too large Load Diff

View File

@@ -99,7 +99,7 @@ void dbg_write_u16(const unsigned short *val, long len)
while (len > 0)
{
dcc_data = val[0]
dcc_data = val[0]
| ((len > 1) ? val[1] << 16: 0x0000);
dbg_write(dcc_data);
@@ -145,7 +145,7 @@ void dbg_write_str(const char *msg)
| ((len > 2) ? msg[2] << 16 : 0x00)
| ((len > 3) ? msg[3] << 24 : 0x00);
dbg_write(dcc_data);
msg += 4;
len -= 4;
}

View File

@@ -23,11 +23,11 @@
#include "dcc_stdio.h"
/* enable openocd debugmsg at the gdb prompt:
* monitor target_request debugmsgs enable
*
* monitor target_request debugmsgs enable
*
* create a trace point:
* monitor trace point 1
*
*
* to show how often the trace point was hit:
* monitor trace point
*/

View File

@@ -1,7 +0,0 @@
libftdi can be built to work under win32 (cygwin/mingw) after applying the patch in this directory.
The issue is caused by windows requiring usb_set_configuration to be called before the usb_claim_interface.
Spen
spen@spen-soft.co.uk

View File

@@ -1,20 +0,0 @@
--- src/ftdi.c.orig Wed Apr 16 16:24:30 2008
+++ src/ftdi.c Thu May 01 20:19:46 2008
@@ -358,6 +358,17 @@
if (usb_detach_kernel_driver_np(ftdi->usb_dev, ftdi->interface) != 0 && errno != ENODATA)
detach_errno = errno;
#endif
+
+#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
+ if (usb_set_configuration(ftdi->usb_dev, 1) != 0) {
+ usb_close (ftdi->usb_dev);
+ if (detach_errno == EPERM) {
+ ftdi_error_return(-8, "inappropriate permissions on device!");
+ } else {
+ ftdi_error_return(-5, "unable to set configuration");
+ }
+ }
+#endif
if (usb_claim_interface(ftdi->usb_dev, ftdi->interface) != 0) {
usb_close (ftdi->usb_dev);

View File

@@ -6,20 +6,55 @@ SYSFS{idVendor}=="15ba", SYSFS{idProduct}=="0003", MODE="664", GROUP="plugdev"
# Olimex ARM-USB-OCD-TINY
SYSFS{idVendor}=="15ba", SYSFS{idProduct}=="0004", MODE="664", GROUP="plugdev"
# Olimex ARM-JTAG-EW
SYSFS{idVendor}=="15ba", SYSFS{idProduct}=="001e", MODE="664", GROUP="plugdev"
# USBprog with OpenOCD firmware
SYSFS{idVendor}=="1781", SYSFS{idProduct}=="0c63", MODE="664", GROUP="plugdev"
# Amontec JTAGkey
# Amontec JTAGkey and JTAGkey-tiny
SYSFS{idVendor}=="0403", SYSFS{idProduct}=="cff8", MODE="664", GROUP="plugdev"
# Amontec JTAGkey-HiSpeed
SYSFS{idVendor}=="0fbb", SYSFS{idProduct}=="1000", MODE="664", GROUP="plugdev"
# Axiom AXM-0432 Link (Symphony SoundBite?)
# Calao Systems USB-A9260-C01
# TinCanTools Flyswatter
# OOCD-Link
# Marvell Sheevaplug (early development versions)
SYSFS{idVendor}=="0403", SYSFS{idProduct}=="6010", MODE="664", GROUP="plugdev"
# Calao Systems USB-A9260-C02
SYSFS{idVendor}=="0403", SYSFS{idProduct}=="6001", MODE="664", GROUP="plugdev"
# IAR J-Link USB
SYSFS{idVendor}=="1366", SYSFS{idProduct}=="0101", MODE="664", GROUP="plugdev"
# Raisonance RLink
SYSFS{idVendor}=="138e", SYSFS{idProduct}=="9000", MODE="664", GROUP="plugdev"
# Hitex STR9-comStick
SYSFS{idVendor}=="0640", SYSFS{idProduct}=="002c", MODE="664", GROUP="plugdev"
# Hitex STM32-PerformanceStick
SYSFS{idVendor}=="0640", SYSFS{idProduct}=="002d", MODE="664", GROUP="plugdev"
# Luminary Micro Stellaris/LM3S811
SYSFS{idVendor}=="0403", SYSFS{idProduct}=="bcd9", MODE="664", GROUP="plugdev"
# Xverve Signalyzer Tool (DT-USB-ST)
SYSFS{idVendor}=="0403", SYSFS{idProduct}=="bca0", MODE="664", GROUP="plugdev"
# egnite Turtelizer 2
SYSFS{idVendor}=="0403", SYSFS{idProduct}=="bdc8", MODE="664", GROUP="plugdev"
# Marvell Sheevaplug
SYSFS{idVendor}=="9e88", SYSFS{idProduct}=="9e8f", MODE="664", GROUP="plugdev"
# Section5 ICEbear
SYSFS{idVendor}=="0403", SYSFS{idProduct}=="c140", MODE="664", GROUP="plugdev"
SYSFS{idVendor}=="0403", SYSFS{idProduct}=="c141", MODE="664", GROUP="plugdev"
LABEL="openocd_rules_end"

View File

@@ -16,7 +16,7 @@ possible using a Cygwin host.
Basic Installation
==================
OpenOCD is distributed without autotools generated files, i.e. without a
OpenOCD is distributed without autotools generated files, i.e. without a
configure script. Run ./bootstrap in the openocd directory to have all
necessary files generated.
@@ -77,7 +77,7 @@ The simplest way to compile this package is:
documentation.
4. You can remove the program binaries and object files from the
source code directory by typing `make clean'.
source code directory by typing `make clean'.
Compilers and Options
=====================

View File

@@ -3,4 +3,17 @@ openocd_TEXINFOS = fdl.texi
man_MANS = openocd.1
EXTRA_DIST = openocd.1
MAINTAINERCLEANFILES = Makefile.in mdate-sh texinfo.tex
dist-hook:
mkdir $(distdir)/manual
cp -p $(srcdir)/manual/*.txt $(distdir)/manual
for i in $$(cd $(srcdir)/manual/ && ls -d */); do \
mkdir $(distdir)/manual/$$i; \
cp -p $(srcdir)/manual/$$i/* $(distdir)/manual/$$i/; \
done
MAINTAINERCLEANFILES = \
$(srcdir)/Makefile.in \
$(srcdir)/mdate-sh \
$(srcdir)/stamp-vti \
$(srcdir)/version.texi \
$(srcdir)/texinfo.tex

9
doc/manual/app.txt Normal file
View File

@@ -0,0 +1,9 @@
/** @page appdocs OpenOCD Application APIs
The top-level APIs in the OpenOCD library allow applications to integrate
all of the low-level functionality using a set of simple function calls.
These function calls do not exist in a re-usable form, but
contributions to create and document them will be welcome.
*/

35
doc/manual/flash.txt Normal file
View File

@@ -0,0 +1,35 @@
/** @page flashdocs OpenOCD Flash APIs
OpenOCD provides its Flash APIs for developers to support different
types of flash devices, some of which are built-in to target devices
while others may be connected via standard memory interface (e.g. CFI,
FMI, etc.).
The Flash module provides the following APIs:
- @subpage flashcfi
- @subpage flashnand
- @subpage flashtarget
This section needs to be expanded.
*/
/** @page flashcfi OpenOCD CFI Flash API
This section needs to be expanded to describe OpenOCD's CFI Flash API.
*/
/** @page flashnand OpenOCD NAND Flash API
This section needs to be expanded to describe OpenOCD's NAND Flash API.
*/
/** @page flashtarget OpenOCD Target Flash API
This section needs to be expanded to describe OpenOCD's Target Flash API.
*/

48
doc/manual/helper.txt Normal file
View File

@@ -0,0 +1,48 @@
/** @page helperdocs OpenOCD Helper APIs
OpenOCD uses several low-level APIs as the foundation for high-level APIs:
- @subpage helperporting
- @subpage helperjim
- @subpage helpercommand
- @subpage helperlogging
- @subpage helperbuffers
This section needs to be expanded.
*/
/** @page helperporting OpenOCD Types/Portability APIs
This section needs to be expanded to describe OpenOCD's type and
portability API.
*/
/** @page helperjim OpenOCD Jim API
The Jim API provides access to a small-footprint TCL implementation.
Visit http://jim.berlios.de/ for more information on Jim.
This section needs to be expanded to describe OpenOCD's Jim API.
*/
/** @page helpercommand OpenOCD Command API
This section needs to be expanded to describe OpenOCD's Command API.
*/
/** @page helperlogging OpenOCD Logging API
This section needs to be expanded to describe OpenOCD's Logging API.
*/
/** @page helperbuffers OpenOCD Byte Buffer API
This section needs to be expanded to describe OpenOCD's Byte Buffer API.
*/

73
doc/manual/jtag.txt Normal file
View File

@@ -0,0 +1,73 @@
/** @page jtagdocs JTAG APIs
For new developers unfamiliar with the technology, @ref primerjtag provides
a brief introduction to the IEEE JTAG interface.
The OpenOCD JTAG library API covers several functional areas. The jtag
@b core communicates through the @b minidriver API with either its full
@a driver implementation (src/jtag/jtag_driver.c) or a @a minidriver .
Internally, the @b command API is used by the JTAG driver for managing
asynchronous transactions.
- @subpage jtagcore
- @b public API routines
- declared in @c src/jtag/jtag.h
- used by other modules
- @subpage jtagtcl
- @b private TCL handling routines
- defined in @c src/jtag/tcl.c
- registers and handles Jim commands that configure and use the JTAG core
- @subpage jtagcmd
- @b private command queue API
- declared in @c src/jtag/commands.h
- provides routines used internally by the full JTAG drivers.
- @subpage jtagiface
- @b private interface driver API
- declared in @c src/jtag/interface.h
- used by the core, minidrivers, and the full interface device drivers.
- allows implementing new interface device drivers.
- includes the Cable/TAP API (commands starting with @c tap_)
- @subpage jtagdriver
- @b private minidriver API
- declared in @c src/jtag/minidriver.h
- used @a only by the core and minidriver implementations:
- @c jtag_driver.c (in-tree OpenOCD drivers)
- @c zy1000/build/include/jtag_minidriver.h (ZY1000 minidriver)
- future implementations (on other embedded hosts)
- interface device drivers do @b not need this API.
*/
/** @page jtagcore JTAG Core API
This section needs to be expanded.
*/
/** @page jtagtcl JTAG TCL API
This section needs to be expanded.
*/
/** @page jtagcmd JTAG Command API
This section needs to be expanded.
*/
/** @page jtagiface JTAG Interface API
This section needs to be expanded.
*/
/** @page jtagdriver JTAG Minidriver API
This section needs to be expanded.
*/

99
doc/manual/main.txt Normal file
View File

@@ -0,0 +1,99 @@
/** @mainpage OpenOCD Reference Manual
Welcome to the OpenOCD Reference Manual -- the developer's resource for
learning about the internal architecture of the OpenOCD project. @par
In addition, this document contains the tactical and strategic plans
and processes that have been developed by and for the OpenOCD community.
Developers that want to contribute to OpenOCD should read the following
sections before starting work:
- The List of @subpage thelist enumerates opportunities for improving or
extending the OpenOCD platform. If your ideas are on The List, you might
check the mailing list archives to find the status of your feature (or bug).
- The @subpage styleguide provides rules that developers should
follow when writing new code for OpenOCD.
- The @subpage patchguide provides policies that developers should
follow when submitting patches to the project.
- The @subpage bugs page contains the content of the BUGS file, which
provides instructions for submitting bug reports to the maintainers.
- The @subpage releases page describes the project's release process.
@ref primer provide introductory materials for new developers on various
specific topics.
Finally, the @ref oocd pages explain how the code has been organized
into layers of APIs, providing an overview of how they fit together.
These pages attempt to give developers a high-level perspective of the
various code modules provided by OpenOCD.
*/
/** @page primer OpenOCD Technical Primers
This pages lists Technical Primers available for OpenOCD Developers.
They seek to provide information to pull novices up the learning curves
associated with the fundamental technologies used by OpenOCD.
- @subpage primerpatches
- @subpage primerdocs
- @subpage primerautotools
- @subpage primertcl
- @subpage primerjtag
These documents should bridge any "ancillary" gaps in contributor
knowledge, without having to learn the complete languages or technology.
They should provide enough information for experienced developers to
learn how to make "correct" changes when creating patches.
In all cases, these Primers should use idiomatic conventions that the
community has agreed are the "right way of doing things". In this
respect, these documents typically assume some familiarity with the
information contained in one or more @ref styleguide, or they will
directly refer to specific style guides as supplemental reading.
Contributions or suggestions for new Technical Primers are welcome.
*/
/** @page oocd OpenOCD Architecture
The OpenOCD library consists of several APIs that build together to
provide the support functionality. The following list shows how these
modules are stacked in the current implementation (from bottom to top):
- @subpage helperdocs
- @ref helperporting
- @ref helperjim
- @ref helpercommand
- @ref helperlogging
- @subpage jtagdocs
- @ref jtagcore
- @ref jtagtcl
- @ref jtagcmd
- @ref jtagiface
- @ref jtagdriver
- @subpage targetdocs
- @ref targetarm
- @ref targetnotarm
- @ref targetregister
- @ref targetimage
- @ref targettrace
- @subpage flashdocs
- @ref flashcfi
- @ref flashnand
- @ref flashtarget
- @subpage serverdocs
- @ref servergdb
- @ref servertelnet
- @ref serverhttp
- @subpage appdocs
Obviously, there are some nuances to the stack that are not shown by
this linear list of layers.
The List of @ref thelist enumerates opportunities for improving or
extending the OpenOCD platform.
*/

View File

@@ -0,0 +1,167 @@
/** @page primerautotools OpenOCD Autotools Primer
This page provides an overview to OpenOCD's use of the GNU autotool suite:
- @ref primerautoconf
- @ref primerautomake
- @ref primerlibtool
Most developers do not need to concern themselves with these tools, as
the @ref primerbootstrap script runs these tools in the required sequence.
@section primerbootstrap Autotools Bootstrap
The @c bootstrap script should be used by developers to run the
autotools in the correct sequence.
When run after a fresh checkout, this script generates the build files
required to compile the project, producing the project configure script.
After running @c configure, the @ref primermaintainermode settings will
handle most situations that require running these tools again. In some
cases, a fresh bootstrap may be still required.
@subsection primerbootstrapcures Problems Solved By Bootstrap
For example, the build system can fail in unexpected ways after running
<code>git pull</code>. Here, the <code>make maintainer-clean</code>
should be used to remove all of the files generated by the @c bootstrap
script and subsequent build processes.
In this particular case, one may also need to remove stray files by hand
after running this command to ensure everything is rebuilt properly.
This step should be necessary only if the @c maintainer-clean was run
@b after altering the build system files with git. If it is run
@b before any updates, the build system should never leave artifacts
in the tree.
Without such precautions, changes can be introduced that leave the tree
timestamps in an inconsistent state, producing strange compile errors
that are resolve after such diligence.
@subsection primermaintainerclean Autotools Cleaning
Normally, all files generated by the bootstrap script, configure
process, and build system should be removed after running <code>make
maintainer-clean</code>. Automatically generated files that remain
after this should be listed in @c MAINTAINERCLEANFILES,
@c DISTCLEANFILES, or @c CLEANFILES, depending on which stage of the
build process they are produced.
@section primerautoconf Autoconf Configuration Script
The @c autoconf program generates the @c configure script from
@c configure.in, using serious Perl voodoo. The resulting script is
included in the project distribution packages and run by users to
configure the build process for their system.
@subsection primermaintainermode Maintainer Mode
After a fresh checkout, @c bootstrap, and a simple @c configure, you may
experience errors when running @c make that some files cannot be found
(e.g. @c version.texi), and a second @c make will "mysteriously" solve
the problems. The isssue is well-known and expected, if unfortunate.
The OpenOCD project requires that all developers building from the
git repository use the @c --enable-maintainer-mode option when
running the @c configure script. This option ensures that certain files
are created during the build process that would normally be packaged in
the distribution tarball. The @c bootstrap script will remind you of
this requirement when it runs.
In addition to solving these problems, this option enables Makefile
rules (provided by automake) that allow the normal @c make process to
rebuild the autotools outputs, included the automake-generated Makefiles
themselves. This avoids the heavy-handed approach of running the
@c bootstrap script after changing one of these files.
@section primerautomake Automake Makefiles
The @c automake program generates @c Makefile.in files (from @c
Makefile.am files). These files are later processed by the configure
script produced by @c autoconf.
@subsection primerautomakenewfiles Creating Makefile.am Files
This section shows how to add a @c Makefile.am in a new directory (or
one that lacks one).
-# The new directory must be listed in the @c SUBDIRS variable in the
parent directory's Makefile.am:
@code
$ echo 'SUBDIRS += directory' >>../Makefile.am
@endcode
-# Create an bare-bones Makefile.am file in directory that needs it:
@code
$ echo "MAINTAINERCLEANFILES = Makefile.in" >Makefile.am
@endcode
-# The @c configure.in script must be updated, so it generates the required
Makefile when the @a configure script is run by the user:
@verbatim
AC_OUTPUT([
...
path/to/new/Makefile
])
@endverbatim
Note: these instructions are @b not meant to be used literally, rather
they are shown for demonstration purposes.
The default MAINTAINERCLEANFILES rule ensures that the
automake-generated @c Makefile.in file will be removed when developers
run <code>make maintainer-clean</code>. Additional rules may be added
after this; however, the project should bootstrap and tear down cleanly
after taking these minimal steps, with the new directory being visited
during the @c make sequence.
@subsection primerautomaketweaks Updating Makefile.am Files
Adding, removing, and renaming files from the project tree usually
requires updating the autotools inputs. This section will help describe
how to do this as questions arise.
@section primerlibtool Libtool and Libraries
The @c libtool program provides the means of generating libraries in a
portable and painless manner (relatively speaking).
This section will contain an answer to "what does libtool give OpenOCD?"
and "what do developers need to consider in new code?"
@section primerautotoolsmation Autotools Automation
This section outlines three ways the autotools provides automation to
assist with testing and distribution:
- @ref primerautocheck -- automatic unit and smoke tests
- @ref primerautodistcheck -- automatic distribution and packaging tests
@subsection primerautocheck make check
The <code>make check</code> command will run the OpenOCD test suite,
once it has been integrated as such. This section will contain
information about how to extend the testing build system components to
implement new checks.
@subsection primerautodistcheck make distcheck
The <code>make distcheck</code> command produces an archive of the
project deliverables (using <code>make dist</code>) and verifies its
integrity for distribution by attemptng to use the package in the same
manner as a user.
These checks includes the following steps:
-# Unpack the project archive into its expected directory.
-# Configure and build the project in a temporary out-of-tree directory.
-# Run <code>make check</code> to ensure the distributed code passes all tests.
-# Run <code>make install</code> into a temporary installation directory.
-# Check that <code>make uninstall</code> removes all files that were installed.
-# Check that <code>make distclean</code> removes all files created
during all other steps (except the first).
If all of these steps complete successfully, the @c make process will
output a friendly message indicating the archive is ready to be
distributed.
*/
/** @file
This file contains the @ref primerautotools page.
*/

124
doc/manual/primer/docs.txt Normal file
View File

@@ -0,0 +1,124 @@
/** @page primerdocs OpenOCD Documentation Primers
This page provides an introduction to OpenOCD's documentation processes.
OpenOCD presently produces several kinds of documentation:
- The User's Guide:
- Focuses on using the OpenOCD software.
- Details the installation, usage, and customization.
- Provides descriptions of public Jim/TCL script commands.
- Written using GNU texinfo.
- Created with 'make pdf' or 'make html'.
- See @subpage primertexinfo and @ref styletexinfo.
- The References: (as proposed)
- Focuses on using specific hardware with OpenOCD.
- Details the supported interfaces, chips, boards, and targets.
- Provides overview, usage, reference, and FAQ for each device.
- Written using LaTeX language with custom macros.
- Created with 'make references'.
- See @subpage primerlatex and @ref stylelatex.
- The Manual:
- Focuses on developing the OpenOCD software.
- Details the architecutre, driver interfaces, and processes.
- Provides "full" coverage of C source code (work-in-progress).
- Written using Doxygen C language conventions (i.e. in comments).
- Created with 'make doxygen'.
- See @subpage primerdoxygen and @ref styledoxygen.
The following sections provide more information for anyone that wants to
contribute new or updated documentation to the OpenOCD project.
*/
/** @page primertexinfo Texinfo Primer
The OpenOCD User's Guide presently exists entirely within the
doc/openocd.texi document. That file contains documentation with
mark-up suitable for being parsed by the GNU Texinfo utilities
(http://www.gnu.org/software/texinfo/).
When you add a new command, driver, or driver option, it needs to be
documented in the User's Guide. Use the existing documentation for
models, but feel free to make better use of Texinfo mechanisms. See
the Texinfo web site for the Texinfo manual and more information.
OpenOCD style guidelines for Texinfo documentation can be found on the
@ref styletexinfo page.
*/
/** @page primerlatex LaTeX Primer
The OpenOCD project provides a number of reference guides using the
LaTeX typesetting language.
- OpenOCD Quick Reference Sheets
- OpenOCD Hardware Reference Guides
These documents have not yet been produced, so this Primer serves as
a placeholder to describe how they are created and can be extended.
The same holds true for the @ref stylelatex page.
*/
/** @page primerdoxygen Doxygen Primer
Doxygen-style comments are used to provide documentation in-line with
the OpenOCD source code. These comments are used to document functions,
variables, structs, enums, fields, and everything else that might need
to be documented for developers. Additional files containing comments
that supplement the code comments in order to provide complete developer
documentation.
Even if you already know Doxygen, please read this Primer to learn
how OpenOCD developers already use Doxygen features in the project tree.
For more information about OpenOCD's required style for using Doxygen,
see the @ref styledoxygen page and look at existing documentation in the
@c doc/manual tree.
@section primerdoxytext Doxygen Input Files
Doxygen has been configured parse all of the C source code files (*.c
and *.h) in @c src/ in order to produce a complete reference of all
OpenOCD project symbols. In addition to the source code files, other
files will also be scanned for comment blocks; some are referenced
explicitly by the @c INPUT variable in the Doxygen configuration file.
By default, the Doxygen configuration enables a "full" set of features,
including generation of dependency graphs (using the GraphViz package).
These features may be disabled by editing the @c Doxyfile.in file at the
top of the project tree; the configuration file includes comments that
provide detailed documentation for each option.
To support out-of-tree building of the documentation, the @c Doxyfile.in
@c INPUT values will have all instances of the string @c "@srcdir@"
replaced with the current value of the make variable
<code>$(srcdir)</code>. The Makefile uses a rule to convert
@c Doxyfile.in into the @c Doxyfile used by <code>make doxygen</code>.
@section primerdoxyoocd OpenOCD Input Files
OpenOCD uses the @c INPUT mechanism to include additional documentation to
provide The Manual for OpenOCD Developers. These extra files contain
high-level information intended to supplement the relatively low-level
documentation that gets extracted from the source code comments.
OpenOCD's Doxygen configuration file will search for all @c .txt files
that can be found under the @c doc/manual directory in the project tree.
New files containing valid Doxygen markup that are placed in or under
that directory will be detected and included in The Manual automatically.
@section primerdoxyman Doxygen Reference Manual
The full documentation for Doxygen can be referenced on-line at the project
home page: http://www.doxygen.org/index.html. In HTML versions of this
document, an image with a link to this site appears in the page footer.
*/
/** @file
This file contains the Doxygen source code for the @ref primerdocs.
The @ref primerdocs page also contains the following sections:
- @ref primertexinfo
- @ref primerlatex
- @ref primerdoxygen
*/

174
doc/manual/primer/jtag.txt Normal file
View File

@@ -0,0 +1,174 @@
/** @page primerjtag OpenOCD JTAG Primer
JTAG is unnecessarily confusing, because JTAG is often confused with
boundary scan, which is just one of its possible functions.
JTAG is simply a communication interface designed to allow communication
to functions contained on devices, for the designed purposes of
initialisation, programming, testing, debugging, and anything else you
want to use it for (as a chip designer).
Think of JTAG as I2C for testing. It doesn't define what it can do,
just a logical interface that allows a uniform channel for communication.
See @par
http://en.wikipedia.org/wiki/Joint_Test_Action_Group
and @par
http://www.inaccessnetworks.com/projects/ianjtag/jtag-intro/jtag-state-machine-large.png
The first page (among other things) shows a logical representation
describing how multiple devices are wired up using JTAG. JTAG does not
specify, data rates or interface levels (3.3V/1.8V, etc) each device can
support different data rates/interface logic levels. How to wire them
in a compatible way is an exercise for an engineer.
Basically TMS controls which shift register is placed on the device,
between TDI and TDO. The second diagram shows the state transitions on
TMS which will select different shift registers.
The first thing you need to do is reset the state machine, because when
you connect to a chip you do not know what state the controller is in,you need
to clock TMS as 1, at least 7 times. This will put you into "Test Logic
Reset" State. Knowing this, you can, once reset, then track what each
transition on TMS will do, and hence know what state the JTAG state
machine is in.
There are 2 "types" of shift registers. The Instruction shift register
and the data shift register. The sizes of these are undefined, and can
change from chip to chip. The Instruction register is used to select
which Data register/data register function is used, and the data
register is used to read data from that function or write data to it.
Each of the states control what happens to either the data register or
instruction register.
For example, one of the data registers will be known as "bypass" this is
(usually) a single bit which has no function and is used to bypass the
chip. Assume we have 3 identical chips, wired up like the picture
and each has a 3 bit instruction register, and there are 2 known
instructions (110 = bypass, 010 = some other function) if we want to use
"some other function", on the second chip in the line, and not change
the other chips we would do the following transitions.
From Test Logic Reset, TMS goes:
0 1 1 0 0
which puts every chip in the chain into the "Shift IR state"
Then (while holding TMS as 0) TDI goes:
0 1 1 0 1 0 0 1 1
which puts the following values in the instruction shift register for
each chip [110] [010] [110]
The order is reversed, because we shift out the least significant bit
first. Then we transition TMS:
1 1 1 1 0 0
which puts us in the "Shift DR state".
Now when we clock data onto TDI (again while holding TMS to 0) , the
data shifts through the data registers, and because of the instruction
registers we selected (some other function has 8 bits in its data
register), our total data register in the chain looks like this:
0 00000000 0
The first and last bit are in the "bypassed" chips, so values read from
them are irrelevant and data written to them is ignored. But we need to
write bits for those registers, because they are in the chain.
If we wanted to write 0xF5 to the data register we would clock out of
TDI (holding TMS to 0):
0 1 0 1 0 1 1 1 1 0
Again, we are clocking the least-significant bit first. Then we would
clock TMS:
1 1 0
which updates the selected data register with the value 0xF5 and returns
us to run test idle.
If we needed to read the data register before over-writing it with F5,
no sweat, that's already done, because the TDI/TDO are set up as a
circular shift register, so if you write enough bits to fill the shift
register, you will receive the "captured" contents of the data registers
simultaneously on TDO.
That's JTAG in a nutshell. On top of this, you need to get specs for
target chips and work out what the various instruction registers/data
registers do, so you can actually do something useful. That's where it
gets interesting. But in and of itself, JTAG is actually very simple.
@section primerjtag More Reading
The following link goes to an HTML (or PDF) introduction to JTAG,
written by one of the original members of the JTAG committee: @par
http://www.asset-intertech.com/products/boundscan.htm
A separate primer contains information about @subpage primerjtagbs for
developers that want to extend OpenOCD for such purposes.
*/
/** @page primerjtagbs JTAG Boundary Scan Primer
The following page provides an introduction on JTAG that focuses on its
boundary scan capabilities: @par
http://www.engr.udayton.edu/faculty/jloomis/ece446/notes/jtag/jtag1.html
OpenOCD does not presently have clear means of using JTAG for boundary
scan testing purposes; however, some developers have explored the
possibilities. The page contains information that may be useful to
those wishing to implement boundary scan capabilities in OpenOCD.
@section primerbsdl The BSDL Language
For more information on the Boundary Scan Description Language (BSDL),
the following page provides a good introduction: @par
http://www.radio-electronics.com/info/t_and_m/boundaryscan/bsdl.php
@section primerbsdlvendors Vendor BSDL Files
NXP LPC: @par
http://www.standardics.nxp.com/support/models/lpc2000/
Freescale PowerPC: @par
http://www.freescale.com/webapp/sps/site/overview.jsp?code=DRPPCBSDLFLS
Freescale i.MX1 (too old): @par
http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=i.MX1&nodeId=0162468rH311432973ZrDR&fpsp=1&tab=Design_Tools_Tab
Renesas R32C/117: @par
http://sg.renesas.com/fmwk.jsp?cnt=r32c116_7_8_root.jsp&fp=/products/mpumcu/m16c_family/r32c100_series/r32c116_7_8_group/
- The device page does not come with BSDL file; you have to register to
download them. @par
http://www.corelis.com/support/BSDL.htm
TI links theirs right off the generic page for each chip;
this may be the case for other vendors as well. For example:
- DaVinci DM355 -- http://www.ti.com/litv/zip/sprm262b
- DaVinci DM6446
- 2.1 silicon -- http://www.ti.com/litv/zip/sprm325a
- older silicon -- http://www.ti.com/litv/zip/sprm203
- OMAP 3530
- CBB package -- http://www.ti.com/litv/zip/sprm315b
- 515 ball s-PGBA, POP, 0.4mm pitch
- CUS package -- http://www.ti.com/litv/zip/sprm314a
- 515 ball s-PGBA, POP, 0.5mm pitch
- CBC package -- http://www.ti.com/litv/zip/sprm346
- 423 ball s-PGBA, 0.65mm pitch
Many other files are available in the "Semiconductor Manufacturer's BSDL
files" section of the following site: @par
http://www.freelabs.com/~whitis/electronics/jtag/
*/
/** @file
This file contains the @ref primerjtag and @ref primerjtagbs page.
*/

View File

@@ -0,0 +1,172 @@
/** @page primerpatches Patch Primer
This page provides an introduction to patching that may be useful
for OpenOCD contributors who are unfamiliar with the process.
@section primerpatchintro Introduction to Patching
The standard method for creating patches requires developers to:
- checkout the git repository (or bring a copy up-to-date),
- make the necessary modifications to a working copy,
- check with 'git status' to see which files will be modified/added, and
- use 'git diff' to review the changes and produce a patch.
It is important to minimize the changes to only those lines that contain
important differences; do not allow stray whitespace changes into your
patches, and keep the focus to a single logical change.
@section primerpatchcreate Creating Patches
You can create a patch (from the root of your working copy) with a
command like the following example: @par
@verbatim
git diff > patch-name.patch
@endverbatim
where @a patch-name should be something that is descriptive and unique.
The above command will create a patch containing all of the changes in
the working copy; if you want to obtain a subset, simply provide the
list of files to the command: @par
@verbatim
git diff doc > <patch-name>-doc.patch
git diff src > <patch-name>-src.patch
@endverbatim
This will create two patches, each containing only those changes present
in the subdirectory specified.
@subsection primerpatchcreate Naming Patches
One developer has evolved an informal standard for naming his patches: @par
@verbatim
<project>-<lod>-<action>-<task>.patch
@endverbatim
where @a project is @c openocd, @a lod (line-of-development) could be a
subsystem (e.g. @c jtag, @c jlink, etc.) or other group identifier,
@a action is @c add, @c change, @c fix, @c update, etc., and @a task is
whatever the patch will accomplish (in 2-4 words).
This scheme does not need to be followed, but it is helpful for
maintainers that receive many patches. You do not want your own
@c openocd.patch file to be accidentally overwritten by another
submission, sending your patch to the bit bucket on accident.
@section primerpatchpreflight Developer Review
Before sending in patches, please make sure you have updated to the
latest version of the trunk (using <code>git pull</code>) before creating
your patch. This helps to increase the chances that it will apply
cleanly to the trunk. However, the content matters most.
When creating a patch using "<code>git diff</code>", git will
produce a patch that contains all of the changes in your working copy.
To manage multiple changes at once, you either need one working copy per
patch, or you can specified specific files and directories when using
<code>git diff</code>. Overlapping patches will be discussed in the
next section.
@todo Does git's treatment of line-endings behave sanely?
Basically, the repository should use newlines internally,
and convert to/from CRLF on Windows etc.
@section primerpatchseries Patch Series
As was mentioned above, each patch should contain one logical @c task,
and multiple logical tasks should be split into a series of patches.
There are no hard guidelines for how that is to be done; it's an art
form. Many simple changes should not have to worry about being split,
as they will naturally represent a single task.
When working on several different non-intersecting lines of development,
a combination of multiple working copies and patch series management
techniques can become critical to efficiently managing change. This
again is an area where developers have favorite methodologies that are
simply a matter of taste or familiarity; your mileage may vary.
Packages such as @c patchutils, @c diffutils, and @c quilt are among
those that have proved themselves invaluable for these type of tasks.
Others take their patch management a step further, using stkgit or
some other framework on top of git.
@subsection primerpatchseriesinterdiff Using @c interdiff
The @c patchutils package includes the @c interdiff command, which
produces a patch that contains the changes made between two other
patches. This command can be used to manage the creation of trivial
patch series. For example, the following sequence of commands will
produce three patches: @par
@verbatim
$ cd openocd/
$ git pull
...
$ <<<start changes for patch #1>>>
...
$ <<<finish changes for patch #1>>>
$ git diff > series-1.patch # patch #1 is easy
$ <<<start changes for patch #2>>>
...
$ <<<finish changes for patch #2>>>
$ git diff > series-1+2.patch # create patch 1+2
$ interdiff series-1{,+2}.patch > series-2.patch # 1 ~ 1+2 => #2
$ <<<start changes for patch #3>>>
...
$ <<<finish changes for patch #3>>>
$ git diff > series-1+2+3.patch # create patch 1+2+3
$ interdiff series-1+2{,+3}.patch > series-3.patch # 1+2 ~ 1+2+3 => 3
@endverbatim
This technique falls apart when the repository changes, but this may be
suitable for small series of patches.
@subsection primerpatchseriesquilt Using @c quilt
The @c quilt package provides scripts to manage series of patches more
efficiently than can be managed by hand. For out-of-tree work projects
that require such patch management, @c quilt provides an indispensable
tool for solving the problem.
@section primerpatchsubmit Submitting Patches
Write access to the OpenOCD git repository is limited to
contributors that have demonstrated the ability to produce clear,
consistent, and frequent patches. These individuals are responsible
for maintaining the integrity of the repository for the community.
Thus, commits to the git repository must be handled by one of
these maintainers.
Patches must be sent to the OpenOCD developer mailing list:
@par
openocd-development@lists.berlios.de
They will be reviewed and committed if the changes are found to be
acceptable. If there are problems, you will receive feedback via the
mailing list; in general, the maintainers prefer all communication to go
through the list, as the entire community needs to judge contributions
for possible merits and mistakes.
Contributors may be asked to address certain issues and submit a new
patch. In the event that it gets overlooked, you may need to resubmit
it or prompt for feedback. Please have patience, as many maintainers
work on the project voluntarily and without compensation for the time
that they spend doing these tasks.
@section primerpatchguide Guidelines for Submitting Patches
- Each patch file should contain:
- A commit description that describes all of the changes.
- A separator line that contains three hyphens: <code>---</code>
- A summary of the changes produced by diffstat (optional)
- Another separator line (optional)
- The actual patch contents, containing a single change.
- Each patch series should include:
- A summary of the patches in the series.
- Logically-related patches that contain incremental changes.
*/
/** @file
This file contains the @ref primerpatches page.
*/

View File

@@ -1,3 +1,9 @@
/** @page primertcl OpenOCD TCL Primer
The @subpage scripting page provides additional TCL Primer material.
@verbatim
****************************************
****************************************
@@ -109,7 +115,7 @@ Exception: The arrays.
set x "2 * 6"
set foo([expr $x]) "twelve"
**************************************************
***************************************************
=== TCL TOUR ===
@@ -127,7 +133,7 @@ This means it is evaluated when the file is parsed.
In TCL, "FOR" is a funny thing, it is not what you think it is.
Syntactically - FOR is a just a command, it is not language
construct like for(;;) in C...
construct like for(;;) in C...
The "for" command takes 4 parameters.
(1) The "initial command" to execute.
@@ -209,16 +215,16 @@ All memory regions must have 2 things:
(2) NAME( array )
And the array must have some specific names:
( <idx>, THING )
Where: THING is one of:
Where: THING is one of:
CHIPSELECT
BASE
LEN
HUMAN
TYPE
RWX - the access ablity.
WIDTH - the accessable width.
RWX - the access ability.
WIDTH - the accessible width.
ie: Some regions of memory are not 'word'
ie: Some regions of memory are not 'word'
accessible.
The function "address_info" - given an address should
@@ -231,14 +237,14 @@ tell you about the address.
MAJOR FUNCTION:
==
proc memread32 { ADDR }
proc memread16 { ADDR }
proc memread8 { ADDR }
proc memread32 { ADDR }
proc memread16 { ADDR }
proc memread8 { ADDR }
All read memory - and return the contents.
[ FIXME: 7/5/2008 - I need to create "memwrite" functions]
**************************************************
***************************************************
=== TCL TOUR ===
@@ -259,13 +265,13 @@ In a makefile or shell script you may have seen this:
FOO_linux = "Penguins rule"
FOO_winXP = "Broken Glass"
FOO_mac = "I like cat names"
# Pick one
BUILD = linux
#BUILD = winXP
#BUILD = mac
FOO = ${FOO_${BUILD}}
The "double [set] square bracket" thing is the TCL way, nothing more.
----
@@ -284,7 +290,7 @@ Notice this IF COMMAND - (not statement) is like this:
The "IF" command expects either 2 params, or 4 params.
=== Sidebar: About "commands" ===
Take a look at the internals of "jim.c"
Look for the function: Jim_IfCoreCommand()
And all those other "CoreCommands"
@@ -292,10 +298,10 @@ The "IF" command expects either 2 params, or 4 params.
You'll notice - they all have "argc" and "argv"
Yea, the entire thing is done that way.
IF is a command. SO is "FOR" and "WHILE" and "DO" and the
others. That is why I keep using the phase it is a "command"
=== END: Sidebar: About "commands" ===
Parameter 1 to the IF command is expected to be an expression.
@@ -309,7 +315,7 @@ CATCH - is an error catcher.
You give CATCH 1 or 2 parameters.
The first 1st parameter is the "code to execute"
The 2nd (optional) is where to put the error message.
CATCH returns 0 on success, 1 for failure.
The "![catch command]" is self explaintory.
@@ -319,7 +325,7 @@ above, the IF command can take many parameters they just have to
be joined by exactly the words "else" or "elseif".
The 4th parameter contains:
"error [format STRING....]"
This lets me modify the previous lower level error by tacking more
@@ -340,7 +346,7 @@ string, then using "dlopen()" and "dlsym()" to look it up - and get a
function pointer - and calling the function pointer.
In this case - I execute a dynamic command. You can do some cool
tricks with interpretors.
tricks with interpretors.
----------
@@ -374,7 +380,7 @@ Some assumptions:
The "CHIP" file has defined some variables in a proper form.
ie: AT91C_BASE_US0 - for usart0,
ie: AT91C_BASE_US0 - for usart0,
AT91C_BASE_US1 - for usart1
... And so on ...
@@ -413,9 +419,9 @@ with the generated list of commands for the entire USART.
With that little bit of code - I now have a bunch of functions like:
show_US0, show_US1, show_US2, .... etc ...
And show_US0_MR, show_US0_IMR ... etc...
And - I have this for every USART... without having to create tons of
boiler plate yucky code.
@@ -428,3 +434,7 @@ END of the Tcl Intro and Walk Through
FUTURE PLANS
Some "GPIO" functions...
@endverbatim
*/

353
doc/manual/release.txt Normal file
View File

@@ -0,0 +1,353 @@
/** @page releases Release Processes
This page provides an introduction to the OpenOCD Release Processes:
- @ref releasewhy - Explain the motivations for producing
releases on a regular basis.
- @ref releasewho - Describes the responsibilities and
authority required to produce official OpenOCD releases.
- @ref releasewhen - Provides guidelines for scheduling
activities for each release cycle.
- @ref releasehow - Outlines all of the steps for the
processes used to produce and release the package source archives.
- @ref releasescript - Introduces the automated @c release.sh script.
@section releasewhy Why Produce Releases?
The OpenOCD maintainers produce <i>releases</i> periodically for many
reasons. This section provides the key reasons for making releases on a
regular basis and why a set of <i>release processes</i> should be used
to produce them.
At any time, <i>source archives</i> can be produced by running
<code>make dist</code> in the OpenOCD project tree. With the 0.2.0
release, this command will package the tree into several popular archive
formats: <code>openocd-\<version\>.{tar.gz,tar.bz2,zip}</code>. If
produced properly, these files are suitable for release to the public.
When released for users, these archives present several important
advantages when contrasted to using the git repository:
-# They allow others to package and distribute the code.
-# They build easier for developers, because they contain
a working configure script that was produced by the Release Manager.
-# They prevent users from trying a random work-in-process revision.
-# They free developers from answering questions about mainline breakage.
Hopefully, this shows several good reasons to produce regular releases,
but the release processes were developed with some additional design
goals in mind. Specifically, the releases processes should have the
following properties:
-# Produce successive sets of archives cleanly and consistently.
-# Implementable as a script that automates the critical steps.
-# Prevent human operators from producing broken packages, when possible.
-# Allow scheduling and automation of building and publishing milestones.
The current release processes are documented in the following sections.
They attempt to meet these design goals, but there may improvements
remaining to be made toward automating the process.
@section releaseversions Release Versions
The OpenOCD version string is composed of three numeric components
separated by two decimal points: @c x.y.z, where @c x is the @a major
version number, @c y is the @a minor number, and @c z is the @a micro.
For a <i>bug-fix</i> release, the micro version number will be non-zero
(<code>z > 0</code>). For a <i>minor release</i>, the micro version
number will be zero (<code>z = 0</code>). For a <i>major releases</i>,
the minor version will @a also be zero (<code>y = 0, z = 0</code>).
@subsection releaseversiontags Version Tags
After these required numeric components, the version string may contain
one or more <i>version tags</i>, such as '-rc1' or '-dev'.
Mainline and all branches should have the tag '-dev' in
their version number. This tag helps developers identify reports
created from the git repository, and it can be detected and
manipulated by the release script. Specifically, this tag will be
removed and re-added during the release process; it should never be
manipulated by developers in submitted patches.
The 'rc' tags indicate a "release candidate" version of the package.
This tag will also be manipulated by the automated release process.
Additional tags may be used as necessary.
@subsection releaseversionsdist Packager Versions
Distributors of patched versions of OpenOCD are encouraged to extend the
version string with a unique version tag when producing external
releases, as this helps to identify your particular distribution series.
For example, the following command will add a 'foo1' tag to the
configure.in script of a local copy of the source tree:
@code
tools/release.sh version bump tag foo
@endcode
This command will modify the configure.in script in your working copy
only. After running the @c bootstrap sequence, the tree can be patched
and used to produce your own derived versions. The same command can be
used each time the derived package is released, incrementing the tag's
version to facilitate tracking the changes you have distributed.
@subsection releaseversionhow Version Processes
The release process includes version number manipulations to the tree
being released, ensuring that all numbers are incremented at the right
time and in the proper locations of the repository.
The version numbers for any branch should increase monotonically
to the next successive integer, except when reset to zero
during major or minor releases. The community should decide when
major and minor milestones will be released.
@section releasewho Release Manager
OpenOCD archive releases will be produced by an individual filling the
role of <i>Release Manager</i>, hereafter abbreviated as <i>RM</i>. This
individual determines the schedule and executes the release processes
for the community.
@subsection releasewhohow RM Authority
Each release requires one individual to fulfill the RM role; however,
graceful transitions of this authority may take place at any time. The
current RM may transfer their authority to another contributor in a post
to the OpenOCD development mailing list. Such delegation of authority
must be approved by the individual that will receive it and the
community of maintainers. Initial arrangements with the new RM should
be made off-list, as not every contributor wants these responsibilities.
@subsection releasewhowhat RM Responsibilities
In addition to the actual process of producing the releases, the RM is
responsible for keeping the community informed of all progress through
the release cycle(s) being managed. The RM is responsible for managing
the changes to the package version, though the release tools should
manage the tasks of adding or removing any required development branch
tags and incrementing the version.
@section releasewhen Release Schedule
The OpenOCD release process must be carried out on a periodic basis, so
the project can realize the benefits presented in answer to the question,
@ref releasewhy.
Starting with the 0.2.0 release, the OpenOCD project should produce a
new minor release every month or two, with a major release once a year.
Bug fix releases could be provided more frequently. These release
schedule goals may be adjusted in the future, after the project
maintainers and distributors receive feedback and experience.
More importantly, the statements made in this section do not create an
obligation by any member of the OpenOCD community to produce new
releases on regular schedule, now or in the future.
@subsection releasewhenexample Sample Schedule
The RM must pro-actively communicate with the community from the
beginning of the development cycle through the delivery of the new
release. This section presents guidelines for scheduling key points
where the community must be informed of changing conditions.
If T is the time of the next release, then the following schedule
might describe some of the key milestones of the new release cycle:
- T minus one month: start of new development cycle
- T minus two weeks: announce pending mainline closure to new work
- T minus one week: close mainline to new work, begin testing phase
- T minus two days: call for final bug fixes
- T minus one day: produce -rc packages and distribute to testers
- T minus one hour: produce final packages and post on-line
- T minus zero: Announce the release to our mailing list and the world.
Some additional supplemental communication will be desirable. The above
list omits the step-by-step instructions to daily release management.
Individuals performing release management need to have the ability to
interact proactively with the community as a whole, anticipating when
such interaction will be required and giving ample notification.
The next section explains why the OpenOCD project allows significant
flexibility in the part of the development that precedes the release
process.
@note The OpenOCD project does not presently produce -rc packages. As
such, the step suggested in the list above should be read as trying to
stimulate others to test the project build and packaging on as many
platforms as possible. This proposition will be palatable once release
management tools have been committed to the tree.
@subsection releasewhenflex Schedule Flexibility
The Release Manager should attempt to follow the guidelines in this
document, but the process of scheduling each release milestone should be
community driven at the start. By the end, missing features that were
scheduled for a release must be dropped by the Release Manager, rather
than allowing the release cycle to be delayed while waiting for them.
Despite any assurances this schedule may appear to give, the Release
Manager cannot schedule the work that will be done on the project,
when it will be submitted, reviewed, and deemed suitable to be committed.
In this way, the RM cannot act as a priest in a cathedral; OpenOCD uses
the bazaar development model. The release schedule must adapt
continuously in response to changes in the rate of churn.
In particular, the suggested period of "one or two month" reflects some
expectation of a fairly high rate of development. Fewer releases may be
required if developers contribute less patches, and more releases may be
desirable if the project continues to grow and experience high rates of
community contribution. During each cycle, the RM should be tracking
the situation and gathering feedback from the community.
@section releasehow Release Process: Step-by-Step
The release process may require a few iterations to work out any bugs.
Even with the release script, some steps require clear user intervention
-- and not only by the Release Manager.
The following steps should be followed to produce each release:
-# Produce final manual patches to mainline (or release branch):
-# Finalize @c NEWS file to describe the changes in the release
- This file is Used to automatically post "blurbs" about the project.
- This material should be produced during the development cycle.
- Add a new item for each @c NEWS-worthy contribution, when committed.
-# Bump library version if our API changed (not yet required)
-# Produce and tag the final revision in the git repository:
- Update and commit the final package version in @c configure.in :
-# Remove @c -dev tag.
-# Remove @c -rc tag, if producing the final release from an -rc series.
- Tags must be named consistently:
@verbatim
@endverbatim
- Tag the final commit with a consistent GIT tag name and message:
@verbatim
PACKAGE_VERSION="x.y.z"
PACKAGE_TAG="v${PACKAGE_VERSION}"
git tag -m "The openocd-${PACKAGE_VERSION} release." "${PACKAGE_TAG}"
@endverbatim
-# Prepare to resume normal development on the branch:
- Restore @c -dev and -@c -rc0 version tags.
- To start a new major (or minor) release cycle on the @c master branch:
- Bump major (or minor) package version, zeroing sub-components.
- Add -rc0 version tag:
- This insures casual releases from GIT always increase monotonically.
- For example, a major increment after releasing 1.2.3 starts 2.0.0-rc0-dev.
- Archive @c NEWS file as "<code>doc/news/NEWS-${PACKAGE_VERSION}</code>".
- Create a new @c NEWS file for the next release
- To start a bug-fix release on a non-master branch:
-# Bump bug-fix version.
- To start another release candidate on a major or minor branch:
-# Bump rc tag.
-# Produce the package source archives:
-# Start with a clean working copy, used for producing releases only.
-# Checkout the appropriate tag:
<code>git checkout $(git tag ) "${PACKAGE_VERSION}"</code>
-# Produce a ChangeLog for the release (using @c git2cl).
-# @c bootstrap, @c configure, and @c make the package.
-# Run <code>make distcheck</code> to produce the distribution archives.
-# Run <code>make maintainer-clean</code> verify the repository is empty.
-# Create signature files using @c md5sum, @c sha1sum, etc.
-# Publish documentation for the release:
- Allow users to access the documentation for each of our releases.
- Place static copies of the following files on the project website:
- @c NEWS: to provide a blurb for each release
- @c ChangeLog: to show exactly what has been changed
- User Guide, Developer Manual: to allow easy on-line viewing
-# Upload packages and post announcements of their availability:
-# Release packages into files section of project sites:
- SF.net:
-# Create a new folder named "${PACKAGE_VERSION}"
-# Select new folder as the target for uploads.
-# Upload files via Web interface into new
-# Set platform types for each archive:
- .tar.bz2: Linux, Mac
- .tar.gz: BSD, Solaris, Others
- .zip: Windows
- Berlios:
-# Create the new release for the new version.
-# Provide @c NEWS and ChangeLog files, as requested.
-# Upload files via FTP to ftp://ftp.berlios.de/incoming/
-# Edit descriptions for each file.
-# Click button to send E-mail Release Notice.
-# Post announcement e-mail to the openocd-development list.
-# Announce updates on freshmeat.net and other trackers.
-# Submit big updates to news feeds (e.g. Digg, Reddit, etc.).
@section releasescript The Release Script
Many of the processes described in the last section are no longer
entrusted to humans. Instead, the @c release.sh script provides
automation of the mechanical steps.
Presently, the @c release.sh script automates steps 2 through 4,
allowing the Release Manager from perform these tasks in easy steps.
The following task still need to be automated:
- Step 5: produce documentation for website using released source archive.
- Step 6(a): package archive upload process.
- Step 6(b): package announcement e-mail process.
- Step 6(c): post files and announce them using releaseforge.
@subsection releasescriptcmds Release Script Commands
The release script can be used for two tasks:
- Creating releases and starting a new release cycle:
@code
git checkout master
tools/release.sh --type=minor --final --start-rc release
@endcode
- Creating a development branch from a tagged release:
@code
git checkout 'v0.2.0'
tools/release.sh --type=micro branch
@endcode
Both of these variations make automatic commits and tags in your
repository, so you should be sure to run it on a cloned copy before
proceding with a live release.
@subsection releasescriptopts Release Script Options
The @c release.sh script recognizes some command-line options that
affect its behavior:
- The @c --start-rc indicates that the new development release cycle
should start with @c -rc0. Without this, the @c -rc tag will be omitted,
leading to non-monotonic versioning of the in-tree version numbers.
- The @c --final indicates that the release should drop the @c -rc tag,
to going from @c x.y.z-rcN-dev to x.y.z.
@subsection releasescriptenv Release Script Environment
The @c release.sh script recognizes some environment variables which
affect its behavior:
- @c CONFIG_OPTS : Passed as options to the configure script.
- @c MAKE_OPTS : Passed as options to the 'make' processes.
@section releasetutorial Release Tutorials
This section should contain a brief tutorial for using the Release
Script to perform release tasks, but the new script needs to be
used for 0.3.0.
@section releasetodo Release Script Shortcomings
Improved automated packaging and distribution of OpenOCD requires more
patching of the configure script. The final release script should be
able to manage most steps of the processes. The steps requiring user
input could be guided by an "assistant" that walks the Release Manager
through the process from beginning to end, performing basic sanity
checks on their various inputs (e.g. the @c NEWS blurb).
*/
/** @file
This file contains the @ref releases page.
*/

View File

@@ -1,13 +1,11 @@
Plan for hosted scripting support in OpenOCD
============================================
/** @page scripting Scripting Overview
What scripting will not do
==========================
It is not the intention that normal OpenOCD users will
use tcl scripting extensively, write lots of clever scripts,
or contribute back to OpenOCD.
@section scriptingisnt What scripting will not do
The scripting support is intended for developers of OpenOCD.
It is not the intention that normal OpenOCD users will
use tcl scripting extensively, write lots of clever scripts,
or contribute back to OpenOCD.
Target scripts can contain new procedures that end users may
tinker to their needs without really understanding tcl.
@@ -17,23 +15,23 @@ language, the choice of language is not terribly important
to those same end users.
Jim Tcl was chosen as it was easy to integrate, works
great in an embedded environment and Øyvind Harboe
great in an embedded environment and Øyvind Harboe
had experience with it.
Uses of scripting
=================
@section scriptinguses Uses of scripting
Default implementation of procedures in tcl/procedures.tcl.
- Polymorphic commands for target scripts.
- there will be added some commands in Tcl that the target
scripts can replace.
- produce <productionfile> <serialnumber>. Default implementation
- produce \<productionfile\> \<serialnumber\>. Default implementation
is to ignore serial number and write a raw binary file
to beginning of first flash. Target script can dictate
file format and structure of serialnumber. Tcl allows
an argument to consit of e.g. a list so the structure of
an argument to consist of e.g. a list so the structure of
the serial number is not limited to a single string.
- reset handling. Precise control of how srst, trst &
- reset handling. Precise control of how srst, trst &
tms is handled.
- replace some parts of the current command line handler.
This is only to simplify the implementation of OpenOCD
@@ -44,7 +42,7 @@ Default implementation of procedures in tcl/procedures.tcl.
that return machine readable output. These low level tcl
functions constitute the tcl api. flash_banks is such
a low level tcl proc. "flash banks" is an example of
a command that has human readable output. The human
a command that has human readable output. The human
readable output is expected to change inbetween versions
of OpenOCD. The output from flash_banks may not be
in the preferred form for the client. The client then
@@ -52,10 +50,10 @@ Default implementation of procedures in tcl/procedures.tcl.
or b) write a small piece of tcl to output the
flash_banks output to a more suitable form. The latter may
be simpler.
External scripting
==================
@section scriptingexternal External scripting
The embedded Jim Tcl interpreter in OpenOCD is very limited
compared to any full scale PC hosted scripting language.
@@ -78,3 +76,5 @@ unknown commands to OpenOCD.
Basically a PC version of startup.tcl. Patches most
gratefully accepted! :-)
*/

325
doc/manual/server.txt Normal file
View File

@@ -0,0 +1,325 @@
/** @page serverdocs OpenOCD Server APIs
OpenOCD provides support for implementing different types of servers.
Presently, the following servers have APIs that can be used.
- @subpage servergdb
- @subpage servertelnet
- @subpage serverhttp
@section serverdocsoverview Overview
What follows is a development history, and describes some of the intent
of why certain features exist within OpenOCD along with the reasoning
behind them.
This roadmap section was written May 2009 - about 9 to 12 months
after some of this work had started, it attempts to document some of
the reasons why certain features exist within OpenOCD at that time.
@section serverdocsbg Background
In early 2008, Oyvind Harboe and Duane Ellis had talked about how to
create a reasonable GUI for OpenOCD - something that is non-invasive,
simple to use and maintain, and does not tie OpenOCD to many other
packages. It would be wrong to "spider web" requirements into other
external external packages. That makes it difficult for developers to
write new code and creates a support nightmare.
In many ways, people had talked about the need for some type of
high-level interface to OpenOCD, because they only had two choices:
- the ability to script: via an external program the actions of OpenOCD.
- the ablity to write a complex internal commands: native 'commands'
inside of OpenOCD was complicated.
Fundamentally, the basic problem with both of those would be solved
with a script language:
-# <b>Internal</b>: simple, small, and self-contained.
-# <b>Cross Language</b>: script friendly front-end
-# <b>Cross Host</b>: GUI Host interface
-# <b>Cross Debugger</b>: GUI-like interface
What follows hopefully shows how the plans to solve these problems
materialized and help to explain the grand roadmap plan.
@subsection serverdocsjim Why JimTCL? The Internal Script Language
At the time, the existing "command context schema" was proving itself
insufficient. However, the problem was also considered from another
direction: should OpenOCD be first class and the script second class?
Which one rules?
In the end, OpenOCD won, the conclusion was that simpler will be better.
Let the script language be "good enough"; it would not need numerous
features. Imagine debugging an embedded Perl module while debugging
OpenOCD. Yuck. OpenOCD already has a complex enough build system, why
make it worse?
The goal was to add a simple language that would be moderately easy to
work with and be self-contained. JimTCL is a single C and single H
file, allowing OpenOCD to avoid the spider web of dependent packages.
@section serverdocstcl TCL Server Port
The TCL Server port was added in mid-2008. With embedded TCL, we can
write scripts internally to help things, or we can write "C" code that
interfaces well with TCL.
From there, the developers wanted to create an external front-end that
would be @a very usable and that that @a any language could utilize,
allowing simple front-ends to be (a) cross-platform (b) languag
agnostic, and (c) easy to develop and use.
Simple ASCII protocols are easy. For example, HTTP, FTP (control), and
SMTP are all text-based. All of these examples are widely and
well-known, and they do not require high-speed or high-volume. They
also support a high degree of interoperability with multiple systems.
They are not human-centric protocols; more correctly, they are rigid,
terse, simple ASCII protocols that are emensely parsable by a script.
Thus, the TCL server -- a 'machine' type socket interface -- was added
with the hope was it would output simple "name-value" pair type
data. At the time, simple name/value pairs seemed reasonably easier to
do at the time, though Maybe it should output JSON;
See here:
http://www.mail-archive.com/openocd-development%40lists.berlios.de/msg00248.html
The hope was that one could write a script in what ever language you want
and do things with it!
@section serverdocsgui GUI Like Interfaces
A lot has been said about various "widigit-foo-gui-library is so
wonderful". Please refer back to the domino and spider web problem of
dependencies. Sure, you may well know the WhatEver-GUI library, but
most others will not (including the next contributer to OpenOCD).
How do we solve that problem?
For example, Cygwin can be painful, Cygwin GUI packages want X11
to be present, crossing the barrier between MinGW and Cygwin is
painful, let alone getting the GUI front end to work on MacOS, and
Linux, yuck yuck yuck. Painful. very very painful.
What works easier and is less work is what is already present in every
platform? The answer: A web browser. In other words, OpenOCD could
serve out embedded web pages via "localhost" to your browser.
Long before OpenOCD had a TCL command line, Zylin AS built their ZY1000
devince with a built-in HTTP server. Later, they were willing to both
contribute and integrate most of that work into the main tree.
@subsection serverdocsother Other Options Considered
What if a web browser is not acceptable ie: You want to write your own
front gadget in Eclipse, or KDevelop, or PerlTK, Ruby, or what ever
the latest and greatest Script De Jour is.
- Option 1: Can we transport this extra data through the GDB server
protocol? In other words, can we extend the GDB server protocol?
No, Eclipse wants to talk to GDB directly and control the GDB port.
- Option 2: SWIG front end (libopenocd): Would that work?
That's painful - unless you design your api to be very simplistic -
every language has it's own set of wack-ness, parameter marshaling is
painful.
What about "callbacks" and structures, and other mess. Imagine
debugging that system. When JimTCL was introduced Spencer Oliver had
quite a few well-put concerns (Summer 2008) about the idea of "TCL"
taking over OpenOCD. His concern is and was: how do you debug
something written in 2 different languages? A "SWIG" front-end is
unlikely to help that situation.
@subsection serverdoccombined Combined: Socket & WebServer Benifits
Seriously think about this question: What script language (or compiled
language) today cannot talk directly to a socket? Every thing in the
OpenOCD world can work a socket interface. Any host side tool can talk
to Localhost or remote host, however one might want to make it work.
A socket interface is very simple. One could write a Java application
and serve it out via the embedded web server, could it - or something
like it talk to the built in TCL server? Yes, absolutely! We are on to
something here.
@subsection serverdocplatforms Platform Permuntations
Look at some permutations where OpenOCD can run; these "just work" if
the Socket Approach is used.
- Linux/Cygwin/MinGw/MacOSx/FreeBSD development Host Locally
- OpenOCD with some dongle on that host
- Linux/Cygwin/MingW/MacOS/FreeBSD development host
- DONGLE: tcpip based ARM-Linux perhaps at91rm9200 or ep93xx.c, running openocd.
- Windows cygwin/X desktop environment.
- Linux development host (via remote X11)
- Dongle: "eb93xx.c" based linux board
@subsection serverdocfuture Development Scale Out
During 2008, Duane Ellis created some TCL scripts to display peripheral
register contents. For example, look at the sam7 TCL scripts, and the
stm32 TCL scripts. The hope was others would create more.
A good example of this is display/view the peripheral registers on
your embedded target. Lots of commercial embedded debug tools have
this, some can show the TIMER registers, the interrupt controller.
What if the chip companies behind STM32, or PIC32, AT91SAM chips -
wanted to write something that makes working with their chip better,
easier, faster, etc.
@a Question: How can we (the OpenOCD group) make that really fancy
stuff across multiple different host platforms?
Remember: OpenOCD runs on:
-# Linux via USB,
-# ARM Linux - bit-banging GPIO pins
-# MacOSX
-# FreeBSD
-# Cygwin
-# MinGW32
-# Ecos
How can we get that to work?
@subsection serverdocdebug What about Debugger Plugins?
Really GDB is nice, it works, but it is not a good embedded debug tool.
OpenOCD cannot work in a GUI when one cannot get to its command line.
Some GDB front-end developers have pedantic designs that refuse any and
all access to the GDB command line (e.g. http://www.kdbg.org/todo.php).
The TELNET interface to OpenOCD works, but the intent of that interface
is <b>human interaction</b>. It must remain available, developers depend
upon it, sometimes that is the only scheme available.
As a small group of developers, supporting all the platforms and
targets in the debugger will be difficult, as there are enough problem
with the plethora of Dongles, Chips, and different target boards.
Yes, the TCL interface might be suitable, but it has not received much
love or attention. Perhaps it will after you read and understand this.
One reason might be, this adds one more host side requirement to make
use of the feature. In other words, one could write a Python/TK
front-end, but it is only useable if you have Python/TK installed.
Maybe this can be done via Ecllipse, but not all developers use Ecplise.
Many devlopers use Emacs (possibly with GUD mode) or vim and will not
accept such an interface. The next developer reading this might be
using Insight (GDB-TK) - and somebody else - DDD..
There is no common host-side GDB front-end method.
@section serverdocschallenge Front-End Scaling
Maybe we are wrong - ie: OpenOCD + some TK tool
Remember: OpenOCD is often (maybe 99.9%) of the time used with
GDB-REMOTE. There is always some front-end package - be it command-line
GDB under DDD, Eclipse, KDevelop, Emacs, or some other package
(e.g. IAR tools can talk to GDB servers). How can the OpenOCD
developers make that fancy target display GUI visible under 5 to 10
different host-side GDB..
Sure - a <em>man on a mission</em> can make that work. The GUI might be
libopenocd + Perl/TK, or maybe an Eclipse Plug-in.
That is a development support nightmare for reasons described
above. We have enough support problems as it is with targets, dongles,
etc.
@section serverdocshttpbg HTTP Server Background
OpenOCD includes an HTTP server because most development environments
are likely contain a web browser. The web browser can talk to OpenOCD's
HTTP server and provide a high-level interfaces to the program.
Altogether, it provides a universally accessible GUI for OpenOCD.
@section serverdocshtml Simple HTML Pages
There is (or could be) a simple "Jim TCL" function to read a memory
location. If that can be tied into a TCL script that can modify the
HTTP text, then we have a simple script-based web server with a JTAG
engine under the hood.
Imagine a web page - served from a small board with two buttons:
"LED_ON" and "LED_OFF", each click - turns the LED on or OFF, a very
simplistic idea. Little boards with web servers are great examples of
this: Ethernut is a good example and Contiki (not a board, an embedded
OS) is another example.
One could create a simple: <b>Click here to display memory</b> or maybe
<b>click here to display the UART REGISTER BLOCK</b>; click again and see
each register explained in exquisit detail.
For an STM32, one could create a simple HTML page, with simple
substitution text that the simple web server use to substitute the
HTML text JIMTCL_PEEK32( 0x12345678 ) with the value read from
memory. We end up with an HTML page that could list the contents of
every peripheral register on the target platform.
That also is transportable, regardless of the OpenOCD host
platform: Linux/X86, Linux/ARM, FreeBSD, Cygwin, MingW, or MacOSX.
You could even port OpenOCD to an Google Android and use it as a
bit-bang dongle JTAG serving web pages.
@subsection serverdocshtmladv Advanced HTML Pages
Java or JavaScript could be used to talk back to the TCL port. One
could write a Java, AJAX, FLASH, or some other developer friendly
toolbox and get a real cross-platform GUI interface. Sure, the interface
is not native - but it is 100% cross-platform!
OpenOCD current uses simple HTML pages; others might be an Adobe FLASH
expert, or a Java Expert. These possibilities could allow the pages
remain cross-platform but still provide a rich user-interface
experience.
Don't forget it can also be very simple, exactly what one developer
can contribute, a set of very simple web pages.
@subsection serverdocshtmlstatus HTTP/HTML Status
As of May 2009, much of the HTML pages were contributed by Zylin AS,
hence they continue to retain some resemblance to the ZY1000 interface.
Patches would be welcome to move these parts of the system forward.
*/
/** @page servergdb OpenOCD GDB Server API
This section needs to be expanded.
*/
/** @page servertelnet OpenOCD Telnet Server API
This section needs to be expanded.
*/
/** @page serverhttp OpenOCD HTTP Server API
Smoketest:
configure --enable-httpd --enable-dummy --enable-ioutil
openocd -s /usr/local/share/openocd -f httpd/httpd.tcl -f interface/dummy.cfg -f target/lpc2148.cfg
Navigate to: http://localhost:8888/
*/

399
doc/manual/style.txt Normal file
View File

@@ -0,0 +1,399 @@
/** @page styleguide Style Guides
The goals for each of these guides are:
- to produce correct code that appears clean, consistent, and readable,
- to allow developers to create patches that conform to a standard, and
- to eliminate these issues as points of future contention.
Some of these rules may be ignored in the spirit of these stated goals;
however, such exceptions should be fairly rare.
The following style guides describe a formatting, naming, and other
conventions that should be followed when writing or changing the OpenOCD
code:
- @subpage styletcl
- @subpage stylec
- @subpage styleperl
- @subpage styleautotools
In addition, the following style guides provide information for
providing documentation, either as part of the C code or stand-alone.
- @subpage styledoxygen
- @subpage styletexinfo
- @subpage stylelatex
Feedback would be welcome to improve the OpenOCD guidelines.
*/
/** @page styletcl TCL Style Guide
OpenOCD needs to expand its Jim/TCL Style Guide.
Many of the guidelines listed on the @ref stylec page should apply to
OpenOCD's Jim/TCL code as well.
*/
/** @page stylec C Style Guide
This page contains guidelines for writing new C source code for the
OpenOCD project.
@section styleformat Formatting Guide
- remove any trailing white space at the end of lines.
- use TAB characters for indentation; do NOT use spaces.
- displayed TAB width is 4 characters.
- use Unix line endings ('\\n'); do NOT use DOS endings ('\\r\\n')
- limit adjacent empty lines to at most two (2).
- remove any trailing empty lines at the end of source files
- do not "comment out" code from the tree; instead, one should either:
-# remove it entirely (git can retrieve the old version), or
-# use an @c \#if/\#endif block.
Finally, try to avoid lines of code that are longer than than 72-80 columns:
- long lines frequently indicate other style problems:
- insufficient use of static functions, macros, or temporary variables
- poor flow-control structure; "inverted" logical tests
- a few lines may be wider than this limit (typically format strings), but:
- all C compilers will concatenate series of string constants.
- all long string constants should be split across multiple lines.
@section stylenames Naming Rules
- most identifiers must use lower-case letters (and digits) only.
- macros must use upper-case letters (and digits) only.
- OpenOCD identifiers should NEVER use @c MixedCaps.
- structure names must end with the '_s' suffix.
- typedef names must end with the '_t' suffix.
- use underline characters between consecutive words in identifiers
(e.g. @c more_than_one_word).
@section stylec99 C99 Rules
- inline functions
- @c // comments -- in new code, prefer these for single-line comments
- trailing comma allowed in enum declarations
- designated initializers (@{ .field = value @})
- variables declarations may be mixed with code
- new block scopes for selection and iteration statements
@section styletypes Type Guidelines
- use native types (@c int or @c unsigned) if the type is not important
- if size matters, use the types from \<stdint.h\> or \<inttypes.h\>:
- @c int8_t, @c int16_t, @c int32_t, or @c int64_t: signed types of specified size
- @c uint8_t, @c uint16_t, @c uint32_t, or @c uint64_t: unsigned types of specified size
- do @b NOT redefine @c uN types from "types.h"
@section stylefunc Functions
- static inline functions should be prefered over macros:
@code
/** do NOT define macro-like functions like this... */
#define CUBE(x) ((x) * (x) * (x))
/** instead, define the same expression using a C99 inline function */
static inline int cube(int x) { return x * x * x; }
@endcode
- Functions should be declared static unless required by other modules
- define static functions before first usage to avoid forward declarations.
- Functions should have no space between its name and its parameter list:
@code
int f(int x1, int x2)
{
...
int y = f(x1, x2 - x1);
...
}
@endcode
- Separate assignment and logical test statements. In other words, you
should write statements like the following:
@code
// separate statements should be preferred
result = foo();
if (ERROR_OK != result)
...
@endcode
More directly, do @b not combine these kinds of statements:
@code
// Combined statements should be avoided
if (ERROR_OK != (result = foo()))
return result;
@endcode
*/
/** @page styledoxygen Doxygen Style Guide
The following sections provide guidelines for OpenOCD developers
who wish to write Doxygen comments in the code or this manual.
For an introduction to Doxygen documentation,
see the @ref primerdoxygen.
@section styledoxyblocks Doxygen Block Selection
Several different types of Doxygen comments can be used; often,
one style will be the most appropriate for a specific context.
The following guidelines provide developers with heuristics for
selecting an appropriate form and writing consistent documentation
comments.
-# use @c /// to for one-line documentation of instances.
-# for documentation requiring multiple lines, use a "block" style:
@verbatim
/**
* @brief First sentence is short description. Remaining text becomes
* the full description block, where "empty" lines start new paragraphs.
*
* One can make text appear in @a italics, @b bold, @c monospace, or
* in blocks such as the one in which this example appears in the Style
* Guide. See the Doxygen Manual for the full list of commands.
*
* @param foo For a function, describe the parameters (e.g. @a foo).
* @returns The value(s) returned, or possible error conditions.
*/
@endverbatim
-# The block should start on the line following the opening @c /**.
-# The end of the block, \f$*/\f$, should also be on its own line.
-# Every line in the block should have a @c '*' in-line with its start:
- A leading space is required to align the @c '*' with the @c /** line.
- A single "empty" line should separate the function documentation
from the block of parameter and return value descriptions.
- Except to separate paragraphs of documentation, other extra
"empty" lines should be removed from the block.
-# Only single spaces should be used; do @b not add mid-line indentation.
-# If the total line length will be less than 72-80 columns, then
- The @c /**< form can be used on the same line.
- This style should be used sparingly; the best use is for fields:
@code int field; /**< field description */ @endcode
@section styledoxyall Doxygen Style Guide
The following guidelines apply to all Doxygen comment blocks:
-# Use the @c '\@cmd' form for all doxygen commands (do @b not use @c '\\cmd').
-# Use symbol names such that Doxygen automatically creates links:
-# @c function_name() can be used to reference functions
(e.g. flash_set_dirty()).
-# @c struct_name::member_name should be used to reference structure
fields in the documentation (e.g. @c flash_driver_s::name).
-# URLS get converted to markup automatically, without any extra effort.
-# new pages can be linked into the heirarchy by using the @c \@subpage
command somewhere the page(s) under which they should be linked:
-# use @c \@ref in other contexts to create links to pages and sections.
-# Use good Doxygen mark-up:
-# '\@a' (italics) should be used to reference parameters (e.g. <i>foo</i>).
-# '\@b' (bold) should be used to emphasizing <b>single</b> words.
-# '\@c' (monospace) should be used with <code>file names</code> and
<code>code symbols</code>, so they appear visually distinct from
surrounding text.
-# To mark-up multiple words, the HTML alternatives must be used.
-# Two spaces should be used when nesting lists; do @b not use '\\t' in lists.
-# Code examples provided in documentation must conform to the Style Guide.
@section styledoxytext Doxygen Text Inputs
In addition to the guidelines in the preceding sections, the following
additional style guidelines should be considered when writing
documentation as part of standalone text files:
-# Text files must contain Doxygen at least one comment block:
-# Documentation should begin in the first column (except for nested lists).
-# Do NOT use the @c '*' convention that must be used in the source code.
-# Each file should contain at least one @c \@page block.
-# Each new page should be listed as a \@subpage in the \@page block
of the page that should serve as its parent.
-# Large pages should be structure in parts using meaningful \@section
and \@subsection commands.
-# Include a @c \@file block at the end of each Doxygen @c .txt file to
document its contents:
- Doxygen creates such pages for files automatically, but no content
will appear on them for those that only contain manual pages.
- The \@file block should provide useful meta-documentation to assist
techincal writers; typically, a list of the pages that it contains.
- For example, the @ref styleguide exists in @c doc/manual/style.txt,
which contains a reference back to itself.
-# The \@file and \@page commands should begin on the same line as
the start of the Doxygen comment:
@verbatim
/** @page pagename Page Title
Documentation for the page.
*/
/** @file
This file contains the @ref pagename page.
*/
@endverbatim
For an example, the Doxygen source for this Style Guide can be found in
@c doc/manual/style.txt, alongside other parts of The Manual.
*/
/** @page styletexinfo Texinfo Style Guide
The User's Guide is there to provide two basic kinds of information. It
is a guide for how and why to use each feature or mechanism of OpenOCD.
It is also the reference manual for all commands and options involved
in using them, including interface, flash, target, and other drivers.
At this time, it is the only user-targetted documentation; everything
else is addressing OpenOCD developers.
There are two key audiences for the User's Guide, both developer based.
The primary audience is developers using OpenOCD as a tool in their
work, or who may be starting to use it that way. A secondary audience
includes developers who are supporting those users by packaging or
customizing it for their hardware, installing it as part of some software
distribution, or by evolving OpenOCD itself. There is some crossover
between those audiences. We encourage contributions from users as the
fundamental way to evolve and improve OpenOCD. In particular, creating
a board or target specific configuration file is something that many
users will end up doing at some point, and we like to see such files
become part of the mainline release.
General documentation rules to remember include:
- Be concise and clear. It's work to remove those extra words and
sentences, but such "noise" doesn't help readers.
- Make it easy to skim and browse. "Tell what you're going to say,
then say it". Help readers decide whether to dig in now, or
leave it for later.
- Make sure the chapters flow well. Presentations should not jump
around, and should move easily from overview down to details.
- Avoid using the passive voice.
- Address the reader to clarify roles ("your config file", "the board you
are debugging", etc.); "the user" (etc) is artificial.
- Use good English grammar and spelling. Remember also that English
will not be the first language for many readers. Avoid complex or
idiomatic usage that could create needless barriers.
- Use examples to highlight fundamental ideas and common idioms.
- Don't overuse list constructs. This is not a slide presentation;
prefer paragraphs.
When presenting features and mechanisms of OpenOCD:
- Explain key concepts before presenting commands using them.
- Tie examples to common developer tasks.
- When giving instructions, you can \@enumerate each step both
to clearly delineate the steps, and to highlight that this is
not explanatory text.
- When you provide "how to use it" advice or tutorials, keep it
in separate sections from the reference material.
- Good indexing is something of a black art. Use \@cindex for important
concepts, but don't overuse it. In particular, rely on the \@deffn
indexing, and use \@cindex primarily with significant blocks of text
such as \@subsection. The \@dfn of a key term may merit indexing.
- Use \@xref (and \@anchor) with care. Hardcopy versions, from the PDF,
must make sense without clickable links (which don't work all that well
with Texinfo in any case). If you find you're using many links,
read that as a symptom that the presentation may be disjointed and
confusing.
- Avoid font tricks like \@b, but use \@option, \@file, \@dfn, \@emph
and related mechanisms where appropriate.
For technical reference material:
- It's OK to start sections with explanations and end them with
detailed lists of the relevant commands.
- Use the \@deffn style declarations to define all commands and drivers.
These will automatically appear in the relevant index, and those
declarations help promote consistent presentation and style.
- It's a "Command" if it can be used interactively.
- Else it's a "Config Command" if it must be used before the
configuration stage completes.
- For a "Driver", list its name.
- Use BNF style regular expressions to define parameters:
brackets around zero-or-one choices, parentheses around
exactly-one choices.
- Use \@option, \@file, \@var and other mechanisms where appropriate.
- Say what output it displays, and what value it returns to callers.
- Explain clearly what the command does. Sometimes you will find
that it can't be explained clearly. That usually means the command
is poorly designed; replace it with something better, if you can.
- Be complete: document all commands, except as part of a strategy
to phase something in or out.
- Be correct: review the documentation against the code, and
vice versa.
- Alphabetize the \@defn declarations for all commands in each
section.
- Keep the per-command documentation focussed on exactly what that
command does, not motivation, advice, suggestions, or big examples.
When commands deserve such expanded text, it belongs elsewhere.
Solutions might be using a \@section explaining a cluster of related
commands, or acting as a mini-tutorial.
- Details for any given driver should be grouped together.
The User's Guide is the first place most users will start reading,
after they begin using OpenOCD. Make that investment of their time
be as productive as possible. Needing to look at OpenOCD source code,
to figure out how to use it is a bad sign, though it's OK to need to
look at the User's guide to figure out what a config script is doing.
*/
/** @page stylelatex LaTeX Style Guide
This page needs to provide style guidelines for using LaTeX, the
typesetting language used by The References for OpenOCD Hardware.
Likewise, the @ref primerlatex for using this guide needs to be completed.
*/
/** @page styleperl Perl Style Guide
This page provides some style guidelines for using Perl, a scripting
language used by several small tools in the tree:
-# Ensure all Perl scripts use the proper suffix (@c .pl for scripts, and
@c .pm for modules)
-# Pass files as script parameters or piped as input:
- Do NOT code paths to files in the tree, as this breaks out-of-tree builds.
- If you must, then you must also use an automake rule to create the script.
-# use @c '#!/usr/bin/perl' as the first line of Perl scripts.
-# always <code>use strict</code> and <code>use warnings</code>
-# invoke scripts indirectly in Makefiles or other scripts:
@code
perl script.pl
@endcode
Maintainers must also be sure to follow additional guidelines:
-# Ensure that Perl scripts are committed as executables:
Use "<code>chmod +x script.pl</code>"
@a before using "<code>git add script.pl</code>"
*/
/** @page styleautotools Autotools Style Guide
This page contains style guidelines for the OpenOCD autotools scripts.
The following guidelines apply to the @c configure.in file:
- Better guidelines need to be developed, but until then...
- Use good judgement.
The following guidelines apply to @c Makefile.am files:
-# When assigning variables with long lists of items:
-# Separate the values on each line to make the files "patch friendly":
@code
VAR = \
value1 \
value2 \
...
value9 \
value10
@endcode
*/
/** @file
This file contains the @ref styleguide pages. The @ref styleguide pages
include the following Style Guides for their respective code and
documentation languages:
- @ref styletcl
- @ref stylec
- @ref styledoxygen
- @ref styletexinfo
- @ref stylelatex
- @ref styleperl
- @ref styleautotools
*/

45
doc/manual/target.txt Normal file
View File

@@ -0,0 +1,45 @@
/** @page targetdocs OpenOCD Target APIs
OpenOCD provides its Target APIs to allow developers to provide trace and
debugging support for specific device targets. These primarily consist of
ARM cores, but other types have been supported. New targets should be
developed by following or using these APIs.
The Target Support module contains APIs that cover several functional areas:
- @subpage targetarm
- @subpage targetnotarm
- @subpage targetregister
- @subpage targetimage
- @subpage targettrace
This section needs to be expanded.
*/
/** @page targetarm OpenOCD ARM Targets
This section needs to describe OpenOCD's ARM target support.
*/
/** @page targetregister OpenOCD Target Register API
This section needs to describe OpenOCD's Target Register API, as
provided by 'src/target/register.h'.
*/
/** @page targetimage OpenOCD Target Image API
This section needs to describe OpenOCD's Target Image API, as provided
by 'src/target/image.h'.
*/
/** @page targettrace OpenOCD Target Trace API
This section needs to describe OpenOCD's Target Trace API, as provided
by 'src/target/trace.h'.
*/

View File

@@ -1,15 +1,9 @@
Some outstanding issues w.r.t. non-ARM32 targets
================================================
This file describes outstanding issues w.r.t.
non-ARM32 targets.
/** @page targetnotarm OpenOCD Non-ARM Targets
Ideas & patches welcome!
This page describes outstanding issues w.r.t. non-ARM targets.
@section targetnotarmflash Flash drivers
Flash drivers
-------------
The flash drivers contain ARM32 code that is used
to execute code on the target.
@@ -26,25 +20,24 @@ compile the target flash drivers. Perhaps
using automake?
eCos has CFI driver that could probably be compiled
for all targets. The trick is to figure out a
way to make the compiled flash drivers work
on all target memory maps + sort out all the
little details
32 vs. 64 bit
-------------
@section targetnotarm32v64 32 vs. 64 bit
Currently OpenOCD only supports 32 bit targets.
Adding 64 bit support would be nice but there
hasn't been any call for it in the openocd development
mailing list
target support
--------------
@section targetnotarmsupport Target Support
target.h is relatively CPU agnostic and
the intention is to move in the direction of less
the intention is to move in the direction of less
instruction set specific.
Non-CPU targets are also supported, but there isn't
@@ -53,8 +46,8 @@ An example is FPGA programming support via JTAG,
but also flash chips can be programmed directly
using JTAG.
non-JTAG physical layer
-----------------------
@section targetnotarmphy non-JTAG physical layer
JTAG is not the only physical protocol used to talk to
CPUs.
@@ -63,14 +56,16 @@ OpenOCD does not today have targets that use non-JTAG.
The actual physical layer is a relatively modest part
of the total OpenOCD system.
PowerPC
-------
@section targetnotarmppc PowerPC
there exists open source implementations of powerpc
target manipulation, but there hasn't been a lot
of activity in the mailing list.
MIPS
----
@section targetnotarmmips MIPS
Currently OpenOCD has a MIPS target defined. This is the
first non-ARM example of a CPU target
first non-ARM example of a CPU target
*/

View File

@@ -8,19 +8,19 @@ boundary\-scan testing tool for ARM and MIPS systems
.B OpenOCD
is an on\-chip debugging, in\-system programming and boundary\-scan
testing tool for various ARM and MIPS systems.
.PP
.PP
The debugger uses an IEEE 1149\-1 compliant JTAG TAP bus master to access
on\-chip debug functionality available on ARM based microcontrollers or
system-on-chip solutions. For MIPS systems the EJTAG interface is supported.
.PP
.PP
User interaction is realized through a telnet command line interface,
a gdb (the GNU debugger) remote protocol server, and a simplified RPC
connection that can be used to interface with OpenOCD's Jim Tcl engine.
.PP
.PP
OpenOCD supports various different types of JTAG interfaces/programmers,
please check the \fIopenocd\fR info page for the complete list.
.SH "OPTIONS"
.TP
.TP
.B "\-f, \-\-file <filename>"
Use configuration file
.BR <filename> .
@@ -29,43 +29,43 @@ In order to specify multiple config files, you can use multiple
arguments. If this option is omitted, the config file
.B openocd.cfg
in the current working directory will be used.
.TP
.TP
.B "\-s, \-\-search <dirname>"
Search for config files and scripts in the directory
.BR <dirname> .
If this option is omitted, OpenOCD searches for config files and scripts
in the current directory.
.TP
.TP
.B "\-d, \-\-debug <debuglevel>"
Set debug level. Possible values are:
.br
.br
.RB " * " 0 " (errors)"
.br
.br
.RB " * " 1 " (warnings)"
.br
.br
.RB " * " 2 " (informational messages)"
.br
.br
.RB " * " 3 " (debug messages)"
.br
.br
The default level is
.BR 2 .
.TP
.TP
.B "\-l, \-\-log_output <filename>"
Redirect log output to the file
.BR <filename> .
Per default the log output is printed on
.BR stderr .
.TP
.TP
.B "\-c, \-\-command <cmd>"
Run the command
.BR <cmd> .
.TP
.TP
.B "\-p, \-\-pipe"
Use pipes when talking to gdb.
.TP
.TP
.B "\-h, \-\-help"
Show a help text and exit.
.TP
.TP
.B "\-v, \-\-version"
Show version information and exit.
.SH "BUGS"
@@ -95,6 +95,6 @@ Also, the OpenOCD wiki contains some more information and examples:
.B http://openfacts.berlios.de/index-en.phtml?title=Open_On-Chip_Debugger
.SH "AUTHORS"
Please see the file AUTHORS.
.PP
.PP
This manual page was written by Uwe Hermann <uwe@hermann\-uwe.de>.
It is licensed under the terms of the GNU GPL (version 2 or later).

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,7 @@
#####ECOSGPLCOPYRIGHTBEGIN####
## -------------------------------------------
## This file is part of eCos, the Embedded Configurable Operating System.
## Copyright (C) 2008 Øyvind Harboe
## Copyright (C) 2008 Øyvind Harboe
##
## eCos is free software; you can redistribute it and/or modify it under
## the terms of the GNU General Public License as published by the Free

View File

@@ -2,7 +2,7 @@
#####ECOSGPLCOPYRIGHTBEGIN####
## -------------------------------------------
## This file is part of eCos, the Embedded Configurable Operating System.
## Copyright (C) 2008 Øyvind Harboe
## Copyright (C) 2008 Øyvind Harboe
##
## eCos is free software; you can redistribute it and/or modify it under
## the terms of the GNU General Public License as published by the Free

View File

@@ -2,7 +2,7 @@
#####ECOSGPLCOPYRIGHTBEGIN####
## -------------------------------------------
## This file is part of eCos, the Embedded Configurable Operating System.
## Copyright (C) 2008 Øyvind Harboe
## Copyright (C) 2008 Øyvind Harboe
##
## eCos is free software; you can redistribute it and/or modify it under
## the terms of the GNU General Public License as published by the Free
@@ -53,7 +53,7 @@ int init()
*t=0;
}
return flash_init((_printf *)&myprintf);
}
@@ -68,15 +68,15 @@ int checkFlash(void *addr, int len)
}
int erase(void *address, int len)
int erase(void *address, int len)
{
int retval;
void *failAddress;
retval=checkFlash(address, len);
if (retval!=0)
return retval;
retval=init();
if (retval!=0)
return retval;
@@ -88,14 +88,14 @@ int erase(void *address, int len)
extern char _end;
// Data follows immediately after program, long word aligned.
int program(void *buffer, void *address, int len)
int program(void *buffer, void *address, int len)
{
int retval;
void *failAddress;
retval=checkFlash(address, len);
if (retval!=0)
return retval;
retval=init();
if (retval!=0)
return retval;

View File

@@ -1,9 +1,83 @@
#!/bin/bash
#!/bin/sh
#
# This scripts adds local version information from the version
# control systems git, mercurial (hg) and subversion (svn).
#
# Copied from Linux 2.6.32 scripts/setlocalversion and modified
# slightly to work better for OpenOCD.
#
REV=unknown
usage() {
echo "Usage: $0 [srctree]" >&2
exit 1
}
which svnversion > /dev/null 2>&1 && REV=`svnversion -n`
cd "${1:-.}" || usage
echo -n $REV
# Check for git and a git repo.
if head=`git rev-parse --verify --short HEAD 2>/dev/null`; then
# If we are at a tagged commit (like "v2.6.30-rc6"), we ignore it,
# because this version is defined in the top level Makefile.
if [ -z "`git describe --exact-match 2>/dev/null`" ]; then
# If we are past a tagged commit (like "v2.6.30-rc5-302-g72357d5"),
# we pretty print it.
if atag="`git describe 2>/dev/null`"; then
echo "$atag" | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}'
# If we don't have a tag at all we print -g{commitish}.
else
printf '%s%s' -g $head
fi
fi
# Is this git on svn?
if git config --get svn-remote.svn.url >/dev/null; then
printf -- '-svn%s' "`git svn find-rev $head`"
fi
# Update index only on r/w media
[ -w . ] && git update-index --refresh --unmerged > /dev/null
# Check for uncommitted changes
if git diff-index --name-only HEAD | grep -v "^scripts/package" \
| read dummy; then
printf '%s' -dirty
fi
# All done with git
exit
fi
# Check for mercurial and a mercurial repo.
if hgid=`hg id 2>/dev/null`; then
tag=`printf '%s' "$hgid" | cut -d' ' -f2`
# Do we have an untagged version?
if [ -z "$tag" -o "$tag" = tip ]; then
id=`printf '%s' "$hgid" | sed 's/[+ ].*//'`
printf '%s%s' -hg "$id"
fi
# Are there uncommitted changes?
# These are represented by + after the changeset id.
case "$hgid" in
*+|*+\ *) printf '%s' -dirty ;;
esac
# All done with mercurial
exit
fi
# Check for svn and a svn repo.
if rev=`svn info 2>/dev/null | grep '^Last Changed Rev'`; then
rev=`echo $rev | awk '{print $NF}'`
printf -- '-svn%s' "$rev"
# All done with svn
exit
fi
# There's no reecognized repository; we must be a snapshot.
printf -- '-snapshot'

View File

@@ -1,3 +1,6 @@
SUBDIRS = helper jtag xsvf svf target server flash pld
lib_LTLIBRARIES = libopenocd.la
bin_PROGRAMS = openocd
if ECOSBOARD
@@ -6,33 +9,41 @@ else
MAINFILE = main.c
endif
openocd_SOURCES = $(MAINFILE) openocd.c
openocd_SOURCES = $(MAINFILE)
openocd_LDADD = libopenocd.la
libopenocd_la_SOURCES = openocd.c
# set the include path found by configure
INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/src/helper \
-I$(top_srcdir)/src/jtag -I$(top_srcdir)/src/target -I$(top_srcdir)/src/xsvf -I$(top_srcdir)/src/svf \
-I$(top_srcdir)/src/server -I$(top_srcdir)/src/flash -I$(top_srcdir)/src/pld $(all_includes)
AM_CPPFLAGS = \
-I$(top_srcdir)/src \
-I$(top_srcdir)/src/helper \
-I$(top_srcdir)/src/jtag \
-I$(top_srcdir)/src/target \
-I$(top_srcdir)/src/xsvf \
-I$(top_srcdir)/src/svf \
-I$(top_srcdir)/src/server \
-I$(top_srcdir)/src/flash \
-I$(top_srcdir)/src/pld
# pass path to prefix path
openocd_CPPFLAGS = \
-DPKGLIBDIR=\"$(pkglibdir)\" \
-DPKGBLDDATE=\"`date +%F-%R`\"
libopenocd_la_CPPFLAGS = -DPKGBLDDATE=\"`date +%F-%R`\"
# banner output includes RELSTR appended to $VERSION from the configure script
# guess-rev.sh returns either a repository version ID or "-snapshot"
if RELEASE
openocd_CPPFLAGS += -DRELSTR=\"Release\" -DPKGBLDREV=\"\"
libopenocd_la_CPPFLAGS += -DRELSTR=\"\"
else
openocd_CPPFLAGS += -DRELSTR=\"svn:\" -DPKGBLDREV=\"`$(top_srcdir)/guess-rev.sh`\"
libopenocd_la_CPPFLAGS += -DRELSTR=\"`$(top_srcdir)/guess-rev.sh $(top_srcdir)`\"
endif
# add default CPPFLAGS
openocd_CPPFLAGS += @CPPFLAGS@
libopenocd_la_CPPFLAGS += $(AM_CPPFLAGS) $(CPPFLAGS)
# the library search path.
openocd_LDFLAGS = $(all_libraries)
SUBDIRS = helper jtag xsvf svf target server flash pld
libopenocd_la_LDFLAGS = $(all_libraries)
if IS_MINGW
MINGWLDADD = -lwsock32
MINGWLDADD = -lws2_32
else
MINGWLDADD =
endif
@@ -65,36 +76,29 @@ endif
endif
endif
openocd_LDADD = $(top_builddir)/src/xsvf/libxsvf.a $(top_builddir)/src/svf/libsvf.a \
$(top_builddir)/src/target/libtarget.a $(top_builddir)/src/jtag/libjtag.a \
$(top_builddir)/src/helper/libhelper.a \
$(top_builddir)/src/server/libserver.a $(top_builddir)/src/helper/libhelper.a \
$(top_builddir)/src/flash/libflash.a $(top_builddir)/src/target/libtarget.a \
$(top_builddir)/src/pld/libpld.a \
libopenocd_la_LIBADD = \
$(top_builddir)/src/xsvf/libxsvf.la \
$(top_builddir)/src/svf/libsvf.la \
$(top_builddir)/src/pld/libpld.la \
$(top_builddir)/src/jtag/libjtag.la \
$(top_builddir)/src/flash/libflash.la \
$(top_builddir)/src/target/libtarget.la \
$(top_builddir)/src/server/libserver.la \
$(top_builddir)/src/helper/libhelper.la \
$(FTDI2232LIB) $(MINGWLDADD) $(LIBUSB)
if HTTPD
openocd_LDADD += -lmicrohttpd
libopenocd_la_LIBADD += -lmicrohttpd
endif
nobase_dist_pkglib_DATA = \
tcl/bitsbytes.tcl \
tcl/chip/atmel/at91/aic.tcl \
tcl/chip/atmel/at91/at91sam7x128.tcl \
tcl/chip/atmel/at91/at91sam7x256.tcl \
tcl/chip/atmel/at91/pmc.tcl \
tcl/chip/atmel/at91/rtt.tcl \
tcl/chip/atmel/at91/usarts.tcl \
tcl/chip/st/stm32/stm32.tcl \
tcl/chip/st/stm32/stm32_rcc.tcl \
tcl/chip/st/stm32/stm32_regs.tcl \
tcl/cpu/arm/arm7tdmi.tcl \
tcl/cpu/arm/arm920.tcl \
tcl/cpu/arm/arm946.tcl \
tcl/cpu/arm/arm966.tcl \
tcl/cpu/arm/cortex_m3.tcl \
tcl/memory.tcl \
tcl/mmr_helpers.tcl \
tcl/readable.tcl
MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
# The "quick" target builds executables & reinstalls the executables
# Primary use: developer types to quicken the edit/compile/debug
# cycle. by not requiring a "full build and full install". Note the
# assumption is: You are only rebuilding the EXE.... and everything
# else is/was previously installed.
#
# use at your own risk
quick: all install-binPROGRAMS
MAINTAINERCLEANFILES = Makefile.in

View File

@@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (C) 2007-2008 by Øyvind Harboe *
* Copyright (C) 2007-2008 by Øyvind Harboe *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@@ -39,8 +39,6 @@
#include <time_support.h>
#include <sys/time.h>
#include <sys/types.h>
#include <strings.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -84,6 +82,8 @@
#include <unistd.h>
#include <stdio.h>
#define MAX_IFS 64
#if defined(CYGPKG_NET_FREEBSD_STACK)
#include <tftp_support.h>
@@ -93,7 +93,7 @@ struct tftpd_fileops fileops =
(int (*)(const char *, int))open,
close,
(int (*)(int, const void *, int))write,
( int (*)(int, void *, int))read
(int (*)(int, void *, int))read
};
#endif
@@ -148,7 +148,6 @@ void start_profile(void)
}
#endif
extern int eth0_up;
static FILE *log;
static char reboot_stack[2048];
@@ -156,8 +155,8 @@ static char reboot_stack[2048];
static void zylinjtag_reboot(cyg_addrword_t data)
{
serialLog = true;
diag_printf("Rebooting in 100 ticks..\n");
cyg_thread_delay(100);
diag_printf("Rebooting in 500 ticks..\n");
cyg_thread_delay(500);
diag_printf("Unmounting /config..\n");
umount("/config");
diag_printf("Rebooting..\n");
@@ -174,6 +173,62 @@ void reboot(void)
cyg_thread_resume(zylinjtag_thread_handle);
}
static char zylinjtag_reboot_port_stack[2048];
static cyg_thread zylinjtag_reboot_port_thread_object;
static cyg_handle_t zylinjtag_reboot_port_thread_handle;
static void zylinjtag_reboot_port_task(cyg_addrword_t data)
{
int so_reuseaddr_option = 1;
int fd;
if ((fd = socket(AF_INET, SOCK_STREAM, 0)) == -1)
{
LOG_ERROR("error creating socket: %s", strerror(errno));
exit(-1);
}
setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (void*) &so_reuseaddr_option,
sizeof(int));
struct sockaddr_in sin;
unsigned int address_size;
address_size = sizeof(sin);
memset(&sin, 0, sizeof(sin));
sin.sin_family = AF_INET;
sin.sin_addr.s_addr = INADDR_ANY;
sin.sin_port = htons(1234);
if (bind(fd, (struct sockaddr *) &sin, sizeof(sin)) == -1)
{
LOG_ERROR("couldn't bind to socket: %s", strerror(errno));
exit(-1);
}
if (listen(fd, 1) == -1)
{
LOG_ERROR("couldn't listen on socket: %s", strerror(errno));
exit(-1);
}
// socket_nonblock(fd);
accept(fd, (struct sockaddr *) &sin, &address_size);
diag_printf("Got reboot signal on port 1234");
reboot();
}
void reboot_port(void)
{
cyg_thread_create(1, zylinjtag_reboot_port_task, (cyg_addrword_t) 0, "wait for reboot signal on port 1234",
(void *) zylinjtag_reboot_port_stack, sizeof(zylinjtag_reboot_port_stack),
&zylinjtag_reboot_port_thread_handle, &zylinjtag_reboot_port_thread_object);
cyg_thread_resume(zylinjtag_reboot_port_thread_handle);
}
int configuration_output_handler(struct command_context_s *context,
const char* line)
{
@@ -191,7 +246,6 @@ int zy1000_configuration_output_handler_log(struct command_context_s *context,
}
#ifdef CYGPKG_PROFILE_GPROF
extern void start_profile(void);
int eCosBoard_handle_eCosBoard_profile_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
@@ -255,11 +309,11 @@ void copyfile(char *name2, char *name1);
void copydir(char *name, char *destdir);
#if 0
MTAB_ENTRY( romfs_mte1,
MTAB_ENTRY(romfs_mte1,
"/rom",
"romfs",
"",
(CYG_ADDRWORD) &filedata[0] );
(CYG_ADDRWORD) &filedata[0]);
#endif
void openocd_sleep_prelude(void)
@@ -274,6 +328,7 @@ void openocd_sleep_postlude(void)
void format(void)
{
#ifdef CYGDAT_IO_FLASH_BLOCK_DEVICE_NAME_1
diag_printf("Formatting JFFS2...\n");
cyg_io_handle_t handle;
@@ -297,22 +352,21 @@ void format(void)
}
cyg_io_flash_getconfig_erase_t e;
void *err_addr;
len = sizeof(e);
e.offset = 0;
e.len = ds.dev_size;
e.err_address = &err_addr;
diag_printf("Formatting 0x%08x bytes\n", ds.dev_size);
diag_printf("Formatting 0x%08x bytes\n", (int)ds.dev_size);
err = cyg_io_get_config(handle, CYG_IO_GET_CONFIG_FLASH_ERASE, &e, &len);
if (err != ENOERR)
{
diag_printf("Flash erase error %d offset 0x%p\n", err, err_addr);
diag_printf("Flash erase error %d offset 0x%08x\n", err, e.err_address);
reboot();
}
diag_printf("Flash formatted successfully\n");
#endif
reboot();
}
@@ -421,8 +475,6 @@ static int zylinjtag_Jim_Command_reboot(Jim_Interp *interp, int argc,
}
extern Jim_Interp *interp;
static void zylinjtag_startNetwork(void)
{
// Bring TCP/IP up immediately before we're ready to accept commands.
@@ -438,6 +490,10 @@ static void zylinjtag_startNetwork(void)
diag_printf("Network not up and running\n");
exit(-1);
}
/* very first thing we want is a reboot capability */
reboot_port();
#if defined(CYGPKG_NET_FREEBSD_STACK)
/*start TFTP*/
tftpd_start(69, &fileops);
@@ -449,7 +505,7 @@ static void zylinjtag_startNetwork(void)
Jim_CreateCommand(httpstate.jim_interp, "log", zylinjtag_Jim_Command_log,
NULL, NULL);
Jim_CreateCommand(httpstate.jim_interp, "reboot",
Jim_CreateCommand(httpstate.jim_interp, "zy1000_reboot",
zylinjtag_Jim_Command_reboot, NULL, NULL);
Jim_CreateCommand(httpstate.jim_interp, "threads",
zylinjtag_Jim_Command_threads, NULL, NULL);
@@ -569,6 +625,9 @@ void setNoDelay(int session, int flag)
#endif
}
#define TEST_TCPIP() 0
#if TEST_TCPIP
struct
{
int req;
@@ -577,6 +636,7 @@ struct
int actual2;
} tcpipSent[512 * 1024];
int cur;
#endif
static void zylinjtag_uart(cyg_addrword_t data)
{
@@ -636,12 +696,14 @@ static void zylinjtag_uart(cyg_addrword_t data)
#ifdef CYGPKG_PROFILE_GPROF
start_profile();
#endif
int actual = 0;
int actual2 = 0;
int pos, pos2;
size_t actual = 0;
size_t actual2 = 0;
size_t pos, pos2;
pos = 0;
pos2 = 0;
#if TEST_TCPIP
cur = 0;
#endif
for (;;)
{
fd_set write_fds;
@@ -671,9 +733,11 @@ static void zylinjtag_uart(cyg_addrword_t data)
if (actual2 <= 0)
{
memset(backwardBuffer, 's', sizeof(backwardBuffer));
actual2 = read(serHandle, backwardBuffer,
int t;
t = read(serHandle, backwardBuffer,
sizeof(backwardBuffer));
if (actual2 < 0)
actual2 = t;
if (t < 0)
{
if (errno != EAGAIN)
{
@@ -684,8 +748,8 @@ static void zylinjtag_uart(cyg_addrword_t data)
pos2 = 0;
}
int x = actual2;
int y = 0;
size_t x = actual2;
size_t y = 0;
if (actual2 > 0)
{
int written = write(session, backwardBuffer + pos2, actual2);
@@ -740,6 +804,7 @@ static void zylinjtag_uart(cyg_addrword_t data)
}
y2 = written;
}
#if TEST_TCPIP
if (cur < 1024)
{
tcpipSent[cur].req = x;
@@ -748,11 +813,12 @@ static void zylinjtag_uart(cyg_addrword_t data)
tcpipSent[cur].actual2 = y2;
cur++;
}
#endif
}
closeSession: close(session);
close(serHandle);
#if TEST_TCPIP
int i;
for (i = 0; i < 1024; i++)
{
@@ -760,6 +826,7 @@ static void zylinjtag_uart(cyg_addrword_t data)
tcpipSent[i].req2, tcpipSent[i].actual2);
}
#endif
}
close(fd);
@@ -860,9 +927,9 @@ int boolParam(char *var);
command_context_t *setup_command_handler(void);
extern const char *zylin_config_dir;
static const char *zylin_config_dir="/config/settings";
int add_default_dirs(void)
static int add_default_dirs(void)
{
add_script_search_dir(zylin_config_dir);
add_script_search_dir("/rom/lib/openocd");
@@ -979,10 +1046,13 @@ int main(int argc, char *argv[])
}
mkdir(zylin_config_dir, 0777);
char *dirname=alloc_printf("%s/target", zylin_config_dir);
char *dirname = alloc_printf("%s/target", zylin_config_dir);
mkdir(dirname, 0777);
free(dirname);
dirname=alloc_printf("%s/event", zylin_config_dir);
dirname = alloc_printf("%s/board", zylin_config_dir);
mkdir(dirname, 0777);
free(dirname);
dirname = alloc_printf("%s/event", zylin_config_dir);
mkdir(dirname, 0777);
free(dirname);
@@ -1037,12 +1107,15 @@ int main(int argc, char *argv[])
if (logAllToSerial)
{
diag_printf(
"%s/logserial=1 => sending log output to serial port using \"debug_level 3\" as default.\n", zylin_config_dir);
"%s/logserial = 1 => sending log output to serial port using \"debug_level 3\" as default.\n", zylin_config_dir);
command_run_line(cmd_ctx, "debug_level 3");
}
command_run_linef(cmd_ctx, "script /rom/openocd.cfg");
/* we MUST always run the init command as it will launch telnet sessions */
command_run_line(cmd_ctx, "init");
// FIX!!! Yuk!
// diag_printf() is really invoked from many more places than we trust it
// not to cause instabilities(e.g. invoking fputc() from an interrupt is *BAD*).
@@ -1094,20 +1167,7 @@ CYG_HTTPD_MIME_TABLE_ENTRY(bin_mime_label, "bin", "application/octet-stream");
#include <cyg/kernel/ktypes.h> // base kernel types
#include <cyg/infra/cyg_trac.h> // tracing macros
#include <cyg/infra/cyg_ass.h> // assertion macros
#include <unistd.h>
#include <sys/types.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <errno.h>
#include <dirent.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <cyg/fileio/fileio.h>
#include <cyg/kernel/kapi.h>
#include <cyg/infra/diag.h>
@@ -1141,7 +1201,7 @@ static int tftpfs_fo_lseek(struct CYG_FILE_TAG *fp, off_t *apos, int whence);
// For simplicity we use _FILESYSTEM synchronization for all accesses since
// we should never block in any filesystem operations.
#if 1
FSTAB_ENTRY( tftpfs_fste, "tftpfs", 0,
FSTAB_ENTRY(tftpfs_fste, "tftpfs", 0,
CYG_SYNCMODE_NONE,
tftpfs_mount,
tftpfs_umount,
@@ -1162,12 +1222,12 @@ FSTAB_ENTRY( tftpfs_fste, "tftpfs", 0,
// mtab entry.
// This defines a single ROMFS loaded into ROM at the configured address
//
// MTAB_ENTRY( rom_mte, // structure name
// MTAB_ENTRY(rom_mte, // structure name
// "/rom", // mount point
// "romfs", // FIlesystem type
// "", // hardware device
// (CYG_ADDRWORD) CYGNUM_FS_ROM_BASE_ADDRESS // Address in ROM
// );
//);
// -------------------------------------------------------------------------
@@ -1470,8 +1530,8 @@ static int logfs_fo_close(struct CYG_FILE_TAG *fp);
// This defines the entry in the filesystem table.
// For simplicity we use _FILESYSTEM synchronization for all accesses since
// we should never block in any filesystem operations.
FSTAB_ENTRY( logfs_fste, "logfs", 0,
CYG_SYNCMODE_FILE_FILESYSTEM|CYG_SYNCMODE_IO_FILESYSTEM,
FSTAB_ENTRY(logfs_fste, "logfs", 0,
CYG_SYNCMODE_FILE_FILESYSTEM | CYG_SYNCMODE_IO_FILESYSTEM,
logfs_mount,
logfs_umount,
logfs_open,
@@ -1558,3 +1618,26 @@ static int logfs_fo_close(struct CYG_FILE_TAG *fp)
return ENOERR;
}
int loadFile(const char *fileName, void **data, int *len);
/* boolean parameter stored on config */
int boolParam(char *var)
{
bool result = false;
char *name = alloc_printf("%s/%s", zylin_config_dir, var);
if (name == NULL)
return result;
void *data;
int len;
if (loadFile(name, &data, &len) == ERROR_OK)
{
if (len > 1)
len = 1;
result = strncmp((char *) data, "1", len) == 0;
free(data);
}
free(name);
return result;
}

View File

@@ -1,12 +1,70 @@
INCLUDES = -I$(top_srcdir)/src/helper -I$(top_srcdir)/src/jtag -I$(top_srcdir)/src/target $(all_includes)
AM_CPPFLAGS = -DPKGLIBDIR=\"$(pkglibdir)\" @CPPFLAGS@
METASOURCES = AUTO
noinst_LIBRARIES = libflash.a
libflash_a_SOURCES = flash.c lpc2000.c cfi.c non_cfi.c at91sam7.c at91sam7_old.c str7x.c str9x.c aduc702x.c nand.c lpc3180_nand_controller.c \
stellaris.c str9xpec.c stm32x.c tms470.c ecos.c \
s3c24xx_nand.c s3c2410_nand.c s3c2412_nand.c s3c2440_nand.c s3c2443_nand.c lpc288x.c ocl.c mflash.c pic32mx.c
noinst_HEADERS = flash.h lpc2000.h cfi.h non_cfi.h at91sam7.h at91sam7_old.h str7x.h str9x.h nand.h lpc3180_nand_controller.h \
stellaris.h str9xpec.h stm32x.h tms470.h s3c24xx_nand.h s3c24xx_regs_nand.h lpc288x.h mflash.h \
ocl.h pic32mx.h
AM_CPPFLAGS = \
-I$(top_srcdir)/src/helper \
-I$(top_srcdir)/src/jtag \
-I$(top_srcdir)/src/target
MAINTAINERCLEANFILES = Makefile.in
METASOURCES = AUTO
noinst_LTLIBRARIES = libflash.la
libflash_la_SOURCES = \
arm_nandio.c \
flash.c \
lpc2000.c \
lpc288x.c \
lpc2900.c \
cfi.c \
non_cfi.c \
at91sam7.c \
at91sam3.c \
davinci_nand.c \
str7x.c \
str9x.c \
aduc702x.c \
nand.c \
nand_ecc.c \
nand_ecc_kw.c \
lpc3180_nand_controller.c \
stellaris.c \
str9xpec.c \
stm32x.c \
tms470.c \
ecos.c \
orion_nand.c \
s3c24xx_nand.c \
s3c2410_nand.c \
s3c2412_nand.c \
s3c2440_nand.c \
s3c2443_nand.c \
ocl.c \
mflash.c \
pic32mx.c \
avrf.c \
faux.c \
mx3_nand.c
noinst_HEADERS = \
arm_nandio.h \
flash.h \
lpc2000.h \
lpc288x.h \
lpc2900.h \
cfi.h \
non_cfi.h \
at91sam7.h \
at91sam3.h \
str7x.h \
str9x.h \
nand.h \
lpc3180_nand_controller.h \
stellaris.h \
str9xpec.h \
stm32x.h \
tms470.h \
s3c24xx_nand.h \
s3c24xx_regs_nand.h \
mflash.h \
ocl.h \
pic32mx.h \
avrf.h \
mx3_nand.h
MAINTAINERCLEANFILES = $(srcdir)/Makefile.in

View File

@@ -23,32 +23,25 @@
#include "config.h"
#endif
#include "replacements.h"
#include "time_support.h"
#include "flash.h"
#include "target.h"
#include "log.h"
#include "armv4_5.h"
#include "algorithm.h"
#include "binarybuffer.h"
#include "time_support.h"
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
int aduc702x_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank);
int aduc702x_register_commands(struct command_context_s *cmd_ctx);
int aduc702x_erase(struct flash_bank_s *bank, int first, int last);
int aduc702x_protect(struct flash_bank_s *bank, int set, int first, int last);
int aduc702x_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count);
int aduc702x_write_single(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count);
int aduc702x_write_block(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count);
int aduc702x_probe(struct flash_bank_s *bank);
int aduc702x_info(struct flash_bank_s *bank, char *buf, int buf_size);
int aduc702x_protect_check(struct flash_bank_s *bank);
int aduc702x_build_sector_list(struct flash_bank_s *bank);
int aduc702x_check_flash_completion(target_t* target, unsigned int timeout_ms);
int aduc702x_set_write_enable(target_t *target, int enable);
static int aduc702x_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank);
static int aduc702x_register_commands(struct command_context_s *cmd_ctx);
static int aduc702x_erase(struct flash_bank_s *bank, int first, int last);
static int aduc702x_protect(struct flash_bank_s *bank, int set, int first, int last);
static int aduc702x_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count);
static int aduc702x_write_single(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count);
static int aduc702x_write_block(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count);
static int aduc702x_probe(struct flash_bank_s *bank);
static int aduc702x_info(struct flash_bank_s *bank, char *buf, int buf_size);
static int aduc702x_protect_check(struct flash_bank_s *bank);
static int aduc702x_build_sector_list(struct flash_bank_s *bank);
static int aduc702x_check_flash_completion(target_t* target, unsigned int timeout_ms);
static int aduc702x_set_write_enable(target_t *target, int enable);
#define ADUC702x_FLASH 0xfffff800
#define ADUC702x_FLASH_FEESTA (0*4)
@@ -61,14 +54,14 @@ int aduc702x_set_write_enable(target_t *target, int enable);
#define ADUC702x_FLASH_FEEHIDE (7*4)
typedef struct {
u32 feesta;
u32 feemod;
u32 feecon;
u32 feedat;
u32 feeadr;
u32 feesign;
u32 feepro;
u32 feehide;
uint32_t feesta;
uint32_t feemod;
uint32_t feecon;
uint32_t feedat;
uint32_t feeadr;
uint32_t feesign;
uint32_t feepro;
uint32_t feehide;
} ADUC702x_FLASH_MMIO;
typedef struct
@@ -91,14 +84,14 @@ flash_driver_t aduc702x_flash =
.info = aduc702x_info
};
int aduc702x_register_commands(struct command_context_s *cmd_ctx)
static int aduc702x_register_commands(struct command_context_s *cmd_ctx)
{
return ERROR_OK;
}
/* flash bank aduc702x 0 0 0 0 <target#>
* The ADC7019-28 devices all have the same flash layout */
int aduc702x_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank)
static int aduc702x_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank)
{
aduc702x_flash_bank_t *nbank;
@@ -113,13 +106,13 @@ int aduc702x_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, ch
return ERROR_OK;
}
int aduc702x_build_sector_list(struct flash_bank_s *bank)
static int aduc702x_build_sector_list(struct flash_bank_s *bank)
{
//aduc7026_flash_bank_t *aduc7026_info = bank->driver_priv;
int i = 0;
u32 offset = 0;
uint32_t offset = 0;
// sector size is 512
bank->num_sectors = bank->size / 512;
bank->sectors = malloc(sizeof(flash_sector_t) * bank->num_sectors);
@@ -135,18 +128,18 @@ int aduc702x_build_sector_list(struct flash_bank_s *bank)
return ERROR_OK;
}
int aduc702x_protect_check(struct flash_bank_s *bank)
static int aduc702x_protect_check(struct flash_bank_s *bank)
{
printf("aduc702x_protect_check not implemented yet.\n");
return ERROR_OK;
}
int aduc702x_erase(struct flash_bank_s *bank, int first, int last)
static int aduc702x_erase(struct flash_bank_s *bank, int first, int last)
{
//int res;
int x;
int count;
//u32 v;
//uint32_t v;
target_t *target = bank->target;
aduc702x_set_write_enable(target, 1);
@@ -194,23 +187,34 @@ int aduc702x_erase(struct flash_bank_s *bank, int first, int last)
return ERROR_OK;
}
int aduc702x_protect(struct flash_bank_s *bank, int set, int first, int last)
static int aduc702x_protect(struct flash_bank_s *bank, int set, int first, int last)
{
printf("aduc702x_protect not implemented yet.\n");
return ERROR_FLASH_OPERATION_FAILED;
}
int aduc702x_write_block(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count)
/* If this fn returns ERROR_TARGET_RESOURCE_NOT_AVAILABLE, then the caller can fall
* back to another mechanism that does not require onboard RAM
*
* Caller should not check for other return values specifically
*/
static int aduc702x_write_block(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count)
{
aduc702x_flash_bank_t *aduc702x_info = bank->driver_priv;
target_t *target = bank->target;
u32 buffer_size = 7000;
uint32_t buffer_size = 7000;
working_area_t *source;
u32 address = bank->base + offset;
uint32_t address = bank->base + offset;
reg_param_t reg_params[6];
armv4_5_algorithm_t armv4_5_info;
int retval = ERROR_OK;
if (((count%2)!=0)||((offset%2)!=0))
{
LOG_ERROR("write block must be multiple of two bytes in offset & length");
return ERROR_FAIL;
}
/* parameters:
r0 - address of source data (absolute)
@@ -225,7 +229,7 @@ int aduc702x_write_block(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32
r6 - set to 2, used to write flash command
*/
u32 aduc702x_flash_write_code[] = {
uint32_t aduc702x_flash_write_code[] = {
//<_start>:
0xe3a05008, // mov r5, #8 ; 0x8
0xe5845004, // str r5, [r4, #4]
@@ -247,7 +251,7 @@ int aduc702x_write_block(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32
//<done>:
0xeafffffe // b 1003c <done>
};
/* flash write code */
if (target_alloc_working_area(target, sizeof(aduc702x_flash_write_code),
&aduc702x_info->write_algorithm) != ERROR_OK)
@@ -255,9 +259,13 @@ int aduc702x_write_block(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32
LOG_WARNING("no working area available, can't do block memory writes");
return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
};
target_write_buffer(target, aduc702x_info->write_algorithm->address,
sizeof(aduc702x_flash_write_code), (u8*)aduc702x_flash_write_code);
retval=target_write_buffer(target, aduc702x_info->write_algorithm->address,
sizeof(aduc702x_flash_write_code), (uint8_t*)aduc702x_flash_write_code);
if (retval!=ERROR_OK)
{
return retval;
}
/* memory buffer */
while (target_alloc_working_area(target, buffer_size, &source) != ERROR_OK)
@@ -268,73 +276,79 @@ int aduc702x_write_block(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32
/* if we already allocated the writing code, but failed to get a buffer, free the algorithm */
if (aduc702x_info->write_algorithm)
target_free_working_area(target, aduc702x_info->write_algorithm);
LOG_WARNING("no large enough working area available, can't do block memory writes");
return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
}
}
armv4_5_info.common_magic = ARMV4_5_COMMON_MAGIC;
armv4_5_info.core_mode = ARMV4_5_MODE_SVC;
armv4_5_info.core_state = ARMV4_5_STATE_ARM;
init_reg_param(&reg_params[0], "r0", 32, PARAM_OUT);
init_reg_param(&reg_params[1], "r1", 32, PARAM_OUT);
init_reg_param(&reg_params[2], "r2", 32, PARAM_OUT);
init_reg_param(&reg_params[3], "r3", 32, PARAM_IN);
init_reg_param(&reg_params[4], "r4", 32, PARAM_OUT);
while (count > 0)
{
u32 thisrun_count = (count > (buffer_size / 2)) ? (buffer_size / 2) : count;
target_write_buffer(target, source->address, thisrun_count * 2, buffer);
uint32_t thisrun_count = (count > buffer_size) ? buffer_size : count;
retval=target_write_buffer(target, source->address, thisrun_count, buffer);
if (retval!=ERROR_OK)
{
break;
}
buf_set_u32(reg_params[0].value, 0, 32, source->address);
buf_set_u32(reg_params[1].value, 0, 32, thisrun_count);
buf_set_u32(reg_params[1].value, 0, 32, thisrun_count/2);
buf_set_u32(reg_params[2].value, 0, 32, address);
buf_set_u32(reg_params[4].value, 0, 32, 0xFFFFF800);
if ((retval = target->type->run_algorithm(target, 0, NULL, 5,
reg_params, aduc702x_info->write_algorithm->address,
aduc702x_info->write_algorithm->address + sizeof(aduc702x_flash_write_code) - 4,
if ((retval = target_run_algorithm(target, 0, NULL, 5,
reg_params, aduc702x_info->write_algorithm->address,
aduc702x_info->write_algorithm->address + sizeof(aduc702x_flash_write_code) - 4,
10000, &armv4_5_info)) != ERROR_OK)
{
LOG_ERROR("error executing aduc702x flash write algorithm");
retval = ERROR_FLASH_OPERATION_FAILED;
break;
}
if ((buf_get_u32(reg_params[3].value, 0, 32) & 1) != 1) {
retval = ERROR_FLASH_OPERATION_FAILED;
break;
}
buffer += thisrun_count * 2;
address += thisrun_count * 2;
if ((buf_get_u32(reg_params[3].value, 0, 32) & 1) != 1)
{
/* FIX!!!! what does this mean??? replace w/sensible error message */
LOG_ERROR("aduc702x detected error writing flash");
retval = ERROR_FAIL;
break;
}
buffer += thisrun_count;
address += thisrun_count;
count -= thisrun_count;
}
target_free_working_area(target, source);
target_free_working_area(target, aduc702x_info->write_algorithm);
destroy_reg_param(&reg_params[0]);
destroy_reg_param(&reg_params[1]);
destroy_reg_param(&reg_params[2]);
destroy_reg_param(&reg_params[3]);
destroy_reg_param(&reg_params[4]);
return retval;
}
/* All-JTAG, single-access method. Very slow. Used only if there is no
/* All-JTAG, single-access method. Very slow. Used only if there is no
* working area available. */
int aduc702x_write_single(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count)
static int aduc702x_write_single(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count)
{
int x;
u8 b;
uint32_t x;
uint8_t b;
target_t *target = bank->target;
aduc702x_set_write_enable(target, 1);
for (x = 0; x < count; x += 2) {
@@ -370,7 +384,7 @@ int aduc702x_write_single(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32
return ERROR_OK;
}
int aduc702x_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count)
int aduc702x_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count)
{
int retval;
@@ -380,39 +394,34 @@ int aduc702x_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count)
if (retval == ERROR_TARGET_RESOURCE_NOT_AVAILABLE)
{
/* if block write failed (no sufficient working area),
* use normal (slow) JTAG method */
* use normal (slow) JTAG method */
LOG_WARNING("couldn't use block writes, falling back to single memory accesses");
if ((retval = aduc702x_write_single(bank, buffer, offset, count)) != ERROR_OK)
{
LOG_ERROR("slow write failed");
return ERROR_FLASH_OPERATION_FAILED;
return ERROR_FLASH_OPERATION_FAILED;
}
}
else if (retval == ERROR_FLASH_OPERATION_FAILED)
{
LOG_ERROR("flash block writing failed");
return ERROR_FLASH_OPERATION_FAILED;
}
}
return ERROR_OK;
return retval;
}
int aduc702x_probe(struct flash_bank_s *bank)
static int aduc702x_probe(struct flash_bank_s *bank)
{
return ERROR_OK;
}
int aduc702x_info(struct flash_bank_s *bank, char *buf, int buf_size)
static int aduc702x_info(struct flash_bank_s *bank, char *buf, int buf_size)
{
snprintf(buf, buf_size, "aduc702x flash driver info" );
snprintf(buf, buf_size, "aduc702x flash driver info");
return ERROR_OK;
}
/* sets FEEMOD bit 3
* enable = 1 enables writes & erases, 0 disables them */
int aduc702x_set_write_enable(target_t *target, int enable)
static int aduc702x_set_write_enable(target_t *target, int enable)
{
// don't bother to preserve int enable bit here
target_write_u16(target, ADUC702x_FLASH + ADUC702x_FLASH_FEEMOD, enable ? 8 : 0);
@@ -425,9 +434,9 @@ int aduc702x_set_write_enable(target_t *target, int enable)
*
* this function sleeps 1ms between checks (after the first one),
* so in some cases may slow things down without a usleep after the first read */
int aduc702x_check_flash_completion(target_t* target, unsigned int timeout_ms)
static int aduc702x_check_flash_completion(target_t* target, unsigned int timeout_ms)
{
u8 v = 4;
uint8_t v = 4;
long long endtime = timeval_ms() + timeout_ms;
while (1) {

134
src/flash/arm_nandio.c Normal file
View File

@@ -0,0 +1,134 @@
/*
* Copyright (C) 2009 by Marvell Semiconductors, Inc.
* Written by Nicolas Pitre <nico at marvell.com>
*
* Copyright (C) 2009 by David Brownell
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "arm_nandio.h"
#include "armv4_5.h"
/*
* ARM-specific bulk write from buffer to address of 8-bit wide NAND.
* For now this only supports ARMv4 and ARMv5 cores.
*
* Enhancements to target_run_algorithm() could enable:
* - ARMv6 and ARMv7 cores in ARM mode
*
* Different code fragments could handle:
* - Thumb2 cores like Cortex-M (needs different byteswapping)
* - 16-bit wide data (needs different setup too)
*/
int arm_nandwrite(struct arm_nand_data *nand, uint8_t *data, int size)
{
target_t *target = nand->target;
armv4_5_algorithm_t algo;
armv4_5_common_t *armv4_5 = target->arch_info;
reg_param_t reg_params[3];
uint32_t target_buf;
uint32_t exit = 0;
int retval;
/* Inputs:
* r0 NAND data address (byte wide)
* r1 buffer address
* r2 buffer length
*/
static const uint32_t code[] = {
0xe4d13001, /* s: ldrb r3, [r1], #1 */
0xe5c03000, /* strb r3, [r0] */
0xe2522001, /* subs r2, r2, #1 */
0x1afffffb, /* bne s */
/* exit: ARMv4 needs hardware breakpoint */
0xe1200070, /* e: bkpt #0 */
};
if (!nand->copy_area) {
uint8_t code_buf[sizeof(code)];
unsigned i;
/* make sure we have a working area */
if (target_alloc_working_area(target,
sizeof(code) + nand->chunk_size,
&nand->copy_area) != ERROR_OK) {
LOG_DEBUG("%s: no %d byte buffer",
__FUNCTION__,
(int) sizeof(code) + nand->chunk_size);
return ERROR_NAND_NO_BUFFER;
}
/* buffer code in target endianness */
for (i = 0; i < sizeof(code) / 4; i++)
target_buffer_set_u32(target, code_buf + i * 4, code[i]);
/* copy code to work area */
retval = target_write_memory(target,
nand->copy_area->address,
4, sizeof(code) / 4, code_buf);
if (retval != ERROR_OK)
return retval;
}
/* copy data to work area */
target_buf = nand->copy_area->address + sizeof(code);
retval = target_bulk_write_memory(target, target_buf, size / 4, data);
if (retval == ERROR_OK && (size & 3) != 0)
retval = target_write_memory(target,
target_buf + (size & ~3),
1, size & 3, data + (size & ~3));
if (retval != ERROR_OK)
return retval;
/* set up algorithm and parameters */
algo.common_magic = ARMV4_5_COMMON_MAGIC;
algo.core_mode = ARMV4_5_MODE_SVC;
algo.core_state = ARMV4_5_STATE_ARM;
init_reg_param(&reg_params[0], "r0", 32, PARAM_IN);
init_reg_param(&reg_params[1], "r1", 32, PARAM_IN);
init_reg_param(&reg_params[2], "r2", 32, PARAM_IN);
buf_set_u32(reg_params[0].value, 0, 32, nand->data);
buf_set_u32(reg_params[1].value, 0, 32, target_buf);
buf_set_u32(reg_params[2].value, 0, 32, size);
/* armv4 must exit using a hardware breakpoint */
if (armv4_5->is_armv4)
exit = nand->copy_area->address + sizeof(code) - 4;
/* use alg to write data from work area to NAND chip */
retval = target_run_algorithm(target, 0, NULL, 3, reg_params,
nand->copy_area->address, exit, 1000, &algo);
if (retval != ERROR_OK)
LOG_ERROR("error executing hosted NAND write");
destroy_reg_param(&reg_params[0]);
destroy_reg_param(&reg_params[1]);
destroy_reg_param(&reg_params[2]);
return retval;
}
/* REVISIT do the same for bulk *read* too ... */

25
src/flash/arm_nandio.h Normal file
View File

@@ -0,0 +1,25 @@
#ifndef __ARM_NANDIO_H
#define __ARM_NANDIO_H
#include "nand.h"
#include "binarybuffer.h"
struct arm_nand_data {
/* target is proxy for some ARM core */
struct target_s *target;
/* copy_area holds write-to-NAND loop and data to write */
struct working_area_s *copy_area;
/* chunk_size == page or ECC unit */
unsigned chunk_size;
/* data == where to write the data */
uint32_t data;
/* currently implicit: data width == 8 bits (not 16) */
};
int arm_nandwrite(struct arm_nand_data *nand, uint8_t *data, int size);
#endif /* __ARM_NANDIO_H */

2531
src/flash/at91sam3.c Normal file

File diff suppressed because it is too large Load Diff

23
src/flash/at91sam3.h Normal file
View File

@@ -0,0 +1,23 @@
/***************************************************************************
* Copyright (C) 2009 by Duane Ellis *
* openocd@duaneellis.com *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
// nothing to do here other then export this.
extern flash_driver_t at91sam3_flash;

View File

@@ -20,59 +20,59 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
****************************************************************************/
/***************************************************************************************************************************************************************************************
/***************************************************************************
*
* New flash setup command:
*
* flash bank <driver> <base_addr> <size> <chip_width> <bus_width> <target_number> [<target_name> <banks> <sectors_per_bank> <pages_per_sector> <page_size> <num_nvmbits> <ext_freq_khz>]
* flash bank <driver> <base_addr> <size> <chip_width> <bus_width> <target_id>
* [<chip_type> <banks>
* <sectors_per_bank> <pages_per_sector>
* <page_size> <num_nvmbits>
* <ext_freq_khz>]
*
* <ext_freq_khz> - MUST be used if clock is from external source,
* CAN be used if main oscillator frequency is known (recomended)
* CAN be used if main oscillator frequency is known (recommended)
* Examples:
* flash bank at91sam7 0x00100000 0 0 4 0 0 AT91SAM7XC256 1 16 64 256 3 25000 ==== RECOMENDED ============
* flash bank at91sam7 0 0 0 0 0 0 0 0 0 0 0 0 25000 (auto-detection, except for clock) ==== RECOMENDED ============
* flash bank at91sam7 0x00100000 0 0 4 0 0 AT91SAM7XC256 1 16 64 256 3 0 ==== NOT RECOMENDED !!! ====
* flash bank at91sam7 0 0 0 0 0 (old style, full auto-detection) ==== NOT RECOMENDED !!! ====
****************************************************************************************************************************************************************************************/
* ==== RECOMMENDED (covers clock speed) ============
* flash bank at91sam7 0x00100000 0 0 4 $_TARGETNAME AT91SAM7XC256 1 16 64 256 3 25000
* (if auto-detect fails; provides clock spec)
* flash bank at91sam7 0 0 0 0 $_TARGETNAME 0 0 0 0 0 0 25000
* (auto-detect everything except the clock)
* ==== NOT RECOMMENDED !!! (clock speed is not configured) ====
* flash bank at91sam7 0x00100000 0 0 4 $_TARGETNAME AT91SAM7XC256 1 16 64 256 3 0
* (if auto-detect fails)
* flash bank at91sam7 0 0 0 0 $_TARGETNAME
* (old style, auto-detect everything)
****************************************************************************/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "replacements.h"
#include "at91sam7.h"
#include "flash.h"
#include "target.h"
#include "log.h"
#include "binarybuffer.h"
#include "types.h"
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
int at91sam7_register_commands(struct command_context_s *cmd_ctx);
int at91sam7_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank);
int at91sam7_erase(struct flash_bank_s *bank, int first, int last);
int at91sam7_protect(struct flash_bank_s *bank, int set, int first, int last);
int at91sam7_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count);
int at91sam7_probe(struct flash_bank_s *bank);
int at91sam7_auto_probe(struct flash_bank_s *bank);
int at91sam7_erase_check(struct flash_bank_s *bank);
int at91sam7_protect_check(struct flash_bank_s *bank);
int at91sam7_info(struct flash_bank_s *bank, char *buf, int buf_size);
static int at91sam7_register_commands(struct command_context_s *cmd_ctx);
static int at91sam7_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank);
static int at91sam7_erase(struct flash_bank_s *bank, int first, int last);
static int at91sam7_protect(struct flash_bank_s *bank, int set, int first, int last);
static int at91sam7_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count);
static int at91sam7_probe(struct flash_bank_s *bank);
//static int at91sam7_auto_probe(struct flash_bank_s *bank);
static int at91sam7_erase_check(struct flash_bank_s *bank);
static int at91sam7_protect_check(struct flash_bank_s *bank);
static int at91sam7_info(struct flash_bank_s *bank, char *buf, int buf_size);
u32 at91sam7_get_flash_status(target_t *target, int bank_number);
void at91sam7_set_flash_mode(flash_bank_t *bank, int mode);
u32 at91sam7_wait_status_busy(flash_bank_t *bank, u32 waitbits, int timeout);
int at91sam7_flash_command(struct flash_bank_s *bank, u8 cmd, u16 pagen);
int at91sam7_handle_gpnvm_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
static uint32_t at91sam7_get_flash_status(target_t *target, int bank_number);
static void at91sam7_set_flash_mode(flash_bank_t *bank, int mode);
static uint32_t at91sam7_wait_status_busy(flash_bank_t *bank, uint32_t waitbits, int timeout);
static int at91sam7_flash_command(struct flash_bank_s *bank, uint8_t cmd, uint16_t pagen);
static int at91sam7_handle_gpnvm_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
flash_driver_t at91sam7_flash =
{
.name = "at91sam7_new",
.name = "at91sam7",
.register_commands = at91sam7_register_commands,
.flash_bank_command = at91sam7_flash_bank_command,
.erase = at91sam7_erase,
@@ -85,17 +85,18 @@ flash_driver_t at91sam7_flash =
.info = at91sam7_info
};
u32 MC_FMR[4] = { 0xFFFFFF60, 0xFFFFFF70, 0xFFFFFF80, 0xFFFFFF90 };
u32 MC_FCR[4] = { 0xFFFFFF64, 0xFFFFFF74, 0xFFFFFF84, 0xFFFFFF94 };
u32 MC_FSR[4] = { 0xFFFFFF68, 0xFFFFFF78, 0xFFFFFF88, 0xFFFFFF98 };
static uint32_t MC_FMR[4] = { 0xFFFFFF60, 0xFFFFFF70, 0xFFFFFF80, 0xFFFFFF90 };
static uint32_t MC_FCR[4] = { 0xFFFFFF64, 0xFFFFFF74, 0xFFFFFF84, 0xFFFFFF94 };
static uint32_t MC_FSR[4] = { 0xFFFFFF68, 0xFFFFFF78, 0xFFFFFF88, 0xFFFFFF98 };
char * EPROC[8]= {"Unknown","ARM946-E","ARM7TDMI","Unknown","ARM920T","ARM926EJ-S","Unknown","Unknown"};
static char * EPROC[8]= {"Unknown","ARM946-E","ARM7TDMI","Unknown","ARM920T","ARM926EJ-S","Unknown","Unknown"};
long SRAMSIZ[16] = {
#if 0
static long SRAMSIZ[16] = {
-1,
0x0400, /* 1K */
0x0800, /* 2K */
-1,
0x0800, /* 2K */
-1,
0x1c000, /* 112K */
0x1000, /* 4K */
0x14000, /* 80K */
@@ -109,30 +110,31 @@ long SRAMSIZ[16] = {
0x18000, /* 96K */
0x80000, /* 512K */
};
#endif
int at91sam7_register_commands(struct command_context_s *cmd_ctx)
static int at91sam7_register_commands(struct command_context_s *cmd_ctx)
{
command_t *at91sam7_cmd = register_command(cmd_ctx, NULL, "at91sam7_new", NULL, COMMAND_ANY, NULL);
command_t *at91sam7_cmd = register_command(cmd_ctx, NULL, "at91sam7", NULL, COMMAND_ANY, NULL);
register_command(cmd_ctx, at91sam7_cmd, "gpnvm", at91sam7_handle_gpnvm_command, COMMAND_EXEC,
"at91sam7 gpnvm <bit> set|clear, set or clear one gpnvm bit");
"at91sam7 gpnvm <bit> set | clear, set or clear one gpnvm bit");
return ERROR_OK;
}
u32 at91sam7_get_flash_status(target_t *target, int bank_number)
static uint32_t at91sam7_get_flash_status(target_t *target, int bank_number)
{
u32 fsr;
uint32_t fsr;
target_read_u32(target, MC_FSR[bank_number], &fsr);
return fsr;
}
/* Read clock configuration and set at91sam7_info->mck_freq */
void at91sam7_read_clock_info(flash_bank_t *bank)
static void at91sam7_read_clock_info(flash_bank_t *bank)
{
at91sam7_flash_bank_t *at91sam7_info = bank->driver_priv;
target_t *target = bank->target;
u32 mckr, mcfr, pllr, mor;
uint32_t mckr, mcfr, pllr, mor;
unsigned long tmp = 0, mainfreq;
/* Read Clock Generator Main Oscillator Register */
@@ -143,10 +145,10 @@ void at91sam7_read_clock_info(flash_bank_t *bank)
target_read_u32(target, PMC_MCKR, &mckr);
/* Read Clock Generator PLL Register */
target_read_u32(target, CKGR_PLLR, &pllr);
at91sam7_info->mck_valid = 0;
at91sam7_info->mck_freq = 0;
switch (mckr & PMC_MCKR_CSS)
switch (mckr & PMC_MCKR_CSS)
{
case 0: /* Slow Clock */
at91sam7_info->mck_valid = 1;
@@ -154,7 +156,7 @@ void at91sam7_read_clock_info(flash_bank_t *bank)
break;
case 1: /* Main Clock */
if ((mcfr & CKGR_MCFR_MAINRDY) &&
if ((mcfr & CKGR_MCFR_MAINRDY) &&
(at91sam7_info->ext_freq == 0))
{
at91sam7_info->mck_valid = 1;
@@ -171,8 +173,8 @@ void at91sam7_read_clock_info(flash_bank_t *bank)
break;
case 3: /* PLL Clock */
if ((mcfr & CKGR_MCFR_MAINRDY) &&
(at91sam7_info->ext_freq == 0))
if ((mcfr & CKGR_MCFR_MAINRDY) &&
(at91sam7_info->ext_freq == 0))
{
target_read_u32(target, CKGR_PLLR, &pllr);
if (!(pllr & CKGR_PLLR_DIV))
@@ -195,7 +197,7 @@ void at91sam7_read_clock_info(flash_bank_t *bank)
}
/* Prescaler adjust */
if ( (((mckr & PMC_MCKR_PRES) >> 2) == 7) || (tmp == 0) )
if ((((mckr & PMC_MCKR_PRES) >> 2) == 7) || (tmp == 0))
{
at91sam7_info->mck_valid = 0;
at91sam7_info->mck_freq = 0;
@@ -207,9 +209,9 @@ void at91sam7_read_clock_info(flash_bank_t *bank)
}
/* Setup the timimg registers for nvbits or normal flash */
void at91sam7_set_flash_mode(flash_bank_t *bank, int mode)
static void at91sam7_set_flash_mode(flash_bank_t *bank, int mode)
{
u32 fmr, fmcn = 0, fws = 0;
uint32_t fmr, fmcn = 0, fws = 0;
at91sam7_flash_bank_t *at91sam7_info = bank->driver_priv;
target_t *target = bank->target;
@@ -221,33 +223,33 @@ void at91sam7_set_flash_mode(flash_bank_t *bank, int mode)
if (at91sam7_info->cidr_arch == 0x60)
{
/* AT91SAM7A3 uses master clocks in 100 ns */
fmcn = (at91sam7_info->mck_freq/10000000ul)+1;
fmcn = (at91sam7_info->mck_freq/10000000ul) + 1;
}
else
{
/* master clocks in 1uS for ARCH 0x7 types */
fmcn = (at91sam7_info->mck_freq/1000000ul)+1;
fmcn = (at91sam7_info->mck_freq/1000000ul) + 1;
}
}
else if (mode == FMR_TIMING_FLASH)
{
/* main clocks in 1.5uS */
fmcn = (at91sam7_info->mck_freq/1000000ul)+
(at91sam7_info->mck_freq/2000000ul)+1;
(at91sam7_info->mck_freq/2000000ul) + 1;
}
/* hard overclocking */
if (fmcn > 0xFF)
fmcn = 0xFF;
/* Only allow fmcn=0 if clock period is > 30 us = 33kHz. */
/* Only allow fmcn = 0 if clock period is > 30 us = 33kHz. */
if (at91sam7_info->mck_freq <= 33333ul)
fmcn = 0;
/* Only allow fws=0 if clock frequency is < 30 MHz. */
/* Only allow fws = 0 if clock frequency is < 30 MHz. */
if (at91sam7_info->mck_freq > 30000000ul)
fws = 1;
LOG_DEBUG("fmcn[%i]: %i", bank->bank_number, fmcn);
LOG_DEBUG("fmcn[%i]: %i", bank->bank_number, (int)(fmcn));
fmr = fmcn << 16 | fws << 8;
target_write_u32(target, MC_FMR[bank->bank_number], fmr);
}
@@ -255,21 +257,21 @@ void at91sam7_set_flash_mode(flash_bank_t *bank, int mode)
at91sam7_info->flashmode = mode;
}
u32 at91sam7_wait_status_busy(flash_bank_t *bank, u32 waitbits, int timeout)
static uint32_t at91sam7_wait_status_busy(flash_bank_t *bank, uint32_t waitbits, int timeout)
{
u32 status;
uint32_t status;
while ((!((status = at91sam7_get_flash_status(bank->target, bank->bank_number)) & waitbits)) && (timeout-- > 0))
{
LOG_DEBUG("status[%i]: 0x%x", bank->bank_number, status);
LOG_DEBUG("status[%i]: 0x%" PRIx32 "", (int)bank->bank_number, status);
alive_sleep(1);
}
LOG_DEBUG("status[%i]: 0x%x", bank->bank_number, status);
LOG_DEBUG("status[%i]: 0x%" PRIx32 "", bank->bank_number, status);
if (status & 0x0C)
{
LOG_ERROR("status register: 0x%x", status);
LOG_ERROR("status register: 0x%" PRIx32 "", status);
if (status & 0x4)
LOG_ERROR("Lock Error Bit Detected, Operation Abort");
if (status & 0x8)
@@ -282,17 +284,17 @@ u32 at91sam7_wait_status_busy(flash_bank_t *bank, u32 waitbits, int timeout)
}
/* Send one command to the AT91SAM flash controller */
int at91sam7_flash_command(struct flash_bank_s *bank, u8 cmd, u16 pagen)
static int at91sam7_flash_command(struct flash_bank_s *bank, uint8_t cmd, uint16_t pagen)
{
u32 fcr;
uint32_t fcr;
at91sam7_flash_bank_t *at91sam7_info = bank->driver_priv;
target_t *target = bank->target;
fcr = (0x5A<<24) | ((pagen&0x3FF)<<8) | cmd;
fcr = (0x5A << 24) | ((pagen&0x3FF) << 8) | cmd;
target_write_u32(target, MC_FCR[bank->bank_number], fcr);
LOG_DEBUG("Flash command: 0x%x, flash bank: %i, page number: %u", fcr, bank->bank_number+1, pagen);
LOG_DEBUG("Flash command: 0x%" PRIx32 ", flash bank: %i, page number: %u", fcr, bank->bank_number + 1, pagen);
if ((at91sam7_info->cidr_arch == 0x60)&&((cmd==SLB)|(cmd==CLB)))
if ((at91sam7_info->cidr_arch == 0x60) && ((cmd == SLB) | (cmd == CLB)))
{
/* Lock bit manipulation on AT91SAM7A3 waits for FC_FSR bit 1, EOL */
if (at91sam7_wait_status_busy(bank, MC_FSR_EOL, 10)&0x0C)
@@ -302,7 +304,7 @@ int at91sam7_flash_command(struct flash_bank_s *bank, u8 cmd, u16 pagen)
return ERROR_OK;
}
if (at91sam7_wait_status_busy(bank, MC_FSR_FRDY, 10)&0x0C)
if (at91sam7_wait_status_busy(bank, MC_FSR_FRDY, 10)&0x0C)
{
return ERROR_FLASH_OPERATION_FAILED;
}
@@ -311,23 +313,23 @@ int at91sam7_flash_command(struct flash_bank_s *bank, u8 cmd, u16 pagen)
}
/* Read device id register, main clock frequency register and fill in driver info structure */
int at91sam7_read_part_info(struct flash_bank_s *bank)
static int at91sam7_read_part_info(struct flash_bank_s *bank)
{
flash_bank_t *t_bank = bank;
at91sam7_flash_bank_t *at91sam7_info;
target_t *target = t_bank->target;
u16 bnk, sec;
u16 arch;
u32 cidr;
u8 banks_num;
u16 num_nvmbits;
u16 sectors_num;
u16 pages_per_sector;
u16 page_size;
u32 ext_freq;
u32 bank_size;
u32 base_address = 0;
uint16_t bnk, sec;
uint16_t arch;
uint32_t cidr;
uint8_t banks_num = 0;
uint16_t num_nvmbits = 0;
uint16_t sectors_num = 0;
uint16_t pages_per_sector = 0;
uint16_t page_size = 0;
uint32_t ext_freq;
uint32_t bank_size;
uint32_t base_address = 0;
char *target_name = "Unknown";
at91sam7_info = t_bank->driver_priv;
@@ -374,13 +376,13 @@ int at91sam7_read_part_info(struct flash_bank_s *bank)
at91sam7_info = t_bank->driver_priv;
at91sam7_info->cidr = cidr;
at91sam7_info->cidr_ext = (cidr>>31)&0x0001;
at91sam7_info->cidr_nvptyp = (cidr>>28)&0x0007;
at91sam7_info->cidr_arch = (cidr>>20)&0x00FF;
at91sam7_info->cidr_sramsiz = (cidr>>16)&0x000F;
at91sam7_info->cidr_nvpsiz2 = (cidr>>12)&0x000F;
at91sam7_info->cidr_nvpsiz = (cidr>>8)&0x000F;
at91sam7_info->cidr_eproc = (cidr>>5)&0x0007;
at91sam7_info->cidr_ext = (cidr >> 31)&0x0001;
at91sam7_info->cidr_nvptyp = (cidr >> 28)&0x0007;
at91sam7_info->cidr_arch = (cidr >> 20)&0x00FF;
at91sam7_info->cidr_sramsiz = (cidr >> 16)&0x000F;
at91sam7_info->cidr_nvpsiz2 = (cidr >> 12)&0x000F;
at91sam7_info->cidr_nvpsiz = (cidr >> 8)&0x000F;
at91sam7_info->cidr_eproc = (cidr >> 5)&0x0007;
at91sam7_info->cidr_version = cidr&0x001F;
/* calculate master clock frequency */
@@ -399,10 +401,10 @@ int at91sam7_read_part_info(struct flash_bank_s *bank)
return ERROR_OK;
}
arch = (cidr>>20)&0x00FF;
arch = (cidr >> 20)&0x00FF;
/* check flash size */
switch ((cidr>>8)&0x000F)
switch ((cidr >> 8)&0x000F)
{
case FLASH_SIZE_8KB:
break;
@@ -558,7 +560,7 @@ int at91sam7_read_part_info(struct flash_bank_s *bank)
/* calculate bank size */
bank_size = sectors_num * pages_per_sector * page_size;
for (bnk=0; bnk<banks_num; bnk++)
for (bnk = 0; bnk < banks_num; bnk++)
{
if (bnk > 0)
{
@@ -583,7 +585,7 @@ int at91sam7_read_part_info(struct flash_bank_s *bank)
/* allocate sectors */
t_bank->sectors = malloc(sectors_num * sizeof(flash_sector_t));
for (sec=0; sec<sectors_num; sec++)
for (sec = 0; sec < sectors_num; sec++)
{
t_bank->sectors[sec].offset = sec * pages_per_sector * page_size;
t_bank->sectors[sec].size = pages_per_sector * page_size;
@@ -594,13 +596,13 @@ int at91sam7_read_part_info(struct flash_bank_s *bank)
at91sam7_info = t_bank->driver_priv;
at91sam7_info->cidr = cidr;
at91sam7_info->cidr_ext = (cidr>>31)&0x0001;
at91sam7_info->cidr_nvptyp = (cidr>>28)&0x0007;
at91sam7_info->cidr_arch = (cidr>>20)&0x00FF;
at91sam7_info->cidr_sramsiz = (cidr>>16)&0x000F;
at91sam7_info->cidr_nvpsiz2 = (cidr>>12)&0x000F;
at91sam7_info->cidr_nvpsiz = (cidr>>8)&0x000F;
at91sam7_info->cidr_eproc = (cidr>>5)&0x0007;
at91sam7_info->cidr_ext = (cidr >> 31)&0x0001;
at91sam7_info->cidr_nvptyp = (cidr >> 28)&0x0007;
at91sam7_info->cidr_arch = (cidr >> 20)&0x00FF;
at91sam7_info->cidr_sramsiz = (cidr >> 16)&0x000F;
at91sam7_info->cidr_nvpsiz2 = (cidr >> 12)&0x000F;
at91sam7_info->cidr_nvpsiz = (cidr >> 8)&0x000F;
at91sam7_info->cidr_eproc = (cidr >> 5)&0x0007;
at91sam7_info->cidr_version = cidr&0x001F;
at91sam7_info->target_name = target_name;
@@ -621,20 +623,20 @@ int at91sam7_read_part_info(struct flash_bank_s *bank)
at91sam7_protect_check(t_bank);
}
LOG_DEBUG("nvptyp: 0x%3.3x, arch: 0x%4.4x", at91sam7_info->cidr_nvptyp, at91sam7_info->cidr_arch );
LOG_DEBUG("nvptyp: 0x%3.3x, arch: 0x%4.4x", at91sam7_info->cidr_nvptyp, at91sam7_info->cidr_arch);
return ERROR_OK;
}
int at91sam7_erase_check(struct flash_bank_s *bank)
static int at91sam7_erase_check(struct flash_bank_s *bank)
{
target_t *target = bank->target;
u16 retval;
u32 blank;
u16 fast_check;
u8 *buffer;
u16 nSector;
u16 nByte;
uint16_t retval;
uint32_t blank;
uint16_t fast_check;
uint8_t *buffer;
uint16_t nSector;
uint16_t nByte;
if (bank->target->state != TARGET_HALTED)
{
@@ -643,13 +645,13 @@ int at91sam7_erase_check(struct flash_bank_s *bank)
}
/* Configure the flash controller timing */
at91sam7_read_clock_info(bank);
at91sam7_read_clock_info(bank);
at91sam7_set_flash_mode(bank, FMR_TIMING_FLASH);
fast_check = 1;
for (nSector=0; nSector<bank->num_sectors; nSector++)
for (nSector = 0; nSector < bank->num_sectors; nSector++)
{
retval = target_blank_check_memory(target, bank->base+bank->sectors[nSector].offset,
retval = target_blank_check_memory(target, bank->base + bank->sectors[nSector].offset,
bank->sectors[nSector].size, &blank);
if (retval != ERROR_OK)
{
@@ -670,15 +672,15 @@ int at91sam7_erase_check(struct flash_bank_s *bank)
LOG_USER("Running slow fallback erase check - add working memory");
buffer = malloc(bank->sectors[0].size);
for (nSector=0; nSector<bank->num_sectors; nSector++)
for (nSector = 0; nSector < bank->num_sectors; nSector++)
{
bank->sectors[nSector].is_erased = 1;
retval = target->type->read_memory(target, bank->base+bank->sectors[nSector].offset, 4,
retval = target_read_memory(target, bank->base + bank->sectors[nSector].offset, 4,
bank->sectors[nSector].size/4, buffer);
if (retval != ERROR_OK)
return retval;
for (nByte=0; nByte<bank->sectors[nSector].size; nByte++)
for (nByte = 0; nByte < bank->sectors[nSector].size; nByte++)
{
if (buffer[nByte] != 0xFF)
{
@@ -692,10 +694,10 @@ int at91sam7_erase_check(struct flash_bank_s *bank)
return ERROR_OK;
}
int at91sam7_protect_check(struct flash_bank_s *bank)
static int at91sam7_protect_check(struct flash_bank_s *bank)
{
u8 lock_pos, gpnvm_pos;
u32 status;
uint8_t lock_pos, gpnvm_pos;
uint32_t status;
at91sam7_flash_bank_t *at91sam7_info = bank->driver_priv;
@@ -710,12 +712,12 @@ int at91sam7_protect_check(struct flash_bank_s *bank)
}
status = at91sam7_get_flash_status(bank->target, bank->bank_number);
at91sam7_info->lockbits = (status>>16);
at91sam7_info->lockbits = (status >> 16);
at91sam7_info->num_lockbits_on = 0;
for (lock_pos=0; lock_pos<bank->num_sectors; lock_pos++)
for (lock_pos = 0; lock_pos < bank->num_sectors; lock_pos++)
{
if ( ((status>>(16+lock_pos))&(0x0001)) == 1)
if (((status >> (16 + lock_pos))&(0x0001)) == 1)
{
at91sam7_info->num_lockbits_on++;
bank->sectors[lock_pos].is_protected = 1;
@@ -727,13 +729,13 @@ int at91sam7_protect_check(struct flash_bank_s *bank)
/* GPNVM and SECURITY bits apply only for MC_FSR of EFC0 */
status = at91sam7_get_flash_status(bank->target, 0);
at91sam7_info->securitybit = (status>>4)&0x01;
at91sam7_info->nvmbits = (status>>8)&0xFF;
at91sam7_info->securitybit = (status >> 4)&0x01;
at91sam7_info->nvmbits = (status >> 8)&0xFF;
at91sam7_info->num_nvmbits_on = 0;
for (gpnvm_pos=0; gpnvm_pos<at91sam7_info->num_nvmbits; gpnvm_pos++)
for (gpnvm_pos = 0; gpnvm_pos < at91sam7_info->num_nvmbits; gpnvm_pos++)
{
if ( ((status>>(8+gpnvm_pos))&(0x01)) == 1)
if (((status >> (8 + gpnvm_pos))&(0x01)) == 1)
{
at91sam7_info->num_nvmbits_on++;
}
@@ -742,34 +744,24 @@ int at91sam7_protect_check(struct flash_bank_s *bank)
return ERROR_OK;
}
/***************************************************************************************************************************************************************************************
# flash bank <driver> <base_addr> <size> <chip_width> <bus_width> <target_number> [<target_name> <banks> <sectors_per_bank> <pages_per_sector> <page_size> <num_nvmbits> <ext_freq_khz>]
# <ext_freq_khz> - MUST be used if clock is from external source
# CAN be used if main oscillator frequency is known
# Examples:
# flash bank at91sam7 0x00100000 0 0 4 0 0 AT91SAM7XC256 1 16 64 256 3 25000 ==== RECOMENDED ============
# flash bank at91sam7 0 0 0 0 0 0 0 0 0 0 0 0 25000 (auto-detection, except for clock) ==== RECOMENDED ============
# flash bank at91sam7 0x00100000 0 0 4 0 0 AT91SAM7XC256 1 16 64 256 3 0 ==== NOT RECOMENDED !!! ====
# flash bank at91sam7 0 0 0 0 0 (old style, full auto-detection) ==== NOT RECOMENDED !!! ====
****************************************************************************************************************************************************************************************/
int at91sam7_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank)
static int at91sam7_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank)
{
flash_bank_t *t_bank = bank;
at91sam7_flash_bank_t *at91sam7_info;
target_t *target = t_bank->target;
u32 base_address;
u32 bank_size;
u32 ext_freq;
uint32_t base_address;
uint32_t bank_size;
uint32_t ext_freq;
int chip_width;
int bus_width;
int banks_num;
int num_sectors;
u16 pages_per_sector;
u16 page_size;
u16 num_nvmbits;
uint16_t pages_per_sector;
uint16_t page_size;
uint16_t num_nvmbits;
char *target_name;
@@ -811,13 +803,13 @@ int at91sam7_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, ch
page_size = atoi(args[11]);
num_nvmbits = atoi(args[12]);
target_name = calloc(strlen(args[7])+1, sizeof(char));
target_name = calloc(strlen(args[7]) + 1, sizeof(char));
strcpy(target_name, args[7]);
/* calculate bank size */
bank_size = num_sectors * pages_per_sector * page_size;
for (bnk=0; bnk<banks_num; bnk++)
for (bnk = 0; bnk < banks_num; bnk++)
{
if (bnk > 0)
{
@@ -842,7 +834,7 @@ int at91sam7_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, ch
/* allocate sectors */
t_bank->sectors = malloc(num_sectors * sizeof(flash_sector_t));
for (sec=0; sec<num_sectors; sec++)
for (sec = 0; sec < num_sectors; sec++)
{
t_bank->sectors[sec].offset = sec * pages_per_sector * page_size;
t_bank->sectors[sec].size = pages_per_sector * page_size;
@@ -864,13 +856,13 @@ int at91sam7_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, ch
return ERROR_OK;
}
int at91sam7_erase(struct flash_bank_s *bank, int first, int last)
static int at91sam7_erase(struct flash_bank_s *bank, int first, int last)
{
at91sam7_flash_bank_t *at91sam7_info = bank->driver_priv;
int sec;
u32 nbytes, pos;
u8 *buffer;
u8 erase_all;
uint32_t nbytes, pos;
uint8_t *buffer;
uint8_t erase_all;
if (at91sam7_info->cidr == 0)
{
@@ -898,9 +890,9 @@ int at91sam7_erase(struct flash_bank_s *bank, int first, int last)
at91sam7_read_clock_info(bank);
at91sam7_set_flash_mode(bank, FMR_TIMING_FLASH);
if(erase_all)
if (erase_all)
{
if (at91sam7_flash_command(bank, EA, 0) != ERROR_OK)
if (at91sam7_flash_command(bank, EA, 0) != ERROR_OK)
{
return ERROR_FLASH_OPERATION_FAILED;
}
@@ -909,13 +901,13 @@ int at91sam7_erase(struct flash_bank_s *bank, int first, int last)
{
/* allocate and clean buffer */
nbytes = (last - first + 1) * bank->sectors[first].size;
buffer = malloc(nbytes * sizeof(u8));
for (pos=0; pos<nbytes; pos++)
buffer = malloc(nbytes * sizeof(uint8_t));
for (pos = 0; pos < nbytes; pos++)
{
buffer[pos] = 0xFF;
}
if ( at91sam7_write(bank, buffer, bank->sectors[first].offset, nbytes) != ERROR_OK)
if (at91sam7_write(bank, buffer, bank->sectors[first].offset, nbytes) != ERROR_OK)
{
return ERROR_FLASH_OPERATION_FAILED;
}
@@ -924,7 +916,7 @@ int at91sam7_erase(struct flash_bank_s *bank, int first, int last)
}
/* mark erased sectors */
for (sec=first; sec<=last; sec++)
for (sec = first; sec <= last; sec++)
{
bank->sectors[sec].is_erased = 1;
}
@@ -932,10 +924,11 @@ int at91sam7_erase(struct flash_bank_s *bank, int first, int last)
return ERROR_OK;
}
int at91sam7_protect(struct flash_bank_s *bank, int set, int first, int last)
static int at91sam7_protect(struct flash_bank_s *bank, int set, int first, int last)
{
u32 cmd;
u32 sector, pagen;
uint32_t cmd;
int sector;
uint32_t pagen;
at91sam7_flash_bank_t *at91sam7_info = bank->driver_priv;
@@ -959,7 +952,7 @@ int at91sam7_protect(struct flash_bank_s *bank, int set, int first, int last)
at91sam7_read_clock_info(bank);
at91sam7_set_flash_mode(bank, FMR_TIMING_NVBITS);
for (sector=first; sector<=last; sector++)
for (sector = first; sector <= last; sector++)
{
if (set)
cmd = SLB;
@@ -981,13 +974,13 @@ int at91sam7_protect(struct flash_bank_s *bank, int set, int first, int last)
return ERROR_OK;
}
int at91sam7_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count)
static int at91sam7_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count)
{
int retval;
at91sam7_flash_bank_t *at91sam7_info = bank->driver_priv;
target_t *target = bank->target;
u32 dst_min_alignment, wcount, bytes_remaining = count;
u32 first_page, last_page, pagen, buffer_pos;
uint32_t dst_min_alignment, wcount, bytes_remaining = count;
uint32_t first_page, last_page, pagen, buffer_pos;
if (at91sam7_info->cidr == 0)
{
@@ -1007,7 +1000,7 @@ int at91sam7_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count)
if (offset % dst_min_alignment)
{
LOG_WARNING("offset 0x%x breaks required alignment 0x%x", offset, dst_min_alignment);
LOG_WARNING("offset 0x%" PRIx32 " breaks required alignment 0x%" PRIx32 "", offset, dst_min_alignment);
return ERROR_FLASH_DST_BREAKS_ALIGNMENT;
}
@@ -1017,15 +1010,15 @@ int at91sam7_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count)
first_page = offset/dst_min_alignment;
last_page = CEIL(offset + count, dst_min_alignment);
LOG_DEBUG("first_page: %i, last_page: %i, count %i", first_page, last_page, count);
LOG_DEBUG("first_page: %i, last_page: %i, count %i", (int)first_page, (int)last_page, (int)count);
/* Configure the flash controller timing */
at91sam7_read_clock_info(bank);
at91sam7_set_flash_mode(bank, FMR_TIMING_FLASH);
for (pagen=first_page; pagen<last_page; pagen++)
for (pagen = first_page; pagen < last_page; pagen++)
{
if (bytes_remaining<dst_min_alignment)
if (bytes_remaining < dst_min_alignment)
count = bytes_remaining;
else
count = dst_min_alignment;
@@ -1034,7 +1027,7 @@ int at91sam7_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count)
/* Write one block to the PageWriteBuffer */
buffer_pos = (pagen-first_page)*dst_min_alignment;
wcount = CEIL(count,4);
if((retval = target->type->write_memory(target, bank->base+pagen*dst_min_alignment, 4, wcount, buffer+buffer_pos)) != ERROR_OK)
if ((retval = target_write_memory(target, bank->base + pagen*dst_min_alignment, 4, wcount, buffer + buffer_pos)) != ERROR_OK)
{
return retval;
}
@@ -1044,13 +1037,13 @@ int at91sam7_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count)
{
return ERROR_FLASH_OPERATION_FAILED;
}
LOG_DEBUG("Write flash bank:%i page number:%i", bank->bank_number, pagen);
LOG_DEBUG("Write flash bank:%i page number:%" PRIi32 "", bank->bank_number, pagen);
}
return ERROR_OK;
}
int at91sam7_probe(struct flash_bank_s *bank)
static int at91sam7_probe(struct flash_bank_s *bank)
{
/* we can't probe on an at91sam7
* if this is an at91sam7, it has the configured flash */
@@ -1069,7 +1062,7 @@ int at91sam7_probe(struct flash_bank_s *bank)
return ERROR_OK;
}
int at91sam7_info(struct flash_bank_s *bank, char *buf, int buf_size)
static int at91sam7_info(struct flash_bank_s *bank, char *buf, int buf_size)
{
int printed;
at91sam7_flash_bank_t *at91sam7_info = bank->driver_priv;
@@ -1086,17 +1079,21 @@ int at91sam7_info(struct flash_bank_s *bank, char *buf, int buf_size)
buf += printed;
buf_size -= printed;
printed = snprintf(buf, buf_size,
" Cidr: 0x%8.8x | Arch: 0x%4.4x | Eproc: %s | Version: 0x%3.3x | Flashsize: 0x%8.8x\n",
at91sam7_info->cidr, at91sam7_info->cidr_arch, EPROC[at91sam7_info->cidr_eproc],
at91sam7_info->cidr_version, bank->size);
printed = snprintf(buf,
buf_size,
" Cidr: 0x%8.8" PRIx32 " | Arch: 0x%4.4x | Eproc: %s | Version: 0x%3.3x | Flashsize: 0x%8.8" PRIx32 "\n",
at91sam7_info->cidr,
at91sam7_info->cidr_arch,
EPROC[at91sam7_info->cidr_eproc],
at91sam7_info->cidr_version,
bank->size);
buf += printed;
buf_size -= printed;
printed = snprintf(buf, buf_size,
" Master clock (estimated): %u KHz | External clock: %u KHz\n",
at91sam7_info->mck_freq / 1000, at91sam7_info->ext_freq / 1000);
(unsigned)(at91sam7_info->mck_freq / 1000), (unsigned)(at91sam7_info->ext_freq / 1000));
buf += printed;
buf_size -= printed;
@@ -1120,28 +1117,28 @@ int at91sam7_info(struct flash_bank_s *bank, char *buf, int buf_size)
return ERROR_OK;
}
/*
* On AT91SAM7S: When the gpnvm bits are set with
/*
* On AT91SAM7S: When the gpnvm bits are set with
* > at91sam7 gpnvm bitnr set
* the changes are not visible in the flash controller status register MC_FSR
* the changes are not visible in the flash controller status register MC_FSR
* until the processor has been reset.
* On the Olimex board this requires a power cycle.
* Note that the AT91SAM7S has the following errata (doc6175.pdf sec 14.1.3):
* The maximum number of write/erase cycles for Non volatile Memory bits is 100. this includes
* Lock Bits (LOCKx), General Purpose NVM bits (GPNVMx) and the Security Bit.
*/
int at91sam7_handle_gpnvm_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
static int at91sam7_handle_gpnvm_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
flash_bank_t *bank;
int bit;
u8 flashcmd;
u32 status;
uint8_t flashcmd;
uint32_t status;
at91sam7_flash_bank_t *at91sam7_info;
int retval;
if (argc != 2)
{
command_print(cmd_ctx, "at91sam7 gpnvm <bit> <set|clear>");
command_print(cmd_ctx, "at91sam7 gpnvm <bit> <set | clear>");
return ERROR_OK;
}
@@ -1194,7 +1191,7 @@ int at91sam7_handle_gpnvm_command(struct command_context_s *cmd_ctx, char *cmd,
/* Configure the flash controller timing */
at91sam7_read_clock_info(bank);
at91sam7_set_flash_mode(bank, FMR_TIMING_NVBITS);
if (at91sam7_flash_command(bank, flashcmd, bit) != ERROR_OK)
{
return ERROR_FLASH_OPERATION_FAILED;
@@ -1202,10 +1199,10 @@ int at91sam7_handle_gpnvm_command(struct command_context_s *cmd_ctx, char *cmd,
/* GPNVM and SECURITY bits apply only for MC_FSR of EFC0 */
status = at91sam7_get_flash_status(bank->target, 0);
LOG_DEBUG("at91sam7_handle_gpnvm_command: cmd 0x%x, value 0x%x, status 0x%x \n", flashcmd, bit, status);
LOG_DEBUG("at91sam7_handle_gpnvm_command: cmd 0x%x, value %d, status 0x%" PRIx32 " \n", flashcmd, bit, status);
/* check protect state */
at91sam7_protect_check(bank);
return ERROR_OK;
}

View File

@@ -24,49 +24,48 @@
#define AT91SAM7_H
#include "flash.h"
#include "target.h"
typedef struct at91sam7_flash_bank_s
{
/* chip id register */
u32 cidr;
u16 cidr_ext;
u16 cidr_nvptyp;
u16 cidr_arch;
u16 cidr_sramsiz;
u16 cidr_nvpsiz;
u16 cidr_nvpsiz2;
u16 cidr_eproc;
u16 cidr_version;
uint32_t cidr;
uint16_t cidr_ext;
uint16_t cidr_nvptyp;
uint16_t cidr_arch;
uint16_t cidr_sramsiz;
uint16_t cidr_nvpsiz;
uint16_t cidr_nvpsiz2;
uint16_t cidr_eproc;
uint16_t cidr_version;
char *target_name;
/* flash auto-detection */
u8 flash_autodetection;
uint8_t flash_autodetection;
/* flash geometry */
u16 pages_per_sector;
u16 pagesize;
u16 pages_in_lockregion;
uint16_t pages_per_sector;
uint16_t pagesize;
uint16_t pages_in_lockregion;
/* nv memory bits */
u16 num_lockbits_on;
u16 lockbits;
u16 num_nvmbits;
u16 num_nvmbits_on;
u16 nvmbits;
u8 securitybit;
uint16_t num_lockbits_on;
uint16_t lockbits;
uint16_t num_nvmbits;
uint16_t num_nvmbits_on;
uint16_t nvmbits;
uint8_t securitybit;
/* 0: not init
* 1: fmcn for nvbits (1uS)
* 2: fmcn for flash (1.5uS) */
u8 flashmode;
uint8_t flashmode;
/* main clock status */
u8 mck_valid;
u32 mck_freq;
uint8_t mck_valid;
uint32_t mck_freq;
/* external clock frequency */
u32 ext_freq;
uint32_t ext_freq;
} at91sam7_flash_bank_t;

View File

@@ -1,954 +0,0 @@
/***************************************************************************
* Copyright (C) 2006 by Magnus Lundin *
* lundin@mlu.mine.nu *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
/***************************************************************************
There are some things to notice
* AT91SAM7S64 is tested
* All AT91SAM7Sxx and AT91SAM7Xxx should work but is not tested
* All parameters are identified from onchip configuartion registers
*
* The flash controller handles erases automatically on a page (128/265 byte) basis
* Only an EraseAll command is supported by the controller
* Partial erases can be implemented in software by writing one 0xFFFFFFFF word to
* some location in every page in the region to be erased
*
* Lock regions (sectors) are 32 or 64 pages
*
***************************************************************************/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "replacements.h"
#include "at91sam7_old.h"
#include "flash.h"
#include "target.h"
#include "log.h"
#include "binarybuffer.h"
#include "types.h"
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
int at91sam7_old_register_commands(struct command_context_s *cmd_ctx);
int at91sam7_old_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank);
int at91sam7_old_erase(struct flash_bank_s *bank, int first, int last);
int at91sam7_old_protect(struct flash_bank_s *bank, int set, int first, int last);
int at91sam7_old_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count);
int at91sam7_old_probe(struct flash_bank_s *bank);
int at91sam7_old_auto_probe(struct flash_bank_s *bank);
int at91sam7_old_erase_check(struct flash_bank_s *bank);
int at91sam7_old_protect_check(struct flash_bank_s *bank);
int at91sam7_old_info(struct flash_bank_s *bank, char *buf, int buf_size);
u32 at91sam7_old_get_flash_status(flash_bank_t *bank, u8 flashplane);
void at91sam7_old_set_flash_mode(flash_bank_t *bank, u8 flashplane, int mode);
u32 at91sam7_old_wait_status_busy(flash_bank_t *bank, u8 flashplane, u32 waitbits, int timeout);
int at91sam7_old_flash_command(struct flash_bank_s *bank, u8 flashplane, u8 cmd, u16 pagen);
int at91sam7_old_handle_gpnvm_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
flash_driver_t at91sam7_old_flash =
{
.name = "at91sam7",
.register_commands = at91sam7_old_register_commands,
.flash_bank_command = at91sam7_old_flash_bank_command,
.erase = at91sam7_old_erase,
.protect = at91sam7_old_protect,
.write = at91sam7_old_write,
.probe = at91sam7_old_probe,
.auto_probe = at91sam7_old_probe,
.erase_check = at91sam7_old_erase_check,
.protect_check = at91sam7_old_protect_check,
.info = at91sam7_old_info
};
u32 MC_FMR_old[4] = { 0xFFFFFF60, 0xFFFFFF70, 0xFFFFFF80, 0xFFFFFF90 };
u32 MC_FCR_old[4] = { 0xFFFFFF64, 0xFFFFFF74, 0xFFFFFF84, 0xFFFFFF94 };
u32 MC_FSR_old[4] = { 0xFFFFFF68, 0xFFFFFF78, 0xFFFFFF88, 0xFFFFFF98 };
char * EPROC_old[8]= {"Unknown","ARM946-E","ARM7TDMI","Unknown","ARM920T","ARM926EJ-S","Unknown","Unknown"};
long NVPSIZ_old[16] = {
0,
0x2000, /* 8K */
0x4000, /* 16K */
0x8000, /* 32K */
-1,
0x10000, /* 64K */
-1,
0x20000, /* 128K */
-1,
0x40000, /* 256K */
0x80000, /* 512K */
-1,
0x100000, /* 1024K */
-1,
0x200000, /* 2048K */
-1
};
long SRAMSIZ_old[16] = {
-1,
0x0400, /* 1K */
0x0800, /* 2K */
-1,
0x1c000, /* 112K */
0x1000, /* 4K */
0x14000, /* 80K */
0x28000, /* 160K */
0x2000, /* 8K */
0x4000, /* 16K */
0x8000, /* 32K */
0x10000, /* 64K */
0x20000, /* 128K */
0x40000, /* 256K */
0x18000, /* 96K */
0x80000, /* 512K */
};
int at91sam7_old_register_commands(struct command_context_s *cmd_ctx)
{
command_t *at91sam7_old_cmd = register_command(cmd_ctx, NULL, "at91sam7", NULL, COMMAND_ANY, NULL);
register_command(cmd_ctx, at91sam7_old_cmd, "gpnvm", at91sam7_old_handle_gpnvm_command, COMMAND_EXEC,
"at91sam7 gpnvm <num> <bit> set|clear, set or clear at91sam7 gpnvm bit");
return ERROR_OK;
}
u32 at91sam7_old_get_flash_status(flash_bank_t *bank, u8 flashplane)
{
target_t *target = bank->target;
u32 fsr;
target_read_u32(target, MC_FSR_old[flashplane], &fsr);
return fsr;
}
/* Read clock configuration and set at91sam7_old_info->usec_clocks*/
void at91sam7_old_read_clock_info(flash_bank_t *bank)
{
at91sam7_old_flash_bank_t *at91sam7_old_info = bank->driver_priv;
target_t *target = bank->target;
u32 mckr, mcfr, pllr;
unsigned long tmp = 0, mainfreq;
int flashplane;
/* Read main clock freqency register */
target_read_u32(target, CKGR_MCFR_old, &mcfr);
/* Read master clock register */
target_read_u32(target, PMC_MCKR_old, &mckr);
/* Read Clock Generator PLL Register */
target_read_u32(target, CKGR_PLLR_old, &pllr);
at91sam7_old_info->mck_valid = 0;
switch (mckr & PMC_MCKR_CSS_old)
{
case 0: /* Slow Clock */
at91sam7_old_info->mck_valid = 1;
mainfreq = RC_FREQ_old / 16ul * (mcfr & 0xffff);
tmp = mainfreq;
break;
case 1: /* Main Clock */
if (mcfr & CKGR_MCFR_MAINRDY_old)
{
at91sam7_old_info->mck_valid = 1;
mainfreq = RC_FREQ_old / 16ul * (mcfr & 0xffff);
tmp = mainfreq;
}
break;
case 2: /* Reserved */
break;
case 3: /* PLL Clock */
if (mcfr & CKGR_MCFR_MAINRDY_old)
{
target_read_u32(target, CKGR_PLLR_old, &pllr);
if (!(pllr & CKGR_PLLR_DIV_old))
break; /* 0 Hz */
at91sam7_old_info->mck_valid = 1;
mainfreq = RC_FREQ_old / 16ul * (mcfr & 0xffff);
/* Integer arithmetic should have sufficient precision
as long as PLL is properly configured. */
tmp = mainfreq / (pllr & CKGR_PLLR_DIV_old) *
(((pllr & CKGR_PLLR_MUL_old) >> 16) + 1);
}
break;
}
/* Prescaler adjust */
if (((mckr & PMC_MCKR_PRES_old) >> 2) == 7)
at91sam7_old_info->mck_valid = 0;
else
at91sam7_old_info->mck_freq = tmp >> ((mckr & PMC_MCKR_PRES_old) >> 2);
/* Forget old flash timing */
for (flashplane = 0; flashplane<at91sam7_old_info->num_planes; flashplane++)
{
at91sam7_old_set_flash_mode(bank, flashplane, FMR_TIMING_NONE_old);
}
}
/* Setup the timimg registers for nvbits or normal flash */
void at91sam7_old_set_flash_mode(flash_bank_t *bank, u8 flashplane, int mode)
{
u32 fmr, fmcn = 0, fws = 0;
at91sam7_old_flash_bank_t *at91sam7_old_info = bank->driver_priv;
target_t *target = bank->target;
if (mode && (mode != at91sam7_old_info->flashmode[flashplane]))
{
/* Always round up (ceil) */
if (mode==FMR_TIMING_NVBITS_old)
{
if (at91sam7_old_info->cidr_arch == 0x60)
{
/* AT91SAM7A3 uses master clocks in 100 ns */
fmcn = (at91sam7_old_info->mck_freq/10000000ul)+1;
}
else
{
/* master clocks in 1uS for ARCH 0x7 types */
fmcn = (at91sam7_old_info->mck_freq/1000000ul)+1;
}
}
else if (mode==FMR_TIMING_FLASH_old)
/* main clocks in 1.5uS */
fmcn = (at91sam7_old_info->mck_freq/666666ul)+1;
/* Only allow fmcn=0 if clock period is > 30 us = 33kHz. */
if (at91sam7_old_info->mck_freq <= 33333ul)
fmcn = 0;
/* Only allow fws=0 if clock frequency is < 30 MHz. */
if (at91sam7_old_info->mck_freq > 30000000ul)
fws = 1;
LOG_DEBUG("fmcn[%i]: %i", flashplane, fmcn);
fmr = fmcn << 16 | fws << 8;
target_write_u32(target, MC_FMR_old[flashplane], fmr);
}
at91sam7_old_info->flashmode[flashplane] = mode;
}
u32 at91sam7_old_wait_status_busy(flash_bank_t *bank, u8 flashplane, u32 waitbits, int timeout)
{
u32 status;
while ((!((status = at91sam7_old_get_flash_status(bank,flashplane)) & waitbits)) && (timeout-- > 0))
{
LOG_DEBUG("status[%i]: 0x%x", flashplane, status);
alive_sleep(1);
}
LOG_DEBUG("status[%i]: 0x%x", flashplane, status);
if (status & 0x0C)
{
LOG_ERROR("status register: 0x%x", status);
if (status & 0x4)
LOG_ERROR("Lock Error Bit Detected, Operation Abort");
if (status & 0x8)
LOG_ERROR("Invalid command and/or bad keyword, Operation Abort");
if (status & 0x10)
LOG_ERROR("Security Bit Set, Operation Abort");
}
return status;
}
/* Send one command to the AT91SAM flash controller */
int at91sam7_old_flash_command(struct flash_bank_s *bank, u8 flashplane, u8 cmd, u16 pagen)
{
u32 fcr;
at91sam7_old_flash_bank_t *at91sam7_old_info = bank->driver_priv;
target_t *target = bank->target;
fcr = (0x5A<<24) | ((pagen&0x3FF)<<8) | cmd;
target_write_u32(target, MC_FCR_old[flashplane], fcr);
LOG_DEBUG("Flash command: 0x%x, flashplane: %i, pagenumber:%u", fcr, flashplane, pagen);
if ((at91sam7_old_info->cidr_arch == 0x60)&&((cmd==SLB_old)|(cmd==CLB_old)))
{
/* Lock bit manipulation on AT91SAM7A3 waits for FC_FSR bit 1, EOL */
if (at91sam7_old_wait_status_busy(bank, flashplane, MC_FSR_EOL_old, 10)&0x0C)
{
return ERROR_FLASH_OPERATION_FAILED;
}
return ERROR_OK;
}
if (at91sam7_old_wait_status_busy(bank, flashplane, MC_FSR_FRDY_old, 10)&0x0C)
{
return ERROR_FLASH_OPERATION_FAILED;
}
return ERROR_OK;
}
/* Read device id register, main clock frequency register and fill in driver info structure */
int at91sam7_old_read_part_info(struct flash_bank_s *bank)
{
at91sam7_old_flash_bank_t *at91sam7_old_info = bank->driver_priv;
target_t *target = bank->target;
u32 cidr, status;
int sectornum;
if (at91sam7_old_info->cidr != 0)
return ERROR_OK; /* already probed, multiple probes may cause memory leak, not allowed */
/* Read and parse chip identification register */
target_read_u32(target, DBGU_CIDR_old, &cidr);
if (cidr == 0)
{
LOG_WARNING("Cannot identify target as an AT91SAM");
return ERROR_FLASH_OPERATION_FAILED;
}
at91sam7_old_info->cidr = cidr;
at91sam7_old_info->cidr_ext = (cidr>>31)&0x0001;
at91sam7_old_info->cidr_nvptyp = (cidr>>28)&0x0007;
at91sam7_old_info->cidr_arch = (cidr>>20)&0x00FF;
at91sam7_old_info->cidr_sramsiz = (cidr>>16)&0x000F;
at91sam7_old_info->cidr_nvpsiz2 = (cidr>>12)&0x000F;
at91sam7_old_info->cidr_nvpsiz = (cidr>>8)&0x000F;
at91sam7_old_info->cidr_eproc = (cidr>>5)&0x0007;
at91sam7_old_info->cidr_version = cidr&0x001F;
bank->size = NVPSIZ_old[at91sam7_old_info->cidr_nvpsiz];
at91sam7_old_info->target_name = "Unknown";
/* Support just for bulk erase of a single flash plane, whole device if flash size <= 256k */
if (NVPSIZ_old[at91sam7_old_info->cidr_nvpsiz]<0x80000) /* Flash size less than 512K, one flash plane */
{
bank->num_sectors = 1;
bank->sectors = malloc(sizeof(flash_sector_t));
bank->sectors[0].offset = 0;
bank->sectors[0].size = bank->size;
bank->sectors[0].is_erased = -1;
bank->sectors[0].is_protected = -1;
}
else /* Flash size 512K or larger, several flash planes */
{
bank->num_sectors = NVPSIZ_old[at91sam7_old_info->cidr_nvpsiz]/0x40000;
bank->sectors = malloc(bank->num_sectors*sizeof(flash_sector_t));
for (sectornum=0; sectornum<bank->num_sectors; sectornum++)
{
bank->sectors[sectornum].offset = sectornum*0x40000;
bank->sectors[sectornum].size = 0x40000;
bank->sectors[sectornum].is_erased = -1;
bank->sectors[sectornum].is_protected = -1;
}
}
LOG_DEBUG("nvptyp: 0x%3.3x, arch: 0x%4.4x", at91sam7_old_info->cidr_nvptyp, at91sam7_old_info->cidr_arch );
/* Read main and master clock freqency register */
at91sam7_old_read_clock_info(bank);
at91sam7_old_info->num_planes = 1;
status = at91sam7_old_get_flash_status(bank, 0);
at91sam7_old_info->securitybit = (status>>4)&0x01;
at91sam7_old_protect_check(bank); /* TODO Check the protect check */
if (at91sam7_old_info->cidr_arch == 0x70 )
{
at91sam7_old_info->num_nvmbits = 2;
at91sam7_old_info->nvmbits = (status>>8)&0x03;
bank->base = 0x100000;
bank->bus_width = 4;
if (bank->size==0x80000) /* AT91SAM7S512 */
{
at91sam7_old_info->target_name = "AT91SAM7S512";
at91sam7_old_info->num_planes = 2;
if (at91sam7_old_info->num_planes != bank->num_sectors)
LOG_WARNING("Internal error: Number of flash planes and erase sectors does not match, please report");;
at91sam7_old_info->num_lockbits = 2*16;
at91sam7_old_info->pagesize = 256;
at91sam7_old_info->pages_in_lockregion = 64;
at91sam7_old_info->num_pages = 2*16*64;
}
if (bank->size==0x40000) /* AT91SAM7S256 */
{
at91sam7_old_info->target_name = "AT91SAM7S256";
at91sam7_old_info->num_lockbits = 16;
at91sam7_old_info->pagesize = 256;
at91sam7_old_info->pages_in_lockregion = 64;
at91sam7_old_info->num_pages = 16*64;
}
if (bank->size==0x20000) /* AT91SAM7S128 */
{
at91sam7_old_info->target_name = "AT91SAM7S128";
at91sam7_old_info->num_lockbits = 8;
at91sam7_old_info->pagesize = 256;
at91sam7_old_info->pages_in_lockregion = 64;
at91sam7_old_info->num_pages = 8*64;
}
if (bank->size==0x10000) /* AT91SAM7S64 */
{
at91sam7_old_info->target_name = "AT91SAM7S64";
at91sam7_old_info->num_lockbits = 16;
at91sam7_old_info->pagesize = 128;
at91sam7_old_info->pages_in_lockregion = 32;
at91sam7_old_info->num_pages = 16*32;
}
if (bank->size==0x08000) /* AT91SAM7S321/32 */
{
at91sam7_old_info->target_name = "AT91SAM7S321/32";
at91sam7_old_info->num_lockbits = 8;
at91sam7_old_info->pagesize = 128;
at91sam7_old_info->pages_in_lockregion = 32;
at91sam7_old_info->num_pages = 8*32;
}
return ERROR_OK;
}
if (at91sam7_old_info->cidr_arch == 0x71 )
{
at91sam7_old_info->num_nvmbits = 3;
at91sam7_old_info->nvmbits = (status>>8)&0x07;
bank->base = 0x100000;
bank->bus_width = 4;
if (bank->size==0x80000) /* AT91SAM7XC512 */
{
at91sam7_old_info->target_name = "AT91SAM7XC512";
at91sam7_old_info->num_planes = 2;
if (at91sam7_old_info->num_planes != bank->num_sectors)
LOG_WARNING("Internal error: Number of flash planes and erase sectors does not match, please report");;
at91sam7_old_info->num_lockbits = 2*16;
at91sam7_old_info->pagesize = 256;
at91sam7_old_info->pages_in_lockregion = 64;
at91sam7_old_info->num_pages = 2*16*64;
}
if (bank->size==0x40000) /* AT91SAM7XC256 */
{
at91sam7_old_info->target_name = "AT91SAM7XC256";
at91sam7_old_info->num_lockbits = 16;
at91sam7_old_info->pagesize = 256;
at91sam7_old_info->pages_in_lockregion = 64;
at91sam7_old_info->num_pages = 16*64;
}
if (bank->size==0x20000) /* AT91SAM7XC128 */
{
at91sam7_old_info->target_name = "AT91SAM7XC128";
at91sam7_old_info->num_lockbits = 8;
at91sam7_old_info->pagesize = 256;
at91sam7_old_info->pages_in_lockregion = 64;
at91sam7_old_info->num_pages = 8*64;
}
return ERROR_OK;
}
if (at91sam7_old_info->cidr_arch == 0x72 )
{
at91sam7_old_info->num_nvmbits = 3;
at91sam7_old_info->nvmbits = (status>>8)&0x07;
bank->base = 0x100000;
bank->bus_width = 4;
if (bank->size==0x80000) /* AT91SAM7SE512 */
{
at91sam7_old_info->target_name = "AT91SAM7SE512";
at91sam7_old_info->num_planes = 2;
if (at91sam7_old_info->num_planes != bank->num_sectors)
LOG_WARNING("Internal error: Number of flash planes and erase sectors does not match, please report");;
at91sam7_old_info->num_lockbits = 32;
at91sam7_old_info->pagesize = 256;
at91sam7_old_info->pages_in_lockregion = 64;
at91sam7_old_info->num_pages = 32*64;
}
if (bank->size==0x40000)
{
at91sam7_old_info->target_name = "AT91SAM7SE256";
at91sam7_old_info->num_lockbits = 16;
at91sam7_old_info->pagesize = 256;
at91sam7_old_info->pages_in_lockregion = 64;
at91sam7_old_info->num_pages = 16*64;
}
if (bank->size==0x08000)
{
at91sam7_old_info->target_name = "AT91SAM7SE32";
at91sam7_old_info->num_lockbits = 8;
at91sam7_old_info->pagesize = 128;
at91sam7_old_info->pages_in_lockregion = 32;
at91sam7_old_info->num_pages = 8*32;
}
return ERROR_OK;
}
if (at91sam7_old_info->cidr_arch == 0x75 )
{
at91sam7_old_info->num_nvmbits = 3;
at91sam7_old_info->nvmbits = (status>>8)&0x07;
bank->base = 0x100000;
bank->bus_width = 4;
if (bank->size==0x80000) /* AT91SAM7X512 */
{
at91sam7_old_info->target_name = "AT91SAM7X512";
at91sam7_old_info->num_planes = 2;
if (at91sam7_old_info->num_planes != bank->num_sectors)
LOG_WARNING("Internal error: Number of flash planes and erase sectors does not match, please report");;
at91sam7_old_info->num_lockbits = 32;
at91sam7_old_info->pagesize = 256;
at91sam7_old_info->pages_in_lockregion = 64;
at91sam7_old_info->num_pages = 2*16*64;
LOG_DEBUG("Support for AT91SAM7X512 is experimental in this version!");
}
if (bank->size==0x40000) /* AT91SAM7X256 */
{
at91sam7_old_info->target_name = "AT91SAM7X256";
at91sam7_old_info->num_lockbits = 16;
at91sam7_old_info->pagesize = 256;
at91sam7_old_info->pages_in_lockregion = 64;
at91sam7_old_info->num_pages = 16*64;
}
if (bank->size==0x20000) /* AT91SAM7X128 */
{
at91sam7_old_info->target_name = "AT91SAM7X128";
at91sam7_old_info->num_lockbits = 8;
at91sam7_old_info->pagesize = 256;
at91sam7_old_info->pages_in_lockregion = 64;
at91sam7_old_info->num_pages = 8*64;
}
return ERROR_OK;
}
if (at91sam7_old_info->cidr_arch == 0x60 )
{
at91sam7_old_info->num_nvmbits = 3;
at91sam7_old_info->nvmbits = (status>>8)&0x07;
bank->base = 0x100000;
bank->bus_width = 4;
if (bank->size == 0x40000) /* AT91SAM7A3 */
{
at91sam7_old_info->target_name = "AT91SAM7A3";
at91sam7_old_info->num_lockbits = 16;
at91sam7_old_info->pagesize = 256;
at91sam7_old_info->pages_in_lockregion = 16;
at91sam7_old_info->num_pages = 16*64;
}
return ERROR_OK;
}
LOG_WARNING("at91sam7_old flash only tested for AT91SAM7Sxx series");
return ERROR_OK;
}
int at91sam7_old_erase_check(struct flash_bank_s *bank)
{
at91sam7_old_flash_bank_t *at91sam7_old_info = bank->driver_priv;
if (!at91sam7_old_info->working_area_size)
{
}
else
{
}
return ERROR_OK;
}
int at91sam7_old_protect_check(struct flash_bank_s *bank)
{
u32 status;
int flashplane;
at91sam7_old_flash_bank_t *at91sam7_old_info = bank->driver_priv;
if (at91sam7_old_info->cidr == 0)
{
return ERROR_FLASH_BANK_NOT_PROBED;
}
if (bank->target->state != TARGET_HALTED)
{
LOG_ERROR("Target not halted");
return ERROR_TARGET_NOT_HALTED;
}
for (flashplane=0;flashplane<at91sam7_old_info->num_planes;flashplane++)
{
status = at91sam7_old_get_flash_status(bank, flashplane);
at91sam7_old_info->lockbits[flashplane] = (status >> 16);
}
return ERROR_OK;
}
/* flash_bank at91sam7_old 0 0 0 0 <target#>
*/
int at91sam7_old_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank)
{
at91sam7_old_flash_bank_t *at91sam7_old_info;
int i;
if (argc < 6)
{
LOG_WARNING("incomplete flash_bank at91sam7_old configuration");
return ERROR_FLASH_BANK_INVALID;
}
at91sam7_old_info = malloc(sizeof(at91sam7_old_flash_bank_t));
bank->driver_priv = at91sam7_old_info;
/* part wasn't probed for info yet */
at91sam7_old_info->cidr = 0;
for (i=0;i<4;i++)
at91sam7_old_info->flashmode[i]=0;
return ERROR_OK;
}
int at91sam7_old_erase(struct flash_bank_s *bank, int first, int last)
{
at91sam7_old_flash_bank_t *at91sam7_old_info = bank->driver_priv;
u8 flashplane;
if (at91sam7_old_info->cidr == 0)
{
return ERROR_FLASH_BANK_NOT_PROBED;
}
if (bank->target->state != TARGET_HALTED)
{
LOG_ERROR("Target not halted");
return ERROR_TARGET_NOT_HALTED;
}
if ((first < 0) || (last < first) || (last >= bank->num_sectors))
{
if ((first == 0) && (last == (at91sam7_old_info->num_lockbits-1)))
{
LOG_WARNING("Sector numbers based on lockbit count, probably a deprecated script");
last = bank->num_sectors-1;
}
else return ERROR_FLASH_SECTOR_INVALID;
}
/* Configure the flash controller timing */
at91sam7_old_read_clock_info(bank);
for (flashplane = first; flashplane<=last; flashplane++)
{
/* Configure the flash controller timing */
at91sam7_old_set_flash_mode(bank, flashplane, FMR_TIMING_FLASH_old);
if (at91sam7_old_flash_command(bank, flashplane, EA_old, 0) != ERROR_OK)
{
return ERROR_FLASH_OPERATION_FAILED;
}
}
return ERROR_OK;
}
int at91sam7_old_protect(struct flash_bank_s *bank, int set, int first, int last)
{
u32 cmd, pagen;
u8 flashplane;
int lockregion;
at91sam7_old_flash_bank_t *at91sam7_old_info = bank->driver_priv;
if (at91sam7_old_info->cidr == 0)
{
return ERROR_FLASH_BANK_NOT_PROBED;
}
if (bank->target->state != TARGET_HALTED)
{
LOG_ERROR("Target not halted");
return ERROR_TARGET_NOT_HALTED;
}
if ((first < 0) || (last < first) || (last >= at91sam7_old_info->num_lockbits))
{
return ERROR_FLASH_SECTOR_INVALID;
}
at91sam7_old_read_clock_info(bank);
for (lockregion=first;lockregion<=last;lockregion++)
{
pagen = lockregion*at91sam7_old_info->pages_in_lockregion;
flashplane = (pagen>>10)&0x03;
/* Configure the flash controller timing */
at91sam7_old_set_flash_mode(bank, flashplane, FMR_TIMING_NVBITS_old);
if (set)
cmd = SLB_old;
else
cmd = CLB_old;
if (at91sam7_old_flash_command(bank, flashplane, cmd, pagen) != ERROR_OK)
{
return ERROR_FLASH_OPERATION_FAILED;
}
}
at91sam7_old_protect_check(bank);
return ERROR_OK;
}
int at91sam7_old_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count)
{
at91sam7_old_flash_bank_t *at91sam7_old_info = bank->driver_priv;
target_t *target = bank->target;
u32 dst_min_alignment, wcount, bytes_remaining = count;
u32 first_page, last_page, pagen, buffer_pos;
u8 flashplane;
if (at91sam7_old_info->cidr == 0)
{
return ERROR_FLASH_BANK_NOT_PROBED;
}
if (bank->target->state != TARGET_HALTED)
{
LOG_ERROR("Target not halted");
return ERROR_TARGET_NOT_HALTED;
}
if (offset + count > bank->size)
return ERROR_FLASH_DST_OUT_OF_BANK;
dst_min_alignment = at91sam7_old_info->pagesize;
if (offset % dst_min_alignment)
{
LOG_WARNING("offset 0x%x breaks required alignment 0x%x", offset, dst_min_alignment);
return ERROR_FLASH_DST_BREAKS_ALIGNMENT;
}
if (at91sam7_old_info->cidr_arch == 0)
return ERROR_FLASH_BANK_NOT_PROBED;
first_page = offset/dst_min_alignment;
last_page = CEIL(offset + count, dst_min_alignment);
LOG_DEBUG("first_page: %i, last_page: %i, count %i", first_page, last_page, count);
at91sam7_old_read_clock_info(bank);
for (pagen=first_page; pagen<last_page; pagen++)
{
if (bytes_remaining<dst_min_alignment)
count = bytes_remaining;
else
count = dst_min_alignment;
bytes_remaining -= count;
/* Write one block to the PageWriteBuffer */
buffer_pos = (pagen-first_page)*dst_min_alignment;
wcount = CEIL(count,4);
target->type->write_memory(target, bank->base+pagen*dst_min_alignment, 4, wcount, buffer+buffer_pos);
flashplane = (pagen>>10)&0x3;
/* Configure the flash controller timing */
at91sam7_old_set_flash_mode(bank, flashplane, FMR_TIMING_FLASH_old);
/* Send Write Page command to Flash Controller */
if (at91sam7_old_flash_command(bank, flashplane, WP_old, pagen) != ERROR_OK)
{
return ERROR_FLASH_OPERATION_FAILED;
}
LOG_DEBUG("Write flash plane:%i page number:%i", flashplane, pagen);
}
return ERROR_OK;
}
int at91sam7_old_probe(struct flash_bank_s *bank)
{
/* we can't probe on an at91sam7_old
* if this is an at91sam7_old, it has the configured flash
*/
at91sam7_old_flash_bank_t *at91sam7_old_info = bank->driver_priv;
int retval;
if (at91sam7_old_info->cidr != 0)
{
return ERROR_OK; /* already probed */
}
if (bank->target->state != TARGET_HALTED)
{
LOG_ERROR("Target not halted");
return ERROR_TARGET_NOT_HALTED;
}
retval = at91sam7_old_read_part_info(bank);
if (retval != ERROR_OK)
return retval;
return ERROR_OK;
}
int at91sam7_old_info(struct flash_bank_s *bank, char *buf, int buf_size)
{
int printed, flashplane;
at91sam7_old_flash_bank_t *at91sam7_old_info = bank->driver_priv;
if (at91sam7_old_info->cidr == 0)
{
return ERROR_FLASH_BANK_NOT_PROBED;
}
printed = snprintf(buf, buf_size, "\nat91sam7_old information: Chip is %s\n",at91sam7_old_info->target_name);
buf += printed;
buf_size -= printed;
printed = snprintf(buf, buf_size, "cidr: 0x%8.8x, arch: 0x%4.4x, eproc: %s, version:0x%3.3x, flashsize: 0x%8.8x\n",
at91sam7_old_info->cidr, at91sam7_old_info->cidr_arch, EPROC_old[at91sam7_old_info->cidr_eproc], at91sam7_old_info->cidr_version, bank->size);
buf += printed;
buf_size -= printed;
printed = snprintf(buf, buf_size, "master clock(estimated): %ikHz \n", at91sam7_old_info->mck_freq / 1000);
buf += printed;
buf_size -= printed;
if (at91sam7_old_info->num_planes>1) {
printed = snprintf(buf, buf_size, "flashplanes: %i, pagesize: %i, lock regions: %i, pages in lock region: %i \n",
at91sam7_old_info->num_planes, at91sam7_old_info->pagesize, at91sam7_old_info->num_lockbits, at91sam7_old_info->num_pages/at91sam7_old_info->num_lockbits);
buf += printed;
buf_size -= printed;
for (flashplane=0; flashplane<at91sam7_old_info->num_planes; flashplane++)
{
printed = snprintf(buf, buf_size, "lockbits[%i]: 0x%4.4x, ", flashplane, at91sam7_old_info->lockbits[flashplane]);
buf += printed;
buf_size -= printed;
}
}
else
if (at91sam7_old_info->num_lockbits>0) {
printed = snprintf(buf, buf_size, "pagesize: %i, lockbits: %i 0x%4.4x, pages in lock region: %i \n",
at91sam7_old_info->pagesize, at91sam7_old_info->num_lockbits, at91sam7_old_info->lockbits[0], at91sam7_old_info->num_pages/at91sam7_old_info->num_lockbits);
buf += printed;
buf_size -= printed;
}
printed = snprintf(buf, buf_size, "securitybit: %i, nvmbits(%i): 0x%1.1x\n", at91sam7_old_info->securitybit, at91sam7_old_info->num_nvmbits, at91sam7_old_info->nvmbits);
buf += printed;
buf_size -= printed;
return ERROR_OK;
}
/*
* On AT91SAM7S: When the gpnvm bits are set with
* > at91sam7_old gpnvm 0 bitnr set
* the changes are not visible in the flash controller status register MC_FSR_old
* until the processor has been reset.
* On the Olimex board this requires a power cycle.
* Note that the AT91SAM7S has the following errata (doc6175.pdf sec 14.1.3):
* The maximum number of write/erase cycles for Non Volatile Memory bits is 100. This includes
* Lock Bits (LOCKx), General Purpose NVM bits (GPNVMx) and the Security Bit.
*/
int at91sam7_old_handle_gpnvm_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
flash_bank_t *bank;
int bit;
u8 flashcmd;
u32 status;
char *value;
at91sam7_old_flash_bank_t *at91sam7_old_info;
int retval;
if (argc < 3)
{
command_print(cmd_ctx, "at91sam7_old gpnvm <num> <bit> <set|clear>");
return ERROR_OK;
}
bank = get_flash_bank_by_num_noprobe(strtoul(args[0], NULL, 0));
bit = atoi(args[1]);
value = args[2];
if (bank == NULL)
{
return ERROR_FLASH_BANK_INVALID;
}
if (bank->driver != &at91sam7_old_flash)
{
command_print(cmd_ctx, "not an at91sam7_old flash bank '%s'", args[0]);
return ERROR_FLASH_BANK_INVALID;
}
if (strcmp(value, "set") == 0)
{
flashcmd = SGPB_old;
}
else if (strcmp(value, "clear") == 0)
{
flashcmd = CGPB_old;
}
else
{
return ERROR_COMMAND_SYNTAX_ERROR;
}
at91sam7_old_info = bank->driver_priv;
if (bank->target->state != TARGET_HALTED)
{
LOG_ERROR("target has to be halted to perform flash operation");
return ERROR_TARGET_NOT_HALTED;
}
if (at91sam7_old_info->cidr == 0)
{
retval = at91sam7_old_read_part_info(bank);
if (retval != ERROR_OK) {
return retval;
}
}
if ((bit<0) || (at91sam7_old_info->num_nvmbits <= bit))
{
command_print(cmd_ctx, "gpnvm bit '#%s' is out of bounds for target %s", args[1],at91sam7_old_info->target_name);
return ERROR_OK;
}
/* Configure the flash controller timing */
at91sam7_old_read_clock_info(bank);
at91sam7_old_set_flash_mode(bank, 0, FMR_TIMING_NVBITS_old);
if (at91sam7_old_flash_command(bank, 0, flashcmd, (u16)(bit)) != ERROR_OK)
{
return ERROR_FLASH_OPERATION_FAILED;
}
status = at91sam7_old_get_flash_status(bank, 0);
LOG_DEBUG("at91sam7_handle_gpnvm_command: cmd 0x%x, value 0x%x, status 0x%x \n",flashcmd,bit,status);
at91sam7_old_info->nvmbits = (status>>8)&((1<<at91sam7_old_info->num_nvmbits)-1);
return ERROR_OK;
}

View File

@@ -1,98 +0,0 @@
/***************************************************************************
* Copyright (C) 2006 by Magnus Lundin *
* lundin@mlu.mine.nu *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef AT91SAM7_OLD_H
#define AT91SAM7_OLD_H
#include "flash.h"
#include "target.h"
typedef struct at91sam7_old_flash_bank_s
{
u32 working_area;
u32 working_area_size;
/* chip id register */
u32 cidr;
u16 cidr_ext;
u16 cidr_nvptyp;
u16 cidr_arch;
u16 cidr_sramsiz;
u16 cidr_nvpsiz;
u16 cidr_nvpsiz2;
u16 cidr_eproc;
u16 cidr_version;
char * target_name;
/* flash geometry */
u16 num_pages;
u16 pagesize;
u16 pages_in_lockregion;
u8 num_erase_regions;
u8 num_planes;
u32 *erase_region_info;
/* nv memory bits */
u16 num_lockbits;
u16 lockbits[4];
u16 num_nvmbits;
u16 nvmbits;
u8 securitybit;
u8 flashmode[4]; /* 0: not init, 1: fmcn for nvbits (1uS), 2: fmcn for flash (1.5uS) */
/* main clock status */
u8 mck_valid;
u32 mck_freq;
} at91sam7_old_flash_bank_t;
/* AT91SAM7 control registers */
#define DBGU_CIDR_old 0xFFFFF240
#define CKGR_MCFR_old 0xFFFFFC24
#define CKGR_MCFR_MAINRDY_old 0x10000
#define CKGR_PLLR_old 0xFFFFFC2c
#define CKGR_PLLR_DIV_old 0xff
#define CKGR_PLLR_MUL_old 0x07ff0000
#define PMC_MCKR_old 0xFFFFFC30
#define PMC_MCKR_CSS_old 0x03
#define PMC_MCKR_PRES_old 0x1c
/* Flash Controller Commands */
#define WP_old 0x01
#define SLB_old 0x02
#define WPL_old 0x03
#define CLB_old 0x04
#define EA_old 0x08
#define SGPB_old 0x0B
#define CGPB_old 0x0D
#define SSB_old 0x0F
/* MC_FSR bit definitions */
#define MC_FSR_FRDY_old 1
#define MC_FSR_EOL_old 2
/* AT91SAM7 constants */
#define RC_FREQ_old 32000
/* FLASH_TIMING_MODES */
#define FMR_TIMING_NONE_old 0
#define FMR_TIMING_NVBITS_old 1
#define FMR_TIMING_FLASH_old 2
#endif /* AT91SAM7_OLD_H */

492
src/flash/avrf.c Normal file
View File

@@ -0,0 +1,492 @@
/***************************************************************************
* Copyright (C) 2009 by Simon Qian *
* SimonQian@SimonQian.com *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "avrf.h"
#include "avrt.h"
#include "flash.h"
/* AVR_JTAG_Instructions */
#define AVR_JTAG_INS_LEN 4
// Public Instructions:
#define AVR_JTAG_INS_EXTEST 0x00
#define AVR_JTAG_INS_IDCODE 0x01
#define AVR_JTAG_INS_SAMPLE_PRELOAD 0x02
#define AVR_JTAG_INS_BYPASS 0x0F
// AVR Specified Public Instructions:
#define AVR_JTAG_INS_AVR_RESET 0x0C
#define AVR_JTAG_INS_PROG_ENABLE 0x04
#define AVR_JTAG_INS_PROG_COMMANDS 0x05
#define AVR_JTAG_INS_PROG_PAGELOAD 0x06
#define AVR_JTAG_INS_PROG_PAGEREAD 0x07
// Data Registers:
#define AVR_JTAG_REG_Bypass_Len 1
#define AVR_JTAG_REG_DeviceID_Len 32
#define AVR_JTAG_REG_Reset_Len 1
#define AVR_JTAG_REG_JTAGID_Len 32
#define AVR_JTAG_REG_ProgrammingEnable_Len 16
#define AVR_JTAG_REG_ProgrammingCommand_Len 15
#define AVR_JTAG_REG_FlashDataByte_Len 16
avrf_type_t avft_chips_info[] =
{
// name, chip_id, flash_page_size, flash_page_num, eeprom_page_size, eeprom_page_num
{"atmega128", 0x9702, 256, 512, 8, 512},
};
static int avrf_register_commands(struct command_context_s *cmd_ctx);
static int avrf_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank);
static int avrf_erase(struct flash_bank_s *bank, int first, int last);
static int avrf_protect(struct flash_bank_s *bank, int set, int first, int last);
static int avrf_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count);
static int avrf_probe(struct flash_bank_s *bank);
static int avrf_auto_probe(struct flash_bank_s *bank);
//static int avrf_handle_part_id_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
static int avrf_protect_check(struct flash_bank_s *bank);
static int avrf_info(struct flash_bank_s *bank, char *buf, int buf_size);
static int avrf_handle_mass_erase_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
extern int avr_jtag_sendinstr(jtag_tap_t *tap, uint8_t *ir_in, uint8_t ir_out);
extern int avr_jtag_senddat(jtag_tap_t *tap, uint32_t *dr_in, uint32_t dr_out, int len);
extern int mcu_write_ir(jtag_tap_t *tap, uint8_t *ir_in, uint8_t *ir_out, int ir_len, int rti);
extern int mcu_write_dr(jtag_tap_t *tap, uint8_t *ir_in, uint8_t *ir_out, int dr_len, int rti);
extern int mcu_write_ir_u8(jtag_tap_t *tap, uint8_t *ir_in, uint8_t ir_out, int ir_len, int rti);
extern int mcu_write_dr_u8(jtag_tap_t *tap, uint8_t *ir_in, uint8_t ir_out, int dr_len, int rti);
extern int mcu_write_ir_u16(jtag_tap_t *tap, uint16_t *ir_in, uint16_t ir_out, int ir_len, int rti);
extern int mcu_write_dr_u16(jtag_tap_t *tap, uint16_t *ir_in, uint16_t ir_out, int dr_len, int rti);
extern int mcu_write_ir_u32(jtag_tap_t *tap, uint32_t *ir_in, uint32_t ir_out, int ir_len, int rti);
extern int mcu_write_dr_u32(jtag_tap_t *tap, uint32_t *ir_in, uint32_t ir_out, int dr_len, int rti);
extern int mcu_execute_queue(void);
flash_driver_t avr_flash =
{
.name = "avr",
.register_commands = avrf_register_commands,
.flash_bank_command = avrf_flash_bank_command,
.erase = avrf_erase,
.protect = avrf_protect,
.write = avrf_write,
.probe = avrf_probe,
.auto_probe = avrf_auto_probe,
.erase_check = default_flash_mem_blank_check,
.protect_check = avrf_protect_check,
.info = avrf_info
};
/* avr program functions */
static int avr_jtag_reset(avr_common_t *avr, uint32_t reset)
{
avr_jtag_sendinstr(avr->jtag_info.tap, NULL, AVR_JTAG_INS_AVR_RESET);
avr_jtag_senddat(avr->jtag_info.tap, NULL, reset ,AVR_JTAG_REG_Reset_Len);
return ERROR_OK;
}
static int avr_jtag_read_jtagid(avr_common_t *avr, uint32_t *id)
{
avr_jtag_sendinstr(avr->jtag_info.tap, NULL, AVR_JTAG_INS_IDCODE);
avr_jtag_senddat(avr->jtag_info.tap, id, 0, AVR_JTAG_REG_JTAGID_Len);
return ERROR_OK;
}
static int avr_jtagprg_enterprogmode(avr_common_t *avr)
{
avr_jtag_reset(avr, 1);
avr_jtag_sendinstr(avr->jtag_info.tap, NULL, AVR_JTAG_INS_PROG_ENABLE);
avr_jtag_senddat(avr->jtag_info.tap, NULL, 0xA370, AVR_JTAG_REG_ProgrammingEnable_Len);
return ERROR_OK;
}
static int avr_jtagprg_leaveprogmode(avr_common_t *avr)
{
avr_jtag_sendinstr(avr->jtag_info.tap, NULL, AVR_JTAG_INS_PROG_COMMANDS);
avr_jtag_senddat(avr->jtag_info.tap, NULL, 0x2300, AVR_JTAG_REG_ProgrammingCommand_Len);
avr_jtag_senddat(avr->jtag_info.tap, NULL, 0x3300, AVR_JTAG_REG_ProgrammingCommand_Len);
avr_jtag_sendinstr(avr->jtag_info.tap, NULL, AVR_JTAG_INS_PROG_ENABLE);
avr_jtag_senddat(avr->jtag_info.tap, NULL, 0, AVR_JTAG_REG_ProgrammingEnable_Len);
avr_jtag_reset(avr, 0);
return ERROR_OK;
}
static int avr_jtagprg_chiperase(avr_common_t *avr)
{
uint32_t poll_value;
avr_jtag_sendinstr(avr->jtag_info.tap, NULL, AVR_JTAG_INS_PROG_COMMANDS);
avr_jtag_senddat(avr->jtag_info.tap, NULL, 0x2380, AVR_JTAG_REG_ProgrammingCommand_Len);
avr_jtag_senddat(avr->jtag_info.tap, NULL, 0x3180, AVR_JTAG_REG_ProgrammingCommand_Len);
avr_jtag_senddat(avr->jtag_info.tap, NULL, 0x3380, AVR_JTAG_REG_ProgrammingCommand_Len);
avr_jtag_senddat(avr->jtag_info.tap, NULL, 0x3380, AVR_JTAG_REG_ProgrammingCommand_Len);
do {
poll_value = 0;
avr_jtag_senddat(avr->jtag_info.tap, &poll_value, 0x3380, AVR_JTAG_REG_ProgrammingCommand_Len);
if (ERROR_OK != mcu_execute_queue())
{
return ERROR_FAIL;
}
LOG_DEBUG("poll_value = 0x%04" PRIx32 "", poll_value);
} while (!(poll_value & 0x0200));
return ERROR_OK;
}
static int avr_jtagprg_writeflashpage(avr_common_t *avr, uint8_t *page_buf, uint32_t buf_size, uint32_t addr, uint32_t page_size)
{
uint32_t i, poll_value;
avr_jtag_sendinstr(avr->jtag_info.tap, NULL, AVR_JTAG_INS_PROG_COMMANDS);
avr_jtag_senddat(avr->jtag_info.tap, NULL, 0x2310, AVR_JTAG_REG_ProgrammingCommand_Len);
// load addr high byte
avr_jtag_senddat(avr->jtag_info.tap, NULL, 0x0700 | ((addr >> 9) & 0xFF), AVR_JTAG_REG_ProgrammingCommand_Len);
// load addr low byte
avr_jtag_senddat(avr->jtag_info.tap, NULL, 0x0300 | ((addr >> 1) & 0xFF), AVR_JTAG_REG_ProgrammingCommand_Len);
avr_jtag_sendinstr(avr->jtag_info.tap, NULL, AVR_JTAG_INS_PROG_PAGELOAD);
for (i = 0; i < page_size; i++)
{
if (i < buf_size)
{
avr_jtag_senddat(avr->jtag_info.tap, NULL, page_buf[i], 8);
}
else
{
avr_jtag_senddat(avr->jtag_info.tap, NULL, 0xFF, 8);
}
}
avr_jtag_sendinstr(avr->jtag_info.tap, NULL, AVR_JTAG_INS_PROG_COMMANDS);
avr_jtag_senddat(avr->jtag_info.tap, NULL, 0x3700, AVR_JTAG_REG_ProgrammingCommand_Len);
avr_jtag_senddat(avr->jtag_info.tap, NULL, 0x3500, AVR_JTAG_REG_ProgrammingCommand_Len);
avr_jtag_senddat(avr->jtag_info.tap, NULL, 0x3700, AVR_JTAG_REG_ProgrammingCommand_Len);
avr_jtag_senddat(avr->jtag_info.tap, NULL, 0x3700, AVR_JTAG_REG_ProgrammingCommand_Len);
do {
poll_value = 0;
avr_jtag_senddat(avr->jtag_info.tap, &poll_value, 0x3700, AVR_JTAG_REG_ProgrammingCommand_Len);
if (ERROR_OK != mcu_execute_queue())
{
return ERROR_FAIL;
}
LOG_DEBUG("poll_value = 0x%04" PRIx32 "", poll_value);
} while (!(poll_value & 0x0200));
return ERROR_OK;
}
/* interface command */
static int avrf_register_commands(struct command_context_s *cmd_ctx)
{
command_t *avr_cmd = register_command(cmd_ctx, NULL, "avr", NULL, COMMAND_ANY, "avr flash specific commands");
register_command(cmd_ctx, avr_cmd, "mass_erase", avrf_handle_mass_erase_command, COMMAND_EXEC,
"mass erase device");
return ERROR_OK;
}
static int avrf_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank)
{
avrf_flash_bank_t *avrf_info;
if (argc < 6)
{
LOG_WARNING("incomplete flash_bank avr configuration");
return ERROR_FLASH_BANK_INVALID;
}
avrf_info = malloc(sizeof(avrf_flash_bank_t));
bank->driver_priv = avrf_info;
avrf_info->probed = 0;
return ERROR_OK;
}
static int avrf_erase(struct flash_bank_s *bank, int first, int last)
{
LOG_INFO("%s", __FUNCTION__);
return ERROR_OK;
}
static int avrf_protect(struct flash_bank_s *bank, int set, int first, int last)
{
LOG_INFO("%s", __FUNCTION__);
return ERROR_OK;
}
static int avrf_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count)
{
target_t *target = bank->target;
avr_common_t *avr = target->arch_info;
uint32_t cur_size, cur_buffer_size, page_size;
if (bank->target->state != TARGET_HALTED)
{
LOG_ERROR("Target not halted");
return ERROR_TARGET_NOT_HALTED;
}
page_size = bank->sectors[0].size;
if ((offset % page_size) != 0)
{
LOG_WARNING("offset 0x%" PRIx32 " breaks required %" PRIu32 "-byte alignment", offset, page_size);
return ERROR_FLASH_DST_BREAKS_ALIGNMENT;
}
LOG_DEBUG("offset is 0x%08" PRIx32 "", offset);
LOG_DEBUG("count is %" PRId32 "", count);
if (ERROR_OK != avr_jtagprg_enterprogmode(avr))
{
return ERROR_FAIL;
}
cur_size = 0;
while (count > 0)
{
if (count > page_size)
{
cur_buffer_size = page_size;
}
else
{
cur_buffer_size = count;
}
avr_jtagprg_writeflashpage(avr, buffer + cur_size, cur_buffer_size, offset + cur_size, page_size);
count -= cur_buffer_size;
cur_size += cur_buffer_size;
keep_alive();
}
return avr_jtagprg_leaveprogmode(avr);
}
#define EXTRACT_MFG(X) (((X) & 0xffe) >> 1)
#define EXTRACT_PART(X) (((X) & 0xffff000) >> 12)
#define EXTRACT_VER(X) (((X) & 0xf0000000) >> 28)
static int avrf_probe(struct flash_bank_s *bank)
{
target_t *target = bank->target;
avrf_flash_bank_t *avrf_info = bank->driver_priv;
avr_common_t *avr = target->arch_info;
avrf_type_t *avr_info = NULL;
int i;
uint32_t device_id;
if (bank->target->state != TARGET_HALTED)
{
LOG_ERROR("Target not halted");
return ERROR_TARGET_NOT_HALTED;
}
avrf_info->probed = 0;
avr_jtag_read_jtagid(avr, &device_id);
if (ERROR_OK != mcu_execute_queue())
{
return ERROR_FAIL;
}
LOG_INFO("device id = 0x%08" PRIx32 "", device_id);
if (EXTRACT_MFG(device_id) != 0x1F)
{
LOG_ERROR("0x%" PRIx32 " is invalid Manufacturer for avr, 0x%X is expected", EXTRACT_MFG(device_id), 0x1F);
}
for (i = 0; i < (int)(sizeof(avft_chips_info) / sizeof(avft_chips_info[0])); i++)
{
if (avft_chips_info[i].chip_id == EXTRACT_PART(device_id))
{
avr_info = &avft_chips_info[i];
LOG_INFO("target device is %s", avr_info->name);
break;
}
}
if (avr_info != NULL)
{
// chip found
bank->base = 0x00000000;
bank->size = (avr_info->flash_page_size * avr_info->flash_page_num);
bank->num_sectors = avr_info->flash_page_num;
bank->sectors = malloc(sizeof(flash_sector_t) * avr_info->flash_page_num);
for (i = 0; i < avr_info->flash_page_num; i++)
{
bank->sectors[i].offset = i * avr_info->flash_page_size;
bank->sectors[i].size = avr_info->flash_page_size;
bank->sectors[i].is_erased = -1;
bank->sectors[i].is_protected = 1;
}
avrf_info->probed = 1;
return ERROR_OK;
}
else
{
// chip not supported
LOG_ERROR("0x%" PRIx32 " is not support for avr", EXTRACT_PART(device_id));
avrf_info->probed = 1;
return ERROR_FAIL;
}
}
static int avrf_auto_probe(struct flash_bank_s *bank)
{
avrf_flash_bank_t *avrf_info = bank->driver_priv;
if (avrf_info->probed)
return ERROR_OK;
return avrf_probe(bank);
}
static int avrf_protect_check(struct flash_bank_s *bank)
{
LOG_INFO("%s", __FUNCTION__);
return ERROR_OK;
}
static int avrf_info(struct flash_bank_s *bank, char *buf, int buf_size)
{
target_t *target = bank->target;
avr_common_t *avr = target->arch_info;
avrf_type_t *avr_info = NULL;
int i;
uint32_t device_id;
if (bank->target->state != TARGET_HALTED)
{
LOG_ERROR("Target not halted");
return ERROR_TARGET_NOT_HALTED;
}
avr_jtag_read_jtagid(avr, &device_id);
if (ERROR_OK != mcu_execute_queue())
{
return ERROR_FAIL;
}
LOG_INFO("device id = 0x%08" PRIx32 "", device_id);
if (EXTRACT_MFG(device_id) != 0x1F)
{
LOG_ERROR("0x%" PRIx32 " is invalid Manufacturer for avr, 0x%X is expected", EXTRACT_MFG(device_id), 0x1F);
}
for (i = 0; i < (int)(sizeof(avft_chips_info) / sizeof(avft_chips_info[0])); i++)
{
if (avft_chips_info[i].chip_id == EXTRACT_PART(device_id))
{
avr_info = &avft_chips_info[i];
LOG_INFO("target device is %s", avr_info->name);
break;
}
}
if (avr_info != NULL)
{
// chip found
snprintf(buf, buf_size, "%s - Rev: 0x%" PRIx32 "", avr_info->name, EXTRACT_VER(device_id));
return ERROR_OK;
}
else
{
// chip not supported
snprintf(buf, buf_size, "Cannot identify target as a avr\n");
return ERROR_FLASH_OPERATION_FAILED;
}
}
static int avrf_mass_erase(struct flash_bank_s *bank)
{
target_t *target = bank->target;
avr_common_t *avr = target->arch_info;
if (target->state != TARGET_HALTED)
{
LOG_ERROR("Target not halted");
return ERROR_TARGET_NOT_HALTED;
}
if ((ERROR_OK != avr_jtagprg_enterprogmode(avr))
|| (ERROR_OK != avr_jtagprg_chiperase(avr))
|| (ERROR_OK != avr_jtagprg_leaveprogmode(avr)))
{
return ERROR_FAIL;
}
return ERROR_OK;
}
static int avrf_handle_mass_erase_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
flash_bank_t *bank;
int i;
if (argc < 1)
{
command_print(cmd_ctx, "avr mass_erase <bank>");
return ERROR_OK;
}
bank = get_flash_bank_by_num(strtoul(args[0], NULL, 0));
if (!bank)
{
command_print(cmd_ctx, "flash bank '#%s' is out of bounds", args[0]);
return ERROR_OK;
}
if (avrf_mass_erase(bank) == ERROR_OK)
{
/* set all sectors as erased */
for (i = 0; i < bank->num_sectors; i++)
{
bank->sectors[i].is_erased = 1;
}
command_print(cmd_ctx, "avr mass erase complete");
}
else
{
command_print(cmd_ctx, "avr mass erase failed");
}
LOG_DEBUG("%s", __FUNCTION__);
return ERROR_OK;
}

41
src/flash/avrf.h Normal file
View File

@@ -0,0 +1,41 @@
/***************************************************************************
* Copyright (C) 2009 by Simon Qian *
* SimonQian@SimonQian.com *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef AVRF_H
#define AVRF_H
#include "types.h"
typedef struct avrf_type_s
{
char name[15];
uint16_t chip_id;
int flash_page_size;
int flash_page_num;
int eeprom_page_size;
int eeprom_page_num;
} avrf_type_t;
typedef struct avrf_flash_bank_s
{
int ppage_size;
int probed;
} avrf_flash_bank_t;
#endif /* AVRF_H */

File diff suppressed because it is too large Load Diff

View File

@@ -21,49 +21,52 @@
#define CFI_H
#include "flash.h"
#include "target.h"
#define CFI_STATUS_POLL_MASK_DQ5_DQ6_DQ7 0xE0 /* DQ5..DQ7 */
#define CFI_STATUS_POLL_MASK_DQ6_DQ7 0xC0 /* DQ6..DQ7 */
typedef struct cfi_flash_bank_s
{
working_area_t *write_algorithm;
int x16_as_x8;
int jedec_probe;
int not_cfi;
int probed;
u16 manufacturer;
u16 device_id;
uint16_t manufacturer;
uint16_t device_id;
char qry[3];
/* identification string */
u16 pri_id;
u16 pri_addr;
u16 alt_id;
u16 alt_addr;
uint16_t pri_id;
uint16_t pri_addr;
uint16_t alt_id;
uint16_t alt_addr;
/* device-system interface */
u8 vcc_min;
u8 vcc_max;
u8 vpp_min;
u8 vpp_max;
u8 word_write_timeout_typ;
u8 buf_write_timeout_typ;
u8 block_erase_timeout_typ;
u8 chip_erase_timeout_typ;
u8 word_write_timeout_max;
u8 buf_write_timeout_max;
u8 block_erase_timeout_max;
u8 chip_erase_timeout_max;
uint8_t vcc_min;
uint8_t vcc_max;
uint8_t vpp_min;
uint8_t vpp_max;
uint8_t word_write_timeout_typ;
uint8_t buf_write_timeout_typ;
uint8_t block_erase_timeout_typ;
uint8_t chip_erase_timeout_typ;
uint8_t word_write_timeout_max;
uint8_t buf_write_timeout_max;
uint8_t block_erase_timeout_max;
uint8_t chip_erase_timeout_max;
uint8_t status_poll_mask;
/* flash geometry */
u8 dev_size;
u16 interface_desc;
u16 max_buf_write_size;
u8 num_erase_regions;
u32 *erase_region_info;
uint32_t dev_size;
uint16_t interface_desc;
uint16_t max_buf_write_size;
uint8_t num_erase_regions;
uint32_t *erase_region_info;
void *pri_ext;
void *alt_ext;
@@ -76,18 +79,18 @@ typedef struct cfi_flash_bank_s
typedef struct cfi_intel_pri_ext_s
{
char pri[3];
u8 major_version;
u8 minor_version;
u32 feature_support;
u8 suspend_cmd_support;
u16 blk_status_reg_mask;
u8 vcc_optimal;
u8 vpp_optimal;
u8 num_protection_fields;
u16 prot_reg_addr;
u8 fact_prot_reg_size;
u8 user_prot_reg_size;
u8 extra[0];
uint8_t major_version;
uint8_t minor_version;
uint32_t feature_support;
uint8_t suspend_cmd_support;
uint16_t blk_status_reg_mask;
uint8_t vcc_optimal;
uint8_t vpp_optimal;
uint8_t num_protection_fields;
uint16_t prot_reg_addr;
uint8_t fact_prot_reg_size;
uint8_t user_prot_reg_size;
uint8_t extra[0];
} cfi_intel_pri_ext_t;
/* Spansion primary extended query table as defined for and used by
@@ -95,23 +98,23 @@ typedef struct cfi_intel_pri_ext_s
*/
typedef struct cfi_spansion_pri_ext_s
{
u8 pri[3];
u8 major_version;
u8 minor_version;
u8 SiliconRevision; /* bits 1-0: Address Sensitive Unlock */
u8 EraseSuspend;
u8 BlkProt;
u8 TmpBlkUnprotect;
u8 BlkProtUnprot;
u8 SimultaneousOps;
u8 BurstMode;
u8 PageMode;
u8 VppMin;
u8 VppMax;
u8 TopBottom;
uint8_t pri[3];
uint8_t major_version;
uint8_t minor_version;
uint8_t SiliconRevision; /* bits 1-0: Address Sensitive Unlock */
uint8_t EraseSuspend;
uint8_t BlkProt;
uint8_t TmpBlkUnprotect;
uint8_t BlkProtUnprot;
uint8_t SimultaneousOps;
uint8_t BurstMode;
uint8_t PageMode;
uint8_t VppMin;
uint8_t VppMax;
uint8_t TopBottom;
int _reversed_geometry;
u32 _unlock1;
u32 _unlock2;
uint32_t _unlock1;
uint32_t _unlock2;
} cfi_spansion_pri_ext_t;
/* Atmel primary extended query table as defined for and used by
@@ -119,13 +122,13 @@ typedef struct cfi_spansion_pri_ext_s
*/
typedef struct cfi_atmel_pri_ext_s
{
u8 pri[3];
u8 major_version;
u8 minor_version;
u8 features;
u8 bottom_boot;
u8 burst_mode;
u8 page_mode;
uint8_t pri[3];
uint8_t major_version;
uint8_t minor_version;
uint8_t features;
uint8_t bottom_boot;
uint8_t burst_mode;
uint8_t page_mode;
} cfi_atmel_pri_ext_t;
enum {
@@ -135,14 +138,14 @@ enum {
typedef struct cfi_unlock_addresses_s
{
u32 unlock1;
u32 unlock2;
uint32_t unlock1;
uint32_t unlock2;
} cfi_unlock_addresses_t;
typedef struct cfi_fixup_s
{
u16 mfr;
u16 id;
uint16_t mfr;
uint16_t id;
void (*fixup)(flash_bank_t *flash, void *param);
void *param;
} cfi_fixup_t;

765
src/flash/davinci_nand.c Normal file
View File

@@ -0,0 +1,765 @@
/***************************************************************************
* Copyright (C) 2009 by David Brownell *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
/*
* DaVinci family NAND controller support for OpenOCD.
*
* This driver uses hardware ECC (1-bit or 4-bit) unless
* the chip is accessed in "raw" mode.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "arm_nandio.h"
enum ecc {
HWECC1, /* all controllers support 1-bit ECC */
HWECC4, /* newer chips also have 4-bit ECC hardware */
HWECC4_INFIX, /* avoid this layout, except maybe for boot code */
};
struct davinci_nand {
target_t *target;
uint8_t chipsel; /* chipselect 0..3 == CS2..CS5 */
uint8_t eccmode;
/* Async EMIF controller base */
uint32_t aemif;
/* NAND chip addresses */
uint32_t data; /* without CLE or ALE */
uint32_t cmd; /* with CLE */
uint32_t addr; /* with ALE */
/* write acceleration */
struct arm_nand_data io;
/* page i/o for the relevant flavor of hardware ECC */
int (*read_page)(struct nand_device_s *nand, uint32_t page,
uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size);
int (*write_page)(struct nand_device_s *nand, uint32_t page,
uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size);
};
#define NANDFCR 0x60 /* flash control register */
#define NANDFSR 0x64 /* flash status register */
#define NANDFECC 0x70 /* 1-bit ECC data, CS0, 1st of 4 */
#define NAND4BITECCLOAD 0xbc /* 4-bit ECC, load saved values */
#define NAND4BITECC 0xc0 /* 4-bit ECC data, 1st of 4 */
#define NANDERRADDR 0xd0 /* 4-bit ECC err addr, 1st of 2 */
#define NANDERRVAL 0xd8 /* 4-bit ECC err value, 1st of 2 */
static int halted(target_t *target, const char *label)
{
if (target->state == TARGET_HALTED)
return true;
LOG_ERROR("Target must be halted to use NAND controller (%s)", label);
return false;
}
static int davinci_register_commands(struct command_context_s *cmd_ctx)
{
return ERROR_OK;
}
static int davinci_init(struct nand_device_s *nand)
{
struct davinci_nand *info = nand->controller_priv;
target_t *target = info->target;
uint32_t nandfcr;
if (!halted(target, "init"))
return ERROR_NAND_OPERATION_FAILED;
/* We require something else to have configured AEMIF to talk
* to NAND chip in this range (including timings and width).
*/
target_read_u32(target, info->aemif + NANDFCR, &nandfcr);
if (!(nandfcr & (1 << info->chipsel))) {
LOG_ERROR("chip address %08" PRIx32 " not NAND-enabled?", info->data);
return ERROR_NAND_OPERATION_FAILED;
}
/* REVISIT verify: AxCR must be in 8-bit mode, since that's all we
* tested. 16 bit support should work too; but not with 4-bit ECC.
*/
return ERROR_OK;
}
static int davinci_reset(struct nand_device_s *nand)
{
return ERROR_OK;
}
static int davinci_nand_ready(struct nand_device_s *nand, int timeout)
{
struct davinci_nand *info = nand->controller_priv;
target_t *target = info->target;
uint32_t nandfsr;
/* NOTE: return code is zero/error, else success; not ERROR_* */
if (!halted(target, "ready"))
return 0;
do {
target_read_u32(target, info->aemif + NANDFSR, &nandfsr);
if (nandfsr & 0x01)
return 1;
alive_sleep(1);
} while (timeout-- > 0);
return 0;
}
static int davinci_command(struct nand_device_s *nand, uint8_t command)
{
struct davinci_nand *info = nand->controller_priv;
target_t *target = info->target;
if (!halted(target, "command"))
return ERROR_NAND_OPERATION_FAILED;
target_write_u8(target, info->cmd, command);
return ERROR_OK;
}
static int davinci_address(struct nand_device_s *nand, uint8_t address)
{
struct davinci_nand *info = nand->controller_priv;
target_t *target = info->target;
if (!halted(target, "address"))
return ERROR_NAND_OPERATION_FAILED;
target_write_u8(target, info->addr, address);
return ERROR_OK;
}
static int davinci_write_data(struct nand_device_s *nand, uint16_t data)
{
struct davinci_nand *info = nand->controller_priv;
target_t *target = info->target;
if (!halted(target, "write_data"))
return ERROR_NAND_OPERATION_FAILED;
target_write_u8(target, info->data, data);
return ERROR_OK;
}
static int davinci_read_data(struct nand_device_s *nand, void *data)
{
struct davinci_nand *info = nand->controller_priv;
target_t *target = info->target;
if (!halted(target, "read_data"))
return ERROR_NAND_OPERATION_FAILED;
target_read_u8(target, info->data, data);
return ERROR_OK;
}
/* REVISIT a bit of native code should let block reads be MUCH faster */
static int davinci_read_block_data(struct nand_device_s *nand,
uint8_t *data, int data_size)
{
struct davinci_nand *info = nand->controller_priv;
target_t *target = info->target;
uint32_t nfdata = info->data;
uint32_t tmp;
if (!halted(target, "read_block"))
return ERROR_NAND_OPERATION_FAILED;
while (data_size >= 4) {
target_read_u32(target, nfdata, &tmp);
data[0] = tmp;
data[1] = tmp >> 8;
data[2] = tmp >> 16;
data[3] = tmp >> 24;
data_size -= 4;
data += 4;
}
while (data_size > 0) {
target_read_u8(target, nfdata, data);
data_size -= 1;
data += 1;
}
return ERROR_OK;
}
static int davinci_write_block_data(struct nand_device_s *nand,
uint8_t *data, int data_size)
{
struct davinci_nand *info = nand->controller_priv;
target_t *target = info->target;
uint32_t nfdata = info->data;
uint32_t tmp;
int status;
if (!halted(target, "write_block"))
return ERROR_NAND_OPERATION_FAILED;
/* try the fast way first */
status = arm_nandwrite(&info->io, data, data_size);
if (status != ERROR_NAND_NO_BUFFER)
return status;
/* else do it slowly */
while (data_size >= 4) {
tmp = le_to_h_u32(data);
target_write_u32(target, nfdata, tmp);
data_size -= 4;
data += 4;
}
while (data_size > 0) {
target_write_u8(target, nfdata, *data);
data_size -= 1;
data += 1;
}
return ERROR_OK;
}
static int davinci_write_page(struct nand_device_s *nand, uint32_t page,
uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size)
{
struct davinci_nand *info = nand->controller_priv;
uint8_t *ooballoc = NULL;
int status;
if (!nand->device)
return ERROR_NAND_DEVICE_NOT_PROBED;
if (!halted(info->target, "write_page"))
return ERROR_NAND_OPERATION_FAILED;
/* Always write both data and OOB ... we are not "raw" I/O! */
if (!data) {
LOG_ERROR("Missing NAND data; try 'nand raw_access enable'\n");
return ERROR_NAND_OPERATION_FAILED;
}
/* If we're not given OOB, write 0xff where we don't write ECC codes. */
switch (nand->page_size) {
case 512:
oob_size = 16;
break;
case 2048:
oob_size = 64;
break;
case 4096:
oob_size = 128;
break;
default:
return ERROR_NAND_OPERATION_FAILED;
}
if (!oob) {
ooballoc = malloc(oob_size);
if (!ooballoc)
return ERROR_NAND_OPERATION_FAILED;
oob = ooballoc;
memset(oob, 0x0ff, oob_size);
}
/* REVISIT avoid wasting SRAM: unless nand->use_raw is set,
* use 512 byte chunks. Read side support will often want
* to include oob_size ...
*/
info->io.chunk_size = nand->page_size;
status = info->write_page(nand, page, data, data_size, oob, oob_size);
free(ooballoc);
return status;
}
static int davinci_read_page(struct nand_device_s *nand, uint32_t page,
uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size)
{
struct davinci_nand *info = nand->controller_priv;
if (!nand->device)
return ERROR_NAND_DEVICE_NOT_PROBED;
if (!halted(info->target, "read_page"))
return ERROR_NAND_OPERATION_FAILED;
return info->read_page(nand, page, data, data_size, oob, oob_size);
}
static void davinci_write_pagecmd(struct nand_device_s *nand, uint8_t cmd, uint32_t page)
{
struct davinci_nand *info = nand->controller_priv;
target_t *target = info->target;
int page3 = nand->address_cycles - (nand->page_size == 512);
/* write command ({page,otp}x{read,program} */
target_write_u8(target, info->cmd, cmd);
/* column address (beginning-of-page) */
target_write_u8(target, info->addr, 0);
if (nand->page_size > 512)
target_write_u8(target, info->addr, 0);
/* page address */
target_write_u8(target, info->addr, page);
target_write_u8(target, info->addr, page >> 8);
if (page3)
target_write_u8(target, info->addr, page >> 16);
if (page3 == 2)
target_write_u8(target, info->addr, page >> 24);
}
static int davinci_writepage_tail(struct nand_device_s *nand,
uint8_t *oob, uint32_t oob_size)
{
struct davinci_nand *info = nand->controller_priv;
target_t *target = info->target;
uint8_t status;
if (oob_size)
davinci_write_block_data(nand, oob, oob_size);
/* non-cachemode page program */
target_write_u8(target, info->cmd, NAND_CMD_PAGEPROG);
if (!davinci_nand_ready(nand, 100))
return ERROR_NAND_OPERATION_TIMEOUT;
if (nand_read_status(nand, &status) != ERROR_OK) {
LOG_ERROR("couldn't read status");
return ERROR_NAND_OPERATION_FAILED;
}
if (status & NAND_STATUS_FAIL) {
LOG_ERROR("write operation failed, status: 0x%02x", status);
return ERROR_NAND_OPERATION_FAILED;
}
return ERROR_OK;
}
/*
* All DaVinci family chips support 1-bit ECC on a per-chipselect basis.
*/
static int davinci_write_page_ecc1(struct nand_device_s *nand, uint32_t page,
uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size)
{
unsigned oob_offset;
struct davinci_nand *info = nand->controller_priv;
target_t *target = info->target;
const uint32_t fcr_addr = info->aemif + NANDFCR;
const uint32_t ecc1_addr = info->aemif + NANDFECC + (4 * info->chipsel);
uint32_t fcr, ecc1;
/* Write contiguous ECC bytes starting at specified offset.
* NOTE: Linux reserves twice as many bytes as we need; and
* for 16-bit OOB, those extra bytes are discontiguous.
*/
switch (nand->page_size) {
case 512:
oob_offset = 0;
break;
case 2048:
oob_offset = 40;
break;
default:
oob_offset = 80;
break;
}
davinci_write_pagecmd(nand, NAND_CMD_SEQIN, page);
/* scrub any old ECC state */
target_read_u32(target, ecc1_addr, &ecc1);
target_read_u32(target, fcr_addr, &fcr);
fcr |= 1 << (8 + info->chipsel);
do {
/* set "start csX 1bit ecc" bit */
target_write_u32(target, fcr_addr, fcr);
/* write 512 bytes */
davinci_write_block_data(nand, data, 512);
data += 512;
data_size -= 512;
/* read the ecc, pack to 3 bytes, and invert so the ecc
* in an erased block is correct
*/
target_read_u32(target, ecc1_addr, &ecc1);
ecc1 = (ecc1 & 0x0fff) | ((ecc1 & 0x0fff0000) >> 4);
ecc1 = ~ecc1;
/* save correct ECC code into oob data */
oob[oob_offset++] = (uint8_t)(ecc1);
oob[oob_offset++] = (uint8_t)(ecc1 >> 8);
oob[oob_offset++] = (uint8_t)(ecc1 >> 16);
} while (data_size);
/* write OOB into spare area */
return davinci_writepage_tail(nand, oob, oob_size);
}
/*
* Preferred "new style" ECC layout for use with 4-bit ECC. This somewhat
* slows down large page reads done with error correction (since the OOB
* is read first, so its ECC data can be used incrementally), but the
* manufacturer bad block markers are safe. Contrast: old "infix" style.
*/
static int davinci_write_page_ecc4(struct nand_device_s *nand, uint32_t page,
uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size)
{
static const uint8_t ecc512[] = {
0, 1, 2, 3, 4, /* 5== mfr badblock */
6, 7, /* 8..12 for BBT or JFFS2 */ 13, 14, 15,
};
static const uint8_t ecc2048[] = {
24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
};
static const uint8_t ecc4096[] = {
48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
58, 59, 60, 61, 62, 63, 64, 65, 66, 67,
68, 69, 70, 71, 72, 73, 74, 75, 76, 77,
78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
88, 89, 90, 91, 92, 93, 94, 95, 96, 97,
98, 99, 100, 101, 102, 103, 104, 105, 106, 107,
108, 109, 110, 111, 112, 113, 114, 115, 116, 117,
118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
};
struct davinci_nand *info = nand->controller_priv;
const uint8_t *l;
target_t *target = info->target;
const uint32_t fcr_addr = info->aemif + NANDFCR;
const uint32_t ecc4_addr = info->aemif + NAND4BITECC;
uint32_t fcr, ecc4;
/* Use the same ECC layout Linux uses. For small page chips
* it's a bit cramped.
*
* NOTE: at this writing, 4KB pages have issues in Linux
* because they need more than 64 bytes of ECC data, which
* the standard ECC logic can't handle.
*/
switch (nand->page_size) {
case 512:
l = ecc512;
break;
case 2048:
l = ecc2048;
break;
default:
l = ecc4096;
break;
}
davinci_write_pagecmd(nand, NAND_CMD_SEQIN, page);
/* scrub any old ECC state */
target_read_u32(target, info->aemif + NANDERRVAL, &ecc4);
target_read_u32(target, fcr_addr, &fcr);
fcr &= ~(0x03 << 4);
fcr |= (1 << 12) | (info->chipsel << 4);
do {
uint32_t raw_ecc[4], *p;
int i;
/* start 4bit ecc on csX */
target_write_u32(target, fcr_addr, fcr);
/* write 512 bytes */
davinci_write_block_data(nand, data, 512);
data += 512;
data_size -= 512;
/* read the ecc, then save it into 10 bytes in the oob */
for (i = 0; i < 4; i++) {
target_read_u32(target, ecc4_addr + 4 * i, &raw_ecc[i]);
raw_ecc[i] &= 0x03ff03ff;
}
for (i = 0, p = raw_ecc; i < 2; i++, p += 2) {
oob[*l++] = p[0] & 0xff;
oob[*l++] = ((p[0] >> 8) & 0x03) | ((p[0] >> 14) & 0xfc);
oob[*l++] = ((p[0] >> 22) & 0x0f) | ((p[1] << 4) & 0xf0);
oob[*l++] = ((p[1] >> 4) & 0x3f) | ((p[1] >> 10) & 0xc0);
oob[*l++] = (p[1] >> 18) & 0xff;
}
} while (data_size);
/* write OOB into spare area */
return davinci_writepage_tail(nand, oob, oob_size);
}
/*
* "Infix" OOB ... like Linux ECC_HW_SYNDROME. Avoided because it trashes
* manufacturer bad block markers, except on small page chips. Once you
* write to a page using this scheme, you need specialized code to update
* it (code which ignores now-invalid bad block markers).
*
* This is needed *only* to support older firmware. Older ROM Boot Loaders
* need it to read their second stage loader (UBL) into SRAM, but from then
* on the whole system can use the cleaner non-infix layouts. Systems with
* older second stage loaders (ABL/U-Boot, etc) or other system software
* (MVL 4.x/5.x kernels, filesystems, etc) may need it more generally.
*/
static int davinci_write_page_ecc4infix(struct nand_device_s *nand, uint32_t page,
uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size)
{
struct davinci_nand *info = nand->controller_priv;
target_t *target = info->target;
const uint32_t fcr_addr = info->aemif + NANDFCR;
const uint32_t ecc4_addr = info->aemif + NAND4BITECC;
uint32_t fcr, ecc4;
davinci_write_pagecmd(nand, NAND_CMD_SEQIN, page);
/* scrub any old ECC state */
target_read_u32(target, info->aemif + NANDERRVAL, &ecc4);
target_read_u32(target, fcr_addr, &fcr);
fcr &= ~(0x03 << 4);
fcr |= (1 << 12) | (info->chipsel << 4);
do {
uint32_t raw_ecc[4], *p;
uint8_t *l;
int i;
/* start 4bit ecc on csX */
target_write_u32(target, fcr_addr, fcr);
/* write 512 bytes */
davinci_write_block_data(nand, data, 512);
data += 512;
data_size -= 512;
/* read the ecc */
for (i = 0; i < 4; i++) {
target_read_u32(target, ecc4_addr + 4 * i, &raw_ecc[i]);
raw_ecc[i] &= 0x03ff03ff;
}
/* skip 6 bytes of prepad, then pack 10 packed ecc bytes */
for (i = 0, l = oob + 6, p = raw_ecc; i < 2; i++, p += 2) {
*l++ = p[0] & 0xff;
*l++ = ((p[0] >> 8) & 0x03) | ((p[0] >> 14) & 0xfc);
*l++ = ((p[0] >> 22) & 0x0f) | ((p[1] << 4) & 0xf0);
*l++ = ((p[1] >> 4) & 0x3f) | ((p[1] >> 10) & 0xc0);
*l++ = (p[1] >> 18) & 0xff;
}
/* write this "out-of-band" data -- infix */
davinci_write_block_data(nand, oob, 16);
oob += 16;
oob_size -= 16;
} while (data_size);
/* the last data and OOB writes included the spare area */
return davinci_writepage_tail(nand, NULL, 0);
}
static int davinci_read_page_ecc4infix(struct nand_device_s *nand, uint32_t page,
uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size)
{
davinci_write_pagecmd(nand, NAND_CMD_READ0, page);
/* large page devices need a start command */
if (nand->page_size > 512)
davinci_command(nand, NAND_CMD_READSTART);
if (!davinci_nand_ready(nand, 100))
return ERROR_NAND_OPERATION_TIMEOUT;
/* NOTE: not bothering to compute and use ECC data for now */
do {
/* write 512 bytes */
davinci_read_block_data(nand, data, 512);
data += 512;
data_size -= 512;
/* read this "out-of-band" data -- infix */
davinci_read_block_data(nand, oob, 16);
oob += 16;
oob_size -= 16;
} while (data_size);
return ERROR_OK;
}
static int davinci_nand_device_command(struct command_context_s *cmd_ctx,
char *cmd, char **argv, int argc,
struct nand_device_s *nand)
{
struct davinci_nand *info;
target_t *target;
unsigned long chip, aemif;
enum ecc eccmode;
int chipsel;
char *ep;
/* arguments:
* - "davinci"
* - target
* - nand chip address
* - ecc mode
* - aemif address
* Plus someday, optionally, ALE and CLE masks.
*/
if (argc < 5) {
LOG_ERROR("parameters: %s target "
"chip_addr hwecc_mode aemif_addr",
argv[0]);
goto fail;
}
target = get_target(argv[1]);
if (!target) {
LOG_ERROR("invalid target %s", argv[1]);
goto fail;
}
chip = strtoul(argv[2], &ep, 0);
if (*ep || chip == 0 || chip == ULONG_MAX) {
LOG_ERROR("Invalid NAND chip address %s", argv[2]);
goto fail;
}
if (strcmp(argv[3], "hwecc1") == 0)
eccmode = HWECC1;
else if (strcmp(argv[3], "hwecc4") == 0)
eccmode = HWECC4;
else if (strcmp(argv[3], "hwecc4_infix") == 0)
eccmode = HWECC4_INFIX;
else {
LOG_ERROR("Invalid ecc mode %s", argv[3]);
goto fail;
}
aemif = strtoul(argv[4], &ep, 0);
if (*ep || aemif == 0 || aemif == ULONG_MAX) {
LOG_ERROR("Invalid AEMIF controller address %s", argv[4]);
goto fail;
}
/* REVISIT what we'd *like* to do is look up valid ranges using
* target-specific declarations, and not even need to pass the
* AEMIF controller address.
*/
if (aemif == 0x01e00000 /* dm6446, dm357 */
|| aemif == 0x01e10000 /* dm335, dm355 */
|| aemif == 0x01d10000 /* dm365 */
) {
if (chip < 0x02000000 || chip >= 0x0a000000) {
LOG_ERROR("NAND address %08lx out of range?", chip);
goto fail;
}
chipsel = (chip - 0x02000000) >> 25;
} else {
LOG_ERROR("unrecognized AEMIF controller address %08lx", aemif);
goto fail;
}
info = calloc(1, sizeof *info);
if (info == NULL)
goto fail;
info->target = target;
info->eccmode = eccmode;
info->chipsel = chipsel;
info->aemif = aemif;
info->data = chip;
info->cmd = chip | 0x10;
info->addr = chip | 0x08;
nand->controller_priv = info;
info->io.target = target;
info->io.data = info->data;
/* NOTE: for now we don't do any error correction on read.
* Nothing else in OpenOCD currently corrects read errors,
* and in any case it's *writing* that we care most about.
*/
info->read_page = nand_read_page_raw;
switch (eccmode) {
case HWECC1:
/* ECC_HW, 1-bit corrections, 3 bytes ECC per 512 data bytes */
info->write_page = davinci_write_page_ecc1;
break;
case HWECC4:
/* ECC_HW, 4-bit corrections, 10 bytes ECC per 512 data bytes */
info->write_page = davinci_write_page_ecc4;
break;
case HWECC4_INFIX:
/* Same 4-bit ECC HW, with problematic page/ecc layout */
info->read_page = davinci_read_page_ecc4infix;
info->write_page = davinci_write_page_ecc4infix;
break;
}
return ERROR_OK;
fail:
return ERROR_NAND_OPERATION_FAILED;
}
nand_flash_controller_t davinci_nand_controller = {
.name = "davinci",
.nand_device_command = davinci_nand_device_command,
.register_commands = davinci_register_commands,
.init = davinci_init,
.reset = davinci_reset,
.command = davinci_command,
.address = davinci_address,
.write_data = davinci_write_data,
.read_data = davinci_read_data,
.write_page = davinci_write_page,
.read_page = davinci_read_page,
.write_block_data = davinci_write_block_data,
.read_block_data = davinci_read_block_data,
.nand_ready = davinci_nand_ready,
};

View File

@@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (C) 2007,2008 Øyvind Harboe *
* Copyright (C) 2007,2008 Øyvind Harboe *
* oyvind.harboe@zylin.com *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -21,34 +21,26 @@
#include "config.h"
#endif
#include <string.h>
#include "replacements.h"
#include "flash.h"
#include "embeddedice.h"
#include "image.h"
#include "target.h"
#include "flash.h"
#include "target.h"
#include "log.h"
#include "binarybuffer.h"
#include "../target/embeddedice.h"
#include "types.h"
static int ecosflash_register_commands(struct command_context_s *cmd_ctx);
static int ecosflash_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank);
static int ecosflash_erase(struct flash_bank_s *bank, int first, int last);
static int ecosflash_protect(struct flash_bank_s *bank, int set, int first, int last);
static int ecosflash_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count);
static int ecosflash_probe(struct flash_bank_s *bank);
static int ecosflash_protect_check(struct flash_bank_s *bank);
static int ecosflash_info(struct flash_bank_s *bank, char *buf, int buf_size);
int ecosflash_register_commands(struct command_context_s *cmd_ctx);
int ecosflash_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank);
int ecosflash_erase(struct flash_bank_s *bank, int first, int last);
int ecosflash_protect(struct flash_bank_s *bank, int set, int first, int last);
int ecosflash_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count);
int ecosflash_probe(struct flash_bank_s *bank);
int ecosflash_protect_check(struct flash_bank_s *bank);
int ecosflash_info(struct flash_bank_s *bank, char *buf, int buf_size);
u32 ecosflash_get_flash_status(flash_bank_t *bank);
void ecosflash_set_flash_mode(flash_bank_t *bank,int mode);
u32 ecosflash_wait_status_busy(flash_bank_t *bank, u32 waitbits, int timeout);
int ecosflash_handle_gpnvm_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
#if 0
static uint32_t ecosflash_get_flash_status(flash_bank_t *bank);
static void ecosflash_set_flash_mode(flash_bank_t *bank,int mode);
static uint32_t ecosflash_wait_status_busy(flash_bank_t *bank, uint32_t waitbits, int timeout);
static int ecosflash_handle_gpnvm_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
#endif
flash_driver_t ecosflash_flash =
{
@@ -71,10 +63,10 @@ typedef struct ecosflash_flash_bank_s
working_area_t *write_algorithm;
working_area_t *erase_check_algorithm;
char *driverPath;
u32 start_address;
uint32_t start_address;
} ecosflash_flash_bank_t;
static const int sectorSize=0x10000;
static const int sectorSize = 0x10000;
char *
flash_errmsg(int err);
@@ -136,7 +128,7 @@ flash_errmsg(int err)
/* flash bank ecosflash <base> <size> <chip_width> <bus_width> <target#> <driverPath>
*/
int ecosflash_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank)
static int ecosflash_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank)
{
ecosflash_flash_bank_t *info;
@@ -147,21 +139,21 @@ int ecosflash_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, c
}
info = malloc(sizeof(ecosflash_flash_bank_t));
if(info == NULL)
if (info == NULL)
{
LOG_ERROR("no memory for flash bank info");
exit(-1);
}
bank->driver_priv = info;
info->driverPath=strdup(args[6]);
info->driverPath = strdup(args[6]);
/* eCos flash sector sizes are not exposed to OpenOCD, use 0x10000 as
* a way to improve impeadance matach between OpenOCD and eCos flash
* a way to improve impedance match between OpenOCD and eCos flash
* driver.
*/
int i = 0;
u32 offset = 0;
bank->num_sectors=bank->size/sectorSize;
uint32_t offset = 0;
bank->num_sectors = bank->size/sectorSize;
bank->sectors = malloc(sizeof(flash_sector_t) * bank->num_sectors);
for (i = 0; i < bank->num_sectors; i++)
{
@@ -172,32 +164,32 @@ int ecosflash_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, c
bank->sectors[i].is_protected = 0;
}
info->target = get_target_by_num(strtoul(args[5], NULL, 0));
info->target = get_target(args[5]);
if (info->target == NULL)
{
LOG_ERROR("no target '%i' configured", (int)strtoul(args[5], NULL, 0));
LOG_ERROR("target '%s' not defined", args[5]);
return ERROR_FAIL;
}
return ERROR_OK;
}
int loadDriver(ecosflash_flash_bank_t *info)
static int loadDriver(ecosflash_flash_bank_t *info)
{
u32 buf_cnt;
u32 image_size;
uint32_t buf_cnt;
uint32_t image_size;
image_t image;
image.base_address_set = 0;
image.start_address_set = 0;
target_t *target=info->target;
target_t *target = info->target;
int retval;
if ((retval=image_open(&image, info->driverPath, NULL)) != ERROR_OK)
if ((retval = image_open(&image, info->driverPath, NULL)) != ERROR_OK)
{
return retval;
}
info->start_address=image.start_address;
info->start_address = image.start_address;
image_size = 0x0;
int i;
@@ -213,7 +205,7 @@ int loadDriver(ecosflash_flash_bank_t *info)
}
target_write_buffer(target, image.sections[i].base_address, buf_cnt, buffer);
image_size += buf_cnt;
LOG_DEBUG("%u byte written at address 0x%8.8x", buf_cnt, image.sections[i].base_address);
LOG_DEBUG("%" PRIu32 " byte written at address 0x%8.8" PRIx32 "", buf_cnt, image.sections[i].base_address);
free(buffer);
}
@@ -223,20 +215,20 @@ int loadDriver(ecosflash_flash_bank_t *info)
return ERROR_OK;
}
static int const OFFSET_ERASE=0x0;
static int const OFFSET_ERASE_SIZE=0x8;
static int const OFFSET_FLASH=0xc;
static int const OFFSET_FLASH_SIZE=0x8;
static int const OFFSET_GET_WORKAREA=0x18;
static int const OFFSET_GET_WORKAREA_SIZE=0x4;
static int const OFFSET_ERASE = 0x0;
static int const OFFSET_ERASE_SIZE = 0x8;
static int const OFFSET_FLASH = 0xc;
static int const OFFSET_FLASH_SIZE = 0x8;
static int const OFFSET_GET_WORKAREA = 0x18;
static int const OFFSET_GET_WORKAREA_SIZE = 0x4;
int runCode(ecosflash_flash_bank_t *info,
u32 codeStart, u32 codeStop, u32 r0, u32 r1, u32 r2,
u32 *result,
static int runCode(ecosflash_flash_bank_t *info,
uint32_t codeStart, uint32_t codeStop, uint32_t r0, uint32_t r1, uint32_t r2,
uint32_t *result,
/* timeout in ms */
int timeout)
{
target_t *target=info->target;
target_t *target = info->target;
reg_param_t reg_params[3];
armv4_5_algorithm_t armv4_5_info;
@@ -253,7 +245,7 @@ int runCode(ecosflash_flash_bank_t *info,
buf_set_u32(reg_params[2].value, 0, 32, r2);
int retval;
if ((retval = target->type->run_algorithm(target, 0, NULL, 3, reg_params,
if ((retval = target_run_algorithm(target, 0, NULL, 3, reg_params,
codeStart,
codeStop, timeout,
&armv4_5_info)) != ERROR_OK)
@@ -262,7 +254,7 @@ int runCode(ecosflash_flash_bank_t *info,
return retval;
}
*result=buf_get_u32(reg_params[0].value, 0, 32);
*result = buf_get_u32(reg_params[0].value, 0, 32);
destroy_reg_param(&reg_params[0]);
destroy_reg_param(&reg_params[1]);
@@ -271,81 +263,81 @@ int runCode(ecosflash_flash_bank_t *info,
return ERROR_OK;
}
int eCosBoard_erase(ecosflash_flash_bank_t *info, u32 address, u32 len)
static int eCosBoard_erase(ecosflash_flash_bank_t *info, uint32_t address, uint32_t len)
{
int retval;
int timeout = (len / 20480 + 1) * 1000; /*asume 20 KB/s*/
retval=loadDriver(info);
if (retval!=ERROR_OK)
retval = loadDriver(info);
if (retval != ERROR_OK)
return retval;
u32 flashErr;
retval=runCode(info,
info->start_address+OFFSET_ERASE,
info->start_address+OFFSET_ERASE+OFFSET_ERASE_SIZE,
uint32_t flashErr;
retval = runCode(info,
info->start_address + OFFSET_ERASE,
info->start_address + OFFSET_ERASE + OFFSET_ERASE_SIZE,
address,
len,
0,
&flashErr,
timeout
);
if (retval!=ERROR_OK)
);
if (retval != ERROR_OK)
return retval;
if (flashErr != 0x0)
{
LOG_ERROR("Flash erase failed with %d (%s)\n", flashErr, flash_errmsg(flashErr));
LOG_ERROR("Flash erase failed with %d (%s)\n", (int)flashErr, flash_errmsg(flashErr));
return ERROR_FAIL;
}
return ERROR_OK;
}
int eCosBoard_flash(ecosflash_flash_bank_t *info, void *data, u32 address, u32 len)
static int eCosBoard_flash(ecosflash_flash_bank_t *info, void *data, uint32_t address, uint32_t len)
{
target_t *target=info->target;
const int chunk=8192;
int retval=ERROR_OK;
target_t *target = info->target;
const int chunk = 8192;
int retval = ERROR_OK;
int timeout = (chunk / 20480 + 1) * 1000; /*asume 20 KB/s + 1 second*/
retval=loadDriver(info);
if (retval!=ERROR_OK)
retval = loadDriver(info);
if (retval != ERROR_OK)
return retval;
u32 buffer;
retval=runCode(info,
info->start_address+OFFSET_GET_WORKAREA,
info->start_address+OFFSET_GET_WORKAREA+OFFSET_GET_WORKAREA_SIZE,
uint32_t buffer;
retval = runCode(info,
info->start_address + OFFSET_GET_WORKAREA,
info->start_address + OFFSET_GET_WORKAREA + OFFSET_GET_WORKAREA_SIZE,
0,
0,
0,
&buffer,
1000);
if (retval!=ERROR_OK)
if (retval != ERROR_OK)
return retval;
int i;
for (i=0; i<len; i+=chunk)
uint32_t i;
for (i = 0; i < len; i += chunk)
{
int t=len-i;
if (t>chunk)
int t = len-i;
if (t > chunk)
{
t=chunk;
t = chunk;
}
int retval;
retval=target_write_buffer(target, buffer, t, ((u8 *)data)+i);
retval = target_write_buffer(target, buffer, t, ((uint8_t *)data) + i);
if (retval != ERROR_OK)
return retval;
u32 flashErr;
retval=runCode(info,
info->start_address+OFFSET_FLASH,
info->start_address+OFFSET_FLASH+OFFSET_FLASH_SIZE,
uint32_t flashErr;
retval = runCode(info,
info->start_address + OFFSET_FLASH,
info->start_address + OFFSET_FLASH + OFFSET_FLASH_SIZE,
buffer,
address+i,
address + i,
t,
&flashErr,
timeout);
@@ -354,19 +346,19 @@ int eCosBoard_flash(ecosflash_flash_bank_t *info, void *data, u32 address, u32 l
if (flashErr != 0x0)
{
LOG_ERROR("Flash prog failed with %d (%s)\n", flashErr, flash_errmsg(flashErr));
LOG_ERROR("Flash prog failed with %d (%s)\n", (int)flashErr, flash_errmsg(flashErr));
return ERROR_FAIL;
}
}
return ERROR_OK;
}
int ecosflash_probe(struct flash_bank_s *bank)
static int ecosflash_probe(struct flash_bank_s *bank)
{
return ERROR_OK;
}
int ecosflash_register_commands(struct command_context_s *cmd_ctx)
static int ecosflash_register_commands(struct command_context_s *cmd_ctx)
{
register_command(cmd_ctx, NULL, "ecosflash", NULL, COMMAND_ANY, NULL);
@@ -374,7 +366,7 @@ int ecosflash_register_commands(struct command_context_s *cmd_ctx)
}
#if 0
static void command(flash_bank_t *bank, u8 cmd, u8 *cmd_buf)
static void command(flash_bank_t *bank, uint8_t cmd, uint8_t *cmd_buf)
{
ecosflash_flash_bank_t *info = bank->driver_priv;
int i;
@@ -396,10 +388,11 @@ static void command(flash_bank_t *bank, u8 cmd, u8 *cmd_buf)
}
#endif
u32 ecosflash_address(struct flash_bank_s *bank, u32 address)
#if 0
static uint32_t ecosflash_address(struct flash_bank_s *bank, uint32_t address)
{
u32 retval = 0;
switch(bank->bus_width)
uint32_t retval = 0;
switch (bank->bus_width)
{
case 4:
retval = address & 0xfffffffc;
@@ -411,54 +404,57 @@ u32 ecosflash_address(struct flash_bank_s *bank, u32 address)
return retval + bank->base;
}
#endif
int ecosflash_erase(struct flash_bank_s *bank, int first, int last)
static int ecosflash_erase(struct flash_bank_s *bank, int first, int last)
{
struct flash_bank_s *c=bank;
struct flash_bank_s *c = bank;
ecosflash_flash_bank_t *info = bank->driver_priv;
return eCosBoard_erase(info, c->base+first*sectorSize, sectorSize*(last-first+1));
return eCosBoard_erase(info, c->base + first*sectorSize, sectorSize*(last-first + 1));
}
int ecosflash_protect(struct flash_bank_s *bank, int set, int first, int last)
static int ecosflash_protect(struct flash_bank_s *bank, int set, int first, int last)
{
return ERROR_OK;
}
int ecosflash_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count)
static int ecosflash_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count)
{
ecosflash_flash_bank_t *info = bank->driver_priv;
struct flash_bank_s *c=bank;
return eCosBoard_flash(info, buffer, c->base+offset, count);
struct flash_bank_s *c = bank;
return eCosBoard_flash(info, buffer, c->base + offset, count);
}
int ecosflash_protect_check(struct flash_bank_s *bank)
static int ecosflash_protect_check(struct flash_bank_s *bank)
{
return ERROR_OK;
}
int ecosflash_info(struct flash_bank_s *bank, char *buf, int buf_size)
static int ecosflash_info(struct flash_bank_s *bank, char *buf, int buf_size)
{
ecosflash_flash_bank_t *info = bank->driver_priv;
snprintf(buf, buf_size, "eCos flash driver: %s", info->driverPath);
return ERROR_OK;
}
u32 ecosflash_get_flash_status(flash_bank_t *bank)
#if 0
static uint32_t ecosflash_get_flash_status(flash_bank_t *bank)
{
return ERROR_OK;
}
void ecosflash_set_flash_mode(flash_bank_t *bank,int mode)
static void ecosflash_set_flash_mode(flash_bank_t *bank,int mode)
{
}
u32 ecosflash_wait_status_busy(flash_bank_t *bank, u32 waitbits, int timeout)
static uint32_t ecosflash_wait_status_busy(flash_bank_t *bank, uint32_t waitbits, int timeout)
{
return ERROR_OK;
}
int ecosflash_handle_gpnvm_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
static int ecosflash_handle_gpnvm_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
return ERROR_OK;
}
#endif

153
src/flash/faux.c Normal file
View File

@@ -0,0 +1,153 @@
/***************************************************************************
* Copyright (C) 2009 Øyvind Harboe *
* oyvind.harboe@zylin.com *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "flash.h"
#include "image.h"
static int faux_register_commands(struct command_context_s *cmd_ctx);
static int faux_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank);
static int faux_erase(struct flash_bank_s *bank, int first, int last);
static int faux_protect(struct flash_bank_s *bank, int set, int first, int last);
static int faux_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count);
static int faux_probe(struct flash_bank_s *bank);
static int faux_protect_check(struct flash_bank_s *bank);
static int faux_info(struct flash_bank_s *bank, char *buf, int buf_size);
flash_driver_t faux_flash =
{
.name = "faux",
.register_commands = faux_register_commands,
.flash_bank_command = faux_flash_bank_command,
.erase = faux_erase,
.protect = faux_protect,
.write = faux_write,
.probe = faux_probe,
.auto_probe = faux_probe,
.erase_check = default_flash_blank_check,
.protect_check = faux_protect_check,
.info = faux_info
};
typedef struct faux_flash_bank_s
{
struct target_s *target;
uint8_t *memory;
uint32_t start_address;
} faux_flash_bank_t;
static const int sectorSize = 0x10000;
/* flash bank faux <base> <size> <chip_width> <bus_width> <target#> <driverPath>
*/
static int faux_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank)
{
faux_flash_bank_t *info;
if (argc < 6)
{
LOG_WARNING("incomplete flash_bank faux configuration");
return ERROR_FLASH_BANK_INVALID;
}
info = malloc(sizeof(faux_flash_bank_t));
if (info == NULL)
{
LOG_ERROR("no memory for flash bank info");
return ERROR_FAIL;
}
info->memory = malloc(bank->size);
if (info == NULL)
{
free(info);
LOG_ERROR("no memory for flash bank info");
return ERROR_FAIL;
}
bank->driver_priv = info;
/* Use 0x10000 as a fixed sector size. */
int i = 0;
uint32_t offset = 0;
bank->num_sectors = bank->size/sectorSize;
bank->sectors = malloc(sizeof(flash_sector_t) * bank->num_sectors);
for (i = 0; i < bank->num_sectors; i++)
{
bank->sectors[i].offset = offset;
bank->sectors[i].size = sectorSize;
offset += bank->sectors[i].size;
bank->sectors[i].is_erased = -1;
bank->sectors[i].is_protected = 0;
}
info->target = get_target(args[5]);
if (info->target == NULL)
{
LOG_ERROR("target '%s' not defined", args[5]);
free(info->memory);
free(info);
return ERROR_FAIL;
}
return ERROR_OK;
}
static int faux_register_commands(struct command_context_s *cmd_ctx)
{
return ERROR_OK;
}
static int faux_erase(struct flash_bank_s *bank, int first, int last)
{
faux_flash_bank_t *info = bank->driver_priv;
memset(info->memory + first*sectorSize, 0xff, sectorSize*(last-first + 1));
return ERROR_OK;
}
static int faux_protect(struct flash_bank_s *bank, int set, int first, int last)
{
LOG_USER("set protection sector %d to %d to %s", first, last, set?"on":"off");
return ERROR_OK;
}
static int faux_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count)
{
faux_flash_bank_t *info = bank->driver_priv;
memcpy(info->memory + offset, buffer, count);
return ERROR_OK;
}
static int faux_protect_check(struct flash_bank_s *bank)
{
return ERROR_OK;
}
static int faux_info(struct flash_bank_s *bank, char *buf, int buf_size)
{
snprintf(buf, buf_size, "faux flash driver");
return ERROR_OK;
}
static int faux_probe(struct flash_bank_s *bank)
{
return ERROR_OK;
}

View File

@@ -2,7 +2,7 @@
* Copyright (C) 2005 by Dominic Rath *
* Dominic.Rath@gmx.de *
* *
* Copyright (C) 2007,2008 Øyvind Harboe *
* Copyright (C) 2007,2008 Øyvind Harboe *
* oyvind.harboe@zylin.com *
* *
* Copyright (C) 2008 by Spencer Oliver *
@@ -28,46 +28,31 @@
#endif
#include "flash.h"
#include "command.h"
#include "target.h"
#include "time_support.h"
#include "fileio.h"
#include "image.h"
#include "log.h"
#include "armv4_5.h"
#include "algorithm.h"
#include "binarybuffer.h"
#include "armv7m.h"
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include <inttypes.h>
#include "time_support.h"
/* command handlers */
int handle_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
int handle_flash_info_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
int handle_flash_probe_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
int handle_flash_erase_check_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
int handle_flash_erase_address_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
int handle_flash_protect_check_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
int handle_flash_erase_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
int handle_flash_write_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
int handle_flash_write_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
int handle_flash_write_image_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
int handle_flash_fill_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
int handle_flash_protect_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
flash_bank_t *get_flash_bank_by_addr(target_t *target, u32 addr);
static int handle_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
static int handle_flash_info_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
static int handle_flash_probe_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
static int handle_flash_erase_check_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
static int handle_flash_erase_address_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
static int handle_flash_protect_check_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
static int handle_flash_erase_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
static int handle_flash_write_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
static int handle_flash_write_image_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
static int handle_flash_fill_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
static int handle_flash_protect_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
static int flash_write_unlock(target_t *target, image_t *image, uint32_t *written, int erase, bool unlock);
/* flash drivers
*/
extern flash_driver_t lpc2000_flash;
extern flash_driver_t lpc288x_flash;
extern flash_driver_t lpc2900_flash;
extern flash_driver_t cfi_flash;
extern flash_driver_t at91sam3_flash;
extern flash_driver_t at91sam7_flash;
extern flash_driver_t at91sam7_old_flash;
extern flash_driver_t str7x_flash;
extern flash_driver_t str9x_flash;
extern flash_driver_t aduc702x_flash;
@@ -76,15 +61,18 @@ extern flash_driver_t str9xpec_flash;
extern flash_driver_t stm32x_flash;
extern flash_driver_t tms470_flash;
extern flash_driver_t ecosflash_flash;
extern flash_driver_t lpc288x_flash;
extern flash_driver_t ocl_flash;
extern flash_driver_t pic32mx_flash;
extern flash_driver_t avr_flash;
extern flash_driver_t faux_flash;
flash_driver_t *flash_drivers[] = {
&lpc2000_flash,
&lpc288x_flash,
&lpc2900_flash,
&cfi_flash,
&at91sam7_flash,
&at91sam7_old_flash,
&at91sam3_flash,
&str7x_flash,
&str9x_flash,
&aduc702x_flash,
@@ -93,9 +81,10 @@ flash_driver_t *flash_drivers[] = {
&stm32x_flash,
&tms470_flash,
&ecosflash_flash,
&lpc288x_flash,
&ocl_flash,
&pic32mx_flash,
&avr_flash,
&faux_flash,
NULL,
};
@@ -103,14 +92,15 @@ flash_bank_t *flash_banks;
static command_t *flash_cmd;
/* wafer thin wrapper for invoking the flash driver */
static int flash_driver_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count)
static int flash_driver_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count)
{
int retval;
retval=bank->driver->write(bank, buffer, offset, count);
if (retval!=ERROR_OK)
retval = bank->driver->write(bank, buffer, offset, count);
if (retval != ERROR_OK)
{
LOG_ERROR("error writing to flash at address 0x%08x at offset 0x%8.8x (%d)", bank->base, offset, retval);
LOG_ERROR("error writing to flash at address 0x%08" PRIx32 " at offset 0x%8.8" PRIx32 " (%d)",
bank->base, offset, retval);
}
return retval;
@@ -120,8 +110,8 @@ static int flash_driver_erase(struct flash_bank_s *bank, int first, int last)
{
int retval;
retval=bank->driver->erase(bank, first, last);
if (retval!=ERROR_OK)
retval = bank->driver->erase(bank, first, last);
if (retval != ERROR_OK)
{
LOG_ERROR("failed erasing sectors %d to %d (%d)", first, last, retval);
}
@@ -133,8 +123,8 @@ int flash_driver_protect(struct flash_bank_s *bank, int set, int first, int last
{
int retval;
retval=bank->driver->protect(bank, set, first, last);
if (retval!=ERROR_OK)
retval = bank->driver->protect(bank, set, first, last);
if (retval != ERROR_OK)
{
LOG_ERROR("failed setting protection for areas %d to %d (%d)", first, last, retval);
}
@@ -159,10 +149,10 @@ static int jim_flash_banks(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
return JIM_ERR;
}
Jim_Obj *list=Jim_NewListObj(interp, NULL, 0);
Jim_Obj *list = Jim_NewListObj(interp, NULL, 0);
for (p = flash_banks; p; p = p->next)
{
Jim_Obj *elem=Jim_NewListObj(interp, NULL, 0);
Jim_Obj *elem = Jim_NewListObj(interp, NULL, 0);
Jim_ListAppendElement(interp, elem, Jim_NewStringObj(interp, "name", -1));
Jim_ListAppendElement(interp, elem, Jim_NewStringObj(interp, p->driver->name, -1));
@@ -212,9 +202,9 @@ int flash_init_drivers(struct command_context_s *cmd_ctx)
register_command(cmd_ctx, flash_cmd, "write_bank", handle_flash_write_bank_command, COMMAND_EXEC,
"write binary data to <bank> <file> <offset>");
register_command(cmd_ctx, flash_cmd, "write_image", handle_flash_write_image_command, COMMAND_EXEC,
"write_image [erase] <file> [offset] [type]");
"write_image [erase] [unlock] <file> [offset] [type]");
register_command(cmd_ctx, flash_cmd, "protect", handle_flash_protect_command, COMMAND_EXEC,
"set protection of sectors at <bank> <first> <last> <on|off>");
"set protection of sectors at <bank> <first> <last> <on | off>");
}
return ERROR_OK;
@@ -265,7 +255,7 @@ flash_bank_t *get_flash_bank_by_num(int num)
return p;
}
int handle_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
static int handle_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
int retval;
int i;
@@ -277,9 +267,9 @@ int handle_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char
return ERROR_COMMAND_SYNTAX_ERROR;
}
if ((target = get_target_by_num(strtoul(args[5], NULL, 0))) == NULL)
if ((target = get_target(args[5])) == NULL)
{
LOG_ERROR("target %lu not defined", strtoul(args[5], NULL, 0));
LOG_ERROR("target '%s' not defined", args[5]);
return ERROR_FAIL;
}
@@ -308,9 +298,9 @@ int handle_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char
c->sectors = NULL;
c->next = NULL;
if ((retval=flash_drivers[i]->flash_bank_command(cmd_ctx, cmd, args, argc, c)) != ERROR_OK)
if ((retval = flash_drivers[i]->flash_bank_command(cmd_ctx, cmd, args, argc, c)) != ERROR_OK)
{
LOG_ERROR("'%s' driver rejected flash bank at 0x%8.8x", args[0], c->base);
LOG_ERROR("'%s' driver rejected flash bank at 0x%8.8" PRIx32 , args[0], c->base);
free(c);
return retval;
}
@@ -345,10 +335,10 @@ int handle_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char
return ERROR_OK;
}
int handle_flash_info_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
static int handle_flash_info_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
flash_bank_t *p;
int i = 0;
uint32_t i = 0;
int j = 0;
int retval;
@@ -367,8 +357,14 @@ int handle_flash_info_command(struct command_context_s *cmd_ctx, char *cmd, char
if ((retval = p->driver->auto_probe(p)) != ERROR_OK)
return retval;
command_print(cmd_ctx, "#%i: %s at 0x%8.8x, size 0x%8.8x, buswidth %i, chipwidth %i",
i, p->driver->name, p->base, p->size, p->bus_width, p->chip_width);
command_print(cmd_ctx,
"#%" PRIi32 " : %s at 0x%8.8" PRIx32 ", size 0x%8.8" PRIx32 ", buswidth %i, chipwidth %i",
i,
p->driver->name,
p->base,
p->size,
p->bus_width,
p->chip_width);
for (j = 0; j < p->num_sectors; j++)
{
char *protect_state;
@@ -380,9 +376,13 @@ int handle_flash_info_command(struct command_context_s *cmd_ctx, char *cmd, char
else
protect_state = "protection state unknown";
command_print(cmd_ctx, "\t#%3i: 0x%8.8x (0x%x %ikB) %s",
j, p->sectors[j].offset, p->sectors[j].size, p->sectors[j].size>>10,
protect_state);
command_print(cmd_ctx,
"\t#%3i: 0x%8.8" PRIx32 " (0x%" PRIx32 " %" PRIi32 "kB) %s",
j,
p->sectors[j].offset,
p->sectors[j].size,
p->sectors[j].size >> 10,
protect_state);
}
*buf = '\0'; /* initialize buffer, otherwise it migh contain garbage if driver function fails */
@@ -396,7 +396,7 @@ int handle_flash_info_command(struct command_context_s *cmd_ctx, char *cmd, char
return ERROR_OK;
}
int handle_flash_probe_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
static int handle_flash_probe_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
flash_bank_t *p;
int retval;
@@ -411,16 +411,16 @@ int handle_flash_probe_command(struct command_context_s *cmd_ctx, char *cmd, cha
{
if ((retval = p->driver->probe(p)) == ERROR_OK)
{
command_print(cmd_ctx, "flash '%s' found at 0x%8.8x", p->driver->name, p->base);
command_print(cmd_ctx, "flash '%s' found at 0x%8.8" PRIx32, p->driver->name, p->base);
}
else if (retval == ERROR_FLASH_BANK_INVALID)
{
command_print(cmd_ctx, "probing failed for flash bank '#%s' at 0x%8.8x",
command_print(cmd_ctx, "probing failed for flash bank '#%s' at 0x%8.8" PRIx32,
args[0], p->base);
}
else
{
command_print(cmd_ctx, "unknown error when probing flash bank '#%s' at 0x%8.8x",
command_print(cmd_ctx, "unknown error when probing flash bank '#%s' at 0x%8.8" PRIx32,
args[0], p->base);
}
}
@@ -432,7 +432,7 @@ int handle_flash_probe_command(struct command_context_s *cmd_ctx, char *cmd, cha
return ERROR_OK;
}
int handle_flash_erase_check_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
static int handle_flash_erase_check_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
flash_bank_t *p;
int retval;
@@ -448,11 +448,11 @@ int handle_flash_erase_check_command(struct command_context_s *cmd_ctx, char *cm
int j;
if ((retval = p->driver->erase_check(p)) == ERROR_OK)
{
command_print(cmd_ctx, "successfully checked erase state", p->driver->name, p->base);
command_print(cmd_ctx, "successfully checked erase state");
}
else
{
command_print(cmd_ctx, "unknown error when checking erase state of flash bank #%s at 0x%8.8x",
command_print(cmd_ctx, "unknown error when checking erase state of flash bank #%s at 0x%8.8" PRIx32,
args[0], p->base);
}
@@ -467,16 +467,20 @@ int handle_flash_erase_check_command(struct command_context_s *cmd_ctx, char *cm
else
erase_state = "erase state unknown";
command_print(cmd_ctx, "\t#%3i: 0x%8.8x (0x%x %ikB) %s",
j, p->sectors[j].offset, p->sectors[j].size, p->sectors[j].size>>10,
erase_state);
command_print(cmd_ctx,
"\t#%3i: 0x%8.8" PRIx32 " (0x%" PRIx32 " %" PRIi32 "kB) %s",
j,
p->sectors[j].offset,
p->sectors[j].size,
p->sectors[j].size >> 10,
erase_state);
}
}
return ERROR_OK;
}
int handle_flash_erase_address_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
static int handle_flash_erase_address_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
flash_bank_t *p;
int retval;
@@ -524,7 +528,7 @@ int handle_flash_erase_address_command(struct command_context_s *cmd_ctx, char *
return retval;
}
int handle_flash_protect_check_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
static int handle_flash_protect_check_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
flash_bank_t *p;
int retval;
@@ -543,11 +547,11 @@ int handle_flash_protect_check_command(struct command_context_s *cmd_ctx, char *
}
else if (retval == ERROR_FLASH_OPERATION_FAILED)
{
command_print(cmd_ctx, "checking protection state failed (possibly unsupported) by flash #%s at 0x%8.8x", args[0], p->base);
command_print(cmd_ctx, "checking protection state failed (possibly unsupported) by flash #%s at 0x%8.8" PRIx32, args[0], p->base);
}
else
{
command_print(cmd_ctx, "unknown error when checking protection state of flash bank '#%s' at 0x%8.8x", args[0], p->base);
command_print(cmd_ctx, "unknown error when checking protection state of flash bank '#%s' at 0x%8.8" PRIx32, args[0], p->base);
}
}
else
@@ -558,88 +562,131 @@ int handle_flash_protect_check_command(struct command_context_s *cmd_ctx, char *
return ERROR_OK;
}
int handle_flash_erase_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
static int flash_check_sector_parameters(struct command_context_s *cmd_ctx,
uint32_t first, uint32_t last, uint32_t num_sectors)
{
if (!(first <= last)) {
command_print(cmd_ctx, "ERROR: "
"first sector must be <= last sector");
return ERROR_FAIL;
}
if (!(last <= (num_sectors - 1))) {
command_print(cmd_ctx, "ERROR: last sector must be <= %d",
(int) num_sectors - 1);
return ERROR_FAIL;
}
return ERROR_OK;
}
static int handle_flash_erase_command(struct command_context_s *cmd_ctx,
char *cmd, char **args, int argc)
{
if (argc > 2)
{
int first = strtoul(args[1], NULL, 0);
int last = strtoul(args[2], NULL, 0);
uint32_t bank_nr;
uint32_t first;
uint32_t last;
int retval;
flash_bank_t *p = get_flash_bank_by_num(strtoul(args[0], NULL, 0));
if ((retval = parse_u32(args[0], &bank_nr)) != ERROR_OK)
return retval;
flash_bank_t *p = get_flash_bank_by_num(bank_nr);
if (!p)
return ERROR_OK;
if ((retval = parse_u32(args[1], &first)) != ERROR_OK)
return retval;
if (strcmp(args[2], "last") == 0)
last = p->num_sectors - 1;
else
if ((retval = parse_u32(args[2], &last)) != ERROR_OK)
return retval;
if ((retval = flash_check_sector_parameters(cmd_ctx,
first, last, p->num_sectors)) != ERROR_OK)
return retval;
duration_t duration;
char *duration_text;
duration_start_measure(&duration);
if (!p)
{
return ERROR_COMMAND_SYNTAX_ERROR;
}
if ((retval = flash_driver_erase(p, first, last)) == ERROR_OK)
{
if ((retval = duration_stop_measure(&duration, &duration_text)) != ERROR_OK)
{
if ((retval = flash_driver_erase(p, first, last)) == ERROR_OK) {
if ((retval = duration_stop_measure(&duration,
&duration_text)) != ERROR_OK)
return retval;
}
command_print(cmd_ctx, "erased sectors %i through %i on flash bank %i in %s", first, last, strtoul(args[0], 0, 0), duration_text);
command_print(cmd_ctx, "erased sectors %i through %i "
"on flash bank %i in %s",
(int) first, (int) last, (int) bank_nr,
duration_text);
free(duration_text);
}
}
else
{
return ERROR_COMMAND_SYNTAX_ERROR;
}
return ERROR_OK;
}
int handle_flash_protect_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
static int handle_flash_protect_command(struct command_context_s *cmd_ctx,
char *cmd, char **args, int argc)
{
if (argc > 3)
{
int first = strtoul(args[1], NULL, 0);
int last = strtoul(args[2], NULL, 0);
int set;
uint32_t bank_nr;
uint32_t first;
uint32_t last;
int retval;
flash_bank_t *p = get_flash_bank_by_num(strtoul(args[0], NULL, 0));
int set;
if ((retval = parse_u32(args[0], &bank_nr)) != ERROR_OK)
return retval;
flash_bank_t *p = get_flash_bank_by_num(bank_nr);
if (!p)
{
command_print(cmd_ctx, "flash bank '#%s' is out of bounds", args[0]);
return ERROR_OK;
}
if ((retval = parse_u32(args[1], &first)) != ERROR_OK)
return retval;
if (strcmp(args[2], "last") == 0)
last = p->num_sectors - 1;
else
if ((retval = parse_u32(args[2], &last)) != ERROR_OK)
return retval;
if (strcmp(args[3], "on") == 0)
set = 1;
else if (strcmp(args[3], "off") == 0)
set = 0;
else
{
return ERROR_COMMAND_SYNTAX_ERROR;
}
if ((retval = flash_check_sector_parameters(cmd_ctx,
first, last, p->num_sectors)) != ERROR_OK)
return retval;
retval = flash_driver_protect(p, set, first, last);
if (retval == ERROR_OK)
{
command_print(cmd_ctx, "%s protection for sectors %i through %i on flash bank %i", (set) ? "set" : "cleared", first, last, strtoul(args[0], 0, 0));
if (retval == ERROR_OK) {
command_print(cmd_ctx, "%s protection for sectors %i "
"through %i on flash bank %i",
(set) ? "set" : "cleared", (int) first,
(int) last, (int) bank_nr);
}
}
else
{
return ERROR_COMMAND_SYNTAX_ERROR;
}
return ERROR_OK;
}
int handle_flash_write_image_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
static int handle_flash_write_image_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
target_t *target = get_current_target(cmd_ctx);
image_t image;
u32 written;
uint32_t written;
duration_t duration;
char *duration_text;
@@ -653,13 +700,26 @@ int handle_flash_write_image_command(struct command_context_s *cmd_ctx, char *cm
/* flash auto-erase is disabled by default*/
int auto_erase = 0;
bool auto_unlock = false;
if (strcmp(args[0], "erase")==0)
for (;;)
{
auto_erase = 1;
args++;
argc--;
command_print(cmd_ctx, "auto erase enabled");
if (strcmp(args[0], "erase") == 0)
{
auto_erase = 1;
args++;
argc--;
command_print(cmd_ctx, "auto erase enabled");
} else if (strcmp(args[0], "unlock") == 0)
{
auto_unlock = true;
args++;
argc--;
command_print(cmd_ctx, "auto unlock enabled");
} else
{
break;
}
}
if (argc < 1)
@@ -694,7 +754,7 @@ int handle_flash_write_image_command(struct command_context_s *cmd_ctx, char *cm
return retval;
}
retval = flash_write(target, &image, &written, auto_erase);
retval = flash_write_unlock(target, &image, &written, auto_erase, auto_unlock);
if (retval != ERROR_OK)
{
image_close(&image);
@@ -706,12 +766,16 @@ int handle_flash_write_image_command(struct command_context_s *cmd_ctx, char *cm
image_close(&image);
return retvaltemp;
}
if (retval == ERROR_OK)
{
command_print(cmd_ctx, "wrote %u byte from file %s in %s (%f kb/s)",
written, args[0], duration_text,
(float)written / 1024.0 / ((float)duration.duration.tv_sec + ((float)duration.duration.tv_usec / 1000000.0)));
}
float speed;
speed = written / 1024.0;
speed /= ((float)duration.duration.tv_sec
+ ((float)duration.duration.tv_usec / 1000000.0));
command_print(cmd_ctx,
"wrote %" PRIu32 " byte from file %s in %s (%f kb/s)",
written, args[0], duration_text, speed);
free(duration_text);
image_close(&image);
@@ -719,20 +783,22 @@ int handle_flash_write_image_command(struct command_context_s *cmd_ctx, char *cm
return retval;
}
int handle_flash_fill_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
static int handle_flash_fill_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
int err = ERROR_OK, retval;
u32 address;
u32 pattern;
u32 count;
u8 chunk[1024];
u32 wrote = 0;
int chunk_count;
uint32_t address;
uint32_t pattern;
uint32_t count;
uint8_t chunk[1024];
uint8_t readback[1024];
uint32_t wrote = 0;
uint32_t cur_size = 0;
uint32_t chunk_count;
char *duration_text;
duration_t duration;
target_t *target = get_current_target(cmd_ctx);
u32 i;
int wordsize;
uint32_t i;
uint32_t wordsize;
if (argc != 3)
{
@@ -743,35 +809,35 @@ int handle_flash_fill_command(struct command_context_s *cmd_ctx, char *cmd, char
pattern = strtoul(args[1], NULL, 0);
count = strtoul(args[2], NULL, 0);
if(count == 0)
if (count == 0)
return ERROR_OK;
switch(cmd[4])
switch (cmd[4])
{
case 'w':
wordsize=4;
wordsize = 4;
break;
case 'h':
wordsize=2;
wordsize = 2;
break;
case 'b':
wordsize=1;
wordsize = 1;
break;
default:
return ERROR_COMMAND_SYNTAX_ERROR;
}
chunk_count = MIN(count, (1024 / wordsize));
switch(wordsize)
switch (wordsize)
{
case 4:
for(i = 0; i < chunk_count; i++)
for (i = 0; i < chunk_count; i++)
{
target_buffer_set_u32(target, chunk + i * wordsize, pattern);
}
break;
case 2:
for(i = 0; i < chunk_count; i++)
for (i = 0; i < chunk_count; i++)
{
target_buffer_set_u16(target, chunk + i * wordsize, pattern);
}
@@ -786,19 +852,34 @@ int handle_flash_fill_command(struct command_context_s *cmd_ctx, char *cmd, char
duration_start_measure(&duration);
for (wrote=0; wrote<(count*wordsize); wrote+=sizeof(chunk))
for (wrote = 0; wrote < (count*wordsize); wrote += cur_size)
{
int cur_size = MIN( (count*wordsize - wrote) , 1024 );
cur_size = MIN((count*wordsize - wrote), sizeof(chunk));
flash_bank_t *bank;
bank = get_flash_bank_by_addr(target, address);
if(bank == NULL)
if (bank == NULL)
{
return ERROR_FAIL;
}
err = flash_driver_write(bank, chunk, address - bank->base + wrote, cur_size);
if (err!=ERROR_OK)
if (err != ERROR_OK)
return err;
wrote += cur_size;
err = target_read_buffer(target, address + wrote, cur_size, readback);
if (err != ERROR_OK)
return err;
unsigned i;
for (i = 0; i < cur_size; i++)
{
if (readback[i]!=chunk[i])
{
LOG_ERROR("Verfication error address 0x%08" PRIx32 ", read back 0x%02x, expected 0x%02x",
address + wrote + i, readback[i], chunk[i]);
return ERROR_FAIL;
}
}
}
if ((retval = duration_stop_measure(&duration, &duration_text)) != ERROR_OK)
@@ -806,24 +887,24 @@ int handle_flash_fill_command(struct command_context_s *cmd_ctx, char *cmd, char
return retval;
}
if(err == ERROR_OK)
{
float speed;
speed=wrote / 1024.0;
speed/=((float)duration.duration.tv_sec + ((float)duration.duration.tv_usec / 1000000.0));
command_print(cmd_ctx, "wrote %d bytes to 0x%8.8x in %s (%f kb/s)",
count*wordsize, address, duration_text,
speed);
}
float speed;
speed = wrote / 1024.0;
speed /= ((float)duration.duration.tv_sec
+ ((float)duration.duration.tv_usec / 1000000.0));
command_print(cmd_ctx,
"wrote %" PRIu32 " bytes to 0x%8.8" PRIx32 " in %s (%f kb/s)",
wrote, address, duration_text, speed);
free(duration_text);
return ERROR_OK;
}
int handle_flash_write_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
static int handle_flash_write_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
u32 offset;
u8 *buffer;
u32 buf_cnt;
uint32_t offset;
uint8_t *buffer;
uint32_t buf_cnt;
fileio_t fileio;
@@ -871,11 +952,16 @@ int handle_flash_write_bank_command(struct command_context_s *cmd_ctx, char *cmd
fileio_close(&fileio);
return retvaltemp;
}
if (retval==ERROR_OK)
if (retval == ERROR_OK)
{
command_print(cmd_ctx, "wrote %"PRIi64" byte from file %s to flash bank %i at offset 0x%8.8x in %s (%f kb/s)",
fileio.size, args[1], strtoul(args[0], NULL, 0), offset, duration_text,
(float)fileio.size / 1024.0 / ((float)duration.duration.tv_sec + ((float)duration.duration.tv_usec / 1000000.0)));
command_print(cmd_ctx,
"wrote %lld byte from file %s to flash bank %li at offset 0x%8.8" PRIx32 " in %s (%f kb/s)",
fileio.size,
args[1],
strtoul(args[0], NULL, 0),
offset,
duration_text,
(float)fileio.size / 1024.0 / ((float)duration.duration.tv_sec + ((float)duration.duration.tv_usec / 1000000.0)));
}
free(duration_text);
@@ -900,7 +986,7 @@ void flash_set_dirty(void)
}
/* lookup flash bank by address */
flash_bank_t *get_flash_bank_by_addr(target_t *target, u32 addr)
flash_bank_t *get_flash_bank_by_addr(target_t *target, uint32_t addr)
{
flash_bank_t *c;
@@ -919,12 +1005,13 @@ flash_bank_t *get_flash_bank_by_addr(target_t *target, u32 addr)
if ((addr >= c->base) && (addr <= c->base + (c->size - 1)) && target == c->target)
return c;
}
LOG_ERROR("No flash at address 0x%08x\n", addr);
LOG_ERROR("No flash at address 0x%08" PRIx32 "\n", addr);
return NULL;
}
/* erase given flash region, selects proper bank according to target and address */
int flash_erase_address_range(target_t *target, u32 addr, u32 length)
static int flash_iterate_address_range(target_t *target, uint32_t addr, uint32_t length,
int (*callback)(struct flash_bank_s *bank, int first, int last))
{
flash_bank_t *c;
int first = -1;
@@ -946,11 +1033,11 @@ int flash_erase_address_range(target_t *target, u32 addr, u32 length)
if (addr != c->base)
return ERROR_FLASH_DST_BREAKS_ALIGNMENT;
return flash_driver_erase(c, 0, c->num_sectors - 1);
return callback(c, 0, c->num_sectors - 1);
}
/* check whether it fits */
if (addr + length > c->base + c->size)
if (addr + length - 1 > c->base + c->size - 1)
return ERROR_FLASH_DST_BREAKS_ALIGNMENT;
addr -= c->base;
@@ -966,19 +1053,37 @@ int flash_erase_address_range(target_t *target, u32 addr, u32 length)
}
}
if( first == -1 || last == -1 )
if (first == -1 || last == -1)
return ERROR_OK;
return flash_driver_erase(c, first, last);
return callback(c, first, last);
}
/* write (optional verify) an image to flash memory of the given target */
int flash_write(target_t *target, image_t *image, u32 *written, int erase)
int flash_erase_address_range(target_t *target, uint32_t addr, uint32_t length)
{
int retval=ERROR_OK;
return flash_iterate_address_range(target, addr, length, &flash_driver_erase);
}
static int flash_driver_unprotect(struct flash_bank_s *bank, int first, int last)
{
return flash_driver_protect(bank, 0, first, last);
}
static int flash_unlock_address_range(target_t *target, uint32_t addr, uint32_t length)
{
return flash_iterate_address_range(target, addr, length, &flash_driver_unprotect);
}
/* write (optional verify) an image to flash memory of the given target */
static int flash_write_unlock(target_t *target, image_t *image, uint32_t *written, int erase, bool unlock)
{
int retval = ERROR_OK;
int section;
u32 section_offset;
uint32_t section_offset;
flash_bank_t *c;
int *padding;
@@ -1002,12 +1107,12 @@ int flash_write(target_t *target, image_t *image, u32 *written, int erase)
/* loop until we reach end of the image */
while (section < image->num_sections)
{
u32 buffer_size;
u8 *buffer;
uint32_t buffer_size;
uint8_t *buffer;
int section_first;
int section_last;
u32 run_address = image->sections[section].base_address + section_offset;
u32 run_size = image->sections[section].size - section_offset;
uint32_t run_address = image->sections[section].base_address + section_offset;
uint32_t run_size = image->sections[section].size - section_offset;
int pad_bytes = 0;
if (image->sections[section].size == 0)
@@ -1030,7 +1135,7 @@ int flash_write(target_t *target, image_t *image, u32 *written, int erase)
section_first = section;
section_last = section;
padding[section] = 0;
while ((run_address + run_size < c->base + c->size)
while ((run_address + run_size - 1 < c->base + c->size - 1)
&& (section_last + 1 < image->num_sections))
{
if (image->sections[section_last + 1].base_address < (run_address + run_size))
@@ -1048,12 +1153,16 @@ int flash_write(target_t *target, image_t *image, u32 *written, int erase)
run_size += pad_bytes;
padding[section_last] = 0;
LOG_INFO("Padding image section %d with %d bytes", section_last-1, pad_bytes );
LOG_INFO("Padding image section %d with %d bytes", section_last-1, pad_bytes);
}
/* fit the run into bank constraints */
if (run_address + run_size > c->base + c->size)
if (run_address + run_size - 1 > c->base + c->size - 1)
{
LOG_WARNING("writing %d bytes only - as image section is %d bytes and bank is only %d bytes", \
(int)(c->base + c->size - run_address), (int)(run_size), (int)(c->size));
run_size = c->base + c->size - run_address;
}
/* allocate buffer */
buffer = malloc(run_size);
@@ -1062,7 +1171,7 @@ int flash_write(target_t *target, image_t *image, u32 *written, int erase)
/* read sections to the buffer */
while (buffer_size < run_size)
{
u32 size_read;
uint32_t size_read;
size_read = run_size - buffer_size;
if (size_read > image->sections[section].size - section_offset)
@@ -1078,7 +1187,7 @@ int flash_write(target_t *target, image_t *image, u32 *written, int erase)
/* see if we need to pad the section */
while (padding[section]--)
(buffer+buffer_size)[size_read++] = 0xff;
(buffer + buffer_size)[size_read++] = 0xff;
buffer_size += size_read;
section_offset += size_read;
@@ -1092,10 +1201,17 @@ int flash_write(target_t *target, image_t *image, u32 *written, int erase)
retval = ERROR_OK;
if (erase)
if (unlock)
{
/* calculate and erase sectors */
retval = flash_erase_address_range( target, run_address, run_size );
retval = flash_unlock_address_range(target, run_address, run_size);
}
if (retval == ERROR_OK)
{
if (erase)
{
/* calculate and erase sectors */
retval = flash_erase_address_range(target, run_address, run_size);
}
}
if (retval == ERROR_OK)
@@ -1121,13 +1237,18 @@ int flash_write(target_t *target, image_t *image, u32 *written, int erase)
return retval;
}
int flash_write(target_t *target, image_t *image, uint32_t *written, int erase)
{
return flash_write_unlock(target, image, written, erase, false);
}
int default_flash_mem_blank_check(struct flash_bank_s *bank)
{
target_t *target = bank->target;
u8 buffer[1024];
uint8_t buffer[1024];
int buffer_size = sizeof(buffer);
int i;
int nBytes;
uint32_t nBytes;
if (bank->target->state != TARGET_HALTED)
{
@@ -1137,12 +1258,12 @@ int default_flash_mem_blank_check(struct flash_bank_s *bank)
for (i = 0; i < bank->num_sectors; i++)
{
int j;
uint32_t j;
bank->sectors[i].is_erased = 1;
for (j = 0; j < bank->sectors[i].size; j += buffer_size)
{
int chunk;
uint32_t chunk;
int retval;
chunk = buffer_size;
if (chunk > (j - bank->sectors[i].size))
@@ -1150,7 +1271,7 @@ int default_flash_mem_blank_check(struct flash_bank_s *bank)
chunk = (j - bank->sectors[i].size);
}
retval = target->type->read_memory(target, bank->base + bank->sectors[i].offset + j, 4, chunk/4, buffer);
retval = target_read_memory(target, bank->base + bank->sectors[i].offset + j, 4, chunk/4, buffer);
if (retval != ERROR_OK)
return retval;
@@ -1174,7 +1295,7 @@ int default_flash_blank_check(struct flash_bank_s *bank)
int i;
int retval;
int fast_check = 0;
u32 blank;
uint32_t blank;
if (bank->target->state != TARGET_HALTED)
{
@@ -1184,8 +1305,8 @@ int default_flash_blank_check(struct flash_bank_s *bank)
for (i = 0; i < bank->num_sectors; i++)
{
u32 address = bank->base + bank->sectors[i].offset;
u32 size = bank->sectors[i].size;
uint32_t address = bank->base + bank->sectors[i].offset;
uint32_t size = bank->sectors[i].size;
if ((retval = target_blank_check_memory(target, address, size, &blank)) != ERROR_OK)
{

View File

@@ -2,7 +2,7 @@
* Copyright (C) 2005 by Dominic Rath *
* Dominic.Rath@gmx.de *
* *
* Copyright (C) 2007,2008 Øyvind Harboe *
* Copyright (C) 2007,2008 Øyvind Harboe *
* oyvind.harboe@zylin.com *
* *
* Copyright (C) 2008 by Spencer Oliver *
@@ -27,70 +27,305 @@
#define FLASH_H
#include "target.h"
#include "image.h"
#include "log.h"
struct image_s;
#define FLASH_MAX_ERROR_STR (128)
/**
* Describes the geometry and status of a single flash sector
* within a flash bank. A single bank typically consists of multiple
* sectors, each of which can be erased and protected independently.
*/
typedef struct flash_sector_s
{
u32 offset;
u32 size;
/// Bus offset from start of the flash chip (in bytes).
uint32_t offset;
/// Number of bytes in this flash sector.
uint32_t size;
/**
* Indication of erasure status: 0 = not erased, 1 = erased,
* other = unknown. Set by @c flash_driver_s::erase_check.
*/
int is_erased;
/**
* Indication of protection status: 0 = unprotected/unlocked,
* 1 = protected/locked, other = unknown. Set by
* @c flash_driver_s::protect_check.
*/
int is_protected;
} flash_sector_t;
struct flash_bank_s;
/**
* @brief Provides the implementation-independent structure that defines
* all of the callbacks required by OpenOCD flash drivers.
*
* Driver authors must implement the routines defined here, providing an
* instance with the fields filled out. After that, the instance must
* be registered in flash.c, so it can be used by the driver lookup system.
*
* Specifically, the user can issue the command: @par
* @code
* flash bank DRIVERNAME ...parameters...
* @endcode
*
* OpenOCD will search for the driver with a @c flash_driver_s::name
* that matches @c DRIVERNAME.
*
* The flash subsystem calls some of the other drivers routines a using
* corresponding static <code>flash_driver_<i>callback</i>()</code>
* routine in flash.c.
*/
typedef struct flash_driver_s
{
/**
* Gives a human-readable name of this flash driver,
* This field is used to select and initialize the driver.
*/
char *name;
/**
* Registers driver-specific commands. When called (during the
* "flash bank" command), the driver may register addition
* commands to support new flash chip functions.
*
* @returns ERROR_OK if successful; otherwise, an error code.
*/
int (*register_commands)(struct command_context_s *cmd_ctx);
/**
* Finish the "flash bank" command for @a bank. The
* @a bank parameter will have been filled in by the core flash
* layer when this routine is called, and the driver can store
* additional information in its flash_bank_t::driver_priv field.
*
* @param cmd_ctx - the command context
* @param cmd - the command, in this case 'flash'
* @param args - parameters, see below
* @param argc - number of parameters on command line
* @param bank - new filled in flash bank.
*
* The args are: @par
* @code
* args[0] = bank
* args[1] = drivername {name above}
* args[2] = baseaddress
* args[3] = lengthbytes
* args[4] = chip_width_in bytes
* args[5] = bus_width_bytes
* args[6] = driver-specific parameters
* @endcode
*
* For example, args[4] = 16 bit flash, args[5] = 32bit bus.
*
* If extra arguments are provided (@a argc > 6), they will
* start in @a args[6]. These can be used to implement
* driver-specific extensions.
*
* @returns ERROR_OK if successful; otherwise, an error code.
*/
int (*flash_bank_command)(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank);
/* use flash_driver_erase() wrapper to invoke */
/**
* Bank/sector erase routine (target-specific). When
* called, the flash driver should erase the specified sectors
* using whatever means are at its disposal.
*
* @param bank The bank of flash to be erased.
* @param first The number of the first sector to erase, typically 0.
* @param last The number of the last sector to erase, typically N-1.
* @returns ERROR_OK if successful; otherwise, an error code.
*/
int (*erase)(struct flash_bank_s *bank, int first, int last);
/* use flash_driver_protect() wrapper to invoke */
/**
* Bank/sector protection routine (target-specific).
* When called, the driver should disable 'flash write' bits (or
* enable 'erase protection' bits) for the given @a bank and @a
* sectors.
*
* @param bank The bank to protect or unprotect.
* @param set If non-zero, enable protection; if 0, disable it.
* @param first The first sector to (un)protect, typicaly 0.
* @param last The last sector to (un)project, typically N-1.
* @returns ERROR_OK if successful; otherwise, an error code.
*/
int (*protect)(struct flash_bank_s *bank, int set, int first, int last);
/* use the flash_driver_write() wrapper to invoke. */
int (*write)(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count);
/**
* Program data into the flash. Note CPU address will be
* "bank->base + offset", while the physical address is
* dependent upon current target MMU mappings.
*
* @param bank The bank to program
* @param buffer The data bytes to write.
* @param offset The offset into the chip to program.
* @param count The number of bytes to write.
* @returns ERROR_OK if successful; otherwise, an error code.
*/
int (*write)(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count);
/**
* Probe to determine what kind of flash is present.
* This is invoked by the "probe" script command.
*
* @param bank The bank to probe
* @returns ERROR_OK if successful; otherwise, an error code.
*/
int (*probe)(struct flash_bank_s *bank);
/**
* Check the erasure status of a flash bank.
* When called, the driver routine must perform the required
* checks and then set the @c flash_sector_s::is_erased field
* for each of the flash banks's sectors.
*
* @param bank The bank to check
* @returns ERROR_OK if successful; otherwise, an error code.
*/
int (*erase_check)(struct flash_bank_s *bank);
/**
* Determine if the specific bank is "protected" or not.
* When called, the driver routine must must perform the
* required protection check(s) and then set the @c
* flash_sector_s::is_protected field for each of the flash
* bank's sectors.
*
* @param bank - the bank to check
* @returns ERROR_OK if successful; otherwise, an error code.
*/
int (*protect_check)(struct flash_bank_s *bank);
/**
* Display human-readable information about the flash
* bank into the given buffer. Drivers must be careful to avoid
* overflowing the buffer.
*
* @param bank - the bank to get info about
* @param char - where to put the text for the human to read
* @param buf_size - the size of the human buffer.
* @returns ERROR_OK if successful; otherwise, an error code.
*/
int (*info)(struct flash_bank_s *bank, char *buf, int buf_size);
/**
* A more gentle flavor of filash_driver_s::probe, performing
* setup with less noise. Generally, driver routines should test
* to seee if the bank has already been probed; if it has, the
* driver probably should not perform its probe a second time.
*
* This callback is often called from the inside of other
* routines (e.g. GDB flash downloads) to autoprobe the flash as
* it is programing the flash.
*
* @param bank - the bank to probe
* @returns ERROR_OK if successful; otherwise, an error code.
*/
int (*auto_probe)(struct flash_bank_s *bank);
} flash_driver_t;
/**
* Provides details of a flash bank, available either on-chip or through
* a major interface.
*
* This structure will be passed as a parameter to the callbacks in the
* flash_driver_s structure, some of which may modify the contents of
* this structure of the area of flash that it defines. Driver writers
* may use the @c driver_priv member to store additional data on a
* per-bank basis, if required.
*/
typedef struct flash_bank_s
{
target_t *target;
flash_driver_t *driver;
void *driver_priv;
int bank_number;
u32 base;
u32 size;
int chip_width;
int bus_width;
struct target_s *target; /**< Target to which this bank belongs. */
flash_driver_t *driver; /**< Driver for this bank. */
void *driver_priv; /**< Private driver storage pointer */
int bank_number; /**< The 'bank' (or chip number) of this instance. */
uint32_t base; /**< The base address of this bank */
uint32_t size; /**< The size of this chip bank, in bytes */
int chip_width; /**< Width of the chip in bytes (1,2,4 bytes) */
int bus_width; /**< Maximum bus width, in bytes (1,2,4 bytes) */
/**
* The number of sectors on this chip. This value will
* be set intially to 0, and the flash driver must set this to
* some non-zero value during "probe()" or "auto_probe()".
*/
int num_sectors;
/// Array of sectors, allocated and initilized by the flash driver
flash_sector_t *sectors;
struct flash_bank_s *next;
struct flash_bank_s *next; /**< The next flash bank on this chip */
} flash_bank_t;
/// Registers the 'flash' subsystem commands
extern int flash_register_commands(struct command_context_s *cmd_ctx);
/// Initializes the 'flash' subsystem drivers
extern int flash_init_drivers(struct command_context_s *cmd_ctx);
extern int flash_erase_address_range(target_t *target, u32 addr, u32 length);
extern int flash_write(target_t *target, image_t *image, u32 *written, int erase);
/**
* Erases @a length bytes in the @a target flash, starting at @a addr.
* @returns ERROR_OK if successful; otherwise, an error code.
*/
extern int flash_erase_address_range(struct target_s *target, uint32_t addr, uint32_t length);
/**
* Writes @a image into the @a target flash. The @a written parameter
* will contain the
* @param target The target with the flash to be programmed.
* @param image The image that will be programmed to flash.
* @param written On return, contains the number of bytes written.
* @param erase If non-zero, indicates the flash driver should first
* erase the corresponding banks or sectors before programming.
* @returns ERROR_OK if successful; otherwise, an error code.
*/
extern int flash_write(struct target_s *target, struct image_s *image, uint32_t *written, int erase);
/**
* Forces targets to re-examine their erase/protection state.
* This routine must be called when the system may modify the status.
*/
extern void flash_set_dirty(void);
/// @returns The number of flash banks currently defined.
extern int flash_get_bank_count(void);
/**
* Provides default erased-bank check handling. Checks to see if
* the flash driver knows they are erased; if things look uncertain,
* this routine will call default_flash_mem_blank_check() to confirm.
* @returns ERROR_OK if successful; otherwise, an error code.
*/
extern int default_flash_blank_check(struct flash_bank_s *bank);
/**
* Provides a default blank flash memory check. Ensures the contents
* of the given bank have truly been erased.
* @param bank The flash bank.
* @returns ERROR_OK if successful; otherwise, an error code.
*/
extern int default_flash_mem_blank_check(struct flash_bank_s *bank);
/**
* Returns a flash bank by the specified flash_bank_s bank_number, @a num.
* @param num The flash bank number.
* @returns A flash_bank_t for flash bank @a num, or NULL
*/
extern flash_bank_t *get_flash_bank_by_num(int num);
/**
* Returns the flash bank like get_flash_bank_by_num(), without probing.
* @param num The flash bank number.
* @returns A flash_bank_t for flash bank @a num, or NULL.
*/
extern flash_bank_t *get_flash_bank_by_num_noprobe(int num);
extern flash_bank_t *get_flash_bank_by_addr(target_t *target, u32 addr);
/**
* Returns the flash bank located at a specified address.
* @param target The target, presumed to contain one or more banks.
* @param addr An address that is within the range of the bank.
* @returns The flash_bank_t located at @a addr, or NULL.
*/
extern flash_bank_t *get_flash_bank_by_addr(struct target_s *target, uint32_t addr);
#define ERROR_FLASH_BANK_INVALID (-900)
#define ERROR_FLASH_SECTOR_INVALID (-901)

View File

@@ -2,6 +2,9 @@
* Copyright (C) 2005 by Dominic Rath *
* Dominic.Rath@gmx.de *
* *
* LPC1700 support Copyright (C) 2009 by Audrius Urmanavicius *
* didele.deze@gmail.com *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
@@ -17,51 +20,50 @@
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "lpc2000.h"
#include "flash.h"
#include "target.h"
#include "log.h"
#include "armv4_5.h"
#include "algorithm.h"
#include "armv7m.h"
#include "binarybuffer.h"
#include <stdlib.h>
#include <string.h>
/* flash programming support for Philips LPC2xxx devices
/* flash programming support for NXP LPC17xx and LPC2xxx devices
* currently supported devices:
* variant 1 (lpc2000_v1):
* - 2104|5|6
* - 2114|9
* - 2124|9
* - 2104 | 5 | 6
* - 2114 | 9
* - 2124 | 9
* - 2194
* - 2212|4
* - 2292|4
* - 2212 | 4
* - 2292 | 4
*
* variant 2 (lpc2000_v2):
* - 213x
* - 214x
* - 2101|2|3
* - 2364|6|8
* - 2101 | 2 | 3
* - 2364 | 6 | 8
* - 2378
*
* lpc1700:
* - 175x
* - 176x (tested with LPC1768)
*/
int lpc2000_register_commands(struct command_context_s *cmd_ctx);
int lpc2000_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank);
int lpc2000_erase(struct flash_bank_s *bank, int first, int last);
int lpc2000_protect(struct flash_bank_s *bank, int set, int first, int last);
int lpc2000_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count);
int lpc2000_probe(struct flash_bank_s *bank);
int lpc2000_erase_check(struct flash_bank_s *bank);
int lpc2000_protect_check(struct flash_bank_s *bank);
int lpc2000_info(struct flash_bank_s *bank, char *buf, int buf_size);
int lpc2000_handle_part_id_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
static int lpc2000_register_commands(struct command_context_s *cmd_ctx);
static int lpc2000_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank);
static int lpc2000_erase(struct flash_bank_s *bank, int first, int last);
static int lpc2000_protect(struct flash_bank_s *bank, int set, int first, int last);
static int lpc2000_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count);
static int lpc2000_probe(struct flash_bank_s *bank);
static int lpc2000_erase_check(struct flash_bank_s *bank);
static int lpc2000_protect_check(struct flash_bank_s *bank);
static int lpc2000_info(struct flash_bank_s *bank, char *buf, int buf_size);
static int lpc2000_handle_part_id_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
flash_driver_t lpc2000_flash =
{
@@ -78,28 +80,27 @@ flash_driver_t lpc2000_flash =
.info = lpc2000_info
};
int lpc2000_register_commands(struct command_context_s *cmd_ctx)
static int lpc2000_register_commands(struct command_context_s *cmd_ctx)
{
command_t *lpc2000_cmd = register_command(cmd_ctx, NULL, "lpc2000", NULL, COMMAND_ANY, NULL);
register_command(cmd_ctx, lpc2000_cmd, "part_id", lpc2000_handle_part_id_command, COMMAND_EXEC,
"print part id of lpc2000 flash bank <num>");
return ERROR_OK;
}
int lpc2000_build_sector_list(struct flash_bank_s *bank)
static int lpc2000_build_sector_list(struct flash_bank_s *bank)
{
lpc2000_flash_bank_t *lpc2000_info = bank->driver_priv;
int i;
uint32_t offset = 0;
/* default to a 4096 write buffer */
lpc2000_info->cmd51_max_buffer = 4096;
if (lpc2000_info->variant == 1)
if (lpc2000_info->variant == lpc2000_v1)
{
int i = 0;
u32 offset = 0;
/* variant 1 has different layout for 128kb and 256kb flashes */
if (bank->size == 128 * 1024)
{
@@ -118,7 +119,7 @@ int lpc2000_build_sector_list(struct flash_bank_s *bank)
{
bank->num_sectors = 18;
bank->sectors = malloc(sizeof(flash_sector_t) * 18);
for (i = 0; i < 8; i++)
{
bank->sectors[i].offset = offset;
@@ -150,52 +151,47 @@ int lpc2000_build_sector_list(struct flash_bank_s *bank)
exit(-1);
}
}
else if (lpc2000_info->variant == 2)
else if (lpc2000_info->variant == lpc2000_v2)
{
int num_sectors;
int i;
u32 offset = 0;
/* variant 2 has a uniform layout, only number of sectors differs */
switch (bank->size)
{
case 4 * 1024:
lpc2000_info->cmd51_max_buffer = 1024;
num_sectors = 1;
bank->num_sectors = 1;
break;
case 8 * 1024:
lpc2000_info->cmd51_max_buffer = 1024;
num_sectors = 2;
bank->num_sectors = 2;
break;
case 16 * 1024:
num_sectors = 4;
bank->num_sectors = 4;
break;
case 32 * 1024:
num_sectors = 8;
bank->num_sectors = 8;
break;
case 64 * 1024:
num_sectors = 9;
bank->num_sectors = 9;
break;
case 128 * 1024:
num_sectors = 11;
bank->num_sectors = 11;
break;
case 256 * 1024:
num_sectors = 15;
bank->num_sectors = 15;
break;
case 512 * 1024:
case 500 * 1024:
num_sectors = 27;
bank->num_sectors = 27;
break;
default:
LOG_ERROR("BUG: unknown bank->size encountered");
exit(-1);
break;
}
bank->num_sectors = num_sectors;
bank->sectors = malloc(sizeof(flash_sector_t) * num_sectors);
for (i = 0; i < num_sectors; i++)
bank->sectors = malloc(sizeof(flash_sector_t) * bank->num_sectors);
for (i = 0; i < bank->num_sectors; i++)
{
if ((i >= 0) && (i < 8))
{
@@ -223,121 +219,215 @@ int lpc2000_build_sector_list(struct flash_bank_s *bank)
}
}
}
else if (lpc2000_info->variant == lpc1700)
{
switch(bank->size)
{
case 32 * 1024:
bank->num_sectors = 8;
break;
case 64 * 1024:
bank->num_sectors = 16;
break;
case 128 * 1024:
bank->num_sectors = 18;
break;
case 256 * 1024:
bank->num_sectors = 22;
break;
case 512 * 1024:
bank->num_sectors = 30;
break;
default:
LOG_ERROR("BUG: unknown bank->size encountered");
exit(-1);
}
bank->sectors = malloc(sizeof(flash_sector_t) * bank->num_sectors);
for(i = 0; i < bank->num_sectors; i++)
{
bank->sectors[i].offset = offset;
/* sectors 0-15 are 4kB-sized, 16 and above are 32kB-sized for LPC17xx devices */
bank->sectors[i].size = (i < 16)? 4 * 1024 : 32 * 1024;
offset += bank->sectors[i].size;
bank->sectors[i].is_erased = -1;
bank->sectors[i].is_protected = 1;
}
}
else
{
LOG_ERROR("BUG: unknown lpc2000_info->variant encountered");
exit(-1);
}
return ERROR_OK;
}
/* call LPC2000 IAP function
* uses 172 bytes working area
/* call LPC1700/LPC2000 IAP function
* uses 180 bytes working area
* 0x0 to 0x7: jump gate (BX to thumb state, b -2 to wait)
* 0x8 to 0x1f: command parameter table
* 0x20 to 0x2b: command result table
* 0x2c to 0xac: stack (only 128b needed)
* 0x8 to 0x1f: command parameter table (1+5 words)
* 0x20 to 0x33: command result table (1+4 words)
* 0x34 to 0xb3: stack (only 128b needed)
*/
int lpc2000_iap_call(flash_bank_t *bank, int code, u32 param_table[5], u32 result_table[2])
static int lpc2000_iap_call(flash_bank_t *bank, int code, uint32_t param_table[5], uint32_t result_table[4])
{
int retval;
lpc2000_flash_bank_t *lpc2000_info = bank->driver_priv;
target_t *target = bank->target;
mem_param_t mem_params[2];
reg_param_t reg_params[5];
armv4_5_algorithm_t armv4_5_info;
u32 status_code;
armv4_5_algorithm_t armv4_5_info; /* for LPC2000 */
armv7m_algorithm_t armv7m_info; /* for LPC1700 */
uint32_t status_code;
uint32_t iap_entry_point = 0; /* to make compiler happier */
/* regrab previously allocated working_area, or allocate a new one */
if (!lpc2000_info->iap_working_area)
{
u8 jump_gate[8];
uint8_t jump_gate[8];
/* make sure we have a working area */
if (target_alloc_working_area(target, 172, &lpc2000_info->iap_working_area) != ERROR_OK)
if (target_alloc_working_area(target, 180, &lpc2000_info->iap_working_area) != ERROR_OK)
{
LOG_ERROR("no working area specified, can't write LPC2000 internal flash");
return ERROR_FLASH_OPERATION_FAILED;
}
/* write IAP code to working area */
target_buffer_set_u32(target, jump_gate, ARMV4_5_BX(12));
target_buffer_set_u32(target, jump_gate + 4, ARMV4_5_B(0xfffffe, 0));
if((retval = target->type->write_memory(target, lpc2000_info->iap_working_area->address, 4, 2, jump_gate)) != ERROR_OK)
switch(lpc2000_info->variant)
{
case lpc1700:
target_buffer_set_u32(target, jump_gate, ARMV7M_T_BX(12));
target_buffer_set_u32(target, jump_gate + 4, ARMV7M_T_B(0xfffffe));
break;
case lpc2000_v1:
case lpc2000_v2:
target_buffer_set_u32(target, jump_gate, ARMV4_5_BX(12));
target_buffer_set_u32(target, jump_gate + 4, ARMV4_5_B(0xfffffe, 0));
break;
default:
LOG_ERROR("BUG: unknown bank->size encountered");
exit(-1);
}
if ((retval = target_write_memory(target, lpc2000_info->iap_working_area->address, 4, 2, jump_gate)) != ERROR_OK)
{
LOG_ERROR("Write memory at address 0x%8.8" PRIx32 " failed (check work_area definition)", lpc2000_info->iap_working_area->address);
return retval;
}
}
armv4_5_info.common_magic = ARMV4_5_COMMON_MAGIC;
armv4_5_info.core_mode = ARMV4_5_MODE_SVC;
armv4_5_info.core_state = ARMV4_5_STATE_ARM;
switch(lpc2000_info->variant)
{
case lpc1700:
armv7m_info.common_magic = ARMV7M_COMMON_MAGIC;
armv7m_info.core_mode = ARMV7M_MODE_ANY;
iap_entry_point = 0x1fff1ff1;
break;
case lpc2000_v1:
case lpc2000_v2:
armv4_5_info.common_magic = ARMV4_5_COMMON_MAGIC;
armv4_5_info.core_mode = ARMV4_5_MODE_SVC;
armv4_5_info.core_state = ARMV4_5_STATE_ARM;
iap_entry_point = 0x7ffffff1;
break;
default:
LOG_ERROR("BUG: unknown lpc2000->variant encountered");
exit(-1);
}
/* command parameter table */
init_mem_param(&mem_params[0], lpc2000_info->iap_working_area->address + 8, 4 * 6, PARAM_OUT);
init_mem_param(&mem_params[0], lpc2000_info->iap_working_area->address + 8, 6 * 4, PARAM_OUT);
target_buffer_set_u32(target, mem_params[0].value, code);
target_buffer_set_u32(target, mem_params[0].value + 0x4, param_table[0]);
target_buffer_set_u32(target, mem_params[0].value + 0x8, param_table[1]);
target_buffer_set_u32(target, mem_params[0].value + 0xc, param_table[2]);
target_buffer_set_u32(target, mem_params[0].value + 0x04, param_table[0]);
target_buffer_set_u32(target, mem_params[0].value + 0x08, param_table[1]);
target_buffer_set_u32(target, mem_params[0].value + 0x0c, param_table[2]);
target_buffer_set_u32(target, mem_params[0].value + 0x10, param_table[3]);
target_buffer_set_u32(target, mem_params[0].value + 0x14, param_table[4]);
init_reg_param(&reg_params[0], "r0", 32, PARAM_OUT);
buf_set_u32(reg_params[0].value, 0, 32, lpc2000_info->iap_working_area->address + 0x8);
buf_set_u32(reg_params[0].value, 0, 32, lpc2000_info->iap_working_area->address + 0x08);
/* command result table */
init_mem_param(&mem_params[1], lpc2000_info->iap_working_area->address + 0x20, 4 * 3, PARAM_IN);
init_mem_param(&mem_params[1], lpc2000_info->iap_working_area->address + 0x20, 5 * 4, PARAM_IN);
init_reg_param(&reg_params[1], "r1", 32, PARAM_OUT);
buf_set_u32(reg_params[1].value, 0, 32, lpc2000_info->iap_working_area->address + 0x20);
/* IAP entry point */
init_reg_param(&reg_params[2], "r12", 32, PARAM_OUT);
buf_set_u32(reg_params[2].value, 0, 32, 0x7ffffff1);
/* IAP stack */
init_reg_param(&reg_params[3], "r13_svc", 32, PARAM_OUT);
buf_set_u32(reg_params[3].value, 0, 32, lpc2000_info->iap_working_area->address + 0xac);
buf_set_u32(reg_params[2].value, 0, 32, iap_entry_point);
switch(lpc2000_info->variant)
{
case lpc1700:
/* IAP stack */
init_reg_param(&reg_params[3], "sp", 32, PARAM_OUT);
buf_set_u32(reg_params[3].value, 0, 32, lpc2000_info->iap_working_area->address + 0xb4);
/* return address */
init_reg_param(&reg_params[4], "lr", 32, PARAM_OUT);
buf_set_u32(reg_params[4].value, 0, 32, (lpc2000_info->iap_working_area->address + 0x04) | 1); /* bit0 of LR = 1 to return in Thumb mode */
target_run_algorithm(target, 2, mem_params, 5, reg_params, lpc2000_info->iap_working_area->address, lpc2000_info->iap_working_area->address + 0x4, 10000, &armv7m_info);
break;
case lpc2000_v1:
case lpc2000_v2:
/* IAP stack */
init_reg_param(&reg_params[3], "r13_svc", 32, PARAM_OUT);
buf_set_u32(reg_params[3].value, 0, 32, lpc2000_info->iap_working_area->address + 0xb4);
/* return address */
init_reg_param(&reg_params[4], "lr_svc", 32, PARAM_OUT);
buf_set_u32(reg_params[4].value, 0, 32, lpc2000_info->iap_working_area->address + 0x04);
target_run_algorithm(target, 2, mem_params, 5, reg_params, lpc2000_info->iap_working_area->address, lpc2000_info->iap_working_area->address + 0x4, 10000, &armv4_5_info);
break;
default:
LOG_ERROR("BUG: unknown lpc2000->variant encountered");
exit(-1);
}
status_code = target_buffer_get_u32(target, mem_params[1].value);
result_table[0] = target_buffer_get_u32(target, mem_params[1].value + 0x04);
result_table[1] = target_buffer_get_u32(target, mem_params[1].value + 0x08);
result_table[2] = target_buffer_get_u32(target, mem_params[1].value + 0x0c);
result_table[3] = target_buffer_get_u32(target, mem_params[1].value + 0x10);
LOG_DEBUG("IAP command = %i (0x%8.8" PRIx32", 0x%8.8" PRIx32", 0x%8.8" PRIx32", 0x%8.8" PRIx32", 0x%8.8" PRIx32") completed with result = %8.8" PRIx32,
code, param_table[0], param_table[1], param_table[2], param_table[3], param_table[4], status_code);
/* return address */
init_reg_param(&reg_params[4], "lr_svc", 32, PARAM_OUT);
buf_set_u32(reg_params[4].value, 0, 32, lpc2000_info->iap_working_area->address + 0x4);
target->type->run_algorithm(target, 2, mem_params, 5, reg_params, lpc2000_info->iap_working_area->address, lpc2000_info->iap_working_area->address + 0x4, 10000, &armv4_5_info);
status_code = buf_get_u32(mem_params[1].value, 0, 32);
result_table[0] = target_buffer_get_u32(target, mem_params[1].value);
result_table[1] = target_buffer_get_u32(target, mem_params[1].value + 4);
destroy_mem_param(&mem_params[0]);
destroy_mem_param(&mem_params[1]);
destroy_reg_param(&reg_params[0]);
destroy_reg_param(&reg_params[1]);
destroy_reg_param(&reg_params[2]);
destroy_reg_param(&reg_params[3]);
destroy_reg_param(&reg_params[4]);
return status_code;
}
int lpc2000_iap_blank_check(struct flash_bank_s *bank, int first, int last)
static int lpc2000_iap_blank_check(struct flash_bank_s *bank, int first, int last)
{
u32 param_table[5];
u32 result_table[2];
uint32_t param_table[5];
uint32_t result_table[4];
int status_code;
int i;
if ((first < 0) || (last > bank->num_sectors))
if ((first < 0) || (last >= bank->num_sectors))
return ERROR_FLASH_SECTOR_INVALID;
for (i = first; i <= last; i++)
{
/* check single sector */
param_table[0] = param_table[1] = i;
status_code = lpc2000_iap_call(bank, 53, param_table, result_table);
switch (status_code)
{
case ERROR_FLASH_OPERATION_FAILED:
@@ -355,71 +445,82 @@ int lpc2000_iap_blank_check(struct flash_bank_s *bank, int first, int last)
return ERROR_FLASH_BUSY;
break;
default:
LOG_ERROR("BUG: unknown LPC2000 status code");
LOG_ERROR("BUG: unknown LPC2000 status code %i", status_code);
exit(-1);
}
}
return ERROR_OK;
}
/* flash bank lpc2000 <base> <size> 0 0 <target#> <lpc_variant> <cclk> [calc_checksum]
/*
* flash bank lpc2000 <base> <size> 0 0 <target#> <lpc_variant> <cclk> [calc_checksum]
*/
int lpc2000_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank)
static int lpc2000_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank)
{
lpc2000_flash_bank_t *lpc2000_info;
if (argc < 8)
{
LOG_WARNING("incomplete flash_bank lpc2000 configuration");
return ERROR_FLASH_BANK_INVALID;
}
lpc2000_info = malloc(sizeof(lpc2000_flash_bank_t));
bank->driver_priv = lpc2000_info;
if (strcmp(args[6], "lpc2000_v1") == 0)
{
lpc2000_info->variant = 1;
lpc2000_info->variant = lpc2000_v1;
lpc2000_info->cmd51_dst_boundary = 512;
lpc2000_info->cmd51_can_256b = 0;
lpc2000_info->cmd51_can_8192b = 1;
lpc2000_info->checksum_vector = 5;
}
else if (strcmp(args[6], "lpc2000_v2") == 0)
{
lpc2000_info->variant = 2;
lpc2000_info->variant = lpc2000_v2;
lpc2000_info->cmd51_dst_boundary = 256;
lpc2000_info->cmd51_can_256b = 1;
lpc2000_info->cmd51_can_8192b = 0;
lpc2000_info->checksum_vector = 5;
}
else if (strcmp(args[6], "lpc1700") == 0)
{
lpc2000_info->variant = lpc1700;
lpc2000_info->cmd51_dst_boundary = 256;
lpc2000_info->cmd51_can_256b = 1;
lpc2000_info->cmd51_can_8192b = 0;
lpc2000_info->checksum_vector = 7;
}
else
{
LOG_ERROR("unknown LPC2000 variant");
LOG_ERROR("unknown LPC2000 variant: %s", args[6]);
free(lpc2000_info);
return ERROR_FLASH_BANK_INVALID;
}
lpc2000_info->iap_working_area = NULL;
lpc2000_info->cclk = strtoul(args[7], NULL, 0);
lpc2000_info->calc_checksum = 0;
lpc2000_build_sector_list(bank);
if (argc >= 9)
{
if (strcmp(args[8], "calc_checksum") == 0)
lpc2000_info->calc_checksum = 1;
}
return ERROR_OK;
}
int lpc2000_erase(struct flash_bank_s *bank, int first, int last)
static int lpc2000_erase(struct flash_bank_s *bank, int first, int last)
{
lpc2000_flash_bank_t *lpc2000_info = bank->driver_priv;
u32 param_table[5];
u32 result_table[2];
uint32_t param_table[5];
uint32_t result_table[4];
int status_code;
if (bank->target->state != TARGET_HALTED)
{
LOG_ERROR("Target not halted");
@@ -429,7 +530,7 @@ int lpc2000_erase(struct flash_bank_s *bank, int first, int last)
param_table[0] = first;
param_table[1] = last;
param_table[2] = lpc2000_info->cclk;
/* Prepare sectors */
status_code = lpc2000_iap_call(bank, 50, param_table, result_table);
switch (status_code)
@@ -445,7 +546,7 @@ int lpc2000_erase(struct flash_bank_s *bank, int first, int last)
LOG_WARNING("lpc2000 prepare sectors returned %i", status_code);
return ERROR_FLASH_OPERATION_FAILED;
}
/* Erase sectors */
status_code = lpc2000_iap_call(bank, 52, param_table, result_table);
switch (status_code)
@@ -461,52 +562,49 @@ int lpc2000_erase(struct flash_bank_s *bank, int first, int last)
LOG_WARNING("lpc2000 erase sectors returned %i", status_code);
return ERROR_FLASH_OPERATION_FAILED;
}
return ERROR_OK;
}
int lpc2000_protect(struct flash_bank_s *bank, int set, int first, int last)
static int lpc2000_protect(struct flash_bank_s *bank, int set, int first, int last)
{
/* can't protect/unprotect on the lpc2000 */
return ERROR_OK;
}
int lpc2000_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count)
static int lpc2000_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count)
{
lpc2000_flash_bank_t *lpc2000_info = bank->driver_priv;
target_t *target = bank->target;
u32 dst_min_alignment;
u32 bytes_remaining = count;
u32 bytes_written = 0;
uint32_t dst_min_alignment;
uint32_t bytes_remaining = count;
uint32_t bytes_written = 0;
int first_sector = 0;
int last_sector = 0;
u32 param_table[5];
u32 result_table[2];
uint32_t param_table[5];
uint32_t result_table[4];
int status_code;
int i;
working_area_t *download_area;
int retval = ERROR_OK;
if (bank->target->state != TARGET_HALTED)
{
LOG_ERROR("Target not halted");
return ERROR_TARGET_NOT_HALTED;
}
if (offset + count > bank->size)
return ERROR_FLASH_DST_OUT_OF_BANK;
if (lpc2000_info->cmd51_can_256b)
dst_min_alignment = 256;
else
dst_min_alignment = 512;
dst_min_alignment = lpc2000_info->cmd51_dst_boundary;
if (offset % dst_min_alignment)
{
LOG_WARNING("offset 0x%x breaks required alignment 0x%x", offset, dst_min_alignment);
LOG_WARNING("offset 0x%" PRIx32 " breaks required alignment 0x%" PRIx32, offset, dst_min_alignment);
return ERROR_FLASH_DST_BREAKS_ALIGNMENT;
}
for (i = 0; i < bank->num_sectors; i++)
{
if (offset >= bank->sectors[i].offset)
@@ -514,35 +612,44 @@ int lpc2000_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count)
if (offset + CEIL(count, dst_min_alignment) * dst_min_alignment > bank->sectors[i].offset)
last_sector = i;
}
LOG_DEBUG("first_sector: %i, last_sector: %i", first_sector, last_sector);
/* check if exception vectors should be flashed */
if ((offset == 0) && (count >= 0x20) && lpc2000_info->calc_checksum)
{
u32 checksum = 0;
int i = 0;
uint32_t checksum = 0;
int i;
for (i = 0; i < 8; i++)
{
LOG_DEBUG("0x%2.2x: 0x%8.8x", i * 4, buf_get_u32(buffer + (i * 4), 0, 32));
if (i != 5)
LOG_DEBUG("Vector 0x%2.2x: 0x%8.8" PRIx32, i * 4, buf_get_u32(buffer + (i * 4), 0, 32));
if (i != lpc2000_info->checksum_vector)
checksum += buf_get_u32(buffer + (i * 4), 0, 32);
}
checksum = 0 - checksum;
LOG_DEBUG("checksum: 0x%8.8x", checksum);
buf_set_u32(buffer + 0x14, 0, 32, checksum);
LOG_DEBUG("checksum: 0x%8.8" PRIx32, checksum);
uint32_t original_value = buf_get_u32(buffer + (lpc2000_info->checksum_vector * 4), 0, 32);
if (original_value != checksum)
{
LOG_WARNING("Verification will fail since checksum in image (0x%8.8" PRIx32 ") to be written to flash is different from calculated vector checksum (0x%8.8" PRIx32 ").",
original_value, checksum);
LOG_WARNING("To remove this warning modify build tools on developer PC to inject correct LPC vector checksum.");
}
buf_set_u32(buffer + (lpc2000_info->checksum_vector * 4), 0, 32, checksum);
}
/* allocate a working area */
if (target_alloc_working_area(target, lpc2000_info->cmd51_max_buffer, &download_area) != ERROR_OK)
{
LOG_ERROR("no working area specified, can't write LPC2000 internal flash");
return ERROR_FLASH_OPERATION_FAILED;
}
while (bytes_remaining > 0)
{
u32 thisrun_bytes;
uint32_t thisrun_bytes;
if (bytes_remaining >= lpc2000_info->cmd51_max_buffer)
thisrun_bytes = lpc2000_info->cmd51_max_buffer;
else if (bytes_remaining >= 1024)
@@ -551,7 +658,7 @@ int lpc2000_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count)
thisrun_bytes = 512;
else
thisrun_bytes = 256;
/* Prepare sectors */
param_table[0] = first_sector;
param_table[1] = last_sector;
@@ -575,7 +682,7 @@ int lpc2000_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count)
/* Exit if error occured */
if (retval != ERROR_OK)
break;
if (bytes_remaining >= thisrun_bytes)
{
if ((retval = target_write_buffer(bank->target, download_area->address, thisrun_bytes, buffer + bytes_written)) != ERROR_OK)
@@ -586,17 +693,15 @@ int lpc2000_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count)
}
else
{
u8 *last_buffer = malloc(thisrun_bytes);
int i;
uint8_t *last_buffer = malloc(thisrun_bytes);
memcpy(last_buffer, buffer + bytes_written, bytes_remaining);
for (i = bytes_remaining; i < thisrun_bytes; i++)
last_buffer[i] = 0xff;
memset(last_buffer + bytes_remaining, 0xff, thisrun_bytes - bytes_remaining);
target_write_buffer(bank->target, download_area->address, thisrun_bytes, last_buffer);
free(last_buffer);
}
LOG_DEBUG("writing 0x%x bytes to address 0x%x", thisrun_bytes, bank->base + offset + bytes_written);
LOG_DEBUG("writing 0x%" PRIx32 " bytes to address 0x%" PRIx32 , thisrun_bytes, bank->base + offset + bytes_written);
/* Write data */
param_table[0] = bank->base + offset + bytes_written;
param_table[1] = download_area->address;
@@ -618,69 +723,69 @@ int lpc2000_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count)
retval = ERROR_FLASH_OPERATION_FAILED;
break;
}
/* Exit if error occured */
if (retval != ERROR_OK)
break;
if (bytes_remaining > thisrun_bytes)
bytes_remaining -= thisrun_bytes;
else
bytes_remaining = 0;
bytes_written += thisrun_bytes;
}
target_free_working_area(target, download_area);
return retval;
}
int lpc2000_probe(struct flash_bank_s *bank)
static int lpc2000_probe(struct flash_bank_s *bank)
{
/* we can't probe on an lpc2000
/* we can't probe on an lpc2000
* if this is an lpc2xxx, it has the configured flash
*/
return ERROR_OK;
}
int lpc2000_erase_check(struct flash_bank_s *bank)
static int lpc2000_erase_check(struct flash_bank_s *bank)
{
if (bank->target->state != TARGET_HALTED)
{
LOG_ERROR("Target not halted");
return ERROR_TARGET_NOT_HALTED;
}
return lpc2000_iap_blank_check(bank, 0, bank->num_sectors - 1);
}
int lpc2000_protect_check(struct flash_bank_s *bank)
static int lpc2000_protect_check(struct flash_bank_s *bank)
{
/* sectors are always protected */
return ERROR_OK;
}
int lpc2000_info(struct flash_bank_s *bank, char *buf, int buf_size)
static int lpc2000_info(struct flash_bank_s *bank, char *buf, int buf_size)
{
lpc2000_flash_bank_t *lpc2000_info = bank->driver_priv;
snprintf(buf, buf_size, "lpc2000 flash driver variant: %i, clk: %i", lpc2000_info->variant, lpc2000_info->cclk);
snprintf(buf, buf_size, "lpc2000 flash driver variant: %i, clk: %" PRIi32 "kHz" , lpc2000_info->variant, lpc2000_info->cclk);
return ERROR_OK;
}
int lpc2000_handle_part_id_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
static int lpc2000_handle_part_id_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
flash_bank_t *bank;
u32 param_table[5];
u32 result_table[2];
uint32_t param_table[5];
uint32_t result_table[4];
int status_code;
if (argc < 1)
{
return ERROR_COMMAND_SYNTAX_ERROR;
}
bank = get_flash_bank_by_num(strtoul(args[0], NULL, 0));
if (!bank)
{
@@ -693,7 +798,7 @@ int lpc2000_handle_part_id_command(struct command_context_s *cmd_ctx, char *cmd,
LOG_ERROR("Target not halted");
return ERROR_TARGET_NOT_HALTED;
}
if ((status_code = lpc2000_iap_call(bank, 54, param_table, result_table)) != 0x0)
{
if (status_code == ERROR_FLASH_OPERATION_FAILED)
@@ -705,8 +810,8 @@ int lpc2000_handle_part_id_command(struct command_context_s *cmd_ctx, char *cmd,
}
else
{
command_print(cmd_ctx, "lpc2000 part id: 0x%8.8x", result_table[0]);
command_print(cmd_ctx, "lpc2000 part id: 0x%8.8" PRIx32 , result_table[0]);
}
return ERROR_OK;
}

View File

@@ -2,6 +2,9 @@
* Copyright (C) 2005 by Dominic Rath *
* Dominic.Rath@gmx.de *
* *
* LPC1700 support Copyright (C) 2009 by Audrius Urmanavicius *
* didele.deze@gmail.com *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
@@ -21,18 +24,25 @@
#define LPC2000_H
#include "flash.h"
#include "target.h"
typedef enum
{
lpc2000_v1,
lpc2000_v2,
lpc1700
} lpc2000_variant;
typedef struct lpc2000_flash_bank_s
{
int variant;
lpc2000_variant variant;
struct working_area_s *iap_working_area;
u32 cclk;
uint32_t cclk;
int cmd51_dst_boundary;
int cmd51_can_256b;
int cmd51_can_8192b;
int calc_checksum;
int cmd51_max_buffer;
uint32_t cmd51_max_buffer;
int checksum_vector;
} lpc2000_flash_bank_t;
enum lpc2000_status_codes
@@ -48,7 +58,16 @@ enum lpc2000_status_codes
LPC2000_SECTOR_NOT_BLANK = 8,
LPC2000_SECTOR_NOT_PREPARED = 9,
LPC2000_COMPARE_ERROR = 10,
LPC2000_BUSY = 11
LPC2000_BUSY = 11,
LPC2000_PARAM_ERROR = 12,
LPC2000_ADDR_ERROR = 13,
LPC2000_ADDR_NOT_MAPPED = 14,
LPC2000_CMD_NOT_LOCKED = 15,
LPC2000_INVALID_CODE = 16,
LPC2000_INVALID_BAUD_RATE = 17,
LPC2000_INVALID_STOP_BIT = 18,
LPC2000_CRP_ENABLED = 19
};
#endif /* LPC2000_H */

View File

@@ -31,19 +31,9 @@
#include "config.h"
#endif
#include "replacements.h"
#include "lpc288x.h"
#include "flash.h"
#include "target.h"
#include "log.h"
#include "binarybuffer.h"
#include "types.h"
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#define LOAD_TIMER_ERASE 0
#define LOAD_TIMER_WRITE 1
@@ -94,22 +84,19 @@
/* F_CLK_TIME */
#define FCT_CLK_DIV_MASK 0x0FFF
int lpc288x_register_commands(struct command_context_s *cmd_ctx);
int lpc288x_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank);
int lpc288x_erase(struct flash_bank_s *bank, int first, int last);
int lpc288x_protect(struct flash_bank_s *bank, int set, int first, int last);
int lpc288x_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count);
int lpc288x_probe(struct flash_bank_s *bank);
int lpc288x_auto_probe(struct flash_bank_s *bank);
int lpc288x_erase_check(struct flash_bank_s *bank);
int lpc288x_protect_check(struct flash_bank_s *bank);
int lpc288x_info(struct flash_bank_s *bank, char *buf, int buf_size);
void lpc288x_set_flash_mode(flash_bank_t *bank, u8 flashplane, int mode);
u32 lpc288x_wait_status_busy(flash_bank_t *bank, int timeout);
void lpc288x_load_timer(int erase, struct target_s *target);
void lpc288x_set_flash_clk(struct flash_bank_s *bank);
u32 lpc288x_system_ready(struct flash_bank_s *bank);
int lpc288x_handle_part_id_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
static int lpc288x_register_commands(struct command_context_s *cmd_ctx);
static int lpc288x_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank);
static int lpc288x_erase(struct flash_bank_s *bank, int first, int last);
static int lpc288x_protect(struct flash_bank_s *bank, int set, int first, int last);
static int lpc288x_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count);
static int lpc288x_probe(struct flash_bank_s *bank);
static int lpc288x_erase_check(struct flash_bank_s *bank);
static int lpc288x_protect_check(struct flash_bank_s *bank);
static int lpc288x_info(struct flash_bank_s *bank, char *buf, int buf_size);
static uint32_t lpc288x_wait_status_busy(flash_bank_t *bank, int timeout);
static void lpc288x_load_timer(int erase, struct target_s *target);
static void lpc288x_set_flash_clk(struct flash_bank_s *bank);
static uint32_t lpc288x_system_ready(struct flash_bank_s *bank);
flash_driver_t lpc288x_flash =
{
@@ -126,23 +113,23 @@ flash_driver_t lpc288x_flash =
.info = lpc288x_info
};
int lpc288x_register_commands(struct command_context_s *cmd_ctx)
static int lpc288x_register_commands(struct command_context_s *cmd_ctx)
{
return ERROR_OK;
}
u32 lpc288x_wait_status_busy(flash_bank_t *bank, int timeout)
static uint32_t lpc288x_wait_status_busy(flash_bank_t *bank, int timeout)
{
u32 status;
uint32_t status;
target_t *target = bank->target;
do
{
alive_sleep(1);
timeout--;
target_read_u32(target, F_STAT, &status);
}while (((status & FS_DONE) == 0) && timeout);
if(timeout == 0)
} while (((status & FS_DONE) == 0) && timeout);
if (timeout == 0)
{
LOG_DEBUG("Timedout!");
return ERROR_FLASH_OPERATION_FAILED;
@@ -151,36 +138,36 @@ u32 lpc288x_wait_status_busy(flash_bank_t *bank, int timeout)
}
/* Read device id register and fill in driver info structure */
int lpc288x_read_part_info(struct flash_bank_s *bank)
static int lpc288x_read_part_info(struct flash_bank_s *bank)
{
lpc288x_flash_bank_t *lpc288x_info = bank->driver_priv;
target_t *target = bank->target;
u32 cidr;
uint32_t cidr;
int i = 0;
u32 offset;
uint32_t offset;
if (lpc288x_info->cidr == 0x0102100A)
return ERROR_OK; /* already probed, multiple probes may cause memory leak, not allowed */
/* Read and parse chip identification register */
target_read_u32(target, DBGU_CIDR, &cidr);
if (cidr != 0x0102100A)
{
LOG_WARNING("Cannot identify target as an LPC288X (%08X)",cidr);
LOG_WARNING("Cannot identify target as an LPC288X (%08" PRIx32 ")",cidr);
return ERROR_FLASH_OPERATION_FAILED;
}
lpc288x_info->cidr = cidr;
lpc288x_info->sector_size_break = 0x000F0000;
lpc288x_info->target_name = "LPC288x";
/* setup the sector info... */
offset = bank->base;
bank->num_sectors = 23;
bank->sectors = malloc(sizeof(flash_sector_t) * 23);
for (i = 0; i < 15; i++)
{
bank->sectors[i].offset = offset;
@@ -197,44 +184,44 @@ int lpc288x_read_part_info(struct flash_bank_s *bank)
bank->sectors[i].is_erased = -1;
bank->sectors[i].is_protected = 1;
}
return ERROR_OK;
}
int lpc288x_protect_check(struct flash_bank_s *bank)
static int lpc288x_protect_check(struct flash_bank_s *bank)
{
return ERROR_OK;
}
/* flash_bank LPC288x 0 0 0 0 <target#> <cclk> */
int lpc288x_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank)
static int lpc288x_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank)
{
lpc288x_flash_bank_t *lpc288x_info;
if (argc < 6)
{
LOG_WARNING("incomplete flash_bank LPC288x configuration");
return ERROR_FLASH_BANK_INVALID;
}
lpc288x_info = malloc(sizeof(lpc288x_flash_bank_t));
bank->driver_priv = lpc288x_info;
/* part wasn't probed for info yet */
lpc288x_info->cidr = 0;
lpc288x_info->cclk = strtoul(args[6], NULL, 0);
return ERROR_OK;
}
/* The frequency is the AHB clock frequency divided by (CLK_DIV ×3) + 1.
* This must be programmed such that the Flash Programming clock frequency is 66 kHz ± 20%.
/* The frequency is the AHB clock frequency divided by (CLK_DIV ×3) + 1.
* This must be programmed such that the Flash Programming clock frequency is 66 kHz ± 20%.
* AHB = 12 MHz ?
* 12000000/66000 = 182
* CLK_DIV = 60 ? */
void lpc288x_set_flash_clk(struct flash_bank_s *bank)
static void lpc288x_set_flash_clk(struct flash_bank_s *bank)
{
u32 clk_time;
uint32_t clk_time;
lpc288x_flash_bank_t *lpc288x_info = bank->driver_priv;
clk_time = (lpc288x_info->cclk / 66000) / 3;
target_write_u32(bank->target, F_CTRL, FC_CS | FC_WEN);
@@ -243,11 +230,11 @@ void lpc288x_set_flash_clk(struct flash_bank_s *bank)
/* AHB tcyc (in ns) 83 ns
* LOAD_TIMER_ERASE FPT_TIME = ((400,000,000 / AHB tcyc (in ns)) - 2) / 512
* = 9412 (9500) (AN10548 9375)
* = 9412 (9500) (AN10548 9375)
* LOAD_TIMER_WRITE FPT_TIME = ((1,000,000 / AHB tcyc (in ns)) - 2) / 512
* = 23 (75) (AN10548 72 - is this wrong?)
* = 23 (75) (AN10548 72 - is this wrong?)
* TODO: Sort out timing calcs ;) */
void lpc288x_load_timer(int erase, struct target_s *target)
static void lpc288x_load_timer(int erase, struct target_s *target)
{
if (erase == LOAD_TIMER_ERASE)
{
@@ -259,14 +246,14 @@ void lpc288x_load_timer(int erase, struct target_s *target)
}
}
u32 lpc288x_system_ready(struct flash_bank_s *bank)
static uint32_t lpc288x_system_ready(struct flash_bank_s *bank)
{
lpc288x_flash_bank_t *lpc288x_info = bank->driver_priv;
if (lpc288x_info->cidr == 0)
{
return ERROR_FLASH_BANK_NOT_PROBED;
}
if (bank->target->state != TARGET_HALTED)
{
LOG_ERROR("Target not halted");
@@ -275,50 +262,50 @@ u32 lpc288x_system_ready(struct flash_bank_s *bank)
return ERROR_OK;
}
int lpc288x_erase_check(struct flash_bank_s *bank)
static int lpc288x_erase_check(struct flash_bank_s *bank)
{
u32 status = lpc288x_system_ready(bank); /* probed? halted? */
uint32_t status = lpc288x_system_ready(bank); /* probed? halted? */
if (status != ERROR_OK)
{
LOG_INFO("Processor not halted/not probed");
return status;
}
return ERROR_OK;
}
int lpc288x_erase(struct flash_bank_s *bank, int first, int last)
static int lpc288x_erase(struct flash_bank_s *bank, int first, int last)
{
u32 status;
uint32_t status;
int sector;
target_t *target = bank->target;
status = lpc288x_system_ready(bank); /* probed? halted? */
if (status != ERROR_OK)
{
return status;
}
if ((first < 0) || (last < first) || (last >= bank->num_sectors))
{
LOG_INFO("Bad sector range");
return ERROR_FLASH_SECTOR_INVALID;
}
/* Configure the flash controller timing */
lpc288x_set_flash_clk(bank);
for (sector = first; sector <= last; sector++)
{
if (lpc288x_wait_status_busy(bank, 1000) != ERROR_OK)
{
return ERROR_FLASH_OPERATION_FAILED;
}
lpc288x_load_timer(LOAD_TIMER_ERASE,target);
target_write_u32(target, bank->sectors[sector].offset, 0x00);
target_write_u32(target, F_CTRL, FC_PROG_REQ | FC_PROTECT | FC_CS);
}
if (lpc288x_wait_status_busy(bank, 1000) != ERROR_OK)
@@ -328,24 +315,25 @@ int lpc288x_erase(struct flash_bank_s *bank, int first, int last)
return ERROR_OK;
}
int lpc288x_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count)
static int lpc288x_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count)
{
u8 page_buffer[FLASH_PAGE_SIZE];
u32 i, status, source_offset,dest_offset;
uint8_t page_buffer[FLASH_PAGE_SIZE];
uint32_t status, source_offset,dest_offset;
target_t *target = bank->target;
u32 bytes_remaining = count;
u32 first_sector, last_sector, sector, page;
uint32_t bytes_remaining = count;
uint32_t first_sector, last_sector, sector, page;
int i;
/* probed? halted? */
status = lpc288x_system_ready(bank);
if (status != ERROR_OK)
{
return status;
}
/* Initialise search indices */
first_sector = last_sector = 0xffffffff;
/* validate the write range... */
for (i = 0; i < bank->num_sectors; i++)
{
@@ -357,7 +345,7 @@ int lpc288x_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count)
/* all writes must start on a sector boundary... */
if (offset % bank->sectors[i].size)
{
LOG_INFO("offset 0x%x breaks required alignment 0x%x", offset, bank->sectors[i].size);
LOG_INFO("offset 0x%" PRIx32 " breaks required alignment 0x%" PRIx32 "", offset, bank->sectors[i].size);
return ERROR_FLASH_DST_BREAKS_ALIGNMENT;
}
}
@@ -368,21 +356,21 @@ int lpc288x_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count)
last_sector = i;
}
}
/* Range check... */
if (first_sector == 0xffffffff || last_sector == 0xffffffff)
{
LOG_INFO("Range check failed %x %x", offset, count);
LOG_INFO("Range check failed %" PRIx32 " %" PRIx32 "", offset, count);
return ERROR_FLASH_DST_OUT_OF_BANK;
}
/* Configure the flash controller timing */
lpc288x_set_flash_clk(bank);
/* initialise the offsets */
source_offset = 0;
dest_offset = 0;
for (sector = first_sector; sector <= last_sector; sector++)
{
for (page = 0; page < bank->sectors[sector].size / FLASH_PAGE_SIZE; page++)
@@ -403,24 +391,24 @@ int lpc288x_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count)
count = FLASH_PAGE_SIZE;
memcpy(page_buffer, &buffer[source_offset], count);
}
/* Wait for flash to become ready */
if (lpc288x_wait_status_busy(bank, 1000) != ERROR_OK)
{
return ERROR_FLASH_OPERATION_FAILED;
}
/* fill flash data latches with 1's */
target_write_u32(target, F_CTRL, FC_CS | FC_SET_DATA | FC_WEN | FC_FUNC);
target_write_u32(target, F_CTRL, FC_CS | FC_WEN | FC_FUNC);
/*would be better to use the clean target_write_buffer() interface but
* it seems not to be a LOT slower....
* bulk_write_memory() is no quicker :(*/
#if 1
if (target->type->write_memory(target, offset + dest_offset, 4, 128, page_buffer) != ERROR_OK)
if (target_write_memory(target, offset + dest_offset, 4, 128, page_buffer) != ERROR_OK)
{
LOG_ERROR("Write failed s %x p %x", sector, page);
LOG_ERROR("Write failed s %" PRIx32 " p %" PRIx32 "", sector, page);
return ERROR_FLASH_OPERATION_FAILED;
}
#else
@@ -433,66 +421,66 @@ int lpc288x_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count)
dest_offset += FLASH_PAGE_SIZE;
source_offset += count;
bytes_remaining -= count;
lpc288x_load_timer(LOAD_TIMER_WRITE, target);
target_write_u32(target, F_CTRL, FC_PROG_REQ | FC_PROTECT | FC_FUNC | FC_CS);
}
}
return ERROR_OK;
}
int lpc288x_probe(struct flash_bank_s *bank)
static int lpc288x_probe(struct flash_bank_s *bank)
{
/* we only deal with LPC2888 so flash config is fixed */
lpc288x_flash_bank_t *lpc288x_info = bank->driver_priv;
int retval;
if (lpc288x_info->cidr != 0)
{
return ERROR_OK; /* already probed */
}
if (bank->target->state != TARGET_HALTED)
{
LOG_ERROR("Target not halted");
return ERROR_TARGET_NOT_HALTED;
}
retval = lpc288x_read_part_info(bank);
if (retval != ERROR_OK)
return retval;
return ERROR_OK;
}
int lpc288x_info(struct flash_bank_s *bank, char *buf, int buf_size)
static int lpc288x_info(struct flash_bank_s *bank, char *buf, int buf_size)
{
snprintf(buf, buf_size, "lpc288x flash driver");
return ERROR_OK;
}
int lpc288x_protect(struct flash_bank_s *bank, int set, int first, int last)
static int lpc288x_protect(struct flash_bank_s *bank, int set, int first, int last)
{
int lockregion, status;
u32 value;
uint32_t value;
target_t *target = bank->target;
/* probed? halted? */
status = lpc288x_system_ready(bank);
status = lpc288x_system_ready(bank);
if (status != ERROR_OK)
{
return status;
}
if ((first < 0) || (last < first) || (last >= bank->num_sectors))
{
return ERROR_FLASH_SECTOR_INVALID;
}
/* Configure the flash controller timing */
lpc288x_set_flash_clk(bank);
lpc288x_set_flash_clk(bank);
for (lockregion = first; lockregion <= last; lockregion++)
{
if (set)
@@ -508,6 +496,6 @@ int lpc288x_protect(struct flash_bank_s *bank, int set, int first, int last)
target_write_u32(target, bank->sectors[lockregion].offset, value);
target_write_u32(target, F_CTRL, FC_LOAD_REQ | FC_PROTECT | FC_WEN | FC_FUNC | FC_CS);
}
return ERROR_OK;
}

View File

@@ -22,19 +22,18 @@
#define lpc288x_H
#include "flash.h"
#include "target.h"
typedef struct lpc288x_flash_bank_s
{
u32 working_area;
u32 working_area_size;
uint32_t working_area;
uint32_t working_area_size;
/* chip id register */
u32 cidr;
uint32_t cidr;
char * target_name;
u32 cclk;
uint32_t cclk;
u32 sector_size_break;
uint32_t sector_size_break;
} lpc288x_flash_bank_t;
#endif /* lpc288x_H */

1928
src/flash/lpc2900.c Normal file

File diff suppressed because it is too large Load Diff

27
src/flash/lpc2900.h Normal file
View File

@@ -0,0 +1,27 @@
/***************************************************************************
* Copyright (C) 2009 by *
* Rolf Meeser <rolfm_9dq@yahoo.de> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef lpc2900_H
#define lpc2900_H
#include "flash.h"
#endif /* lpc2900_H */

View File

@@ -22,30 +22,22 @@
#endif
#include "lpc3180_nand_controller.h"
#include "replacements.h"
#include "log.h"
#include <stdlib.h>
#include <string.h>
#include "nand.h"
#include "target.h"
int lpc3180_nand_device_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct nand_device_s *device);
int lpc3180_register_commands(struct command_context_s *cmd_ctx);
int lpc3180_init(struct nand_device_s *device);
int lpc3180_reset(struct nand_device_s *device);
int lpc3180_command(struct nand_device_s *device, u8 command);
int lpc3180_address(struct nand_device_s *device, u8 address);
int lpc3180_write_data(struct nand_device_s *device, u16 data);
int lpc3180_read_data(struct nand_device_s *device, void *data);
int lpc3180_write_page(struct nand_device_s *device, u32 page, u8 *data, u32 data_size, u8 *oob, u32 oob_size);
int lpc3180_read_page(struct nand_device_s *device, u32 page, u8 *data, u32 data_size, u8 *oob, u32 oob_size);
int lpc3180_controller_ready(struct nand_device_s *device, int timeout);
int lpc3180_nand_ready(struct nand_device_s *device, int timeout);
static int lpc3180_nand_device_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct nand_device_s *device);
static int lpc3180_register_commands(struct command_context_s *cmd_ctx);
static int lpc3180_init(struct nand_device_s *device);
static int lpc3180_reset(struct nand_device_s *device);
static int lpc3180_command(struct nand_device_s *device, uint8_t command);
static int lpc3180_address(struct nand_device_s *device, uint8_t address);
static int lpc3180_write_data(struct nand_device_s *device, uint16_t data);
static int lpc3180_read_data(struct nand_device_s *device, void *data);
static int lpc3180_write_page(struct nand_device_s *device, uint32_t page, uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size);
static int lpc3180_read_page(struct nand_device_s *device, uint32_t page, uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size);
static int lpc3180_controller_ready(struct nand_device_s *device, int timeout);
static int lpc3180_nand_ready(struct nand_device_s *device, int timeout);
int handle_lpc3180_select_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
static int handle_lpc3180_select_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
nand_flash_controller_t lpc3180_nand_controller =
{
@@ -66,49 +58,49 @@ nand_flash_controller_t lpc3180_nand_controller =
/* nand device lpc3180 <target#> <oscillator_frequency>
*/
int lpc3180_nand_device_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct nand_device_s *device)
static int lpc3180_nand_device_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct nand_device_s *device)
{
lpc3180_nand_controller_t *lpc3180_info;
if (argc < 3)
{
LOG_WARNING("incomplete 'lpc3180' nand flash configuration");
return ERROR_FLASH_BANK_INVALID;
}
lpc3180_info = malloc(sizeof(lpc3180_nand_controller_t));
device->controller_priv = lpc3180_info;
lpc3180_info->target = get_target_by_num(strtoul(args[1], NULL, 0));
lpc3180_info->target = get_target(args[1]);
if (!lpc3180_info->target)
{
LOG_ERROR("no target '%s' configured", args[1]);
LOG_ERROR("target '%s' not defined", args[1]);
return ERROR_NAND_DEVICE_INVALID;
}
lpc3180_info->osc_freq = strtoul(args[2], NULL, 0);
if ((lpc3180_info->osc_freq < 1000) || (lpc3180_info->osc_freq > 20000))
{
LOG_WARNING("LPC3180 oscillator frequency should be between 1000 and 20000 kHz, was %i", lpc3180_info->osc_freq);
LOG_WARNING("LPC3180 oscillator frequency should be between 1000 and 20000 kHz, was %i", lpc3180_info->osc_freq);
}
lpc3180_info->selected_controller = LPC3180_NO_CONTROLLER;
lpc3180_info->sw_write_protection = 0;
lpc3180_info->sw_wp_lower_bound = 0x0;
lpc3180_info->sw_wp_upper_bound = 0x0;
return ERROR_OK;
}
int lpc3180_register_commands(struct command_context_s *cmd_ctx)
static int lpc3180_register_commands(struct command_context_s *cmd_ctx)
{
command_t *lpc3180_cmd = register_command(cmd_ctx, NULL, "lpc3180", NULL, COMMAND_ANY, "commands specific to the LPC3180 NAND flash controllers");
register_command(cmd_ctx, lpc3180_cmd, "select", handle_lpc3180_select_command, COMMAND_EXEC, "select <'mlc'|'slc'> controller (default is mlc)");
return ERROR_OK;
}
int lpc3180_pll(int fclkin, u32 pll_ctrl)
static int lpc3180_pll(int fclkin, uint32_t pll_ctrl)
{
int bypass = (pll_ctrl & 0x8000) >> 15;
int direct = (pll_ctrl & 0x4000) >> 14;
@@ -120,44 +112,44 @@ int lpc3180_pll(int fclkin, u32 pll_ctrl)
if (!lock)
LOG_WARNING("PLL is not locked");
if (!bypass && direct) /* direct mode */
return (m * fclkin) / n;
if (bypass && !direct) /* bypass mode */
return fclkin / (2 * p);
if (bypass & direct) /* direct bypass mode */
return fclkin;
if (feedback) /* integer mode */
return m * (fclkin / n);
else /* non-integer mode */
return (m / (2 * p)) * (fclkin / n);
return (m / (2 * p)) * (fclkin / n);
}
float lpc3180_cycle_time(lpc3180_nand_controller_t *lpc3180_info)
static float lpc3180_cycle_time(lpc3180_nand_controller_t *lpc3180_info)
{
target_t *target = lpc3180_info->target;
u32 sysclk_ctrl, pwr_ctrl, hclkdiv_ctrl, hclkpll_ctrl;
uint32_t sysclk_ctrl, pwr_ctrl, hclkdiv_ctrl, hclkpll_ctrl;
int sysclk;
int hclk;
int hclk_pll;
float cycle;
/* calculate timings */
/* determine current SYSCLK (13'MHz or main oscillator) */
/* determine current SYSCLK (13'MHz or main oscillator) */
target_read_u32(target, 0x40004050, &sysclk_ctrl);
if ((sysclk_ctrl & 1) == 0)
sysclk = lpc3180_info->osc_freq;
else
sysclk = 13000;
/* determine selected HCLK source */
target_read_u32(target, 0x40004044, &pwr_ctrl);
if ((pwr_ctrl & (1 << 2)) == 0) /* DIRECT RUN mode */
{
hclk = sysclk;
@@ -168,45 +160,45 @@ float lpc3180_cycle_time(lpc3180_nand_controller_t *lpc3180_info)
hclk_pll = lpc3180_pll(sysclk, hclkpll_ctrl);
target_read_u32(target, 0x40004040, &hclkdiv_ctrl);
if (pwr_ctrl & (1 << 10)) /* ARM_CLK and HCLK use PERIPH_CLK */
{
hclk = hclk_pll / (((hclkdiv_ctrl & 0x7c) >> 2) + 1);
}
else /* HCLK uses HCLK_PLL */
{
hclk = hclk_pll / (1 << (hclkdiv_ctrl & 0x3));
hclk = hclk_pll / (1 << (hclkdiv_ctrl & 0x3));
}
}
LOG_DEBUG("LPC3180 HCLK currently clocked at %i kHz", hclk);
cycle = (1.0 / hclk) * 1000000.0;
return cycle;
}
int lpc3180_init(struct nand_device_s *device)
static int lpc3180_init(struct nand_device_s *device)
{
lpc3180_nand_controller_t *lpc3180_info = device->controller_priv;
target_t *target = lpc3180_info->target;
int bus_width = (device->bus_width) ? (device->bus_width) : 8;
int address_cycles = (device->address_cycles) ? (device->address_cycles) : 3;
int page_size = (device->page_size) ? (device->page_size) : 512;
if (target->state != TARGET_HALTED)
{
LOG_ERROR("target must be halted to use LPC3180 NAND flash controller");
return ERROR_NAND_OPERATION_FAILED;
}
/* sanitize arguments */
if ((bus_width != 8) && (bus_width != 16))
{
LOG_ERROR("LPC3180 only supports 8 or 16 bit bus width, not %i", bus_width);
return ERROR_NAND_OPERATION_NOT_SUPPORTED;
}
/* The LPC3180 only brings out 8 bit NAND data bus, but the controller
* would support 16 bit, too, so we just warn about this for now
*/
@@ -214,44 +206,44 @@ int lpc3180_init(struct nand_device_s *device)
{
LOG_WARNING("LPC3180 only supports 8 bit bus width");
}
/* inform calling code about selected bus width */
device->bus_width = bus_width;
if ((address_cycles != 3) && (address_cycles != 4))
{
LOG_ERROR("LPC3180 only supports 3 or 4 address cycles, not %i", address_cycles);
return ERROR_NAND_OPERATION_NOT_SUPPORTED;
}
if ((page_size != 512) && (page_size != 2048))
{
LOG_ERROR("LPC3180 only supports 512 or 2048 byte pages, not %i", page_size);
return ERROR_NAND_OPERATION_NOT_SUPPORTED;
}
/* select MLC controller if none is currently selected */
if (lpc3180_info->selected_controller == LPC3180_NO_CONTROLLER)
{
LOG_DEBUG("no LPC3180 NAND flash controller selected, using default 'mlc'");
lpc3180_info->selected_controller = LPC3180_MLC_CONTROLLER;
}
if (lpc3180_info->selected_controller == LPC3180_MLC_CONTROLLER)
{
u32 mlc_icr_value = 0x0;
uint32_t mlc_icr_value = 0x0;
float cycle;
int twp, twh, trp, treh, trhz, trbwb, tcea;
/* FLASHCLK_CTRL = 0x22 (enable clock for MLC flash controller) */
target_write_u32(target, 0x400040c8, 0x22);
/* MLC_CEH = 0x0 (Force nCE assert) */
target_write_u32(target, 0x200b804c, 0x0);
/* MLC_LOCK = 0xa25e (unlock protected registers) */
target_write_u32(target, 0x200b8044, 0xa25e);
/* MLC_ICR = configuration */
if (lpc3180_info->sw_write_protection)
mlc_icr_value |= 0x8;
@@ -262,10 +254,10 @@ int lpc3180_init(struct nand_device_s *device)
if (bus_width == 16)
mlc_icr_value |= 0x1;
target_write_u32(target, 0x200b8030, mlc_icr_value);
/* calculate NAND controller timings */
cycle = lpc3180_cycle_time(lpc3180_info);
twp = ((40 / cycle) + 1);
twh = ((20 / cycle) + 1);
trp = ((30 / cycle) + 1);
@@ -273,14 +265,14 @@ int lpc3180_init(struct nand_device_s *device)
trhz = ((30 / cycle) + 1);
trbwb = ((100 / cycle) + 1);
tcea = ((45 / cycle) + 1);
/* MLC_LOCK = 0xa25e (unlock protected registers) */
target_write_u32(target, 0x200b8044, 0xa25e);
/* MLC_TIME_REG */
target_write_u32(target, 0x200b8034, (twp & 0xf) | ((twh & 0xf) << 4) |
((trp & 0xf) << 8) | ((treh & 0xf) << 12) | ((trhz & 0x7) << 16) |
((trbwb & 0x1f) << 19) | ((tcea & 0x3) << 24));
target_write_u32(target, 0x200b8034, (twp & 0xf) | ((twh & 0xf) << 4) |
((trp & 0xf) << 8) | ((treh & 0xf) << 12) | ((trhz & 0x7) << 16) |
((trbwb & 0x1f) << 19) | ((tcea & 0x3) << 24));
lpc3180_reset(device);
}
@@ -289,44 +281,44 @@ int lpc3180_init(struct nand_device_s *device)
float cycle;
int r_setup, r_hold, r_width, r_rdy;
int w_setup, w_hold, w_width, w_rdy;
/* FLASHCLK_CTRL = 0x05 (enable clock for SLC flash controller) */
target_write_u32(target, 0x400040c8, 0x05);
/* SLC_CFG = 0x (Force nCE assert, ECC enabled, WIDTH = bus_width) */
target_write_u32(target, 0x20020014, 0x28 | (bus_width == 16) ? 1 : 0);
/* calculate NAND controller timings */
cycle = lpc3180_cycle_time(lpc3180_info);
r_setup = w_setup = 0;
r_hold = w_hold = 10 / cycle;
r_width = 30 / cycle;
w_width = 40 / cycle;
r_rdy = w_rdy = 100 / cycle;
/* SLC_TAC: SLC timing arcs register */
target_write_u32(target, 0x2002002c, (r_setup & 0xf) | ((r_hold & 0xf) << 4) |
((r_width & 0xf) << 8) | ((r_rdy & 0xf) << 12) | ((w_setup & 0xf) << 16) |
((w_hold & 0xf) << 20) | ((w_width & 0xf) << 24) | ((w_rdy & 0xf) << 28));
((w_hold & 0xf) << 20) | ((w_width & 0xf) << 24) | ((w_rdy & 0xf) << 28));
lpc3180_reset(device);
}
return ERROR_OK;
}
int lpc3180_reset(struct nand_device_s *device)
static int lpc3180_reset(struct nand_device_s *device)
{
lpc3180_nand_controller_t *lpc3180_info = device->controller_priv;
target_t *target = lpc3180_info->target;
if (target->state != TARGET_HALTED)
{
LOG_ERROR("target must be halted to use LPC3180 NAND flash controller");
return ERROR_NAND_OPERATION_FAILED;
}
if (lpc3180_info->selected_controller == LPC3180_NO_CONTROLLER)
{
LOG_ERROR("BUG: no LPC3180 NAND flash controller selected");
@@ -347,28 +339,28 @@ int lpc3180_reset(struct nand_device_s *device)
{
/* SLC_CTRL = 0x6 (ECC_CLEAR, SW_RESET) */
target_write_u32(target, 0x20020010, 0x6);
if (!lpc3180_controller_ready(device, 100))
{
LOG_ERROR("LPC3180 NAND controller timed out after reset");
return ERROR_NAND_OPERATION_TIMEOUT;
}
}
return ERROR_OK;
}
int lpc3180_command(struct nand_device_s *device, u8 command)
static int lpc3180_command(struct nand_device_s *device, uint8_t command)
{
lpc3180_nand_controller_t *lpc3180_info = device->controller_priv;
target_t *target = lpc3180_info->target;
if (target->state != TARGET_HALTED)
{
LOG_ERROR("target must be halted to use LPC3180 NAND flash controller");
return ERROR_NAND_OPERATION_FAILED;
}
if (lpc3180_info->selected_controller == LPC3180_NO_CONTROLLER)
{
LOG_ERROR("BUG: no LPC3180 NAND flash controller selected");
@@ -383,22 +375,22 @@ int lpc3180_command(struct nand_device_s *device, u8 command)
{
/* SLC_CMD = command */
target_write_u32(target, 0x20020008, command);
}
}
return ERROR_OK;
}
int lpc3180_address(struct nand_device_s *device, u8 address)
static int lpc3180_address(struct nand_device_s *device, uint8_t address)
{
lpc3180_nand_controller_t *lpc3180_info = device->controller_priv;
target_t *target = lpc3180_info->target;
if (target->state != TARGET_HALTED)
{
LOG_ERROR("target must be halted to use LPC3180 NAND flash controller");
return ERROR_NAND_OPERATION_FAILED;
}
if (lpc3180_info->selected_controller == LPC3180_NO_CONTROLLER)
{
LOG_ERROR("BUG: no LPC3180 NAND flash controller selected");
@@ -414,21 +406,21 @@ int lpc3180_address(struct nand_device_s *device, u8 address)
/* SLC_ADDR = address */
target_write_u32(target, 0x20020004, address);
}
return ERROR_OK;
}
int lpc3180_write_data(struct nand_device_s *device, u16 data)
static int lpc3180_write_data(struct nand_device_s *device, uint16_t data)
{
lpc3180_nand_controller_t *lpc3180_info = device->controller_priv;
target_t *target = lpc3180_info->target;
if (target->state != TARGET_HALTED)
{
LOG_ERROR("target must be halted to use LPC3180 NAND flash controller");
return ERROR_NAND_OPERATION_FAILED;
}
if (lpc3180_info->selected_controller == LPC3180_NO_CONTROLLER)
{
LOG_ERROR("BUG: no LPC3180 NAND flash controller selected");
@@ -444,21 +436,21 @@ int lpc3180_write_data(struct nand_device_s *device, u16 data)
/* SLC_DATA = data */
target_write_u32(target, 0x20020000, data);
}
return ERROR_OK;
}
int lpc3180_read_data(struct nand_device_s *device, void *data)
static int lpc3180_read_data(struct nand_device_s *device, void *data)
{
lpc3180_nand_controller_t *lpc3180_info = device->controller_priv;
target_t *target = lpc3180_info->target;
if (target->state != TARGET_HALTED)
{
LOG_ERROR("target must be halted to use LPC3180 NAND flash controller");
return ERROR_NAND_OPERATION_FAILED;
}
if (lpc3180_info->selected_controller == LPC3180_NO_CONTROLLER)
{
LOG_ERROR("BUG: no LPC3180 NAND flash controller selected");
@@ -469,12 +461,12 @@ int lpc3180_read_data(struct nand_device_s *device, void *data)
/* data = MLC_DATA, use sized access */
if (device->bus_width == 8)
{
u8 *data8 = data;
uint8_t *data8 = data;
target_read_u8(target, 0x200b0000, data8);
}
else if (device->bus_width == 16)
{
u16 *data16 = data;
uint16_t *data16 = data;
target_read_u16(target, 0x200b0000, data16);
}
else
@@ -485,19 +477,19 @@ int lpc3180_read_data(struct nand_device_s *device, void *data)
}
else if (lpc3180_info->selected_controller == LPC3180_SLC_CONTROLLER)
{
u32 data32;
uint32_t data32;
/* data = SLC_DATA, must use 32-bit access */
target_read_u32(target, 0x20020000, &data32);
if (device->bus_width == 8)
{
u8 *data8 = data;
uint8_t *data8 = data;
*data8 = data32 & 0xff;
}
else if (device->bus_width == 16)
{
u16 *data16 = data;
uint16_t *data16 = data;
*data16 = data32 & 0xffff;
}
else
@@ -505,24 +497,24 @@ int lpc3180_read_data(struct nand_device_s *device, void *data)
LOG_ERROR("BUG: bus_width neither 8 nor 16 bit");
return ERROR_NAND_OPERATION_FAILED;
}
}
}
return ERROR_OK;
}
int lpc3180_write_page(struct nand_device_s *device, u32 page, u8 *data, u32 data_size, u8 *oob, u32 oob_size)
static int lpc3180_write_page(struct nand_device_s *device, uint32_t page, uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size)
{
lpc3180_nand_controller_t *lpc3180_info = device->controller_priv;
target_t *target = lpc3180_info->target;
int retval;
u8 status;
uint8_t status;
if (target->state != TARGET_HALTED)
{
LOG_ERROR("target must be halted to use LPC3180 NAND flash controller");
return ERROR_NAND_OPERATION_FAILED;
}
if (lpc3180_info->selected_controller == LPC3180_NO_CONTROLLER)
{
LOG_ERROR("BUG: no LPC3180 NAND flash controller selected");
@@ -530,33 +522,33 @@ int lpc3180_write_page(struct nand_device_s *device, u32 page, u8 *data, u32 dat
}
else if (lpc3180_info->selected_controller == LPC3180_MLC_CONTROLLER)
{
u8 *page_buffer;
u8 *oob_buffer;
uint8_t *page_buffer;
uint8_t *oob_buffer;
int quarter, num_quarters;
if (!data && oob)
{
LOG_ERROR("LPC3180 MLC controller can't write OOB data only");
return ERROR_NAND_OPERATION_NOT_SUPPORTED;
}
if (oob && (oob_size > 6))
{
LOG_ERROR("LPC3180 MLC controller can't write more than 6 bytes of OOB data");
return ERROR_NAND_OPERATION_NOT_SUPPORTED;
}
if (data_size > device->page_size)
if (data_size > (uint32_t)device->page_size)
{
LOG_ERROR("data size exceeds page size");
return ERROR_NAND_OPERATION_NOT_SUPPORTED;
}
/* MLC_CMD = sequential input */
target_write_u32(target, 0x200b8000, NAND_CMD_SEQIN);
page_buffer = malloc(512);
oob_buffer = malloc(6);
oob_buffer = malloc(6);
if (device->page_size == 512)
{
@@ -566,7 +558,7 @@ int lpc3180_write_page(struct nand_device_s *device, u32 page, u8 *data, u32 dat
/* MLC_ADDR = row */
target_write_u32(target, 0x200b8004, page & 0xff);
target_write_u32(target, 0x200b8004, (page >> 8) & 0xff);
if (device->address_cycles == 4)
target_write_u32(target, 0x200b8004, (page >> 16) & 0xff);
}
@@ -580,17 +572,17 @@ int lpc3180_write_page(struct nand_device_s *device, u32 page, u8 *data, u32 dat
target_write_u32(target, 0x200b8004, page & 0xff);
target_write_u32(target, 0x200b8004, (page >> 8) & 0xff);
}
/* when using the MLC controller, we have to treat a large page device
* as being made out of four quarters, each the size of a small page device
*/
num_quarters = (device->page_size == 2048) ? 4 : 1;
for (quarter = 0; quarter < num_quarters; quarter++)
{
int thisrun_data_size = (data_size > 512) ? 512 : data_size;
int thisrun_oob_size = (oob_size > 6) ? 6 : oob_size;
memset(page_buffer, 0xff, 512);
if (data)
{
@@ -598,7 +590,7 @@ int lpc3180_write_page(struct nand_device_s *device, u32 page, u8 *data, u32 dat
data_size -= thisrun_data_size;
data += thisrun_data_size;
}
memset(oob_buffer, 0xff, (device->page_size == 512) ? 6 : 24);
if (oob)
{
@@ -606,38 +598,38 @@ int lpc3180_write_page(struct nand_device_s *device, u32 page, u8 *data, u32 dat
oob_size -= thisrun_oob_size;
oob += thisrun_oob_size;
}
/* write MLC_ECC_ENC_REG to start encode cycle */
target_write_u32(target, 0x200b8008, 0x0);
target->type->write_memory(target, 0x200a8000, 4, 128, page_buffer + (quarter * 512));
target->type->write_memory(target, 0x200a8000, 1, 6, oob_buffer + (quarter * 6));
target_write_memory(target, 0x200a8000, 4, 128, page_buffer + (quarter * 512));
target_write_memory(target, 0x200a8000, 1, 6, oob_buffer + (quarter * 6));
/* write MLC_ECC_AUTO_ENC_REG to start auto encode */
target_write_u32(target, 0x200b8010, 0x0);
if (!lpc3180_controller_ready(device, 1000))
{
LOG_ERROR("timeout while waiting for completion of auto encode cycle");
return ERROR_NAND_OPERATION_FAILED;
}
}
/* MLC_CMD = auto program command */
target_write_u32(target, 0x200b8000, NAND_CMD_PAGEPROG);
if ((retval = nand_read_status(device, &status)) != ERROR_OK)
{
LOG_ERROR("couldn't read status");
return ERROR_NAND_OPERATION_FAILED;
}
if (status & NAND_STATUS_FAIL)
{
LOG_ERROR("write operation didn't pass, status: 0x%2.2x", status);
return ERROR_NAND_OPERATION_FAILED;
}
free(page_buffer);
free(oob_buffer);
}
@@ -645,21 +637,21 @@ int lpc3180_write_page(struct nand_device_s *device, u32 page, u8 *data, u32 dat
{
return nand_write_page_raw(device, page, data, data_size, oob, oob_size);
}
return ERROR_OK;
}
int lpc3180_read_page(struct nand_device_s *device, u32 page, u8 *data, u32 data_size, u8 *oob, u32 oob_size)
static int lpc3180_read_page(struct nand_device_s *device, uint32_t page, uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size)
{
lpc3180_nand_controller_t *lpc3180_info = device->controller_priv;
target_t *target = lpc3180_info->target;
if (target->state != TARGET_HALTED)
{
LOG_ERROR("target must be halted to use LPC3180 NAND flash controller");
return ERROR_NAND_OPERATION_FAILED;
}
if (lpc3180_info->selected_controller == LPC3180_NO_CONTROLLER)
{
LOG_ERROR("BUG: no LPC3180 NAND flash controller selected");
@@ -667,11 +659,11 @@ int lpc3180_read_page(struct nand_device_s *device, u32 page, u8 *data, u32 data
}
else if (lpc3180_info->selected_controller == LPC3180_MLC_CONTROLLER)
{
u8 *page_buffer;
u8 *oob_buffer;
u32 page_bytes_done = 0;
u32 oob_bytes_done = 0;
u32 mlc_isr;
uint8_t *page_buffer;
uint8_t *oob_buffer;
uint32_t page_bytes_done = 0;
uint32_t oob_bytes_done = 0;
uint32_t mlc_isr;
#if 0
if (oob && (oob_size > 6))
@@ -680,13 +672,13 @@ int lpc3180_read_page(struct nand_device_s *device, u32 page, u8 *data, u32 data
return ERROR_NAND_OPERATION_NOT_SUPPORTED;
}
#endif
if (data_size > device->page_size)
if (data_size > (uint32_t)device->page_size)
{
LOG_ERROR("data size exceeds page size");
return ERROR_NAND_OPERATION_NOT_SUPPORTED;
}
if (device->page_size == 2048)
{
page_buffer = malloc(2048);
@@ -697,10 +689,10 @@ int lpc3180_read_page(struct nand_device_s *device, u32 page, u8 *data, u32 data
page_buffer = malloc(512);
oob_buffer = malloc(16);
}
if (!data && oob)
{
/* MLC_CMD = Read OOB
/* MLC_CMD = Read OOB
* we can use the READOOB command on both small and large page devices,
* as the controller translates the 0x50 command to a 0x0 with appropriate
* positioning of the serial buffer read pointer
@@ -712,7 +704,7 @@ int lpc3180_read_page(struct nand_device_s *device, u32 page, u8 *data, u32 data
/* MLC_CMD = Read0 */
target_write_u32(target, 0x200b8000, NAND_CMD_READ0);
}
if (device->page_size == 512)
{
/* small page device */
@@ -722,7 +714,7 @@ int lpc3180_read_page(struct nand_device_s *device, u32 page, u8 *data, u32 data
/* MLC_ADDR = row */
target_write_u32(target, 0x200b8004, page & 0xff);
target_write_u32(target, 0x200b8004, (page >> 8) & 0xff);
if (device->address_cycles == 4)
target_write_u32(target, 0x200b8004, (page >> 16) & 0xff);
}
@@ -736,55 +728,55 @@ int lpc3180_read_page(struct nand_device_s *device, u32 page, u8 *data, u32 data
/* MLC_ADDR = row */
target_write_u32(target, 0x200b8004, page & 0xff);
target_write_u32(target, 0x200b8004, (page >> 8) & 0xff);
/* MLC_CMD = Read Start */
target_write_u32(target, 0x200b8000, NAND_CMD_READSTART);
}
while (page_bytes_done < device->page_size)
while (page_bytes_done < (uint32_t)device->page_size)
{
/* MLC_ECC_AUTO_DEC_REG = dummy */
target_write_u32(target, 0x200b8014, 0xaa55aa55);
if (!lpc3180_controller_ready(device, 1000))
{
LOG_ERROR("timeout while waiting for completion of auto decode cycle");
return ERROR_NAND_OPERATION_FAILED;
}
target_read_u32(target, 0x200b8048, &mlc_isr);
if (mlc_isr & 0x8)
{
if (mlc_isr & 0x40)
{
LOG_ERROR("uncorrectable error detected: 0x%2.2x", mlc_isr);
LOG_ERROR("uncorrectable error detected: 0x%2.2x", (unsigned)mlc_isr);
return ERROR_NAND_OPERATION_FAILED;
}
LOG_WARNING("%i symbol error detected and corrected", ((mlc_isr & 0x30) >> 4) + 1);
LOG_WARNING("%i symbol error detected and corrected", ((int)(((mlc_isr & 0x30) >> 4) + 1)));
}
if (data)
{
target->type->read_memory(target, 0x200a8000, 4, 128, page_buffer + page_bytes_done);
target_read_memory(target, 0x200a8000, 4, 128, page_buffer + page_bytes_done);
}
if (oob)
{
target->type->read_memory(target, 0x200a8000, 4, 4, oob_buffer + oob_bytes_done);
target_read_memory(target, 0x200a8000, 4, 4, oob_buffer + oob_bytes_done);
}
page_bytes_done += 512;
oob_bytes_done += 16;
}
if (data)
memcpy(data, page_buffer, data_size);
if (oob)
memcpy(oob, oob_buffer, oob_size);
free(page_buffer);
free(oob_buffer);
}
@@ -792,29 +784,29 @@ int lpc3180_read_page(struct nand_device_s *device, u32 page, u8 *data, u32 data
{
return nand_read_page_raw(device, page, data, data_size, oob, oob_size);
}
return ERROR_OK;
}
int lpc3180_controller_ready(struct nand_device_s *device, int timeout)
static int lpc3180_controller_ready(struct nand_device_s *device, int timeout)
{
lpc3180_nand_controller_t *lpc3180_info = device->controller_priv;
target_t *target = lpc3180_info->target;
u8 status = 0x0;
uint8_t status = 0x0;
if (target->state != TARGET_HALTED)
{
LOG_ERROR("target must be halted to use LPC3180 NAND flash controller");
return ERROR_NAND_OPERATION_FAILED;
}
do
{
if (lpc3180_info->selected_controller == LPC3180_MLC_CONTROLLER)
{
/* Read MLC_ISR, wait for controller to become ready */
target_read_u8(target, 0x200b8048, &status);
if (status & 2)
return 1;
}
@@ -826,73 +818,73 @@ int lpc3180_controller_ready(struct nand_device_s *device, int timeout)
alive_sleep(1);
} while (timeout-- > 0);
return 0;
}
int lpc3180_nand_ready(struct nand_device_s *device, int timeout)
static int lpc3180_nand_ready(struct nand_device_s *device, int timeout)
{
lpc3180_nand_controller_t *lpc3180_info = device->controller_priv;
target_t *target = lpc3180_info->target;
if (target->state != TARGET_HALTED)
{
LOG_ERROR("target must be halted to use LPC3180 NAND flash controller");
return ERROR_NAND_OPERATION_FAILED;
}
do
{
if (lpc3180_info->selected_controller == LPC3180_MLC_CONTROLLER)
{
u8 status = 0x0;
{
uint8_t status = 0x0;
/* Read MLC_ISR, wait for NAND flash device to become ready */
target_read_u8(target, 0x200b8048, &status);
if (status & 1)
return 1;
}
else if (lpc3180_info->selected_controller == LPC3180_SLC_CONTROLLER)
{
u32 status = 0x0;
uint32_t status = 0x0;
/* Read SLC_STAT and check READY bit */
target_read_u32(target, 0x20020018, &status);
if (status & 1)
return 1;
}
alive_sleep(1);
} while (timeout-- > 0);
return 0;
return 0;
}
int handle_lpc3180_select_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
static int handle_lpc3180_select_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
nand_device_t *device = NULL;
lpc3180_nand_controller_t *lpc3180_info = NULL;
char *selected[] =
char *selected[] =
{
"no", "mlc", "slc"
};
if ((argc < 1) || (argc > 2))
{
return ERROR_COMMAND_SYNTAX_ERROR;
}
device = get_nand_device_by_num(strtoul(args[0], NULL, 0));
if (!device)
{
command_print(cmd_ctx, "nand device '#%s' is out of bounds", args[0]);
return ERROR_OK;
}
lpc3180_info = device->controller_priv;
if (argc == 2)
{
if (strcmp(args[1], "mlc") == 0)
@@ -908,8 +900,8 @@ int handle_lpc3180_select_command(struct command_context_s *cmd_ctx, char *cmd,
return ERROR_COMMAND_SYNTAX_ERROR;
}
}
command_print(cmd_ctx, "%s controller selected", selected[lpc3180_info->selected_controller]);
return ERROR_OK;
}

View File

@@ -35,8 +35,8 @@ typedef struct lpc3180_nand_controller_s
int osc_freq;
enum lpc3180_selected_controller selected_controller;
int sw_write_protection;
u32 sw_wp_lower_bound;
u32 sw_wp_upper_bound;
uint32_t sw_wp_lower_bound;
uint32_t sw_wp_upper_bound;
} lpc3180_nand_controller_t;
#endif /*LPC3180_NAND_CONTROLLER_H */

File diff suppressed because it is too large Load Diff

View File

@@ -20,6 +20,8 @@
#ifndef _MFLASH_H
#define _MFLASH_H
#include "target.h"
typedef unsigned long mg_io_uint32;
typedef unsigned short mg_io_uint16;
typedef unsigned char mg_io_uint8;
@@ -34,7 +36,7 @@ typedef struct mflash_gpio_drv_s
{
char *name;
int (*set_gpio_to_output) (mflash_gpio_num_t gpio);
int (*set_gpio_output_val) (mflash_gpio_num_t gpio, u8 val);
int (*set_gpio_output_val) (mflash_gpio_num_t gpio, uint8_t val);
} mflash_gpio_drv_t;
typedef struct _mg_io_type_drv_info {
@@ -46,7 +48,7 @@ typedef struct _mg_io_type_drv_info {
mg_io_uint16 unformatted_bytes_per_track; /* 04 */
mg_io_uint16 unformatted_bytes_per_sector; /* 05 */
mg_io_uint16 sectors_per_track; /* 06 */
mg_io_uint8 vendor_unique1[6]; /* 07/08/09 */
mg_io_uint16 vendor_unique1[3]; /* 07/08/09 */
mg_io_uint8 serial_number[20]; /* 10~19 */
@@ -115,26 +117,28 @@ typedef struct _mg_io_type_drv_info {
} mg_io_type_drv_info;
typedef struct _mg_pll_t
{
unsigned int lock_cyc;
unsigned short feedback_div; /* 9bit divider */
unsigned char input_div; /* 5bit divider */
unsigned char output_div; /* 2bit divider */
} mg_pll_t;
typedef struct mg_drv_info_s {
mg_io_type_drv_info drv_id;
u32 tot_sects;
uint32_t tot_sects;
} mg_drv_info_t;
typedef struct mflash_bank_s
{
u32 base;
u32 chip_width;
u32 bus_width;
uint32_t base;
mflash_gpio_num_t rst_pin;
mflash_gpio_num_t wp_pin;
mflash_gpio_num_t dpd_pin;
mflash_gpio_drv_t *gpio_drv;
target_t *target;
mg_drv_info_t *drv_info;
u8 proved;
} mflash_bank_t;
extern int mflash_register_commands(struct command_context_s *cmd_ctx);
@@ -162,6 +166,25 @@ extern int mflash_init_drivers(struct command_context_s *cmd_ctx);
#define MG_OEM_DISK_WAIT_TIME_NORMAL 3000 /* msec */
#define MG_OEM_DISK_WAIT_TIME_SHORT 1000 /* msec */
#define MG_PLL_CLK_OUT 66000000.0 /* 66Mhz */
#define MG_PLL_MAX_FEEDBACKDIV_VAL 512
#define MG_PLL_MAX_INPUTDIV_VAL 32
#define MG_PLL_MAX_OUTPUTDIV_VAL 4
#define MG_PLL_STD_INPUTCLK 12000000.0 /* 12Mhz */
#define MG_PLL_STD_LOCKCYCLE 10000
#define MG_UNLOCK_OTP_AREA 0xFF
#define MG_FILEIO_CHUNK 1048576
#define ERROR_MG_IO (-1600)
#define ERROR_MG_TIMEOUT (-1601)
#define ERROR_MG_INVALID_PLL (-1603)
#define ERROR_MG_INTERFACE (-1604)
#define ERROR_MG_INVALID_OSC (-1605)
#define ERROR_MG_UNSUPPORTED_SOC (-1606)
typedef enum _mg_io_type_wait{
mg_io_wait_bsy = 1,
@@ -242,4 +265,37 @@ typedef enum _mg_io_type_cmd
} mg_io_type_cmd;
typedef enum _mg_feature_id
{
mg_feature_id_transmode = 0x3
} mg_feature_id;
typedef enum _mg_feature_val
{
mg_feature_val_trans_default = 0x0,
mg_feature_val_trans_vcmd = 0x3,
mg_feature_val_trand_vcmds = 0x2
} mg_feature_val;
typedef enum _mg_vcmd
{
mg_vcmd_update_xipinfo = 0xFA, /* FWPATCH commmand through IOM I/O */
mg_vcmd_verify_fwpatch = 0xFB, /* FWPATCH commmand through IOM I/O */
mg_vcmd_update_stgdrvinfo = 0xFC, /* IOM identificatin info program command */
mg_vcmd_prep_fwpatch = 0xFD, /* FWPATCH commmand through IOM I/O */
mg_vcmd_exe_fwpatch = 0xFE, /* FWPATCH commmand through IOM I/O */
mg_vcmd_wr_pll = 0x8B,
mg_vcmd_purge_nand = 0x8C, /* Only for Seagle */
mg_vcmd_lock_otp = 0x8D,
mg_vcmd_rd_otp = 0x8E,
mg_vcmd_wr_otp = 0x8F
} mg_vcmd;
typedef enum _mg_opmode
{
mg_op_mode_xip = 1, /* TRUE XIP */
mg_op_mode_snd = 2, /* BOOT + Storage */
mg_op_mode_stg = 0 /* Only Storage */
} mg_opmode;
#endif

902
src/flash/mx3_nand.c Normal file
View File

@@ -0,0 +1,902 @@
/***************************************************************************
* Copyright (C) 2009 by Alexei Babich *
* Rezonans plc., Chelyabinsk, Russia *
* impatt@mail.ru *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
/*
* Freescale iMX3* OpenOCD NAND Flash controller support.
*
* Many thanks to Ben Dooks for writing s3c24xx driver.
*/
/*
driver tested with STMicro NAND512W3A @imx31
tested "nand probe #", "nand erase # 0 #", "nand dump # file 0 #", "nand write # file 0"
get_next_halfword_from_sram_buffer() not tested
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "mx3_nand.h"
static const char target_not_halted_err_msg[] =
"target must be halted to use mx3 NAND flash controller";
static const char data_block_size_err_msg[] =
"minimal granularity is one half-word, %" PRId32 " is incorrect";
static const char sram_buffer_bounds_err_msg[] =
"trying to access out of SRAM buffer bound (addr=0x%" PRIx32 ")";
static const char get_status_register_err_msg[] = "can't get NAND status";
static uint32_t in_sram_address;
unsigned char sign_of_sequental_byte_read;
static int test_iomux_settings (target_t * target, uint32_t value,
uint32_t mask, const char *text);
static int initialize_nf_controller (struct nand_device_s *device);
static int get_next_byte_from_sram_buffer (target_t * target, uint8_t * value);
static int get_next_halfword_from_sram_buffer (target_t * target,
uint16_t * value);
static int poll_for_complete_op (target_t * target, const char *text);
static int validate_target_state (struct nand_device_s *device);
static int do_data_output (struct nand_device_s *device);
static int imx31_nand_device_command (struct command_context_s *cmd_ctx,
char *cmd, char **args, int argc,
struct nand_device_s *device);
static int imx31_init (struct nand_device_s *device);
static int imx31_read_data (struct nand_device_s *device, void *data);
static int imx31_write_data (struct nand_device_s *device, uint16_t data);
static int imx31_nand_ready (struct nand_device_s *device, int timeout);
static int imx31_register_commands (struct command_context_s *cmd_ctx);
static int imx31_reset (struct nand_device_s *device);
static int imx31_command (struct nand_device_s *device, uint8_t command);
static int imx31_address (struct nand_device_s *device, uint8_t address);
static int imx31_controller_ready (struct nand_device_s *device, int tout);
static int imx31_write_page (struct nand_device_s *device, uint32_t page,
uint8_t * data, uint32_t data_size, uint8_t * oob,
uint32_t oob_size);
static int imx31_read_page (struct nand_device_s *device, uint32_t page,
uint8_t * data, uint32_t data_size, uint8_t * oob,
uint32_t oob_size);
nand_flash_controller_t imx31_nand_flash_controller = {
.name = "imx31",
.nand_device_command = imx31_nand_device_command,
.register_commands = imx31_register_commands,
.init = imx31_init,
.reset = imx31_reset,
.command = imx31_command,
.address = imx31_address,
.write_data = imx31_write_data,
.read_data = imx31_read_data,
.write_page = imx31_write_page,
.read_page = imx31_read_page,
.controller_ready = imx31_controller_ready,
.nand_ready = imx31_nand_ready,
};
static int imx31_nand_device_command (struct command_context_s *cmd_ctx,
char *cmd, char **args, int argc,
struct nand_device_s *device)
{
mx3_nf_controller_t *mx3_nf_info;
mx3_nf_info = malloc (sizeof (mx3_nf_controller_t));
if (mx3_nf_info == NULL)
{
LOG_ERROR ("no memory for nand controller");
return ERROR_FAIL;
}
device->controller_priv = mx3_nf_info;
mx3_nf_info->target = get_target (args[1]);
if (mx3_nf_info->target == NULL)
{
LOG_ERROR ("target '%s' not defined", args[1]);
return ERROR_FAIL;
}
if (argc < 3)
{
LOG_ERROR ("use \"nand device imx31 target noecc|hwecc\"");
return ERROR_FAIL;
}
/*
* check hwecc requirements
*/
{
int hwecc_needed;
hwecc_needed = strcmp (args[2], "hwecc");
if (hwecc_needed == 0)
{
mx3_nf_info->flags.hw_ecc_enabled = 1;
}
else
{
mx3_nf_info->flags.hw_ecc_enabled = 0;
}
}
mx3_nf_info->optype = MX3_NF_DATAOUT_PAGE;
mx3_nf_info->fin = MX3_NF_FIN_NONE;
mx3_nf_info->flags.target_little_endian =
(mx3_nf_info->target->endianness == TARGET_LITTLE_ENDIAN);
/*
* testing host endianess
*/
{
int x = 1;
if (*(char *) &x == 1)
{
mx3_nf_info->flags.host_little_endian = 1;
}
else
{
mx3_nf_info->flags.host_little_endian = 0;
}
}
return ERROR_OK;
}
static int imx31_init (struct nand_device_s *device)
{
mx3_nf_controller_t *mx3_nf_info = device->controller_priv;
target_t *target = mx3_nf_info->target;
{
/*
* validate target state
*/
int validate_target_result;
validate_target_result = validate_target_state (device);
if (validate_target_result != ERROR_OK)
{
return validate_target_result;
}
}
{
uint16_t buffsize_register_content;
target_read_u16 (target, MX3_NF_BUFSIZ, &buffsize_register_content);
mx3_nf_info->flags.one_kb_sram = !(buffsize_register_content & 0x000f);
}
{
uint32_t pcsr_register_content;
target_read_u32 (target, MX3_PCSR, &pcsr_register_content);
if (!device->bus_width)
{
device->bus_width =
(pcsr_register_content & 0x80000000) ? 16 : 8;
}
else
{
pcsr_register_content |=
((device->bus_width == 16) ? 0x80000000 : 0x00000000);
target_write_u32 (target, MX3_PCSR, pcsr_register_content);
}
if (!device->page_size)
{
device->page_size =
(pcsr_register_content & 0x40000000) ? 2048 : 512;
}
else
{
pcsr_register_content |=
((device->page_size == 2048) ? 0x40000000 : 0x00000000);
target_write_u32 (target, MX3_PCSR, pcsr_register_content);
}
if (mx3_nf_info->flags.one_kb_sram && (device->page_size == 2048))
{
LOG_ERROR
("NAND controller have only 1 kb SRAM, so pagesize 2048 is incompatible with it");
}
}
{
uint32_t cgr_register_content;
target_read_u32 (target, MX3_CCM_CGR2, &cgr_register_content);
if (!(cgr_register_content & 0x00000300))
{
LOG_ERROR ("clock gating to EMI disabled");
return ERROR_FAIL;
}
}
{
uint32_t gpr_register_content;
target_read_u32 (target, MX3_GPR, &gpr_register_content);
if (gpr_register_content & 0x00000060)
{
LOG_ERROR ("pins mode overrided by GPR");
return ERROR_FAIL;
}
}
{
/*
* testing IOMUX settings; must be in "functional-mode output and
* functional-mode input" mode
*/
int test_iomux;
test_iomux = ERROR_OK;
test_iomux |=
test_iomux_settings (target, 0x43fac0c0, 0x7f7f7f00, "d0,d1,d2");
test_iomux |=
test_iomux_settings (target, 0x43fac0c4, 0x7f7f7f7f, "d3,d4,d5,d6");
test_iomux |=
test_iomux_settings (target, 0x43fac0c8, 0x0000007f, "d7");
if (device->bus_width == 16)
{
test_iomux |=
test_iomux_settings (target, 0x43fac0c8, 0x7f7f7f00,
"d8,d9,d10");
test_iomux |=
test_iomux_settings (target, 0x43fac0cc, 0x7f7f7f7f,
"d11,d12,d13,d14");
test_iomux |=
test_iomux_settings (target, 0x43fac0d0, 0x0000007f, "d15");
}
test_iomux |=
test_iomux_settings (target, 0x43fac0d0, 0x7f7f7f00,
"nfwp,nfce,nfrb");
test_iomux |=
test_iomux_settings (target, 0x43fac0d4, 0x7f7f7f7f,
"nfwe,nfre,nfale,nfcle");
if (test_iomux != ERROR_OK)
{
return ERROR_FAIL;
}
}
initialize_nf_controller (device);
{
int retval;
uint16_t nand_status_content;
retval = ERROR_OK;
retval |= imx31_command (device, NAND_CMD_STATUS);
retval |= imx31_address (device, 0x00);
retval |= do_data_output (device);
if (retval != ERROR_OK)
{
LOG_ERROR (get_status_register_err_msg);
return ERROR_FAIL;
}
target_read_u16 (target, MX3_NF_MAIN_BUFFER0, &nand_status_content);
if (!(nand_status_content & 0x0080))
{
/*
* is host-big-endian correctly ??
*/
LOG_INFO ("NAND read-only");
mx3_nf_info->flags.nand_readonly = 1;
}
else
{
mx3_nf_info->flags.nand_readonly = 0;
}
}
return ERROR_OK;
}
static int imx31_read_data (struct nand_device_s *device, void *data)
{
mx3_nf_controller_t *mx3_nf_info = device->controller_priv;
target_t *target = mx3_nf_info->target;
{
/*
* validate target state
*/
int validate_target_result;
validate_target_result = validate_target_state (device);
if (validate_target_result != ERROR_OK)
{
return validate_target_result;
}
}
{
/*
* get data from nand chip
*/
int try_data_output_from_nand_chip;
try_data_output_from_nand_chip = do_data_output (device);
if (try_data_output_from_nand_chip != ERROR_OK)
{
return try_data_output_from_nand_chip;
}
}
if (device->bus_width == 16)
{
get_next_halfword_from_sram_buffer (target, data);
}
else
{
get_next_byte_from_sram_buffer (target, data);
}
return ERROR_OK;
}
static int imx31_write_data (struct nand_device_s *device, uint16_t data)
{
LOG_ERROR ("write_data() not implemented");
return ERROR_NAND_OPERATION_FAILED;
}
static int imx31_nand_ready (struct nand_device_s *device, int timeout)
{
return imx31_controller_ready (device, timeout);
}
static int imx31_register_commands (struct command_context_s *cmd_ctx)
{
return ERROR_OK;
}
static int imx31_reset (struct nand_device_s *device)
{
/*
* validate target state
*/
int validate_target_result;
validate_target_result = validate_target_state (device);
if (validate_target_result != ERROR_OK)
{
return validate_target_result;
}
initialize_nf_controller (device);
return ERROR_OK;
}
static int imx31_command (struct nand_device_s *device, uint8_t command)
{
mx3_nf_controller_t *mx3_nf_info = device->controller_priv;
target_t *target = mx3_nf_info->target;
{
/*
* validate target state
*/
int validate_target_result;
validate_target_result = validate_target_state (device);
if (validate_target_result != ERROR_OK)
{
return validate_target_result;
}
}
switch (command)
{
case NAND_CMD_READOOB:
command = NAND_CMD_READ0;
in_sram_address = MX3_NF_SPARE_BUFFER0; /* set read point for
* data_read() and
* read_block_data() to
* spare area in SRAM
* buffer */
break;
case NAND_CMD_READ1:
command = NAND_CMD_READ0;
/*
* offset == one half of page size
*/
in_sram_address =
MX3_NF_MAIN_BUFFER0 + (device->page_size >> 1);
default:
in_sram_address = MX3_NF_MAIN_BUFFER0;
}
target_write_u16 (target, MX3_NF_FCMD, command);
/*
* start command input operation (set MX3_NF_BIT_OP_DONE==0)
*/
target_write_u16 (target, MX3_NF_CFG2, MX3_NF_BIT_OP_FCI);
{
int poll_result;
poll_result = poll_for_complete_op (target, "command");
if (poll_result != ERROR_OK)
{
return poll_result;
}
}
/*
* reset cursor to begin of the buffer
*/
sign_of_sequental_byte_read = 0;
switch (command)
{
case NAND_CMD_READID:
mx3_nf_info->optype = MX3_NF_DATAOUT_NANDID;
mx3_nf_info->fin = MX3_NF_FIN_DATAOUT;
break;
case NAND_CMD_STATUS:
mx3_nf_info->optype = MX3_NF_DATAOUT_NANDSTATUS;
mx3_nf_info->fin = MX3_NF_FIN_DATAOUT;
break;
case NAND_CMD_READ0:
mx3_nf_info->fin = MX3_NF_FIN_DATAOUT;
mx3_nf_info->optype = MX3_NF_DATAOUT_PAGE;
break;
default:
mx3_nf_info->optype = MX3_NF_DATAOUT_PAGE;
}
return ERROR_OK;
}
static int imx31_address (struct nand_device_s *device, uint8_t address)
{
mx3_nf_controller_t *mx3_nf_info = device->controller_priv;
target_t *target = mx3_nf_info->target;
{
/*
* validate target state
*/
int validate_target_result;
validate_target_result = validate_target_state (device);
if (validate_target_result != ERROR_OK)
{
return validate_target_result;
}
}
target_write_u16 (target, MX3_NF_FADDR, address);
/*
* start address input operation (set MX3_NF_BIT_OP_DONE==0)
*/
target_write_u16 (target, MX3_NF_CFG2, MX3_NF_BIT_OP_FAI);
{
int poll_result;
poll_result = poll_for_complete_op (target, "address");
if (poll_result != ERROR_OK)
{
return poll_result;
}
}
return ERROR_OK;
}
static int imx31_controller_ready (struct nand_device_s *device, int tout)
{
uint16_t poll_complete_status;
mx3_nf_controller_t *mx3_nf_info = device->controller_priv;
target_t *target = mx3_nf_info->target;
{
/*
* validate target state
*/
int validate_target_result;
validate_target_result = validate_target_state (device);
if (validate_target_result != ERROR_OK)
{
return validate_target_result;
}
}
do
{
target_read_u16 (target, MX3_NF_CFG2, &poll_complete_status);
if (poll_complete_status & MX3_NF_BIT_OP_DONE)
{
return tout;
}
alive_sleep (1);
}
while (tout-- > 0);
return tout;
}
static int imx31_write_page (struct nand_device_s *device, uint32_t page,
uint8_t * data, uint32_t data_size, uint8_t * oob,
uint32_t oob_size)
{
mx3_nf_controller_t *mx3_nf_info = device->controller_priv;
target_t *target = mx3_nf_info->target;
if (data_size % 2)
{
LOG_ERROR (data_block_size_err_msg, data_size);
return ERROR_NAND_OPERATION_FAILED;
}
if (oob_size % 2)
{
LOG_ERROR (data_block_size_err_msg, oob_size);
return ERROR_NAND_OPERATION_FAILED;
}
if (!data)
{
LOG_ERROR ("nothing to program");
return ERROR_NAND_OPERATION_FAILED;
}
{
/*
* validate target state
*/
int retval;
retval = validate_target_state (device);
if (retval != ERROR_OK)
{
return retval;
}
}
{
int retval = ERROR_OK;
retval |= imx31_command (device, NAND_CMD_SEQIN);
retval |= imx31_address (device, 0x00);
retval |= imx31_address (device, page & 0xff);
retval |= imx31_address (device, (page >> 8) & 0xff);
if (device->address_cycles >= 4)
{
retval |= imx31_address (device, (page >> 16) & 0xff);
if (device->address_cycles >= 5)
{
retval |= imx31_address (device, (page >> 24) & 0xff);
}
}
target_write_buffer (target, MX3_NF_MAIN_BUFFER0, data_size, data);
if (oob)
{
if (mx3_nf_info->flags.hw_ecc_enabled)
{
/*
* part of spare block will be overrided by hardware
* ECC generator
*/
LOG_DEBUG
("part of spare block will be overrided by hardware ECC generator");
}
target_write_buffer (target, MX3_NF_SPARE_BUFFER0, oob_size,
oob);
}
/*
* start data input operation (set MX3_NF_BIT_OP_DONE==0)
*/
target_write_u16 (target, MX3_NF_CFG2, MX3_NF_BIT_OP_FDI);
{
int poll_result;
poll_result = poll_for_complete_op (target, "data input");
if (poll_result != ERROR_OK)
{
return poll_result;
}
}
retval |= imx31_command (device, NAND_CMD_PAGEPROG);
if (retval != ERROR_OK)
{
return retval;
}
/*
* check status register
*/
{
uint16_t nand_status_content;
retval = ERROR_OK;
retval |= imx31_command (device, NAND_CMD_STATUS);
retval |= imx31_address (device, 0x00);
retval |= do_data_output (device);
if (retval != ERROR_OK)
{
LOG_ERROR (get_status_register_err_msg);
return retval;
}
target_read_u16 (target, MX3_NF_MAIN_BUFFER0, &nand_status_content);
if (nand_status_content & 0x0001)
{
/*
* is host-big-endian correctly ??
*/
return ERROR_NAND_OPERATION_FAILED;
}
}
}
return ERROR_OK;
}
static int imx31_read_page (struct nand_device_s *device, uint32_t page,
uint8_t * data, uint32_t data_size, uint8_t * oob,
uint32_t oob_size)
{
mx3_nf_controller_t *mx3_nf_info = device->controller_priv;
target_t *target = mx3_nf_info->target;
if (data_size % 2)
{
LOG_ERROR (data_block_size_err_msg, data_size);
return ERROR_NAND_OPERATION_FAILED;
}
if (oob_size % 2)
{
LOG_ERROR (data_block_size_err_msg, oob_size);
return ERROR_NAND_OPERATION_FAILED;
}
{
/*
* validate target state
*/
int retval;
retval = validate_target_state (device);
if (retval != ERROR_OK)
{
return retval;
}
}
{
int retval = ERROR_OK;
retval |= imx31_command (device, NAND_CMD_READ0);
retval |= imx31_address (device, 0x00);
retval |= imx31_address (device, page & 0xff);
retval |= imx31_address (device, (page >> 8) & 0xff);
if (device->address_cycles >= 4)
{
retval |= imx31_address (device, (page >> 16) & 0xff);
if (device->address_cycles >= 5)
{
retval |= imx31_address (device, (page >> 24) & 0xff);
retval |= imx31_command (device, NAND_CMD_READSTART);
}
}
retval |= do_data_output (device);
if (retval != ERROR_OK)
{
return retval;
}
if (data)
{
target_read_buffer (target, MX3_NF_MAIN_BUFFER0, data_size,
data);
}
if (oob)
{
target_read_buffer (target, MX3_NF_SPARE_BUFFER0, oob_size,
oob);
}
}
return ERROR_OK;
}
static int test_iomux_settings (target_t * target, uint32_t address,
uint32_t mask, const char *text)
{
uint32_t register_content;
target_read_u32 (target, address, &register_content);
if ((register_content & mask) != (0x12121212 & mask))
{
LOG_ERROR ("IOMUX for {%s} is bad", text);
return ERROR_FAIL;
}
return ERROR_OK;
}
static int initialize_nf_controller (struct nand_device_s *device)
{
mx3_nf_controller_t *mx3_nf_info = device->controller_priv;
target_t *target = mx3_nf_info->target;
/*
* resets NAND flash controller in zero time ? I dont know.
*/
target_write_u16 (target, MX3_NF_CFG1, MX3_NF_BIT_RESET_EN);
{
uint16_t work_mode;
work_mode = MX3_NF_BIT_INT_DIS; /* disable interrupt */
if (target->endianness == TARGET_BIG_ENDIAN)
{
work_mode |= MX3_NF_BIT_BE_EN;
}
if (mx3_nf_info->flags.hw_ecc_enabled)
{
work_mode |= MX3_NF_BIT_ECC_EN;
}
target_write_u16 (target, MX3_NF_CFG1, work_mode);
}
/*
* unlock SRAM buffer for write; 2 mean "Unlock", other values means "Lock"
*/
target_write_u16 (target, MX3_NF_BUFCFG, 2);
{
uint16_t temp;
target_read_u16 (target, MX3_NF_FWP, &temp);
if ((temp & 0x0007) == 1)
{
LOG_ERROR ("NAND flash is tight-locked, reset needed");
return ERROR_FAIL;
}
}
/*
* unlock NAND flash for write
*/
target_write_u16 (target, MX3_NF_FWP, 4);
target_write_u16 (target, MX3_NF_LOCKSTART, 0x0000);
target_write_u16 (target, MX3_NF_LOCKEND, 0xFFFF);
/*
* 0x0000 means that first SRAM buffer @0xB800_0000 will be used
*/
target_write_u16 (target, MX3_NF_BUFADDR, 0x0000);
/*
* address of SRAM buffer
*/
in_sram_address = MX3_NF_MAIN_BUFFER0;
sign_of_sequental_byte_read = 0;
return ERROR_OK;
}
static int get_next_byte_from_sram_buffer (target_t * target, uint8_t * value)
{
static uint8_t even_byte = 0;
/*
* host-big_endian ??
*/
if (sign_of_sequental_byte_read == 0)
{
even_byte = 0;
}
if (in_sram_address > MX3_NF_LAST_BUFFER_ADDR)
{
LOG_ERROR (sram_buffer_bounds_err_msg, in_sram_address);
*value = 0;
sign_of_sequental_byte_read = 0;
even_byte = 0;
return ERROR_NAND_OPERATION_FAILED;
}
else
{
uint16_t temp;
target_read_u16 (target, in_sram_address, &temp);
if (even_byte)
{
*value = temp >> 8;
even_byte = 0;
in_sram_address += 2;
}
else
{
*value = temp & 0xff;
even_byte = 1;
}
}
sign_of_sequental_byte_read = 1;
return ERROR_OK;
}
static int get_next_halfword_from_sram_buffer (target_t * target,
uint16_t * value)
{
if (in_sram_address > MX3_NF_LAST_BUFFER_ADDR)
{
LOG_ERROR (sram_buffer_bounds_err_msg, in_sram_address);
*value = 0;
return ERROR_NAND_OPERATION_FAILED;
}
else
{
target_read_u16 (target, in_sram_address, value);
in_sram_address += 2;
}
return ERROR_OK;
}
static int poll_for_complete_op (target_t * target, const char *text)
{
uint16_t poll_complete_status;
for (int poll_cycle_count = 0; poll_cycle_count < 100; poll_cycle_count++)
{
usleep (25);
target_read_u16 (target, MX3_NF_CFG2, &poll_complete_status);
if (poll_complete_status & MX3_NF_BIT_OP_DONE)
{
break;
}
}
if (!(poll_complete_status & MX3_NF_BIT_OP_DONE))
{
LOG_ERROR ("%s sending timeout", text);
return ERROR_NAND_OPERATION_FAILED;
}
return ERROR_OK;
}
static int validate_target_state (struct nand_device_s *device)
{
mx3_nf_controller_t *mx3_nf_info = device->controller_priv;
target_t *target = mx3_nf_info->target;
if (target->state != TARGET_HALTED)
{
LOG_ERROR (target_not_halted_err_msg);
return ERROR_NAND_OPERATION_FAILED;
}
if (mx3_nf_info->flags.target_little_endian !=
(target->endianness == TARGET_LITTLE_ENDIAN))
{
/*
* endianness changed after NAND controller probed
*/
return ERROR_NAND_OPERATION_FAILED;
}
return ERROR_OK;
}
static int do_data_output (struct nand_device_s *device)
{
mx3_nf_controller_t *mx3_nf_info = device->controller_priv;
target_t *target = mx3_nf_info->target;
switch (mx3_nf_info->fin)
{
case MX3_NF_FIN_DATAOUT:
/*
* start data output operation (set MX3_NF_BIT_OP_DONE==0)
*/
target_write_u16 (target, MX3_NF_CFG2,
MX3_NF_BIT_DATAOUT_TYPE (mx3_nf_info->
optype));
{
int poll_result;
poll_result = poll_for_complete_op (target, "data output");
if (poll_result != ERROR_OK)
{
return poll_result;
}
}
mx3_nf_info->fin = MX3_NF_FIN_NONE;
/*
* ECC stuff
*/
if ((mx3_nf_info->optype == MX3_NF_DATAOUT_PAGE)
&& mx3_nf_info->flags.hw_ecc_enabled)
{
uint16_t ecc_status;
target_read_u16 (target, MX3_NF_ECCSTATUS, &ecc_status);
switch (ecc_status & 0x000c)
{
case 1 << 2:
LOG_DEBUG
("main area readed with 1 (correctable) error");
break;
case 2 << 2:
LOG_DEBUG
("main area readed with more than 1 (incorrectable) error");
return ERROR_NAND_OPERATION_FAILED;
break;
}
switch (ecc_status & 0x0003)
{
case 1:
LOG_DEBUG
("spare area readed with 1 (correctable) error");
break;
case 2:
LOG_DEBUG
("main area readed with more than 1 (incorrectable) error");
return ERROR_NAND_OPERATION_FAILED;
break;
}
}
break;
case MX3_NF_FIN_NONE:
break;
}
return ERROR_OK;
}

117
src/flash/mx3_nand.h Normal file
View File

@@ -0,0 +1,117 @@
/***************************************************************************
* Copyright (C) 2009 by Alexei Babich *
* Rezonans plc., Chelyabinsk, Russia *
* impatt@mail.ru *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
/*
* Freescale iMX3* OpenOCD NAND Flash controller support.
*
* Many thanks to Ben Dooks for writing s3c24xx driver.
*/
#include <nand.h>
#define MX3_NF_BASE_ADDR 0xb8000000
#define MX3_NF_BUFSIZ (MX3_NF_BASE_ADDR + 0xe00)
#define MX3_NF_BUFADDR (MX3_NF_BASE_ADDR + 0xe04)
#define MX3_NF_FADDR (MX3_NF_BASE_ADDR + 0xe06)
#define MX3_NF_FCMD (MX3_NF_BASE_ADDR + 0xe08)
#define MX3_NF_BUFCFG (MX3_NF_BASE_ADDR + 0xe0a)
#define MX3_NF_ECCSTATUS (MX3_NF_BASE_ADDR + 0xe0c)
#define MX3_NF_ECCMAINPOS (MX3_NF_BASE_ADDR + 0xe0e)
#define MX3_NF_ECCSPAREPOS (MX3_NF_BASE_ADDR + 0xe10)
#define MX3_NF_FWP (MX3_NF_BASE_ADDR + 0xe12)
#define MX3_NF_LOCKSTART (MX3_NF_BASE_ADDR + 0xe14)
#define MX3_NF_LOCKEND (MX3_NF_BASE_ADDR + 0xe16)
#define MX3_NF_FWPSTATUS (MX3_NF_BASE_ADDR + 0xe18)
/*
* all bits not marked as self-clearing bit
*/
#define MX3_NF_CFG1 (MX3_NF_BASE_ADDR + 0xe1a)
#define MX3_NF_CFG2 (MX3_NF_BASE_ADDR + 0xe1c)
#define MX3_NF_MAIN_BUFFER0 (MX3_NF_BASE_ADDR + 0x0000)
#define MX3_NF_MAIN_BUFFER1 (MX3_NF_BASE_ADDR + 0x0200)
#define MX3_NF_MAIN_BUFFER2 (MX3_NF_BASE_ADDR + 0x0400)
#define MX3_NF_MAIN_BUFFER3 (MX3_NF_BASE_ADDR + 0x0600)
#define MX3_NF_SPARE_BUFFER0 (MX3_NF_BASE_ADDR + 0x0800)
#define MX3_NF_SPARE_BUFFER1 (MX3_NF_BASE_ADDR + 0x0810)
#define MX3_NF_SPARE_BUFFER2 (MX3_NF_BASE_ADDR + 0x0820)
#define MX3_NF_SPARE_BUFFER3 (MX3_NF_BASE_ADDR + 0x0830)
#define MX3_NF_MAIN_BUFFER_LEN 512
#define MX3_NF_SPARE_BUFFER_LEN 16
#define MX3_NF_LAST_BUFFER_ADDR ((MX3_NF_SPARE_BUFFER3) + MX3_NF_SPARE_BUFFER_LEN - 2)
/* bits in MX3_NF_CFG1 register */
#define MX3_NF_BIT_SPARE_ONLY_EN (1<<2)
#define MX3_NF_BIT_ECC_EN (1<<3)
#define MX3_NF_BIT_INT_DIS (1<<4)
#define MX3_NF_BIT_BE_EN (1<<5)
#define MX3_NF_BIT_RESET_EN (1<<6)
#define MX3_NF_BIT_FORCE_CE (1<<7)
/* bits in MX3_NF_CFG2 register */
/*Flash Command Input*/
#define MX3_NF_BIT_OP_FCI (1<<0)
/*
* Flash Address Input
*/
#define MX3_NF_BIT_OP_FAI (1<<1)
/*
* Flash Data Input
*/
#define MX3_NF_BIT_OP_FDI (1<<2)
/* see "enum mx_dataout_type" below */
#define MX3_NF_BIT_DATAOUT_TYPE(x) ((x)<<3)
#define MX3_NF_BIT_OP_DONE (1<<15)
#define MX3_CCM_CGR2 0x53f80028
#define MX3_GPR 0x43fac008
#define MX3_PCSR 0x53f8000c
enum mx_dataout_type
{
MX3_NF_DATAOUT_PAGE = 1,
MX3_NF_DATAOUT_NANDID = 2,
MX3_NF_DATAOUT_NANDSTATUS = 4,
};
enum mx_nf_finalize_action
{
MX3_NF_FIN_NONE,
MX3_NF_FIN_DATAOUT,
};
struct mx3_nf_flags
{
unsigned host_little_endian:1;
unsigned target_little_endian:1;
unsigned nand_readonly:1;
unsigned one_kb_sram:1;
unsigned hw_ecc_enabled:1;
};
typedef struct mx3_nf_controller_s
{
struct target_s *target;
enum mx_dataout_type optype;
enum mx_nf_finalize_action fin;
struct mx3_nf_flags flags;
} mx3_nf_controller_t;

File diff suppressed because it is too large Load Diff

View File

@@ -36,26 +36,38 @@ typedef struct nand_flash_controller_s
int (*register_commands)(struct command_context_s *cmd_ctx);
int (*init)(struct nand_device_s *device);
int (*reset)(struct nand_device_s *device);
int (*command)(struct nand_device_s *device, u8 command);
int (*address)(struct nand_device_s *device, u8 address);
int (*write_data)(struct nand_device_s *device, u16 data);
int (*command)(struct nand_device_s *device, uint8_t command);
int (*address)(struct nand_device_s *device, uint8_t address);
int (*write_data)(struct nand_device_s *device, uint16_t data);
int (*read_data)(struct nand_device_s *device, void *data);
int (*write_block_data)(struct nand_device_s *device, u8 *data, int size);
int (*read_block_data)(struct nand_device_s *device, u8 *data, int size);
int (*write_page)(struct nand_device_s *device, u32 page, u8 *data, u32 data_size, u8 *oob, u32 oob_size);
int (*read_page)(struct nand_device_s *device, u32 page, u8 *data, u32 data_size, u8 *oob, u32 oob_size);
int (*write_block_data)(struct nand_device_s *device, uint8_t *data, int size);
int (*read_block_data)(struct nand_device_s *device, uint8_t *data, int size);
int (*write_page)(struct nand_device_s *device, uint32_t page, uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size);
int (*read_page)(struct nand_device_s *device, uint32_t page, uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size);
int (*controller_ready)(struct nand_device_s *device, int timeout);
int (*nand_ready)(struct nand_device_s *device, int timeout);
} nand_flash_controller_t;
typedef struct nand_block_s
{
u32 offset;
u32 size;
uint32_t offset;
uint32_t size;
int is_erased;
int is_bad;
} nand_block_t;
struct nand_oobfree {
int offset;
int length;
};
typedef struct nand_ecclayout_s {
int eccbytes;
int eccpos[64];
int oobavail;
struct nand_oobfree oobfree[2];
} nand_ecclayout_t;
typedef struct nand_device_s
{
nand_flash_controller_t *controller;
@@ -83,11 +95,12 @@ enum
NAND_MFR_RENESAS = 0x07,
NAND_MFR_STMICRO = 0x20,
NAND_MFR_HYNIX = 0xad,
NAND_MFR_MICRON = 0x2c,
};
typedef struct nand_manufacturer_s
{
int id;
int id;
char *name;
} nand_manufacturer_t;
@@ -103,43 +116,43 @@ typedef struct nand_info_s
/* Option constants for bizarre disfunctionality and real features
*/
enum {
enum {
/* Chip can not auto increment pages */
NAND_NO_AUTOINCR = 0x00000001,
/* Buswitdh is 16 bit */
NAND_BUSWIDTH_16 = 0x00000002,
/* Device supports partial programming without padding */
NAND_NO_PADDING = 0x00000004,
/* Chip has cache program function */
NAND_CACHEPRG = 0x00000008,
/* Chip has copy back function */
NAND_COPYBACK = 0x00000010,
/* AND Chip which has 4 banks and a confusing page / block
* assignment. See Renesas datasheet for further information */
NAND_IS_AND = 0x00000020,
/* Chip has a array of 4 pages which can be read without
* additional ready /busy waits */
NAND_4PAGE_ARRAY = 0x00000040,
/* Chip requires that BBT is periodically rewritten to prevent
* bits from adjacent blocks from 'leaking' in altering data.
* This happens with the Renesas AG-AND chips, possibly others. */
BBT_AUTO_REFRESH = 0x00000080,
/* Chip does not require ready check on read. True
* for all large page devices, as they do not support
* autoincrement.*/
NAND_NO_READRDY = 0x00000100,
/* Options valid for Samsung large page devices */
NAND_SAMSUNG_LP_OPTIONS = (NAND_NO_PADDING | NAND_CACHEPRG | NAND_COPYBACK),
/* Options for new chips with large page size. The pagesize and the
* erasesize is determined from the extended id bytes
*/
@@ -163,7 +176,7 @@ enum
NAND_CMD_READID = 0x90,
NAND_CMD_ERASE2 = 0xd0,
NAND_CMD_RESET = 0xff,
/* Extended commands for large page devices */
NAND_CMD_READSTART = 0x30,
NAND_CMD_RNDOUTSTART = 0xE0,
@@ -186,17 +199,20 @@ enum oob_formats
NAND_OOB_NONE = 0x0, /* no OOB data at all */
NAND_OOB_RAW = 0x1, /* raw OOB data (16 bytes for 512b page sizes, 64 bytes for 2048b page sizes) */
NAND_OOB_ONLY = 0x2, /* only OOB data */
NAND_OOB_SW_ECC = 0x10, /* when writing, use SW ECC (as opposed to no ECC) */
NAND_OOB_SW_ECC = 0x10, /* when writing, use SW ECC (as opposed to no ECC) */
NAND_OOB_HW_ECC = 0x20, /* when writing, use HW ECC (as opposed to no ECC) */
NAND_OOB_SW_ECC_KW = 0x40, /* when writing, use Marvell's Kirkwood bootrom format */
NAND_OOB_JFFS2 = 0x100, /* when writing, use JFFS2 OOB layout */
NAND_OOB_YAFFS2 = 0x100,/* when writing, use YAFFS2 OOB layout */
};
/* Function prototypes */
extern nand_device_t *get_nand_device_by_num(int num);
extern int nand_read_page_raw(struct nand_device_s *device, u32 page, u8 *data, u32 data_size, u8 *oob, u32 oob_size);
extern int nand_write_page_raw(struct nand_device_s *device, u32 page, u8 *data, u32 data_size, u8 *oob, u32 oob_size);
extern int nand_read_status(struct nand_device_s *device, u8 *status);
extern int nand_read_page_raw(struct nand_device_s *device, uint32_t page, uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size);
extern int nand_write_page_raw(struct nand_device_s *device, uint32_t page, uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size);
extern int nand_read_status(struct nand_device_s *device, uint8_t *status);
extern int nand_calculate_ecc(struct nand_device_s *device, const uint8_t *dat, uint8_t *ecc_code);
extern int nand_calculate_ecc_kw(struct nand_device_s *device, const uint8_t *dat, uint8_t *ecc_code);
extern int nand_register_commands(struct command_context_s *cmd_ctx);
extern int nand_init(struct command_context_s *cmd_ctx);
@@ -207,5 +223,6 @@ extern int nand_init(struct command_context_s *cmd_ctx);
#define ERROR_NAND_OPERATION_NOT_SUPPORTED (-1103)
#define ERROR_NAND_DEVICE_NOT_PROBED (-1104)
#define ERROR_NAND_ERROR_CORRECTION_FAILED (-1105)
#define ERROR_NAND_NO_BUFFER (-1106)
#endif /* NAND_H */

122
src/flash/nand_ecc.c Normal file
View File

@@ -0,0 +1,122 @@
/*
* This file contains an ECC algorithm from Toshiba that allows for detection
* and correction of 1-bit errors in a 256 byte block of data.
*
* [ Extracted from the initial code found in some early Linux versions.
* The current Linux code is bigger while being faster, but this is of
* no real benefit when the bottleneck largely remains the JTAG link. ]
*
* Copyright (C) 2000-2004 Steven J. Hill (sjhill at realitydiluted.com)
* Toshiba America Electronics Components, Inc.
*
* Copyright (C) 2006 Thomas Gleixner <tglx at linutronix.de>
*
* This file is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 or (at your option) any
* later version.
*
* This file is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this file; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*
* As a special exception, if other files instantiate templates or use
* macros or inline functions from these files, or you compile these
* files and link them with other works to produce a work based on these
* files, these files do not by themselves cause the resulting work to be
* covered by the GNU General Public License. However the source code for
* these files must still be made available in accordance with section (3)
* of the GNU General Public License.
*
* This exception does not invalidate any other reasons why a work based on
* this file might be covered by the GNU General Public License.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "nand.h"
/*
* Pre-calculated 256-way 1 byte column parity
*/
static const uint8_t nand_ecc_precalc_table[] = {
0x00, 0x55, 0x56, 0x03, 0x59, 0x0c, 0x0f, 0x5a, 0x5a, 0x0f, 0x0c, 0x59, 0x03, 0x56, 0x55, 0x00,
0x65, 0x30, 0x33, 0x66, 0x3c, 0x69, 0x6a, 0x3f, 0x3f, 0x6a, 0x69, 0x3c, 0x66, 0x33, 0x30, 0x65,
0x66, 0x33, 0x30, 0x65, 0x3f, 0x6a, 0x69, 0x3c, 0x3c, 0x69, 0x6a, 0x3f, 0x65, 0x30, 0x33, 0x66,
0x03, 0x56, 0x55, 0x00, 0x5a, 0x0f, 0x0c, 0x59, 0x59, 0x0c, 0x0f, 0x5a, 0x00, 0x55, 0x56, 0x03,
0x69, 0x3c, 0x3f, 0x6a, 0x30, 0x65, 0x66, 0x33, 0x33, 0x66, 0x65, 0x30, 0x6a, 0x3f, 0x3c, 0x69,
0x0c, 0x59, 0x5a, 0x0f, 0x55, 0x00, 0x03, 0x56, 0x56, 0x03, 0x00, 0x55, 0x0f, 0x5a, 0x59, 0x0c,
0x0f, 0x5a, 0x59, 0x0c, 0x56, 0x03, 0x00, 0x55, 0x55, 0x00, 0x03, 0x56, 0x0c, 0x59, 0x5a, 0x0f,
0x6a, 0x3f, 0x3c, 0x69, 0x33, 0x66, 0x65, 0x30, 0x30, 0x65, 0x66, 0x33, 0x69, 0x3c, 0x3f, 0x6a,
0x6a, 0x3f, 0x3c, 0x69, 0x33, 0x66, 0x65, 0x30, 0x30, 0x65, 0x66, 0x33, 0x69, 0x3c, 0x3f, 0x6a,
0x0f, 0x5a, 0x59, 0x0c, 0x56, 0x03, 0x00, 0x55, 0x55, 0x00, 0x03, 0x56, 0x0c, 0x59, 0x5a, 0x0f,
0x0c, 0x59, 0x5a, 0x0f, 0x55, 0x00, 0x03, 0x56, 0x56, 0x03, 0x00, 0x55, 0x0f, 0x5a, 0x59, 0x0c,
0x69, 0x3c, 0x3f, 0x6a, 0x30, 0x65, 0x66, 0x33, 0x33, 0x66, 0x65, 0x30, 0x6a, 0x3f, 0x3c, 0x69,
0x03, 0x56, 0x55, 0x00, 0x5a, 0x0f, 0x0c, 0x59, 0x59, 0x0c, 0x0f, 0x5a, 0x00, 0x55, 0x56, 0x03,
0x66, 0x33, 0x30, 0x65, 0x3f, 0x6a, 0x69, 0x3c, 0x3c, 0x69, 0x6a, 0x3f, 0x65, 0x30, 0x33, 0x66,
0x65, 0x30, 0x33, 0x66, 0x3c, 0x69, 0x6a, 0x3f, 0x3f, 0x6a, 0x69, 0x3c, 0x66, 0x33, 0x30, 0x65,
0x00, 0x55, 0x56, 0x03, 0x59, 0x0c, 0x0f, 0x5a, 0x5a, 0x0f, 0x0c, 0x59, 0x03, 0x56, 0x55, 0x00
};
/*
* nand_calculate_ecc - Calculate 3-byte ECC for 256-byte block
*/
int nand_calculate_ecc(struct nand_device_s *device, const uint8_t *dat, uint8_t *ecc_code)
{
uint8_t idx, reg1, reg2, reg3, tmp1, tmp2;
int i;
/* Initialize variables */
reg1 = reg2 = reg3 = 0;
/* Build up column parity */
for (i = 0; i < 256; i++) {
/* Get CP0 - CP5 from table */
idx = nand_ecc_precalc_table[*dat++];
reg1 ^= (idx & 0x3f);
/* All bit XOR = 1 ? */
if (idx & 0x40) {
reg3 ^= (uint8_t) i;
reg2 ^= ~((uint8_t) i);
}
}
/* Create non-inverted ECC code from line parity */
tmp1 = (reg3 & 0x80) >> 0; /* B7 -> B7 */
tmp1 |= (reg2 & 0x80) >> 1; /* B7 -> B6 */
tmp1 |= (reg3 & 0x40) >> 1; /* B6 -> B5 */
tmp1 |= (reg2 & 0x40) >> 2; /* B6 -> B4 */
tmp1 |= (reg3 & 0x20) >> 2; /* B5 -> B3 */
tmp1 |= (reg2 & 0x20) >> 3; /* B5 -> B2 */
tmp1 |= (reg3 & 0x10) >> 3; /* B4 -> B1 */
tmp1 |= (reg2 & 0x10) >> 4; /* B4 -> B0 */
tmp2 = (reg3 & 0x08) << 4; /* B3 -> B7 */
tmp2 |= (reg2 & 0x08) << 3; /* B3 -> B6 */
tmp2 |= (reg3 & 0x04) << 3; /* B2 -> B5 */
tmp2 |= (reg2 & 0x04) << 2; /* B2 -> B4 */
tmp2 |= (reg3 & 0x02) << 2; /* B1 -> B3 */
tmp2 |= (reg2 & 0x02) << 1; /* B1 -> B2 */
tmp2 |= (reg3 & 0x01) << 1; /* B0 -> B1 */
tmp2 |= (reg2 & 0x01) << 0; /* B7 -> B0 */
/* Calculate final ECC code */
#ifdef NAND_ECC_SMC
ecc_code[0] = ~tmp2;
ecc_code[1] = ~tmp1;
#else
ecc_code[0] = ~tmp1;
ecc_code[1] = ~tmp2;
#endif
ecc_code[2] = ((~reg1) << 2) | 0x03;
return 0;
}

174
src/flash/nand_ecc_kw.c Normal file
View File

@@ -0,0 +1,174 @@
/*
* Reed-Solomon ECC handling for the Marvell Kirkwood SOC
* Copyright (C) 2009 Marvell Semiconductor, Inc.
*
* Authors: Lennert Buytenhek <buytenh@wantstofly.org>
* Nicolas Pitre <nico@fluxnic.net>
*
* This file is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 or (at your option) any
* later version.
*
* This file is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <sys/types.h>
#include "nand.h"
/*****************************************************************************
* Arithmetic in GF(2^10) ("F") modulo x^10 + x^3 + 1.
*
* For multiplication, a discrete log/exponent table is used, with
* primitive element x (F is a primitive field, so x is primitive).
*/
#define MODPOLY 0x409 /* x^10 + x^3 + 1 in binary */
/*
* Maps an integer a [0..1022] to a polynomial b = gf_exp[a] in
* GF(2^10) mod x^10 + x^3 + 1 such that b = x ^ a. There's two
* identical copies of this array back-to-back so that we can save
* the mod 1023 operation when doing a GF multiplication.
*/
static uint16_t gf_exp[1023 + 1023];
/*
* Maps a polynomial b in GF(2^10) mod x^10 + x^3 + 1 to an index
* a = gf_log[b] in [0..1022] such that b = x ^ a.
*/
static uint16_t gf_log[1024];
static void gf_build_log_exp_table(void)
{
int i;
int p_i;
/*
* p_i = x ^ i
*
* Initialise to 1 for i = 0.
*/
p_i = 1;
for (i = 0; i < 1023; i++) {
gf_exp[i] = p_i;
gf_exp[i + 1023] = p_i;
gf_log[p_i] = i;
/*
* p_i = p_i * x
*/
p_i <<= 1;
if (p_i & (1 << 10))
p_i ^= MODPOLY;
}
}
/*****************************************************************************
* Reed-Solomon code
*
* This implements a (1023,1015) Reed-Solomon ECC code over GF(2^10)
* mod x^10 + x^3 + 1, shortened to (520,512). The ECC data consists
* of 8 10-bit symbols, or 10 8-bit bytes.
*
* Given 512 bytes of data, computes 10 bytes of ECC.
*
* This is done by converting the 512 bytes to 512 10-bit symbols
* (elements of F), interpreting those symbols as a polynomial in F[X]
* by taking symbol 0 as the coefficient of X^8 and symbol 511 as the
* coefficient of X^519, and calculating the residue of that polynomial
* divided by the generator polynomial, which gives us the 8 ECC symbols
* as the remainder. Finally, we convert the 8 10-bit ECC symbols to 10
* 8-bit bytes.
*
* The generator polynomial is hardcoded, as that is faster, but it
* can be computed by taking the primitive element a = x (in F), and
* constructing a polynomial in F[X] with roots a, a^2, a^3, ..., a^8
* by multiplying the minimal polynomials for those roots (which are
* just 'x - a^i' for each i).
*
* Note: due to unfortunate circumstances, the bootrom in the Kirkwood SOC
* expects the ECC to be computed backward, i.e. from the last byte down
* to the first one.
*/
int nand_calculate_ecc_kw(struct nand_device_s *device, const uint8_t *data, uint8_t *ecc)
{
unsigned int r7, r6, r5, r4, r3, r2, r1, r0;
int i;
static int tables_initialized = 0;
if (!tables_initialized) {
gf_build_log_exp_table();
tables_initialized = 1;
}
/*
* Load bytes 504..511 of the data into r.
*/
r0 = data[504];
r1 = data[505];
r2 = data[506];
r3 = data[507];
r4 = data[508];
r5 = data[509];
r6 = data[510];
r7 = data[511];
/*
* Shift bytes 503..0 (in that order) into r0, followed
* by eight zero bytes, while reducing the polynomial by the
* generator polynomial in every step.
*/
for (i = 503; i >= -8; i--) {
unsigned int d;
d = 0;
if (i >= 0)
d = data[i];
if (r7) {
uint16_t *t = gf_exp + gf_log[r7];
r7 = r6 ^ t[0x21c];
r6 = r5 ^ t[0x181];
r5 = r4 ^ t[0x18e];
r4 = r3 ^ t[0x25f];
r3 = r2 ^ t[0x197];
r2 = r1 ^ t[0x193];
r1 = r0 ^ t[0x237];
r0 = d ^ t[0x024];
} else {
r7 = r6;
r6 = r5;
r5 = r4;
r4 = r3;
r3 = r2;
r2 = r1;
r1 = r0;
r0 = d;
}
}
ecc[0] = r0;
ecc[1] = (r0 >> 8) | (r1 << 2);
ecc[2] = (r1 >> 6) | (r2 << 4);
ecc[3] = (r2 >> 4) | (r3 << 6);
ecc[4] = (r3 >> 2);
ecc[5] = r4;
ecc[6] = (r4 >> 8) | (r5 << 2);
ecc[7] = (r5 >> 6) | (r6 << 4);
ecc[8] = (r6 >> 4) | (r7 << 6);
ecc[9] = (r7 >> 2);
return 0;
}

View File

@@ -1,6 +1,8 @@
/***************************************************************************
* Copyright (C) 2007 by Dominic Rath *
* Dominic.Rath@gmx.de *
* Copyright (C) 2009 Michael Schwingen *
* michael@schwingen.org *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@@ -21,220 +23,378 @@
#include "config.h"
#endif
#include <stdlib.h>
#include "log.h"
#include "flash.h"
#include "cfi.h"
#include "non_cfi.h"
#include "cfi.h"
#define KB 1024
#define MB (1024*1024)
#define ERASE_REGION(num, size) (((size/256) << 16) | (num-1))
/* non-CFI compatible flashes */
non_cfi_t non_cfi_flashes[] = {
static non_cfi_t non_cfi_flashes[] = {
{
.mfr = CFI_MFR_SST,
.id = 0xd4,
.pri_id = 0x02,
.dev_size = 0x10, /* 2^16 = 64KB */
.dev_size = 64*KB,
.interface_desc = 0x0, /* x8 only device */
.max_buf_write_size = 0x0,
.status_poll_mask = CFI_STATUS_POLL_MASK_DQ5_DQ6_DQ7,
.num_erase_regions = 1,
.erase_region_info =
{
0x0010000f, /* 16x 4KB */
0x00000000
ERASE_REGION(16, 4*KB)
}
},
{
.mfr = CFI_MFR_SST,
.id = 0xd5,
.pri_id = 0x02,
.dev_size = 0x11, /* 2^17 = 128KB */
.dev_size = 128*KB,
.interface_desc = 0x0, /* x8 only device */
.max_buf_write_size = 0x0,
.status_poll_mask = CFI_STATUS_POLL_MASK_DQ5_DQ6_DQ7,
.num_erase_regions = 1,
.erase_region_info =
{
0x0010001f,
0x00000000
ERASE_REGION(32, 4*KB)
}
},
{
.mfr = CFI_MFR_SST,
.id = 0xd6,
.pri_id = 0x02,
.dev_size = 0x12, /* 2^18 = 256KB */
.dev_size = 256*KB,
.interface_desc = 0x0, /* x8 only device */
.max_buf_write_size = 0x0,
.status_poll_mask = CFI_STATUS_POLL_MASK_DQ5_DQ6_DQ7,
.num_erase_regions = 1,
.erase_region_info =
{
0x0010003f,
0x00000000
ERASE_REGION(64, 4*KB)
}
},
{
.mfr = CFI_MFR_SST,
.id = 0xd7,
.pri_id = 0x02,
.dev_size = 0x13, /* 2^19 = 512KB */
.dev_size = 512*KB,
.interface_desc = 0x0, /* x8 only device */
.max_buf_write_size = 0x0,
.status_poll_mask = CFI_STATUS_POLL_MASK_DQ5_DQ6_DQ7,
.num_erase_regions = 1,
.erase_region_info =
{
0x0010007f,
0x00000000
ERASE_REGION(128, 4*KB)
}
},
{
.mfr = CFI_MFR_SST,
.id = 0x2780,
.pri_id = 0x02,
.dev_size = 0x13, /* 2^19 = 512KB */
.dev_size = 512*KB,
.interface_desc = 0x2, /* x8 or x16 device */
.max_buf_write_size = 0x0,
.status_poll_mask = CFI_STATUS_POLL_MASK_DQ5_DQ6_DQ7,
.num_erase_regions = 1,
.erase_region_info =
{
0x0010007f,
0x00000000
ERASE_REGION(128, 4*KB)
}
},
{
.mfr = CFI_MFR_ST,
.id = 0xd6, /* ST29F400BB */
.pri_id = 0x02,
.dev_size = 0x13, /* 2^19 = 512KB */
.dev_size = 512*KB,
.interface_desc = 0x2, /* x8 or x16 device with nBYTE */
.max_buf_write_size = 0x0,
.status_poll_mask = CFI_STATUS_POLL_MASK_DQ5_DQ6_DQ7,
.num_erase_regions = 4,
.erase_region_info =
{
0x00400000, /* 1x 16KB */
0x00200001, /* 2x 8KB */
0x00800000, /* 1x 32KB */
0x01000006, /* 7x 64KB */
0x00000000
ERASE_REGION(1, 16*KB),
ERASE_REGION(2, 8*KB),
ERASE_REGION(1, 32*KB),
ERASE_REGION(7, 64*KB)
}
},
{
.mfr = CFI_MFR_ST,
.id = 0xd5, /* ST29F400BT */
.pri_id = 0x02,
.dev_size = 0x13, /* 2^19 = 512KB */
.dev_size = 512*KB,
.interface_desc = 0x2, /* x8 or x16 device with nBYTE */
.max_buf_write_size = 0x0,
.status_poll_mask = CFI_STATUS_POLL_MASK_DQ5_DQ6_DQ7,
.num_erase_regions = 4,
.erase_region_info =
{
0x01000006, /* 7x 64KB */
0x00800000, /* 1x 32KB */
0x00200001, /* 2x 8KB */
0x00400000, /* 1x 16KB */
0x00000000
ERASE_REGION(7, 64*KB),
ERASE_REGION(1, 32*KB),
ERASE_REGION(2, 8*KB),
ERASE_REGION(1, 16*KB)
}
},
/* SST 39VF* do not support DQ5 status polling - this currently is
only supported by the host algorithm, not by the target code using
the work area.
Only true for 8-bit and 32-bit wide memories. 16-bit wide memories
without DQ5 status polling are supported by the target code.
*/
{
.mfr = CFI_MFR_SST,
.id = 0x2782, /* SST39xF160 */
.pri_id = 0x02,
.dev_size = 2*MB,
.interface_desc = 0x2, /* x8 or x16 device with nBYTE */
.max_buf_write_size = 0x0,
.status_poll_mask = CFI_STATUS_POLL_MASK_DQ6_DQ7,
.num_erase_regions = 1,
.erase_region_info =
{
ERASE_REGION(512, 4*KB)
}
},
{
.mfr = CFI_MFR_SST,
.id = 0x2783, /* SST39VF320 */
.pri_id = 0x02,
.dev_size = 4*MB,
.interface_desc = 0x2, /* x8 or x16 device with nBYTE */
.max_buf_write_size = 0x0,
.status_poll_mask = CFI_STATUS_POLL_MASK_DQ6_DQ7,
.num_erase_regions = 1,
.erase_region_info =
{
ERASE_REGION(1024, 4*KB)
}
},
{
.mfr = CFI_MFR_SST,
.id = 0x234b, /* SST39VF1601 */
.pri_id = 0x02,
.dev_size = 2*MB,
.interface_desc = 0x2, /* x8 or x16 device with nBYTE */
.max_buf_write_size = 0x0,
.status_poll_mask = CFI_STATUS_POLL_MASK_DQ6_DQ7,
.num_erase_regions = 1,
.erase_region_info =
{
ERASE_REGION(512, 4*KB)
}
},
{
.mfr = CFI_MFR_SST,
.id = 0x234a, /* SST39VF1602 */
.pri_id = 0x02,
.dev_size = 2*MB,
.interface_desc = 0x2, /* x8 or x16 device with nBYTE */
.max_buf_write_size = 0x0,
.status_poll_mask = CFI_STATUS_POLL_MASK_DQ6_DQ7,
.num_erase_regions = 1,
.erase_region_info =
{
ERASE_REGION(512, 4*KB)
}
},
{
.mfr = CFI_MFR_SST,
.id = 0x235b, /* SST39VF3201 */
.pri_id = 0x02,
.dev_size = 4*MB,
.interface_desc = 0x2, /* x8 or x16 device with nBYTE */
.max_buf_write_size = 0x0,
.status_poll_mask = CFI_STATUS_POLL_MASK_DQ6_DQ7,
.num_erase_regions = 1,
.erase_region_info =
{
ERASE_REGION(1024, 4*KB)
}
},
{
.mfr = CFI_MFR_SST,
.id = 0x235a, /* SST39VF3202 */
.pri_id = 0x02,
.dev_size = 4*MB,
.interface_desc = 0x2, /* x8 or x16 device with nBYTE */
.max_buf_write_size = 0x0,
.status_poll_mask = CFI_STATUS_POLL_MASK_DQ6_DQ7,
.num_erase_regions = 1,
.erase_region_info =
{
ERASE_REGION(1024, 4*KB)
}
},
{
.mfr = CFI_MFR_AMD,
.id = 0x22ab, /* AM29F400BB */
.pri_id = 0x02,
.dev_size = 0x13, /* 2^19 = 512KB */
.dev_size = 512*KB,
.interface_desc = 0x2, /* x8 or x16 device with nBYTE */
.max_buf_write_size = 0x0,
.status_poll_mask = CFI_STATUS_POLL_MASK_DQ5_DQ6_DQ7,
.num_erase_regions = 4,
.erase_region_info =
{
0x00400000, /* 1x 16KB */
0x00200001, /* 2x 8KB */
0x00800000, /* 1x 32KB */
0x01000006, /* 7x 64KB */
0x00000000
ERASE_REGION(1, 16*KB),
ERASE_REGION(2, 8*KB),
ERASE_REGION(1, 32*KB),
ERASE_REGION(7, 64*KB)
}
},
{
.mfr = CFI_MFR_AMD,
.id = 0x2223, /* AM29F400BT */
.pri_id = 0x02,
.dev_size = 0x13, /* 2^19 = 512KB */
.dev_size = 512*KB,
.interface_desc = 0x2, /* x8 or x16 device with nBYTE */
.max_buf_write_size = 0x0,
.status_poll_mask = CFI_STATUS_POLL_MASK_DQ5_DQ6_DQ7,
.num_erase_regions = 4,
.erase_region_info =
{
0x01000006, /* 7x 64KB */
0x00800000, /* 1x 32KB */
0x00200001, /* 2x 8KB */
0x00400000, /* 1x 16KB */
0x00000000
ERASE_REGION(7, 64*KB),
ERASE_REGION(1, 32*KB),
ERASE_REGION(2, 8*KB),
ERASE_REGION(1, 16*KB)
}
},
{
.mfr = CFI_MFR_FUJITSU,
.id = 0x226b, /* AM29SL800DB */
.pri_id = 0x02,
.dev_size = 0x14, /* 2^20 = 1MB */
.dev_size = 1*MB,
.interface_desc = 0x2, /* x8 or x16 device with nBYTE */
.max_buf_write_size = 0x0,
.status_poll_mask = CFI_STATUS_POLL_MASK_DQ5_DQ6_DQ7,
.num_erase_regions = 4,
.erase_region_info =
{
0x00400000, /* 1x 16KB */
0x00200001, /* 2x 8KB */
0x00800000, /* 1x 32KB */
0x0100000e, /* 15x 64KB */
0x00000000
ERASE_REGION(1, 16*KB),
ERASE_REGION(2, 8*KB),
ERASE_REGION(1, 32*KB),
ERASE_REGION(15, 64*KB)
}
},
{
.mfr = CFI_MFR_AMIC,
.id = 0xb31a, /* A29L800A */
.pri_id = 0x02,
.dev_size = 0x14,
.dev_size = 1*MB,
.interface_desc = 0x2,
.max_buf_write_size = 0x0,
.status_poll_mask = CFI_STATUS_POLL_MASK_DQ5_DQ6_DQ7,
.num_erase_regions = 4,
.erase_region_info =
{
0x00400000, /* 1x 16KB */
0x00200001, /* 2x 8KB */
0x00800000, /* 1x 32KB */
0x0100000e, /* 15x 64KB */
0x00000000
ERASE_REGION(1, 16*KB),
ERASE_REGION(2, 8*KB),
ERASE_REGION(1, 32*KB),
ERASE_REGION(15, 64*KB)
}
},
{
.mfr = CFI_MFR_MX,
.id = 0x225b, /* MX29LV800B */
.pri_id = 0x02,
.dev_size = 0x14, /* 2^20 = 1MB */
.dev_size = 1*MB,
.interface_desc = 0x2, /* x8 or x16 device with nBYTE */
.max_buf_write_size = 0x0,
.status_poll_mask = CFI_STATUS_POLL_MASK_DQ5_DQ6_DQ7,
.num_erase_regions = 4,
.erase_region_info =
{
0x00400000, /* 1x 16KB */
0x00200001, /* 2x 8KB */
0x00800000, /* 1x 32KB */
0x0100000e, /* 15x 64KB */
0x00000000
ERASE_REGION(1, 16*KB),
ERASE_REGION(2, 8*KB),
ERASE_REGION(1, 32*KB),
ERASE_REGION(15, 64*KB)
}
},
{
.mfr = CFI_MFR_MX,
.id = 0x2249, /* MX29LV160AB: 2MB */
.pri_id = 0x02,
.dev_size = 2*MB,
.interface_desc = 0x2, /* x8 or x16 device with nBYTE */
.max_buf_write_size = 0x0,
.status_poll_mask = CFI_STATUS_POLL_MASK_DQ5_DQ6_DQ7,
.num_erase_regions = 4,
.erase_region_info =
{
ERASE_REGION(1, 16*KB),
ERASE_REGION(2, 8*KB),
ERASE_REGION(1, 32*KB),
ERASE_REGION(31, 64*KB)
}
},
{
.mfr = CFI_MFR_MX,
.id = 0x22C4, /* MX29LV160AT: 2MB */
.pri_id = 0x02,
.dev_size = 2*MB,
.interface_desc = 0x2, /* x8 or x16 device with nBYTE */
.max_buf_write_size = 0x0,
.status_poll_mask = CFI_STATUS_POLL_MASK_DQ5_DQ6_DQ7,
.num_erase_regions = 4,
.erase_region_info =
{
ERASE_REGION(31, 64*KB),
ERASE_REGION(1, 32*KB),
ERASE_REGION(2, 8*KB),
ERASE_REGION(1, 16*KB)
}
},
{
.mfr = CFI_MFR_ATMEL,
.id = 0x00c0, /* Atmel 49BV1614 */
.pri_id = 0x02,
.dev_size = 2*MB,
.interface_desc = 0x2, /* x8 or x16 device with nBYTE */
.max_buf_write_size = 0x0,
.status_poll_mask = CFI_STATUS_POLL_MASK_DQ5_DQ6_DQ7,
.num_erase_regions = 3,
.erase_region_info =
{
ERASE_REGION(8, 8*KB),
ERASE_REGION(2, 32*KB),
ERASE_REGION(30, 64*KB)
}
},
{
.mfr = CFI_MFR_ATMEL,
.id = 0xC2, /* Atmel 49BV1614T */
.pri_id = 0x02,
.dev_size = 2*MB,
.interface_desc = 0x2, /* x8 or x16 device with nBYTE */
.max_buf_write_size = 0x0,
.status_poll_mask = CFI_STATUS_POLL_MASK_DQ5_DQ6_DQ7,
.num_erase_regions = 3,
.erase_region_info =
{
ERASE_REGION(30, 64*KB),
ERASE_REGION(2, 32*KB),
ERASE_REGION(8, 8*KB)
}
},
{
.mfr = CFI_MFR_AMD,
.id = 0x225b, /* S29AL008D */
.pri_id = 0x02,
.dev_size = 0x14, /* 2^20 = 1MB */
.dev_size = 1*MB,
.interface_desc = 0x2, /* x8 or x16 device with nBYTE */
.max_buf_write_size = 0x0,
.status_poll_mask = CFI_STATUS_POLL_MASK_DQ5_DQ6_DQ7,
.num_erase_regions = 4,
.erase_region_info =
{
0x00400000, /* 1x 16KB */
0x00200001, /* 2x 8KB */
0x00800000, /* 1x 32KB */
0x0100000e, /* 15x 64KB */
0x00000000
ERASE_REGION(1, 16*KB),
ERASE_REGION(2, 8*KB),
ERASE_REGION(1, 32*KB),
ERASE_REGION(15, 64*KB)
}
},
{
@@ -243,23 +403,26 @@ non_cfi_t non_cfi_flashes[] = {
}
};
void cfi_fixup_non_cfi(flash_bank_t *bank, void *param)
void cfi_fixup_non_cfi(flash_bank_t *bank)
{
cfi_flash_bank_t *cfi_info = bank->driver_priv;
non_cfi_t *non_cfi = non_cfi_flashes;
while (non_cfi->mfr)
for (non_cfi = non_cfi_flashes; non_cfi->mfr; non_cfi++)
{
if ((cfi_info->manufacturer == non_cfi->mfr)
&& (cfi_info->device_id == non_cfi->id))
{
break;
}
non_cfi++;
}
/* only fixup jedec flashs found in table */
if (!non_cfi->mfr)
return;
cfi_info->not_cfi = 1;
/* fill in defaults for non-critical data */
cfi_info->vcc_min = 0x0;
cfi_info->vcc_max = 0x0;
@@ -273,22 +436,24 @@ void cfi_fixup_non_cfi(flash_bank_t *bank, void *param)
cfi_info->buf_write_timeout_max = 0x0;
cfi_info->block_erase_timeout_max = 0x0;
cfi_info->chip_erase_timeout_max = 0x0;
cfi_info->qry[0] = 'Q';
cfi_info->qry[1] = 'R';
cfi_info->qry[2] = 'Y';
cfi_info->pri_id = non_cfi->pri_id;
cfi_info->pri_addr = 0x0;
cfi_info->alt_id = 0x0;
cfi_info->alt_addr = 0x0;
cfi_info->alt_ext = NULL;
cfi_info->interface_desc = non_cfi->interface_desc;
cfi_info->max_buf_write_size = non_cfi->max_buf_write_size;
cfi_info->status_poll_mask = non_cfi->status_poll_mask;
cfi_info->num_erase_regions = non_cfi->num_erase_regions;
cfi_info->erase_region_info = non_cfi->erase_region_info;
cfi_info->dev_size = non_cfi->dev_size;
if (cfi_info->pri_id == 0x2)
{
cfi_spansion_pri_ext_t *pri_ext = malloc(sizeof(cfi_spansion_pri_ext_t));
@@ -296,10 +461,10 @@ void cfi_fixup_non_cfi(flash_bank_t *bank, void *param)
pri_ext->pri[0] = 'P';
pri_ext->pri[1] = 'R';
pri_ext->pri[2] = 'I';
pri_ext->major_version = '1';
pri_ext->minor_version = '0';
pri_ext->SiliconRevision = 0x0;
pri_ext->EraseSuspend = 0x0;
pri_ext->EraseSuspend = 0x0;
@@ -312,9 +477,11 @@ void cfi_fixup_non_cfi(flash_bank_t *bank, void *param)
pri_ext->VppMin = 0x0;
pri_ext->VppMax = 0x0;
pri_ext->TopBottom = 0x0;
pri_ext->_unlock1 = 0x5555;
pri_ext->_unlock2 = 0x2AAA;
pri_ext->_reversed_geometry = 0;
cfi_info->pri_ext = pri_ext;
} else if ((cfi_info->pri_id == 0x1) || (cfi_info->pri_id == 0x3))
{

View File

@@ -20,21 +20,21 @@
#ifndef NON_CFI_H
#define NON_CFI_H
#include "types.h"
#include "flash.h"
typedef struct non_cfi_s
{
u16 mfr;
u16 id;
u16 pri_id;
u8 dev_size;
u16 interface_desc;
u16 max_buf_write_size;
u8 num_erase_regions;
u32 erase_region_info[6];
uint16_t mfr;
uint16_t id;
uint16_t pri_id;
uint32_t dev_size;
uint16_t interface_desc;
uint16_t max_buf_write_size;
uint8_t num_erase_regions;
uint32_t erase_region_info[6];
uint8_t status_poll_mask;
} non_cfi_t;
extern non_cfi_t non_cfi_flashes[];
extern void cfi_fixup_non_cfi(flash_bank_t *bank, void *param);
extern void cfi_fixup_non_cfi(flash_bank_t *bank);
#endif /* NON_CFI_H */

View File

@@ -21,32 +21,21 @@
#include "config.h"
#endif
#include "replacements.h"
#include "ocl.h"
#include "flash.h"
#include "target.h"
#include "log.h"
#include "binarybuffer.h"
#include "types.h"
#include "embeddedice.h"
#include "arm7_9_common.h"
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
int ocl_register_commands(struct command_context_s *cmd_ctx);
int ocl_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank);
int ocl_erase(struct flash_bank_s *bank, int first, int last);
int ocl_protect(struct flash_bank_s *bank, int set, int first, int last);
int ocl_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count);
int ocl_probe(struct flash_bank_s *bank);
int ocl_erase_check(struct flash_bank_s *bank);
int ocl_protect_check(struct flash_bank_s *bank);
int ocl_info(struct flash_bank_s *bank, char *buf, int buf_size);
int ocl_auto_probe(struct flash_bank_s *bank);
static int ocl_register_commands(struct command_context_s *cmd_ctx);
static int ocl_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank);
static int ocl_erase(struct flash_bank_s *bank, int first, int last);
static int ocl_protect(struct flash_bank_s *bank, int set, int first, int last);
static int ocl_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count);
static int ocl_probe(struct flash_bank_s *bank);
static int ocl_erase_check(struct flash_bank_s *bank);
static int ocl_protect_check(struct flash_bank_s *bank);
static int ocl_info(struct flash_bank_s *bank, char *buf, int buf_size);
static int ocl_auto_probe(struct flash_bank_s *bank);
flash_driver_t ocl_flash =
{
@@ -66,27 +55,27 @@ flash_driver_t ocl_flash =
typedef struct ocl_priv_s
{
arm_jtag_t *jtag_info;
int buflen;
int bufalign;
unsigned int buflen;
unsigned int bufalign;
} ocl_priv_t;
int ocl_register_commands(struct command_context_s *cmd_ctx)
static int ocl_register_commands(struct command_context_s *cmd_ctx)
{
return ERROR_OK;
}
int ocl_erase_check(struct flash_bank_s *bank)
static int ocl_erase_check(struct flash_bank_s *bank)
{
return ERROR_OK;
}
int ocl_protect_check(struct flash_bank_s *bank)
static int ocl_protect_check(struct flash_bank_s *bank)
{
return ERROR_OK;
}
/* flash_bank ocl 0 0 0 0 <target#> */
int ocl_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank)
static int ocl_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank)
{
int retval;
armv4_5_common_t *armv4_5;
@@ -110,22 +99,22 @@ int ocl_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **
return ERROR_OK;
}
int ocl_erase(struct flash_bank_s *bank, int first, int last)
static int ocl_erase(struct flash_bank_s *bank, int first, int last)
{
ocl_priv_t *ocl = bank->driver_priv;
int retval;
u32 dcc_buffer[3];
uint32_t dcc_buffer[3];
/* check preconditions */
if (bank->num_sectors == 0)
return ERROR_FLASH_BANK_NOT_PROBED;
if (bank->target->state != TARGET_RUNNING)
{
LOG_ERROR("target has to be running to communicate with the loader");
return ERROR_TARGET_NOT_RUNNING;
}
if ((first == 0) && (last == bank->num_sectors - 1))
{
dcc_buffer[0] = OCL_ERASE_ALL;
@@ -150,40 +139,40 @@ int ocl_erase(struct flash_bank_s *bank, int first, int last)
}
/* receive response */
if ((retval = embeddedice_receive(ocl->jtag_info, dcc_buffer+1, 1) != ERROR_OK))
if ((retval = embeddedice_receive(ocl->jtag_info, dcc_buffer + 1, 1) != ERROR_OK))
return retval;
if (dcc_buffer[1] != OCL_CMD_DONE)
{
if (dcc_buffer[0] == OCL_ERASE_ALL)
LOG_ERROR("loader response to OCL_ERASE_ALL 0x%08X", dcc_buffer[1]);
LOG_ERROR("loader response to OCL_ERASE_ALL 0x%08" PRIx32 "", dcc_buffer[1]);
else
LOG_ERROR("loader response to OCL_ERASE_BLOCK 0x%08X", dcc_buffer[1]);
LOG_ERROR("loader response to OCL_ERASE_BLOCK 0x%08" PRIx32 "", dcc_buffer[1]);
return ERROR_FLASH_OPERATION_FAILED;
}
return ERROR_OK;
}
int ocl_protect(struct flash_bank_s *bank, int set, int first, int last)
static int ocl_protect(struct flash_bank_s *bank, int set, int first, int last)
{
return ERROR_OK;
}
int ocl_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count)
static int ocl_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count)
{
ocl_priv_t *ocl = bank->driver_priv;
int retval;
u32 *dcc_buffer;
u32 *dcc_bufptr;
uint32_t *dcc_buffer;
uint32_t *dcc_bufptr;
int byteofs;
int runlen;
u32 chksum;
uint32_t chksum;
int i;
/* check preconditions */
if (ocl->buflen == 0 || ocl->bufalign==0)
if (ocl->buflen == 0 || ocl->bufalign == 0)
return ERROR_FLASH_BANK_NOT_PROBED;
if (bank->target->state != TARGET_RUNNING)
@@ -193,7 +182,7 @@ int ocl_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count)
}
/* allocate buffer for max. ocl buffer + overhead */
dcc_buffer = malloc(sizeof(u32)*(ocl->buflen/4+3));
dcc_buffer = malloc(sizeof(uint32_t)*(ocl->buflen/4 + 3));
while (count)
{
@@ -211,7 +200,7 @@ int ocl_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count)
chksum = OCL_CHKS_INIT;
/* copy data to DCC buffer in proper byte order and properly aligned */
for (i=0; i<runlen; i++)
for (i = 0; i < runlen; i++)
{
switch (byteofs++)
{
@@ -219,13 +208,13 @@ int ocl_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count)
*dcc_bufptr &= *(buffer++) | 0xffffff00;
break;
case 1:
*dcc_bufptr &= ((*(buffer++))<<8) | 0xffff00ff;
*dcc_bufptr &= ((*(buffer++)) << 8) | 0xffff00ff;
break;
case 2:
*dcc_bufptr &= ((*(buffer++))<<16) | 0xff00ffff;
*dcc_bufptr &= ((*(buffer++)) << 16) | 0xff00ffff;
break;
case 3:
*dcc_bufptr &= ((*(buffer++))<<24) | 0x00ffffff;
*dcc_bufptr &= ((*(buffer++)) << 24) | 0x00ffffff;
chksum ^= *(dcc_bufptr++);
*dcc_bufptr = 0xffffffff;
byteofs = 0;
@@ -238,7 +227,7 @@ int ocl_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count)
chksum ^= *(dcc_bufptr++);
*(dcc_bufptr++) = chksum;
/* send the data */
if ((retval = embeddedice_send(ocl->jtag_info, dcc_buffer, dcc_bufptr-dcc_buffer)) != ERROR_OK)
{
@@ -264,7 +253,7 @@ int ocl_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count)
if (dcc_buffer[0] != OCL_CMD_DONE)
{
LOG_ERROR("loader response to OCL_FLASH_BLOCK 0x%08X", dcc_buffer[0]);
LOG_ERROR("loader response to OCL_FLASH_BLOCK 0x%08" PRIx32 "", dcc_buffer[0]);
free(dcc_buffer);
return ERROR_FLASH_OPERATION_FAILED;
}
@@ -277,11 +266,11 @@ int ocl_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count)
return ERROR_OK;
}
int ocl_probe(struct flash_bank_s *bank)
static int ocl_probe(struct flash_bank_s *bank)
{
ocl_priv_t *ocl = bank->driver_priv;
int retval;
u32 dcc_buffer[1];
uint32_t dcc_buffer[1];
int sectsize;
int i;
@@ -303,10 +292,10 @@ int ocl_probe(struct flash_bank_s *bank)
/* receive response */
if ((retval = embeddedice_receive(ocl->jtag_info, dcc_buffer, 1) != ERROR_OK))
return retval;
if (dcc_buffer[0] != OCL_CMD_DONE)
{
LOG_ERROR("loader response to OCL_PROBE 0x%08X", dcc_buffer[0]);
LOG_ERROR("loader response to OCL_PROBE 0x%08" PRIx32 "", dcc_buffer[0]);
return ERROR_FLASH_OPERATION_FAILED;
}
@@ -343,7 +332,7 @@ int ocl_probe(struct flash_bank_s *bank)
return ERROR_FLASH_BANK_INVALID;
}
sectsize = bank->size / bank->num_sectors;
for (i=0; i<bank->num_sectors; i++)
for (i = 0; i < bank->num_sectors; i++)
{
bank->sectors[i].offset = i * sectsize;
bank->sectors[i].size = sectsize;
@@ -375,16 +364,16 @@ int ocl_probe(struct flash_bank_s *bank)
return ERROR_OK;
}
int ocl_info(struct flash_bank_s *bank, char *buf, int buf_size)
static int ocl_info(struct flash_bank_s *bank, char *buf, int buf_size)
{
return ERROR_OK;
}
int ocl_auto_probe(struct flash_bank_s *bank)
static int ocl_auto_probe(struct flash_bank_s *bank)
{
ocl_priv_t *ocl = bank->driver_priv;
if (ocl->buflen == 0 || ocl->bufalign==0)
if (ocl->buflen == 0 || ocl->bufalign == 0)
return ERROR_FLASH_BANK_NOT_PROBED;
return ERROR_OK;

View File

@@ -1,30 +1,30 @@
/****************************************************************************
* Copyright (c) 2006 by Michael Fischer. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the author nor the names of its contributors may
* be used to endorse or promote products derived from this software
* 3. Neither the name of the author nor the names of its contributors may
* be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
* THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
* THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
****************************************************************************
@@ -94,11 +94,11 @@ SECTIONS
*(COMMON)
. = ALIGN(4);
PROVIDE (__bss_end = .);
. = ALIGN(256);
PROVIDE (__stack_start = .);
PROVIDE (__stack_fiq_start = .);
. += FIQ_STACK_SIZE;
. = ALIGN(4);
@@ -124,9 +124,9 @@ SECTIONS
. = ALIGN(4);
PROVIDE (__stack_svc_end = .);
PROVIDE (__stack_end = .);
PROVIDE (__heap_start = .);
PROVIDE (__heap_start = .);
} > ram
}
/*** EOF ***/

View File

@@ -1,30 +1,30 @@
/****************************************************************************
* Copyright (c) 2006 by Michael Fischer. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the author nor the names of its contributors may
* be used to endorse or promote products derived from this software
* 3. Neither the name of the author nor the names of its contributors may
* be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
* THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
* THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
****************************************************************************
@@ -33,14 +33,14 @@
*
* 18.12.06 mifi First Version
* The hardware initialization is based on the startup file
* crtat91sam7x256_rom.S from NutOS 4.2.1.
* crtat91sam7x256_rom.S from NutOS 4.2.1.
* Therefore partial copyright by egnite Software GmbH.
****************************************************************************/
/*
* Some defines for the program status registers
*/
ARM_MODE_USER = 0x10 /* Normal User Mode */
ARM_MODE_USER = 0x10 /* Normal User Mode */
ARM_MODE_FIQ = 0x11 /* FIQ Fast Interrupts Mode */
ARM_MODE_IRQ = 0x12 /* IRQ Standard Interrupts Mode */
ARM_MODE_SVC = 0x13 /* Supervisor Interrupts Mode */
@@ -48,10 +48,10 @@
ARM_MODE_UNDEF = 0x1B /* Undefined Instructions Mode */
ARM_MODE_SYS = 0x1F /* System Running in Priviledged Operating Mode */
ARM_MODE_MASK = 0x1F
I_BIT = 0x80 /* disable IRQ when I bit is set */
F_BIT = 0x40 /* disable IRQ when I bit is set */
/*
* Register Base Address
*/
@@ -70,10 +70,10 @@
MC_BASE = 0xFFFFFF00
MC_FMR_OFF = 0x00000060
MC_FWS_1FWS = 0x00480100
.section .vectors,"ax"
.code 32
/****************************************************************************/
/* Vector table and reset entry */
/****************************************************************************/
@@ -101,7 +101,7 @@ FIQAddr: .word FIQHandler
.section .init, "ax"
.code 32
.global ResetHandler
.global ExitFunction
.extern main
@@ -116,7 +116,7 @@ ResetHandler:
ldr r0, =WDT_WDDIS
str r0, [r1, #WDT_MR_OFF]
/*
* Enable user reset: assertion length programmed to 1ms
*/
@@ -124,7 +124,7 @@ ResetHandler:
ldr r1, =RSTC_MR
str r0, [r1, #0]
/*
* Use 2 cycles for flash access.
*/
@@ -141,22 +141,22 @@ ResetHandler:
str r0, [r1, #AIC_EOICR_OFF]
str r0, [r1, #AIC_IDCR_OFF]
/*
* Setup a stack for each mode
*/
msr CPSR_c, #ARM_MODE_UNDEF | I_BIT | F_BIT /* Undefined Instruction Mode */
*/
msr CPSR_c, #ARM_MODE_UNDEF | I_BIT | F_BIT /* Undefined Instruction Mode */
ldr sp, =__stack_und_end
msr CPSR_c, #ARM_MODE_ABORT | I_BIT | F_BIT /* Abort Mode */
ldr sp, =__stack_abt_end
msr CPSR_c, #ARM_MODE_FIQ | I_BIT | F_BIT /* FIQ Mode */
msr CPSR_c, #ARM_MODE_FIQ | I_BIT | F_BIT /* FIQ Mode */
ldr sp, =__stack_fiq_end
msr CPSR_c, #ARM_MODE_IRQ | I_BIT | F_BIT /* IRQ Mode */
msr CPSR_c, #ARM_MODE_IRQ | I_BIT | F_BIT /* IRQ Mode */
ldr sp, =__stack_irq_end
msr CPSR_c, #ARM_MODE_SVC | I_BIT | F_BIT /* Supervisor Mode */
ldr sp, =__stack_svc_end
@@ -171,27 +171,27 @@ bss_clear_loop:
cmp r1, r2
strne r3, [r1], #+4
bne bss_clear_loop
/*
* Jump to main
*/
mrs r0, cpsr
bic r0, r0, #I_BIT | F_BIT /* Enable FIQ and IRQ interrupt */
msr cpsr, r0
mov r0, #0 /* No arguments */
mov r1, #0 /* No arguments */
ldr r2, =main
mov lr, pc
bx r2 /* And jump... */
ExitFunction:
nop
nop
nop
b ExitFunction
b ExitFunction
/****************************************************************************/
/* Default interrupt handler */
@@ -199,7 +199,7 @@ ExitFunction:
UndefHandler:
b UndefHandler
SWIHandler:
b SWIHandler
@@ -208,13 +208,13 @@ PAbortHandler:
DAbortHandler:
b DAbortHandler
IRQHandler:
b IRQHandler
FIQHandler:
b FIQHandler
.weak ExitFunction
.weak UndefHandler, PAbortHandler, DAbortHandler
.weak IRQHandler, FIQHandler

View File

@@ -26,10 +26,10 @@ uint32 dcc_rd(void)
volatile uint32 dcc_reg;
do {
asm volatile ("mrc p14, 0, %0, C0, C0" : "=r" (dcc_reg) : );
} while ((dcc_reg&1)==0);
asm volatile ("mrc p14, 0, %0, C0, C0" : "=r" (dcc_reg) :);
} while ((dcc_reg&1) == 0);
asm volatile ("mrc p14, 0, %0, C1, C0" : "=r" (dcc_reg) : );
asm volatile ("mrc p14, 0, %0, C1, C0" : "=r" (dcc_reg) :);
return dcc_reg;
}
@@ -40,7 +40,7 @@ int dcc_wr(uint32 data)
volatile uint32 dcc_reg;
do {
asm volatile ("mrc p14, 0, %0, C0, C0" : "=r" (dcc_reg) : );
asm volatile ("mrc p14, 0, %0, C0, C0" : "=r" (dcc_reg) :);
/* operation controled by master, cancel operation
upon reception of data for immediate response */
if (dcc_reg&1) return -1;

View File

@@ -39,40 +39,40 @@ void cmd_flash(uint32 cmd)
int pagenum;
int result;
adr=dcc_rd();
len=cmd&0xffff;
ofs=adr%flash_page_size;
bi_start=ofs/4;
bi_end=(ofs+len+3)/4;
adr = dcc_rd();
len = cmd&0xffff;
ofs = adr%flash_page_size;
bi_start = ofs/4;
bi_end = (ofs + len + 3)/4;
if (bi_end>BUFSIZE) {
if (bi_end > BUFSIZE) {
dcc_wr(OCL_BUFF_OVER);
return;
}
chksum=OCL_CHKS_INIT;
for (bi=0; bi<bi_end; bi++) chksum^=buffer[bi]=dcc_rd();
chksum = OCL_CHKS_INIT;
for (bi = 0; bi < bi_end; bi++) chksum^=buffer[bi]=dcc_rd();
if (dcc_rd()!=chksum) {
if (dcc_rd() != chksum) {
dcc_wr(OCL_CHKS_FAIL);
return;
}
/* fill in unused positions with unprogrammed values */
for (bi=0; bi<bi_start; bi++) buffer[bi]=0xffffffff;
for (bi=bi_end; bi%flash_page_size; bi++) buffer[bi]=0xffffffff;
for (bi = 0; bi < bi_start; bi++) buffer[bi]=0xffffffff;
for (bi = bi_end; bi%flash_page_size; bi++) buffer[bi]=0xffffffff;
result=0;
pagenum=adr/flash_page_size;
for (bi=0; bi<bi_end; bi+=flash_page_size/4) {
result=flash_page_program(buffer+bi, pagenum++);
result = 0;
pagenum = adr/flash_page_size;
for (bi = 0; bi < bi_end; bi += flash_page_size/4) {
result = flash_page_program(buffer + bi, pagenum++);
if (result) break;
}
/* verify written data */
if (!result) result=flash_verify(adr, len, ((uint8 *)buffer)+ofs);
if (!result) result = flash_verify(adr, len, ((uint8 *)buffer) + ofs);
dcc_wr(OCL_CMD_DONE|result);
dcc_wr(OCL_CMD_DONE | result);
}
@@ -81,17 +81,17 @@ int main (void)
uint32 cmd;
for (;;) {
cmd=dcc_rd();
cmd = dcc_rd();
switch (cmd&OCL_CMD_MASK) {
case OCL_PROBE:
dcc_wr(OCL_CMD_DONE|flash_init());
dcc_wr(OCL_CMD_DONE | flash_init());
dcc_wr(0x100000); /* base */
dcc_wr(flash_page_count*flash_page_size); /* size */
dcc_wr(1); /* num_sectors */
dcc_wr(4096 | ((unsigned long) flash_page_size<<16)); /* buflen and bufalign */
dcc_wr(4096 | ((unsigned long) flash_page_size << 16)); /* buflen and bufalign */
break;
case OCL_ERASE_ALL:
dcc_wr(OCL_CMD_DONE|flash_erase_all());
dcc_wr(OCL_CMD_DONE | flash_erase_all());
break;
case OCL_FLASH_BLOCK:
cmd_flash(cmd);

View File

@@ -13,19 +13,19 @@ OBJDUMP = $(TRGT)objdump
MCU = arm7tdmi
# List all default C defines here, like -D_DEBUG=1
DDEFS =
DDEFS =
# List all default ASM defines here, like -D_DEBUG=1
DADEFS =
DADEFS =
# List all default directories to look for include files here
DINCDIR =
DINCDIR =
# List the default directory to look for the libraries here
DLIBDIR =
# List all default libraries here
DLIBS =
DLIBS =
#
# End of default section
@@ -42,10 +42,10 @@ PROJECT = at91sam7x_ocl
LDSCRIPT= at91sam7x_ram.ld
# List all user C define here, like -D_DEBUG=1
UDEFS =
UDEFS =
# Define ASM defines here
UADEFS =
UADEFS =
# List C source files here
SRC = main.c dcc.c samflash.c
@@ -60,7 +60,7 @@ UINCDIR =
ULIBDIR =
# List all user libraries here
ULIBS =
ULIBS =
# Define optimisation level here
OPT = -O2
@@ -122,7 +122,7 @@ clean:
-rm -f $(ASRC:.s=.lst)
-rm -fR .dep
#
#
# Include the dependency files, should be the last of the makefile
#
#-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*)

View File

@@ -20,11 +20,11 @@
#include "samflash.h"
unsigned int flash_page_count=1024;
unsigned int flash_page_size=256;
unsigned int flash_page_count = 1024;
unsigned int flash_page_size = 256;
/* pages per lock bit */
unsigned int flash_lock_pages=1024/16;
unsigned int flash_lock_pages = 1024/16;
/* detect chip and set loader parameters */
@@ -32,38 +32,38 @@ int flash_init(void)
{
unsigned int nvpsiz;
nvpsiz=(inr(DBGU_CIDR)>>8)&0xf;
nvpsiz = (inr(DBGU_CIDR) >> 8)&0xf;
switch (nvpsiz) {
case 3:
/* AT91SAM7x32 */
flash_page_count=256;
flash_page_size=128;
flash_lock_pages=256/8;
flash_page_count = 256;
flash_page_size = 128;
flash_lock_pages = 256/8;
break;
case 5:
/* AT91SAM7x64 */
flash_page_count=512;
flash_page_size=128;
flash_lock_pages=512/16;
flash_page_count = 512;
flash_page_size = 128;
flash_lock_pages = 512/16;
break;
case 7:
/* AT91SAM7x128*/
flash_page_count=512;
flash_page_size=256;
flash_lock_pages=512/8;
flash_page_count = 512;
flash_page_size = 256;
flash_lock_pages = 512/8;
break;
case 9:
/* AT91SAM7x256 */
flash_page_count=1024;
flash_page_size=256;
flash_lock_pages=1024/16;
flash_page_count = 1024;
flash_page_size = 256;
flash_lock_pages = 1024/16;
break;
case 10:
/* AT91SAM7x512 */
flash_page_count=2048;
flash_page_size=256;
flash_lock_pages=2048/32;
flash_page_count = 2048;
flash_page_size = 256;
flash_lock_pages = 2048/32;
break;
default:
return FLASH_STAT_INITE;
@@ -82,39 +82,39 @@ int flash_page_program(uint32 *data, int page_num)
uint32 *data_ptr;
/* select proper controller */
if (page_num>=1024) efc_ofs=0x10;
else efc_ofs=0;
if (page_num >= 1024) efc_ofs = 0x10;
else efc_ofs = 0;
/* wait until FLASH is ready, just for sure */
while ((inr(MC_FSR+efc_ofs)&MC_FRDY)==0);
while ((inr(MC_FSR + efc_ofs)&MC_FRDY) == 0);
/* calculate page address, only lower 8 bits are used to address the latch,
but the upper part of address is needed for writing to proper EFC */
flash_ptr=(uint32 *)(FLASH_AREA_ADDR+(page_num*flash_page_size));
data_ptr=data;
flash_ptr = (uint32 *)(FLASH_AREA_ADDR + (page_num*flash_page_size));
data_ptr = data;
/* copy data to latch */
for (i=flash_page_size/4; i; i--) {
for (i = flash_page_size/4; i; i--) {
/* we do not use memcpy to be sure that only 32 bit access is used */
*(flash_ptr++)=*(data_ptr++);
}
/* page number and page write command to FCR */
outr(MC_FCR+efc_ofs, ((page_num&0x3ff)<<8) | MC_KEY | MC_FCMD_WP);
outr(MC_FCR + efc_ofs, ((page_num&0x3ff) << 8) | MC_KEY | MC_FCMD_WP);
/* wait until it's done */
while ((inr(MC_FSR+efc_ofs)&MC_FRDY)==0);
while ((inr(MC_FSR + efc_ofs)&MC_FRDY) == 0);
/* check for errors */
if ((inr(MC_FSR+efc_ofs)&MC_PROGE)) return FLASH_STAT_PROGE;
if ((inr(MC_FSR+efc_ofs)&MC_LOCKE)) return FLASH_STAT_LOCKE;
if ((inr(MC_FSR + efc_ofs)&MC_PROGE)) return FLASH_STAT_PROGE;
if ((inr(MC_FSR + efc_ofs)&MC_LOCKE)) return FLASH_STAT_LOCKE;
#if 0
/* verify written data */
flash_ptr=(uint32 *)(FLASH_AREA_ADDR+(page_num*flash_page_size));
data_ptr=data;
flash_ptr = (uint32 *)(FLASH_AREA_ADDR + (page_num*flash_page_size));
data_ptr = data;
for (i=flash_page_size/4; i; i--) {
for (i = flash_page_size/4; i; i--) {
if (*(flash_ptr++)!=*(data_ptr++)) return FLASH_STAT_VERIFE;
}
#endif
@@ -128,43 +128,43 @@ int flash_erase_plane(int efc_ofs)
unsigned int lockbits;
int page_num;
page_num=0;
lockbits=inr(MC_FSR+efc_ofs)>>16;
page_num = 0;
lockbits = inr(MC_FSR + efc_ofs) >> 16;
while (lockbits) {
if (lockbits&1) {
/* wait until FLASH is ready, just for sure */
while ((inr(MC_FSR+efc_ofs)&MC_FRDY)==0);
while ((inr(MC_FSR + efc_ofs)&MC_FRDY) == 0);
outr(MC_FCR+efc_ofs, ((page_num&0x3ff)<<8) | 0x5a000004);
outr(MC_FCR + efc_ofs, ((page_num&0x3ff) << 8) | 0x5a000004);
/* wait until it's done */
while ((inr(MC_FSR+efc_ofs)&MC_FRDY)==0);
while ((inr(MC_FSR + efc_ofs)&MC_FRDY) == 0);
/* check for errors */
if ((inr(MC_FSR+efc_ofs)&MC_PROGE)) return FLASH_STAT_PROGE;
if ((inr(MC_FSR+efc_ofs)&MC_LOCKE)) return FLASH_STAT_LOCKE;
if ((inr(MC_FSR + efc_ofs)&MC_PROGE)) return FLASH_STAT_PROGE;
if ((inr(MC_FSR + efc_ofs)&MC_LOCKE)) return FLASH_STAT_LOCKE;
}
if ((page_num+=flash_lock_pages)>flash_page_count) break;
if ((page_num += flash_lock_pages) > flash_page_count) break;
lockbits>>=1;
}
/* wait until FLASH is ready, just for sure */
while ((inr(MC_FSR+efc_ofs)&MC_FRDY)==0);
while ((inr(MC_FSR + efc_ofs)&MC_FRDY) == 0);
/* erase all command to FCR */
outr(MC_FCR+efc_ofs, 0x5a000008);
outr(MC_FCR + efc_ofs, 0x5a000008);
/* wait until it's done */
while ((inr(MC_FSR+efc_ofs)&MC_FRDY)==0);
while ((inr(MC_FSR + efc_ofs)&MC_FRDY) == 0);
/* check for errors */
if ((inr(MC_FSR+efc_ofs)&MC_PROGE)) return FLASH_STAT_PROGE;
if ((inr(MC_FSR+efc_ofs)&MC_LOCKE)) return FLASH_STAT_LOCKE;
if ((inr(MC_FSR + efc_ofs)&MC_PROGE)) return FLASH_STAT_PROGE;
if ((inr(MC_FSR + efc_ofs)&MC_LOCKE)) return FLASH_STAT_LOCKE;
/* set no erase before programming */
outr(MC_FMR+efc_ofs, inr(MC_FMR+efc_ofs)|0x80);
outr(MC_FMR + efc_ofs, inr(MC_FMR + efc_ofs) | 0x80);
return FLASH_STAT_OK;
}
@@ -174,11 +174,11 @@ int flash_erase_plane(int efc_ofs)
int flash_erase_all(void)
{
int result;
if ((result=flash_erase_plane(0))!=FLASH_STAT_OK) return result;
if ((result = flash_erase_plane(0)) != FLASH_STAT_OK) return result;
/* the second flash controller, if any */
if (flash_page_count>1024) result=flash_erase_plane(0x10);
if (flash_page_count > 1024) result = flash_erase_plane(0x10);
return result;
}
@@ -188,8 +188,8 @@ int flash_verify(uint32 adr, unsigned int len, uint8 *src)
{
unsigned char *flash_ptr;
flash_ptr=(uint8 *)FLASH_AREA_ADDR+adr;
for ( ;len; len--) {
flash_ptr = (uint8 *)FLASH_AREA_ADDR + adr;
for (;len; len--) {
if (*(flash_ptr++)!=*(src++)) return FLASH_STAT_VERIFE;
}
return FLASH_STAT_OK;

188
src/flash/orion_nand.c Normal file
View File

@@ -0,0 +1,188 @@
/***************************************************************************
* Copyright (C) 2009 by Marvell Semiconductors, Inc. *
* Written by Nicolas Pitre <nico at marvell.com> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
/*
* NAND controller interface for Marvell Orion/Kirkwood SoCs.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "arm_nandio.h"
#include "armv4_5.h"
typedef struct orion_nand_controller_s
{
struct target_s *target;
struct arm_nand_data io;
uint32_t cmd;
uint32_t addr;
uint32_t data;
} orion_nand_controller_t;
#define CHECK_HALTED \
do { \
if (target->state != TARGET_HALTED) { \
LOG_ERROR("NAND flash access requires halted target"); \
return ERROR_NAND_OPERATION_FAILED; \
} \
} while (0)
static int orion_nand_command(struct nand_device_s *device, uint8_t command)
{
orion_nand_controller_t *hw = device->controller_priv;
target_t *target = hw->target;
CHECK_HALTED;
target_write_u8(target, hw->cmd, command);
return ERROR_OK;
}
static int orion_nand_address(struct nand_device_s *device, uint8_t address)
{
orion_nand_controller_t *hw = device->controller_priv;
target_t *target = hw->target;
CHECK_HALTED;
target_write_u8(target, hw->addr, address);
return ERROR_OK;
}
static int orion_nand_read(struct nand_device_s *device, void *data)
{
orion_nand_controller_t *hw = device->controller_priv;
target_t *target = hw->target;
CHECK_HALTED;
target_read_u8(target, hw->data, data);
return ERROR_OK;
}
static int orion_nand_write(struct nand_device_s *device, uint16_t data)
{
orion_nand_controller_t *hw = device->controller_priv;
target_t *target = hw->target;
CHECK_HALTED;
target_write_u8(target, hw->data, data);
return ERROR_OK;
}
static int orion_nand_slow_block_write(struct nand_device_s *device, uint8_t *data, int size)
{
while (size--)
orion_nand_write(device, *data++);
return ERROR_OK;
}
static int orion_nand_fast_block_write(struct nand_device_s *device, uint8_t *data, int size)
{
orion_nand_controller_t *hw = device->controller_priv;
int retval;
hw->io.chunk_size = device->page_size;
retval = arm_nandwrite(&hw->io, data, size);
if (retval == ERROR_NAND_NO_BUFFER)
retval = orion_nand_slow_block_write(device, data, size);
return retval;
}
static int orion_nand_reset(struct nand_device_s *device)
{
return orion_nand_command(device, NAND_CMD_RESET);
}
static int orion_nand_controller_ready(struct nand_device_s *device, int timeout)
{
return 1;
}
static int orion_nand_register_commands(struct command_context_s *cmd_ctx)
{
return ERROR_OK;
}
int orion_nand_device_command(struct command_context_s *cmd_ctx, char *cmd,
char **args, int argc,
struct nand_device_s *device)
{
orion_nand_controller_t *hw;
uint32_t base;
uint8_t ale, cle;
if (argc != 3) {
LOG_ERROR("arguments must be: <target_id> <NAND_address>\n");
return ERROR_NAND_DEVICE_INVALID;
}
hw = calloc(1, sizeof(*hw));
if (!hw) {
LOG_ERROR("no memory for nand controller\n");
return ERROR_NAND_DEVICE_INVALID;
}
device->controller_priv = hw;
hw->target = get_target(args[1]);
if (!hw->target) {
LOG_ERROR("target '%s' not defined", args[1]);
free(hw);
return ERROR_NAND_DEVICE_INVALID;
}
base = strtoul(args[2], NULL, 0);
cle = 0;
ale = 1;
hw->data = base;
hw->cmd = base + (1 << cle);
hw->addr = base + (1 << ale);
hw->io.target = hw->target;
hw->io.data = hw->data;
return ERROR_OK;
}
static int orion_nand_init(struct nand_device_s *device)
{
return ERROR_OK;
}
nand_flash_controller_t orion_nand_controller =
{
.name = "orion",
.command = orion_nand_command,
.address = orion_nand_address,
.read_data = orion_nand_read,
.write_data = orion_nand_write,
.write_block_data = orion_nand_fast_block_write,
.reset = orion_nand_reset,
.controller_ready = orion_nand_controller_ready,
.nand_device_command = orion_nand_device_command,
.register_commands = orion_nand_register_commands,
.init = orion_nand_init,
};

View File

@@ -27,24 +27,15 @@
#include "config.h"
#endif
#include "replacements.h"
#include "pic32mx.h"
#include "flash.h"
#include "target.h"
#include "log.h"
#include "mips32.h"
#include "algorithm.h"
#include "binarybuffer.h"
#include <stdlib.h>
#include <string.h>
static
struct pic32mx_devs_s {
u8 devid;
uint8_t devid;
char *name;
u32 pfm_size;
uint32_t pfm_size;
} pic32mx_devs[] = {
{ 0x78, "460F512L USB", 512 },
{ 0x74, "460F256L USB", 256 },
@@ -66,26 +57,26 @@ struct pic32mx_devs_s {
{ 0x00, NULL, 0 }
};
int pic32mx_register_commands(struct command_context_s *cmd_ctx);
int pic32mx_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank);
int pic32mx_erase(struct flash_bank_s *bank, int first, int last);
int pic32mx_protect(struct flash_bank_s *bank, int set, int first, int last);
int pic32mx_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count);
int pic32mx_write_row(struct flash_bank_s *bank, u32 address, u32 srcaddr);
int pic32mx_write_word(struct flash_bank_s *bank, u32 address, u32 word);
int pic32mx_probe(struct flash_bank_s *bank);
int pic32mx_auto_probe(struct flash_bank_s *bank);
int pic32mx_handle_part_id_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
int pic32mx_protect_check(struct flash_bank_s *bank);
int pic32mx_info(struct flash_bank_s *bank, char *buf, int buf_size);
static int pic32mx_register_commands(struct command_context_s *cmd_ctx);
static int pic32mx_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank);
static int pic32mx_erase(struct flash_bank_s *bank, int first, int last);
static int pic32mx_protect(struct flash_bank_s *bank, int set, int first, int last);
static int pic32mx_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count);
static int pic32mx_write_row(struct flash_bank_s *bank, uint32_t address, uint32_t srcaddr);
static int pic32mx_write_word(struct flash_bank_s *bank, uint32_t address, uint32_t word);
static int pic32mx_probe(struct flash_bank_s *bank);
static int pic32mx_auto_probe(struct flash_bank_s *bank);
//static int pic32mx_handle_part_id_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
static int pic32mx_protect_check(struct flash_bank_s *bank);
static int pic32mx_info(struct flash_bank_s *bank, char *buf, int buf_size);
#if 0
int pic32mx_handle_lock_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
int pic32mx_handle_unlock_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
#endif
int pic32mx_handle_chip_erase_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
int pic32mx_handle_pgm_word_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
int pic32mx_chip_erase(struct flash_bank_s *bank);
static int pic32mx_handle_chip_erase_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
static int pic32mx_handle_pgm_word_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
//static int pic32mx_chip_erase(struct flash_bank_s *bank);
flash_driver_t pic32mx_flash =
{
@@ -102,7 +93,7 @@ flash_driver_t pic32mx_flash =
.info = pic32mx_info
};
int pic32mx_register_commands(struct command_context_s *cmd_ctx)
static int pic32mx_register_commands(struct command_context_s *cmd_ctx)
{
command_t *pic32mx_cmd = register_command(cmd_ctx, NULL, "pic32mx", NULL, COMMAND_ANY, "pic32mx flash specific commands");
@@ -121,7 +112,7 @@ int pic32mx_register_commands(struct command_context_s *cmd_ctx)
/* flash bank pic32mx <base> <size> 0 0 <target#>
*/
int pic32mx_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank)
static int pic32mx_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank)
{
pic32mx_flash_bank_t *pic32mx_info;
@@ -140,38 +131,38 @@ int pic32mx_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, cha
return ERROR_OK;
}
u32 pic32mx_get_flash_status(flash_bank_t *bank)
static uint32_t pic32mx_get_flash_status(flash_bank_t *bank)
{
target_t *target = bank->target;
u32 status;
uint32_t status;
target_read_u32(target, PIC32MX_NVMCON, &status);
return status;
}
u32 pic32mx_wait_status_busy(flash_bank_t *bank, int timeout)
static uint32_t pic32mx_wait_status_busy(flash_bank_t *bank, int timeout)
{
u32 status;
uint32_t status;
/* wait for busy to clear */
while (((status = pic32mx_get_flash_status(bank)) & NVMCON_NVMWR) && (timeout-- > 0))
{
LOG_DEBUG("status: 0x%x", status);
LOG_DEBUG("status: 0x%" PRIx32, status);
alive_sleep(1);
}
if(timeout <= 0)
LOG_DEBUG("timeout: status: 0x%x", status);
if (timeout <= 0)
LOG_DEBUG("timeout: status: 0x%" PRIx32, status);
return status;
}
int pic32mx_nvm_exec(struct flash_bank_s *bank, u32 op, u32 timeout)
static int pic32mx_nvm_exec(struct flash_bank_s *bank, uint32_t op, uint32_t timeout)
{
target_t *target = bank->target;
u32 status;
uint32_t status;
target_write_u32(target, PIC32MX_NVMCON, NVMCON_NVMWREN|op);
target_write_u32(target, PIC32MX_NVMCON, NVMCON_NVMWREN | op);
/* unlock flash registers */
target_write_u32(target, PIC32MX_NVMKEY, NVMKEY1);
@@ -188,11 +179,11 @@ int pic32mx_nvm_exec(struct flash_bank_s *bank, u32 op, u32 timeout)
return status;
}
int pic32mx_protect_check(struct flash_bank_s *bank)
static int pic32mx_protect_check(struct flash_bank_s *bank)
{
target_t *target = bank->target;
u32 devcfg0;
uint32_t devcfg0;
int s;
int num_pages;
@@ -203,11 +194,11 @@ int pic32mx_protect_check(struct flash_bank_s *bank)
}
target_read_u32(target, PIC32MX_DEVCFG0, &devcfg0);
if((devcfg0 & (1<<28)) == 0) /* code protect bit */
if ((devcfg0 & (1 << 28)) == 0) /* code protect bit */
num_pages = 0xffff; /* All pages protected */
else if(bank->base == PIC32MX_KSEG1_BOOT_FLASH)
else if (bank->base == PIC32MX_KSEG1_BOOT_FLASH)
{
if(devcfg0 & (1<<24))
if (devcfg0 & (1 << 24))
num_pages = 0; /* All pages unprotected */
else
num_pages = 0xffff; /* All pages protected */
@@ -222,11 +213,11 @@ int pic32mx_protect_check(struct flash_bank_s *bank)
return ERROR_OK;
}
int pic32mx_erase(struct flash_bank_s *bank, int first, int last)
static int pic32mx_erase(struct flash_bank_s *bank, int first, int last)
{
target_t *target = bank->target;
int i;
u32 status;
uint32_t status;
if (bank->target->state != TARGET_HALTED)
{
@@ -238,25 +229,25 @@ int pic32mx_erase(struct flash_bank_s *bank, int first, int last)
{
LOG_DEBUG("Erasing entire program flash");
status = pic32mx_nvm_exec(bank, NVMCON_OP_PFM_ERASE, 50);
if( status & NVMCON_NVMERR )
if (status & NVMCON_NVMERR)
return ERROR_FLASH_OPERATION_FAILED;
if( status & NVMCON_LVDERR )
if (status & NVMCON_LVDERR)
return ERROR_FLASH_OPERATION_FAILED;
return ERROR_OK;
}
for (i = first; i <= last; i++)
{
if(bank->base >= PIC32MX_KSEG1_PGM_FLASH)
if (bank->base >= PIC32MX_KSEG1_PGM_FLASH)
target_write_u32(target, PIC32MX_NVMADDR, KS1Virt2Phys(bank->base + bank->sectors[i].offset));
else
target_write_u32(target, PIC32MX_NVMADDR, KS0Virt2Phys(bank->base + bank->sectors[i].offset));
status = pic32mx_nvm_exec(bank, NVMCON_OP_PAGE_ERASE, 10);
if( status & NVMCON_NVMERR )
if (status & NVMCON_NVMERR)
return ERROR_FLASH_OPERATION_FAILED;
if( status & NVMCON_LVDERR )
if (status & NVMCON_LVDERR)
return ERROR_FLASH_OPERATION_FAILED;
bank->sectors[i].is_erased = 1;
}
@@ -264,14 +255,16 @@ int pic32mx_erase(struct flash_bank_s *bank, int first, int last)
return ERROR_OK;
}
int pic32mx_protect(struct flash_bank_s *bank, int set, int first, int last)
static int pic32mx_protect(struct flash_bank_s *bank, int set, int first, int last)
{
pic32mx_flash_bank_t *pic32mx_info = NULL;
target_t *target = bank->target;
u16 prot_reg[4] = {0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF};
#if 0
uint16_t prot_reg[4] = {0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF};
int i, reg, bit;
int status;
u32 protection;
uint32_t protection;
#endif
pic32mx_info = bank->driver_priv;
@@ -292,10 +285,10 @@ int pic32mx_protect(struct flash_bank_s *bank, int set, int first, int last)
* high density - each bit refers to a 2bank protection */
target_read_u32(target, PIC32MX_FLASH_WRPR, &protection);
prot_reg[0] = (u16)protection;
prot_reg[1] = (u16)(protection >> 8);
prot_reg[2] = (u16)(protection >> 16);
prot_reg[3] = (u16)(protection >> 24);
prot_reg[0] = (uint16_t)protection;
prot_reg[1] = (uint16_t)(protection >> 8);
prot_reg[2] = (uint16_t)(protection >> 16);
prot_reg[3] = (uint16_t)(protection >> 24);
if (pic32mx_info->ppage_size == 2)
{
@@ -320,7 +313,7 @@ int pic32mx_protect(struct flash_bank_s *bank, int set, int first, int last)
reg = (i / pic32mx_info->ppage_size) / 8;
bit = (i / pic32mx_info->ppage_size) - (reg * 8);
if( set )
if (set)
prot_reg[reg] &= ~(1 << bit);
else
prot_reg[reg] |= (1 << bit);
@@ -334,7 +327,7 @@ int pic32mx_protect(struct flash_bank_s *bank, int set, int first, int last)
reg = (i / pic32mx_info->ppage_size) / 8;
bit = (i / pic32mx_info->ppage_size) - (reg * 8);
if( set )
if (set)
prot_reg[reg] &= ~(1 << bit);
else
prot_reg[reg] |= (1 << bit);
@@ -355,18 +348,18 @@ int pic32mx_protect(struct flash_bank_s *bank, int set, int first, int last)
#endif
}
int pic32mx_write_block(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count)
static int pic32mx_write_block(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count)
{
target_t *target = bank->target;
u32 buffer_size = 512;
uint32_t buffer_size = 512;
working_area_t *source;
u32 address = bank->base + offset;
uint32_t address = bank->base + offset;
int retval = ERROR_OK;
#if 0
pic32mx_flash_bank_t *pic32mx_info = bank->driver_priv;
armv7m_algorithm_t armv7m_info;
u8 pic32mx_flash_write_code[] = {
uint8_t pic32mx_flash_write_code[] = {
/* write: */
0xDF, 0xF8, 0x24, 0x40, /* ldr r4, PIC32MX_FLASH_CR */
0x09, 0x4D, /* ldr r5, PIC32MX_FLASH_SR */
@@ -395,7 +388,7 @@ int pic32mx_write_block(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 c
return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
};
if ((retval=target_write_buffer(target, pic32mx_info->write_algorithm->address, sizeof(pic32mx_flash_write_code), pic32mx_flash_write_code))!=ERROR_OK)
if ((retval = target_write_buffer(target, pic32mx_info->write_algorithm->address, sizeof(pic32mx_flash_write_code), pic32mx_flash_write_code)) != ERROR_OK)
return retval;
#endif
@@ -414,10 +407,10 @@ int pic32mx_write_block(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 c
while (count >= buffer_size/4)
{
u32 status;
uint32_t status;
if ((retval = target_write_buffer(target, source->address, buffer_size, buffer))!=ERROR_OK) {
LOG_ERROR("Failed to write row buffer (%d words) to RAM", buffer_size/4);
if ((retval = target_write_buffer(target, source->address, buffer_size, buffer)) != ERROR_OK) {
LOG_ERROR("Failed to write row buffer (%d words) to RAM", (int)(buffer_size/4));
break;
}
@@ -426,7 +419,7 @@ int pic32mx_write_block(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 c
buf_set_u32(reg_params[1].value, 0, 32, address);
buf_set_u32(reg_params[2].value, 0, 32, buffer_size/4);
if ((retval = target->type->run_algorithm(target, 0, NULL, 4, reg_params, pic32mx_info->write_algorithm->address, \
if ((retval = target_run_algorithm(target, 0, NULL, 4, reg_params, pic32mx_info->write_algorithm->address, \
pic32mx_info->write_algorithm->address + (sizeof(pic32mx_flash_write_code) - 10), 10000, &armv7m_info)) != ERROR_OK)
{
LOG_ERROR("error executing pic32mx flash write algorithm");
@@ -441,13 +434,13 @@ int pic32mx_write_block(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 c
}
#endif
status = pic32mx_write_row(bank, address, source->address);
if( status & NVMCON_NVMERR ) {
LOG_ERROR("Flash write error NVMERR (status=0x%08x)", status);
if (status & NVMCON_NVMERR) {
LOG_ERROR("Flash write error NVMERR (status = 0x%08" PRIx32 ")", status);
retval = ERROR_FLASH_OPERATION_FAILED;
break;
}
if( status & NVMCON_LVDERR ) {
LOG_ERROR("Flash write error LVDERR (status=0x%08x)", status);
if (status & NVMCON_LVDERR) {
LOG_ERROR("Flash write error LVDERR (status = 0x%08" PRIx32 ")", status);
retval = ERROR_FLASH_OPERATION_FAILED;
break;
}
@@ -459,18 +452,19 @@ int pic32mx_write_block(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 c
target_free_working_area(target, source);
while(count > 0)
while (count > 0)
{
u32 status;
uint32_t value;
memcpy(&value, buffer, sizeof(uint32_t));
status = pic32mx_write_word(bank, address, *(u32*)buffer);
if( status & NVMCON_NVMERR ) {
LOG_ERROR("Flash write error NVMERR (status=0x%08x)", status);
uint32_t status = pic32mx_write_word(bank, address, value);
if (status & NVMCON_NVMERR) {
LOG_ERROR("Flash write error NVMERR (status = 0x%08" PRIx32 ")", status);
retval = ERROR_FLASH_OPERATION_FAILED;
break;
}
if( status & NVMCON_LVDERR ) {
LOG_ERROR("Flash write error LVDERR (status=0x%08x)", status);
if (status & NVMCON_LVDERR) {
LOG_ERROR("Flash write error LVDERR (status = 0x%08" PRIx32 ")", status);
retval = ERROR_FLASH_OPERATION_FAILED;
break;
}
@@ -483,11 +477,11 @@ int pic32mx_write_block(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 c
return retval;
}
int pic32mx_write_word(struct flash_bank_s *bank, u32 address, u32 word)
static int pic32mx_write_word(struct flash_bank_s *bank, uint32_t address, uint32_t word)
{
target_t *target = bank->target;
if(bank->base >= PIC32MX_KSEG1_PGM_FLASH)
if (bank->base >= PIC32MX_KSEG1_PGM_FLASH)
target_write_u32(target, PIC32MX_NVMADDR, KS1Virt2Phys(address));
else
target_write_u32(target, PIC32MX_NVMADDR, KS0Virt2Phys(address));
@@ -499,17 +493,17 @@ int pic32mx_write_word(struct flash_bank_s *bank, u32 address, u32 word)
/*
* Write a 128 word (512 byte) row to flash address from RAM srcaddr.
*/
int pic32mx_write_row(struct flash_bank_s *bank, u32 address, u32 srcaddr)
static int pic32mx_write_row(struct flash_bank_s *bank, uint32_t address, uint32_t srcaddr)
{
target_t *target = bank->target;
LOG_DEBUG("addr: 0x%08x srcaddr: 0x%08x", address, srcaddr);
LOG_DEBUG("addr: 0x%08" PRIx32 " srcaddr: 0x%08" PRIx32 "", address, srcaddr);
if(address >= PIC32MX_KSEG1_PGM_FLASH)
if (address >= PIC32MX_KSEG1_PGM_FLASH)
target_write_u32(target, PIC32MX_NVMADDR, KS1Virt2Phys(address));
else
target_write_u32(target, PIC32MX_NVMADDR, KS0Virt2Phys(address));
if(srcaddr >= PIC32MX_KSEG1_RAM)
if (srcaddr >= PIC32MX_KSEG1_RAM)
target_write_u32(target, PIC32MX_NVMSRCADDR, KS1Virt2Phys(srcaddr));
else
target_write_u32(target, PIC32MX_NVMSRCADDR, KS0Virt2Phys(srcaddr));
@@ -517,14 +511,14 @@ int pic32mx_write_row(struct flash_bank_s *bank, u32 address, u32 srcaddr)
return pic32mx_nvm_exec(bank, NVMCON_OP_ROW_PROG, 100);
}
int pic32mx_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count)
static int pic32mx_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t offset, uint32_t count)
{
u32 words_remaining = (count / 4);
u32 bytes_remaining = (count & 0x00000003);
u32 address = bank->base + offset;
u32 bytes_written = 0;
u32 status;
u32 retval;
uint32_t words_remaining = (count / 4);
uint32_t bytes_remaining = (count & 0x00000003);
uint32_t address = bank->base + offset;
uint32_t bytes_written = 0;
uint32_t status;
int retval;
if (bank->target->state != TARGET_HALTED)
{
@@ -534,7 +528,7 @@ int pic32mx_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count)
if (offset & 0x3)
{
LOG_WARNING("offset 0x%x breaks required 4-byte alignment", offset);
LOG_WARNING("offset 0x%" PRIx32 "breaks required 4-byte alignment", offset);
return ERROR_FLASH_DST_BREAKS_ALIGNMENT;
}
@@ -566,11 +560,13 @@ int pic32mx_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count)
while (words_remaining > 0)
{
status = pic32mx_write_word(bank, address, *(u32*)(buffer + bytes_written));
uint32_t value;
memcpy(&value, buffer + bytes_written, sizeof(uint32_t));
if( status & NVMCON_NVMERR )
status = pic32mx_write_word(bank, address, value);
if (status & NVMCON_NVMERR)
return ERROR_FLASH_OPERATION_FAILED;
if( status & NVMCON_LVDERR )
if (status & NVMCON_LVDERR)
return ERROR_FLASH_OPERATION_FAILED;
bytes_written += 4;
@@ -580,62 +576,57 @@ int pic32mx_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count)
if (bytes_remaining)
{
u8 last_word[4] = {0xff, 0xff, 0xff, 0xff};
int i = 0;
uint32_t value = 0xffffffff;
memcpy(&value, buffer + bytes_written, bytes_remaining);
while(bytes_remaining > 0)
{
/* Assumes little endian */
last_word[i++] = *(buffer + bytes_written);
bytes_remaining--;
bytes_written++;
}
status = pic32mx_write_word(bank, address, *(u32*)last_word);
if( status & NVMCON_NVMERR )
status = pic32mx_write_word(bank, address, value);
if (status & NVMCON_NVMERR)
return ERROR_FLASH_OPERATION_FAILED;
if( status & NVMCON_LVDERR )
if (status & NVMCON_LVDERR)
return ERROR_FLASH_OPERATION_FAILED;
}
return ERROR_OK;
}
int pic32mx_probe(struct flash_bank_s *bank)
static int pic32mx_probe(struct flash_bank_s *bank)
{
target_t *target = bank->target;
pic32mx_flash_bank_t *pic32mx_info = bank->driver_priv;
mips32_common_t *mips32 = target->arch_info;
mips_ejtag_t *ejtag_info = &mips32->ejtag_info;
int i;
u16 num_pages;
u32 device_id;
uint16_t num_pages = 0;
uint32_t device_id;
int page_size;
pic32mx_info->probed = 0;
device_id = ejtag_info->idcode;
LOG_INFO( "device id = 0x%08x (manuf 0x%03x dev 0x%02x, ver 0x%03x)", device_id, (device_id>>1)&0x7ff, (device_id>>12)&0xff, (device_id>>20)&0xfff );
LOG_INFO("device id = 0x%08" PRIx32 " (manuf 0x%03x dev 0x%02x, ver 0x%03x)",
device_id,
(unsigned)((device_id >> 1)&0x7ff),
(unsigned)((device_id >> 12)&0xff),
(unsigned)((device_id >> 20)&0xfff));
if(((device_id>>1)&0x7ff) != PIC32MX_MANUF_ID) {
LOG_WARNING( "Cannot identify target as a PIC32MX family." );
if (((device_id >> 1)&0x7ff) != PIC32MX_MANUF_ID) {
LOG_WARNING("Cannot identify target as a PIC32MX family.");
return ERROR_FLASH_OPERATION_FAILED;
}
page_size = 4096;
if(bank->base == PIC32MX_KSEG1_BOOT_FLASH || bank->base == 1) {
if (bank->base == PIC32MX_KSEG1_BOOT_FLASH || bank->base == 1) {
/* 0xBFC00000: Boot flash size fixed at 12k */
num_pages = 12;
} else {
/* 0xBD000000: Program flash size varies with device */
for(i=0; pic32mx_devs[i].name != NULL; i++)
if(pic32mx_devs[i].devid == ((device_id >> 12) & 0xff)) {
for (i = 0; pic32mx_devs[i].name != NULL; i++)
if (pic32mx_devs[i].devid == ((device_id >> 12) & 0xff)) {
num_pages = pic32mx_devs[i].pfm_size;
break;
}
if(pic32mx_devs[i].name == NULL) {
LOG_WARNING( "Cannot identify target as a PIC32MX family." );
if (pic32mx_devs[i].name == NULL) {
LOG_WARNING("Cannot identify target as a PIC32MX family.");
return ERROR_FLASH_OPERATION_FAILED;
}
}
@@ -655,13 +646,13 @@ int pic32mx_probe(struct flash_bank_s *bank)
}
#endif
LOG_INFO( "flash size = %dkbytes", num_pages );
LOG_INFO("flash size = %dkbytes", num_pages);
/* calculate numbers of pages */
num_pages /= (page_size / 1024);
if(bank->base == 0) bank->base = PIC32MX_KSEG1_PGM_FLASH;
if(bank->base == 1) bank->base = PIC32MX_KSEG1_BOOT_FLASH;
if (bank->base == 0) bank->base = PIC32MX_KSEG1_PGM_FLASH;
if (bank->base == 1) bank->base = PIC32MX_KSEG1_BOOT_FLASH;
bank->size = (num_pages * page_size);
bank->num_sectors = num_pages;
bank->chip_width = 4;
@@ -681,7 +672,7 @@ int pic32mx_probe(struct flash_bank_s *bank)
return ERROR_OK;
}
int pic32mx_auto_probe(struct flash_bank_s *bank)
static int pic32mx_auto_probe(struct flash_bank_s *bank)
{
pic32mx_flash_bank_t *pic32mx_info = bank->driver_priv;
if (pic32mx_info->probed)
@@ -689,37 +680,43 @@ int pic32mx_auto_probe(struct flash_bank_s *bank)
return pic32mx_probe(bank);
}
int pic32mx_handle_part_id_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
#if 0
static int pic32mx_handle_part_id_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
return ERROR_OK;
}
#endif
int pic32mx_info(struct flash_bank_s *bank, char *buf, int buf_size)
static int pic32mx_info(struct flash_bank_s *bank, char *buf, int buf_size)
{
target_t *target = bank->target;
mips32_common_t *mips32 = target->arch_info;
mips_ejtag_t *ejtag_info = &mips32->ejtag_info;
u32 device_id;
int printed, i;
uint32_t device_id;
int printed = 0, i;
device_id = ejtag_info->idcode;
if(((device_id>>1)&0x7ff) != PIC32MX_MANUF_ID) {
snprintf(buf, buf_size, "Cannot identify target as a PIC32MX family (manufacturer 0x%03d != 0x%03d)\n", (device_id>>1)&0x7ff, PIC32MX_MANUF_ID);
if (((device_id >> 1)&0x7ff) != PIC32MX_MANUF_ID) {
snprintf(buf, buf_size,
"Cannot identify target as a PIC32MX family (manufacturer 0x%03d != 0x%03d)\n",
(unsigned)((device_id >> 1)&0x7ff),
PIC32MX_MANUF_ID);
return ERROR_FLASH_OPERATION_FAILED;
}
for(i=0; pic32mx_devs[i].name != NULL; i++)
if(pic32mx_devs[i].devid == ((device_id >> 12) & 0xff)) {
for (i = 0; pic32mx_devs[i].name != NULL; i++)
if (pic32mx_devs[i].devid == ((device_id >> 12) & 0xff)) {
printed = snprintf(buf, buf_size, "PIC32MX%s", pic32mx_devs[i].name);
break;
}
if(pic32mx_devs[i].name == NULL) {
if (pic32mx_devs[i].name == NULL) {
snprintf(buf, buf_size, "Cannot identify target as a PIC32MX family\n");
return ERROR_FLASH_OPERATION_FAILED;
}
buf += printed;
buf_size -= printed;
printed = snprintf(buf, buf_size, " Ver: 0x%03x", (device_id>>20)&0xfff);
printed = snprintf(buf, buf_size, " Ver: 0x%03x",
(unsigned)((device_id >> 20)&0xfff));
return ERROR_OK;
}
@@ -821,10 +818,13 @@ int pic32mx_handle_unlock_command(struct command_context_s *cmd_ctx, char *cmd,
}
#endif
int pic32mx_chip_erase(struct flash_bank_s *bank)
#if 0
static int pic32mx_chip_erase(struct flash_bank_s *bank)
{
target_t *target = bank->target;
u32 status;
#if 0
uint32_t status;
#endif
if (target->state != TARGET_HALTED)
{
@@ -841,19 +841,19 @@ int pic32mx_chip_erase(struct flash_bank_s *bank)
/* chip erase flash memory */
target_write_u32(target, PIC32MX_FLASH_CR, FLASH_MER);
target_write_u32(target, PIC32MX_FLASH_CR, FLASH_MER|FLASH_STRT);
target_write_u32(target, PIC32MX_FLASH_CR, FLASH_MER | FLASH_STRT);
status = pic32mx_wait_status_busy(bank, 10);
target_write_u32(target, PIC32MX_FLASH_CR, FLASH_LOCK);
if( status & FLASH_WRPRTERR )
if (status & FLASH_WRPRTERR)
{
LOG_ERROR("pic32mx device protected");
return ERROR_OK;
}
if( status & FLASH_PGERR )
if (status & FLASH_PGERR)
{
LOG_ERROR("pic32mx device programming failed");
return ERROR_OK;
@@ -862,13 +862,14 @@ int pic32mx_chip_erase(struct flash_bank_s *bank)
return ERROR_OK;
}
#endif
int pic32mx_handle_chip_erase_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
static int pic32mx_handle_chip_erase_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
#if 0
flash_bank_t *bank;
int i;
#if 0
if (argc != 0)
{
command_print(cmd_ctx, "pic32mx chip_erase");
@@ -901,10 +902,10 @@ int pic32mx_handle_chip_erase_command(struct command_context_s *cmd_ctx, char *c
return ERROR_OK;
}
int pic32mx_handle_pgm_word_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
static int pic32mx_handle_pgm_word_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
flash_bank_t *bank;
u32 address, value;
uint32_t address, value;
int status, res;
if (argc != 3)
@@ -922,7 +923,7 @@ int pic32mx_handle_pgm_word_command(struct command_context_s *cmd_ctx, char *cmd
command_print(cmd_ctx, "flash bank '#%s' is out of bounds", args[2]);
return ERROR_OK;
}
if (address < bank->base || address >= (bank->base+bank->size))
if (address < bank->base || address >= (bank->base + bank->size))
{
command_print(cmd_ctx, "flash address '%s' is out of bounds", args[0]);
return ERROR_OK;
@@ -930,15 +931,15 @@ int pic32mx_handle_pgm_word_command(struct command_context_s *cmd_ctx, char *cmd
res = ERROR_OK;
status = pic32mx_write_word(bank, address, value);
if( status & NVMCON_NVMERR )
if (status & NVMCON_NVMERR)
res = ERROR_FLASH_OPERATION_FAILED;
if( status & NVMCON_LVDERR )
if (status & NVMCON_LVDERR)
res = ERROR_FLASH_OPERATION_FAILED;
if (res == ERROR_OK)
command_print(cmd_ctx, "pic32mx pgm word complete");
else
command_print(cmd_ctx, "pic32mx pgm word failed (status=0x%x)", status);
command_print(cmd_ctx, "pic32mx pgm word failed (status = 0x%x)", status);
return ERROR_OK;
}

View File

@@ -27,7 +27,6 @@
#define PIC32MX_H
#include "flash.h"
#include "target.h"
typedef struct pic32mx_flash_bank_s
{
@@ -63,9 +62,9 @@ typedef struct pic32mx_flash_bank_s
* Note: These macros only work for KSEG0/KSEG1 addresses.
*/
#define KS1Virt2Phys(vaddr) ((vaddr)-0xA0000000)
#define Phys2KS1Virt(paddr) ((paddr)+0xA0000000)
#define Phys2KS1Virt(paddr) ((paddr) + 0xA0000000)
#define KS0Virt2Phys(vaddr) ((vaddr)-0x80000000)
#define Phys2KS0Virt(paddr) ((paddr)+0x80000000)
#define Phys2KS0Virt(paddr) ((paddr) + 0x80000000)
/* pic32mx configuration register locations */
@@ -81,11 +80,11 @@ typedef struct pic32mx_flash_bank_s
#define PIC32MX_NVMCONCLR 0xBF80F404
#define PIC32MX_NVMCONSET 0xBF80F408
#define PIC32MX_NVMCONINV 0xBF80F40C
#define NVMCON_NVMWR (1<<15)
#define NVMCON_NVMWREN (1<<14)
#define NVMCON_NVMERR (1<<13)
#define NVMCON_LVDERR (1<<12)
#define NVMCON_LVDSTAT (1<<11)
#define NVMCON_NVMWR (1 << 15)
#define NVMCON_NVMWREN (1 << 14)
#define NVMCON_NVMERR (1 << 13)
#define NVMCON_LVDERR (1 << 12)
#define NVMCON_LVDSTAT (1 << 11)
#define NVMCON_OP_PFM_ERASE 0x5
#define NVMCON_OP_PAGE_ERASE 0x4
#define NVMCON_OP_ROW_PROG 0x3
@@ -106,8 +105,8 @@ typedef struct pic32mx_flash_bank_s
#define NVMKEY2 0x556699AA
typedef struct pic32mx_mem_layout_s {
u32 sector_start;
u32 sector_size;
uint32_t sector_start;
uint32_t sector_size;
} pic32mx_mem_layout_t;
#endif /* PIC32MX_H */

View File

@@ -28,21 +28,14 @@
#include "config.h"
#endif
#include "replacements.h"
#include "log.h"
#include <stdlib.h>
#include <string.h>
#include "nand.h"
#include "s3c24xx_nand.h"
#include "target.h"
int s3c2410_nand_device_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct nand_device_s *device);
int s3c2410_init(struct nand_device_s *device);
int s3c2410_read_data(struct nand_device_s *device, void *data);
int s3c2410_write_data(struct nand_device_s *device, u16 data);
int s3c2410_nand_ready(struct nand_device_s *device, int timeout);
static int s3c2410_nand_device_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct nand_device_s *device);
static int s3c2410_init(struct nand_device_s *device);
static int s3c2410_read_data(struct nand_device_s *device, void *data);
static int s3c2410_write_data(struct nand_device_s *device, uint16_t data);
static int s3c2410_nand_ready(struct nand_device_s *device, int timeout);
nand_flash_controller_t s3c2410_nand_controller =
{
@@ -61,12 +54,12 @@ nand_flash_controller_t s3c2410_nand_controller =
.nand_ready = s3c2410_nand_ready,
};
int s3c2410_nand_device_command(struct command_context_s *cmd_ctx, char *cmd,
static int s3c2410_nand_device_command(struct command_context_s *cmd_ctx, char *cmd,
char **args, int argc,
struct nand_device_s *device)
{
s3c24xx_nand_controller_t *info;
info = s3c24xx_nand_device_command(cmd_ctx, cmd, args, argc, device);
if (info == NULL) {
return ERROR_NAND_DEVICE_INVALID;
@@ -77,23 +70,23 @@ int s3c2410_nand_device_command(struct command_context_s *cmd_ctx, char *cmd,
info->addr = S3C2410_NFADDR;
info->data = S3C2410_NFDATA;
info->nfstat = S3C2410_NFSTAT;
return ERROR_OK;
}
int s3c2410_init(struct nand_device_s *device)
static int s3c2410_init(struct nand_device_s *device)
{
s3c24xx_nand_controller_t *s3c24xx_info = device->controller_priv;
target_t *target = s3c24xx_info->target;
target_write_u32(target, S3C2410_NFCONF,
target_write_u32(target, S3C2410_NFCONF,
S3C2410_NFCONF_EN | S3C2410_NFCONF_TACLS(3) |
S3C2410_NFCONF_TWRPH0(5) | S3C2410_NFCONF_TWRPH1(3));
return ERROR_OK;
}
int s3c2410_write_data(struct nand_device_s *device, u16 data)
static int s3c2410_write_data(struct nand_device_s *device, uint16_t data)
{
s3c24xx_nand_controller_t *s3c24xx_info = device->controller_priv;
target_t *target = s3c24xx_info->target;
@@ -102,43 +95,43 @@ int s3c2410_write_data(struct nand_device_s *device, u16 data)
LOG_ERROR("target must be halted to use S3C24XX NAND flash controller");
return ERROR_NAND_OPERATION_FAILED;
}
target_write_u32(target, S3C2410_NFDATA, data);
return ERROR_OK;
}
int s3c2410_read_data(struct nand_device_s *device, void *data)
static int s3c2410_read_data(struct nand_device_s *device, void *data)
{
s3c24xx_nand_controller_t *s3c24xx_info = device->controller_priv;
target_t *target = s3c24xx_info->target;
if (target->state != TARGET_HALTED) {
LOG_ERROR("target must be halted to use S3C24XX NAND flash controller");
return ERROR_NAND_OPERATION_FAILED;
}
target_read_u8(target, S3C2410_NFDATA, data);
target_read_u8(target, S3C2410_NFDATA, data);
return ERROR_OK;
}
int s3c2410_nand_ready(struct nand_device_s *device, int timeout)
static int s3c2410_nand_ready(struct nand_device_s *device, int timeout)
{
s3c24xx_nand_controller_t *s3c24xx_info = device->controller_priv;
target_t *target = s3c24xx_info->target;
u8 status;
uint8_t status;
if (target->state != TARGET_HALTED) {
LOG_ERROR("target must be halted to use S3C24XX NAND flash controller");
return ERROR_NAND_OPERATION_FAILED;
}
do {
target_read_u8(target, S3C2410_NFSTAT, &status);
if (status & S3C2410_NFSTAT_BUSY)
return 1;
alive_sleep(1);
alive_sleep(1);
} while (timeout-- > 0);
return 0;

View File

@@ -28,18 +28,11 @@
#include "config.h"
#endif
#include "replacements.h"
#include "log.h"
#include <stdlib.h>
#include <string.h>
#include "nand.h"
#include "s3c24xx_nand.h"
#include "target.h"
int s3c2412_nand_device_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct nand_device_s *device);
int s3c2412_init(struct nand_device_s *device);
static int s3c2412_nand_device_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct nand_device_s *device);
static int s3c2412_init(struct nand_device_s *device);
nand_flash_controller_t s3c2412_nand_controller =
{
@@ -60,7 +53,7 @@ nand_flash_controller_t s3c2412_nand_controller =
.nand_ready = s3c2440_nand_ready,
};
int s3c2412_nand_device_command(struct command_context_s *cmd_ctx, char *cmd,
static int s3c2412_nand_device_command(struct command_context_s *cmd_ctx, char *cmd,
char **args, int argc,
struct nand_device_s *device)
{
@@ -76,11 +69,11 @@ int s3c2412_nand_device_command(struct command_context_s *cmd_ctx, char *cmd,
info->addr = S3C2440_NFADDR;
info->data = S3C2440_NFDATA;
info->nfstat = S3C2412_NFSTAT;
return ERROR_OK;
}
int s3c2412_init(struct nand_device_s *device)
static int s3c2412_init(struct nand_device_s *device)
{
s3c24xx_nand_controller_t *s3c24xx_info = device->controller_priv;
target_t *target = s3c24xx_info->target;

View File

@@ -28,19 +28,12 @@
#include "config.h"
#endif
#include "replacements.h"
#include "log.h"
#include <stdlib.h>
#include <string.h>
#include "nand.h"
#include "s3c24xx_nand.h"
#include "target.h"
int s3c2440_nand_device_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct nand_device_s *device);
int s3c2440_init(struct nand_device_s *device);
int s3c2440_nand_ready(struct nand_device_s *device, int timeout);
static int s3c2440_nand_device_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct nand_device_s *device);
static int s3c2440_init(struct nand_device_s *device);
//static int s3c2440_nand_ready(struct nand_device_s *device, int timeout);
nand_flash_controller_t s3c2440_nand_controller =
{
@@ -61,12 +54,12 @@ nand_flash_controller_t s3c2440_nand_controller =
.nand_ready = s3c2440_nand_ready,
};
int s3c2440_nand_device_command(struct command_context_s *cmd_ctx, char *cmd,
static int s3c2440_nand_device_command(struct command_context_s *cmd_ctx, char *cmd,
char **args, int argc,
struct nand_device_s *device)
{
s3c24xx_nand_controller_t *info;
info = s3c24xx_nand_device_command(cmd_ctx, cmd, args, argc, device);
if (info == NULL) {
return ERROR_NAND_DEVICE_INVALID;
@@ -77,11 +70,11 @@ int s3c2440_nand_device_command(struct command_context_s *cmd_ctx, char *cmd,
info->addr = S3C2440_NFADDR;
info->data = S3C2440_NFDATA;
info->nfstat = S3C2440_NFSTAT;
return ERROR_OK;
}
int s3c2440_init(struct nand_device_s *device)
static int s3c2440_init(struct nand_device_s *device)
{
s3c24xx_nand_controller_t *s3c24xx_info = device->controller_priv;
target_t *target = s3c24xx_info->target;
@@ -101,16 +94,16 @@ int s3c2440_nand_ready(struct nand_device_s *device, int timeout)
{
s3c24xx_nand_controller_t *s3c24xx_info = device->controller_priv;
target_t *target = s3c24xx_info->target;
u8 status;
uint8_t status;
if (target->state != TARGET_HALTED) {
LOG_ERROR("target must be halted to use S3C24XX NAND flash controller");
return ERROR_NAND_OPERATION_FAILED;
}
do {
do {
target_read_u8(target, s3c24xx_info->nfstat, &status);
if (status & S3C2440_NFSTAT_READY)
return 1;
@@ -123,12 +116,12 @@ int s3c2440_nand_ready(struct nand_device_s *device, int timeout)
/* use the fact we can read/write 4 bytes in one go via a single 32bit op */
int s3c2440_read_block_data(struct nand_device_s *device, u8 *data, int data_size)
int s3c2440_read_block_data(struct nand_device_s *device, uint8_t *data, int data_size)
{
s3c24xx_nand_controller_t *s3c24xx_info = device->controller_priv;
target_t *target = s3c24xx_info->target;
u32 nfdata = s3c24xx_info->data;
u32 tmp;
uint32_t nfdata = s3c24xx_info->data;
uint32_t tmp;
LOG_INFO("%s: reading data: %p, %p, %d\n", __func__, device, data, data_size);
@@ -137,7 +130,7 @@ int s3c2440_read_block_data(struct nand_device_s *device, u8 *data, int data_siz
return ERROR_NAND_OPERATION_FAILED;
}
while (data_size >= 4) {
while (data_size >= 4) {
target_read_u32(target, nfdata, &tmp);
data[0] = tmp;
@@ -159,19 +152,19 @@ int s3c2440_read_block_data(struct nand_device_s *device, u8 *data, int data_siz
return ERROR_OK;
}
int s3c2440_write_block_data(struct nand_device_s *device, u8 *data, int data_size)
int s3c2440_write_block_data(struct nand_device_s *device, uint8_t *data, int data_size)
{
s3c24xx_nand_controller_t *s3c24xx_info = device->controller_priv;
target_t *target = s3c24xx_info->target;
u32 nfdata = s3c24xx_info->data;
u32 tmp;
uint32_t nfdata = s3c24xx_info->data;
uint32_t tmp;
if (target->state != TARGET_HALTED) {
LOG_ERROR("target must be halted to use S3C24XX NAND flash controller");
return ERROR_NAND_OPERATION_FAILED;
}
while (data_size >= 4) {
while (data_size >= 4) {
tmp = le_to_h_u32(data);
target_write_u32(target, nfdata, tmp);

View File

@@ -28,19 +28,11 @@
#include "config.h"
#endif
#include "replacements.h"
#include "log.h"
#include <stdlib.h>
#include <string.h>
#include "nand.h"
#include "s3c24xx_nand.h"
#include "target.h"
int s3c2443_nand_device_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct nand_device_s *device);
int s3c2443_init(struct nand_device_s *device);
int s3c2443_nand_ready(struct nand_device_s *device, int timeout);
static int s3c2443_nand_device_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct nand_device_s *device);
static int s3c2443_init(struct nand_device_s *device);
nand_flash_controller_t s3c2443_nand_controller =
{
@@ -61,12 +53,12 @@ nand_flash_controller_t s3c2443_nand_controller =
.nand_ready = s3c2440_nand_ready,
};
int s3c2443_nand_device_command(struct command_context_s *cmd_ctx, char *cmd,
static int s3c2443_nand_device_command(struct command_context_s *cmd_ctx, char *cmd,
char **args, int argc,
struct nand_device_s *device)
{
s3c24xx_nand_controller_t *info;
info = s3c24xx_nand_device_command(cmd_ctx, cmd, args, argc, device);
if (info == NULL) {
return ERROR_NAND_DEVICE_INVALID;
@@ -77,11 +69,11 @@ int s3c2443_nand_device_command(struct command_context_s *cmd_ctx, char *cmd,
info->addr = S3C2440_NFADDR;
info->data = S3C2440_NFDATA;
info->nfstat = S3C2412_NFSTAT;
return ERROR_OK;
}
int s3c2443_init(struct nand_device_s *device)
static int s3c2443_init(struct nand_device_s *device)
{
s3c24xx_nand_controller_t *s3c24xx_info = device->controller_priv;
target_t *target = s3c24xx_info->target;

View File

@@ -28,15 +28,8 @@
#include "config.h"
#endif
#include "replacements.h"
#include "log.h"
#include <stdlib.h>
#include <string.h>
#include "nand.h"
#include "s3c24xx_nand.h"
#include "target.h"
s3c24xx_nand_controller_t *
s3c24xx_nand_device_command(struct command_context_s *cmd_ctx, char *cmd,
@@ -44,7 +37,7 @@ s3c24xx_nand_device_command(struct command_context_s *cmd_ctx, char *cmd,
struct nand_device_s *device)
{
s3c24xx_nand_controller_t *s3c24xx_info;
s3c24xx_info = malloc(sizeof(s3c24xx_nand_controller_t));
if (s3c24xx_info == NULL) {
LOG_ERROR("no memory for nand controller\n");
@@ -53,12 +46,12 @@ s3c24xx_nand_device_command(struct command_context_s *cmd_ctx, char *cmd,
device->controller_priv = s3c24xx_info;
s3c24xx_info->target = get_target_by_num(strtoul(args[1], NULL, 0));
s3c24xx_info->target = get_target(args[1]);
if (s3c24xx_info->target == NULL) {
LOG_ERROR("no target '%s' configured", args[1]);
LOG_ERROR("target '%s' not defined", args[1]);
return NULL;
}
return s3c24xx_info;
}
@@ -76,17 +69,17 @@ int s3c24xx_reset(struct nand_device_s *device)
LOG_ERROR("target must be halted to use S3C24XX NAND flash controller");
return ERROR_NAND_OPERATION_FAILED;
}
target_write_u32(target, s3c24xx_info->cmd, 0xff);
return ERROR_OK;
}
int s3c24xx_command(struct nand_device_s *device, u8 command)
int s3c24xx_command(struct nand_device_s *device, uint8_t command)
{
s3c24xx_nand_controller_t *s3c24xx_info = device->controller_priv;
target_t *target = s3c24xx_info->target;
if (target->state != TARGET_HALTED) {
LOG_ERROR("target must be halted to use S3C24XX NAND flash controller");
return ERROR_NAND_OPERATION_FAILED;
@@ -97,21 +90,21 @@ int s3c24xx_command(struct nand_device_s *device, u8 command)
}
int s3c24xx_address(struct nand_device_s *device, u8 address)
int s3c24xx_address(struct nand_device_s *device, uint8_t address)
{
s3c24xx_nand_controller_t *s3c24xx_info = device->controller_priv;
target_t *target = s3c24xx_info->target;
if (target->state != TARGET_HALTED) {
LOG_ERROR("target must be halted to use S3C24XX NAND flash controller");
return ERROR_NAND_OPERATION_FAILED;
}
target_write_u16(target, s3c24xx_info->addr, address);
return ERROR_OK;
}
int s3c24xx_write_data(struct nand_device_s *device, u16 data)
int s3c24xx_write_data(struct nand_device_s *device, uint16_t data)
{
s3c24xx_nand_controller_t *s3c24xx_info = device->controller_priv;
target_t *target = s3c24xx_info->target;
@@ -120,7 +113,7 @@ int s3c24xx_write_data(struct nand_device_s *device, u16 data)
LOG_ERROR("target must be halted to use S3C24XX NAND flash controller");
return ERROR_NAND_OPERATION_FAILED;
}
target_write_u8(target, s3c24xx_info->data, data);
return ERROR_OK;
}
@@ -129,7 +122,7 @@ int s3c24xx_read_data(struct nand_device_s *device, void *data)
{
s3c24xx_nand_controller_t *s3c24xx_info = device->controller_priv;
target_t *target = s3c24xx_info->target;
if (target->state != TARGET_HALTED) {
LOG_ERROR("target must be halted to use S3C24XX NAND flash controller");
return ERROR_NAND_OPERATION_FAILED;

View File

@@ -24,18 +24,18 @@
* Many thanks to Simtec Electronics for sponsoring this work.
*/
#include "target.h"
#include "nand.h"
#include "s3c24xx_regs_nand.h"
typedef struct s3c24xx_nand_controller_s
{
struct target_s *target;
/* register addresses */
u32 cmd;
u32 addr;
u32 data;
u32 nfstat;
uint32_t cmd;
uint32_t addr;
uint32_t data;
uint32_t nfstat;
} s3c24xx_nand_controller_t;
/* Default to using the un-translated NAND register based address */
@@ -46,9 +46,9 @@ extern s3c24xx_nand_controller_t *s3c24xx_nand_device_command(struct command_con
extern int s3c24xx_register_commands(struct command_context_s *cmd_ctx);
extern int s3c24xx_reset(struct nand_device_s *device);
extern int s3c24xx_command(struct nand_device_s *device, u8 command);
extern int s3c24xx_address(struct nand_device_s *device, u8 address);
extern int s3c24xx_write_data(struct nand_device_s *device, u16 data);
extern int s3c24xx_command(struct nand_device_s *device, uint8_t command);
extern int s3c24xx_address(struct nand_device_s *device, uint8_t address);
extern int s3c24xx_write_data(struct nand_device_s *device, uint16_t data);
extern int s3c24xx_read_data(struct nand_device_s *device, void *data);
extern int s3c24xx_controller_ready(struct nand_device_s *device, int tout);
@@ -59,5 +59,5 @@ extern int s3c24xx_controller_ready(struct nand_device_s *device, int tout);
extern int s3c2440_nand_ready(struct nand_device_s *device, int timeout);
extern int s3c2440_read_block_data(struct nand_device_s *, u8 *data, int data_size);
extern int s3c2440_write_block_data(struct nand_device_s *, u8 *data, int data_size);
extern int s3c2440_read_block_data(struct nand_device_s *, uint8_t *data, int data_size);
extern int s3c2440_write_block_data(struct nand_device_s *, uint8_t *data, int data_size);

Some files were not shown because too many files have changed in this diff Show More