Commit Graph

4326 Commits (818120d4092be0d0a7cae50140dc339581cae7fc)

Author SHA1 Message Date
Andreas Fritiofson ddf7aabc67 stm32x: allow flash probe on a running target
If the flash has not yet been probed and GDB connects while the target is
running, the flash probe triggered by GDB's memory map read will fail. In
that case the returned memory map will be empty, causing a subsequent load
from within GDB to fail. There's not much you can do from GDB to recover,
other than a restart; a 'mon reset init' and manual 'mon flash probe' won't
help since GDB has already made up its mind about the memory map.

It seems there's no reason to require the target to be halted when probing
the flash. Remove the check to let a valid memory map be provided to GDB
even when connecting to a running target.

Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2010-04-20 08:55:48 +02:00
David Brownell 620310bcc6 NOR/core bugfix: restore invariants
The The patch labeled "CFI CORE: bug-fix protect single sector" was merged
rged without some requested bugfixes.  Most significantly it broke invariants
in the code, invalidating descriptions and changing the calling convention
for underlying drivers.  (It (Also wasn't CFI-specific...)

Fix that, and Include an update from Antonio Borneo for the degenerate
"nothing to do" case, (although that's still in the  wrong location.  which
is presumably why that is it was working in some cases but not all.)

 src/flash/nor/core.c |   21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2010-04-15 19:48:55 -07:00
Antonio Borneo b886049c74 NOR/CFI: remove redundant code
Arguments for "flash bank" command are already
parsed and put in "bank" struct.
Removed code to parse them again.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-04-15 19:19:54 +02:00
Antonio Borneo c9e58238c3 NOR/CFI: fix order of arguments check
Syntax of "flash bank" command requires:
- chip_width as CMD_ARGV[3]
- bus_width  as CMD_ARGV[4]
Actual code swaps the arguments.
Bug has no run time impact since wrong variables
are only used to check value and both are checked
against same constraint.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-04-15 19:19:46 +02:00
Mike Dunn ee13916411 xscale: fix analyze_trace for trace data collected in wrap mode
This patch fixes the xscale_analyze_trace() function.  This function was
defective for a trace collected in 'fill' mode (hiccups with repeated
instructions) and completely broken when buffer overflowed in 'wrap' mode.  The
reason for the latter case is that the checkpoint registers were interpreted
incorrectly when two checkpoints are present in the trace (which will be true in
'wrap' mode once the buffer fills).  In this case, checkpoint1 register will
contain the older entry, and checkpoint0 the newer.  The original code assumed
the opposite.  I eventually gave up trying to understand all the logic of the
function, and rewrote it.  I think it's much cleaner and understandable now.  I
have been using and testing this for a few weeks now.  I'm confident it hasn't
regressed in any way.

Also added capability to handle (as best as possible) the case where an
instruction can not be read from the loaded trace image; e.g., partial image.
This was a 'TODO' comment in the original xscale_analyze_trace().

Outside of xcsale_analyze_trace(), these (related) changes were made:

- Remove pc_ok and current_pc elements from struct xscale_trace.  These elements
  and associated logic are useless clutter because the very first entry placed
  in the trace buffer is always an indirect jump to the address at which
  execution resumed.  This type of trace entry includes the literal address in
  the trace buffer, so the initial address of the trace is immediately
  determined from the trace buffer contents and does not need to be recorded
  when trace is enabled.

- Added num_checkpoints to struct xscale_trace_data, which is necessary in order
  to correctly interpret the checkpoint register contents.

- In xscale_read_trace()
  - Fix potential array out-of-bounds condition.
  - Eliminate partial address entries when parsing trace (can occur in wrap mode).
  - Count and record number of checkpoints in trace.

- Added small, inlined utility function xscale_display_instruction() to help
  make the code more concise and clear.

TODO:
 - Save processor state (arm or thumb) in struct xscale_trace when trace is
   enabled so that trace can be analyzed correctly (currently assumes arm mode).
 - Add element to struct xscale_trace that records (when trace is enabled)
   whether vector table is relocated high (to 0xffff0000) or not, so that a
   branch to an exception vector is traced correctly (curently assumes vectors
   at 0x0).
2010-04-15 19:17:31 +02:00
Antonio Borneo d31bbc33fa TCL SCRIPTS: fix command name
Some tcl script has underline between the words "flash bank"
resulting in 'invalid command name "flash_bank"'.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-04-15 19:10:36 +02:00
Anton Fedotov decad30865 cortex-a8: more MMU support
+ virt2phys() can now convert virtual address to real
+ read_memory() and write_memory() are renamed to read_phys_memory()
and write_phys_memory()
+ new read_memory() and write_memory() try to resolve real address if
mmu is enambled than perform real address reading/writing
   + if address is bellow 0xc000000 than TTB0 is used for page table
dereference, if above - than TTB1. Linux style of user/kernel address
separation
   + if above fails (i.e address is unspecified) than mode is checked
whether it is Supervisor (than TTB1) or User (than TTB0)
- Software breakpoints doesn't work. You should invoke
"gdb_breakpoint_override hard" before you start debugging
+ cortex_a8_mmu(), cortex_a8_enable_mmu_caches(),
cortex_a8_disable_mmu_caches() are implemented

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-04-14 07:36:08 +02:00
Antonio Borneo a8a9eddca0 TARGET/ARM7_9_COMMON: review scope of symbols
Add "static" qualifier to private functions.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-04-11 01:31:42 +08:00
Antonio Borneo 41cb911853 NOR/TMS470: review scope of symbols
Add "static" qualifier to private functions and data.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-04-11 01:19:41 +08:00
Antonio Borneo f549dadb85 TARGET/MIPS32: review scope of functions
Add "static" qualifier to private functions.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-04-11 01:16:14 +08:00
Antonio Borneo 689fa8ad8c TARGET/MIPS32_PRACC: review scope of functions
Add "static" qualifier to private functions.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-04-11 01:11:11 +08:00
Antonio Borneo da741a51f2 TARGET/MIPS32_DMAACC: review scope of functions
Add "static" qualifier to private functions.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-04-11 01:03:53 +08:00
Antonio Borneo f1be0e6af2 HELPER/LOG: review unused symbols
Remove unused functions:
- log_catch
- log_rethrow
- log_try

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-04-10 22:25:22 +08:00
Antonio Borneo 2ea78551ab TARGET/MIPS_EJTAG: review scope of functions
Add "static" qualifier to private functions.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-04-10 22:20:41 +08:00
Antonio Borneo 4809dbb2d7 NOR/CFI: review scope of functions
Add "static" qualifier to private functions.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-04-10 22:14:34 +08:00
Antonio Borneo 11fd673f0c TARGET/DSP563XX_ONCE: review scope of functions
Add "static" qualifier to private functions.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-04-10 22:12:20 +08:00
Antonio Borneo b2495c0101 OPENOCD: review scope of functions
Add "static" qualifier to private functions.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-04-10 22:04:03 +08:00
Antonio Borneo 787a5067fb JTAG/COMMANDS: review scope of functions
Add "static" qualifier to private functions.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-04-10 22:01:16 +08:00
Antonio Borneo fdb9199001 BINARYBUFFER: review scope of data and functions
Add "static" qualifier to private data and functions.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-04-10 21:54:37 +08:00
Antonio Borneo d7246f452f NOR/STR7X: review scope of data
Add "static" qualifier to private data.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-04-10 21:52:33 +08:00
Antonio Borneo c936cb334b NAND/TCL: review scope of functions
Add "static" qualifier to private functions.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-04-10 21:50:15 +08:00
Antonio Borneo 5926b5a94f MFLASH: review scope of functions
Add "static" qualifier to private functions.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-04-10 20:11:40 +08:00
Antonio Borneo a6307fed91 NAND/ARM_IO: review scope of functions
Add "static" qualifier to private functions.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-04-10 20:09:59 +08:00
Antonio Borneo 617811ac66 NAND/CORE: review scope of functions
Add "static" qualifier to private functions.
Move function's comment from core.h to core.c.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-04-10 20:08:41 +08:00
Antonio Borneo aaf848596c NAND/MX3: review scope of data
Add "static" qualifier to private data.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-04-10 20:03:19 +08:00
Antonio Borneo 9acd453d9f NOR/ADUC702X: review scope of data
Add "static" qualifier to private data.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-04-10 19:58:15 +08:00
Antonio Borneo 069f88cfac NOR/AVRF: review scope of data
Add "static" qualifier to private data.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-04-10 19:56:24 +08:00
Antonio Borneo 300f0f53c5 NOR/CORE: review scope of data
Add "static" qualifier to private data.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-04-10 19:54:22 +08:00
Antonio Borneo 402d3292bb NOR/DRIVERS: review scope of functions
Add "static" qualifier to private functions.
Remove unused "extern" in src/ecosboard.c

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-04-10 19:38:15 +08:00
Antonio Borneo 61c0635991 STR9XPEC: review scope of functions
Add "static" qualifier to private functions.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-04-10 19:29:51 +08:00
Antonio Borneo 0c82bea44a TCL: review scope of functions
Add "static" qualifier to private functions.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-04-10 19:28:13 +08:00
Antonio Borneo c0b5ca6d17 TIME_SUPPORT: review unused symbols
Remove unused functions:
- timeval_add

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-04-10 19:25:32 +08:00
Antonio Borneo b2468e3c4f HELLO: review unused symbols
Remove unused functions:
- hello_register_commands

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-04-10 17:23:06 +08:00
Antonio Borneo 4678108034 PLD: review scope of functions
Add "static" qualifier to private functions.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-04-10 17:06:16 +08:00
Antonio Borneo ec1c90e3cd ADI_V5_JTAG: review scope of data
Add "static" qualifier to private data.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-04-10 17:03:02 +08:00
Antonio Borneo 8ffdefcc59 ARM920T: review scope of functions
Add "static" qualifier to private functions.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-04-10 17:01:06 +08:00
Antonio Borneo de27d28df9 ARM_JTAG: review scope of functions
Add "static" qualifier to private functions.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-04-10 16:59:50 +08:00
Antonio Borneo 8a871560f9 ARM_SIMULATOR: review scope of functions
Add "static" qualifier to private functions.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-04-10 16:57:49 +08:00
Antonio Borneo 4a1bd5b806 ARMV4_5_MMU: review unused symbols
Remove unused data:
- armv4_5_mmu_page_type_names
Remove prototype of not existing function:
- armv4mmu_translate_va

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-04-10 16:46:59 +08:00
Antonio Borneo 0f3bbcf096 ARMV4_5: review scope of data
Add "static" qualifier to private data.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-04-10 16:46:01 +08:00
Antonio Borneo 263b4b9057 EMBEDDEDICE: review scope of functions
Add "static" qualifier to private functions.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-04-10 16:44:54 +08:00
Antonio Borneo 3f0b17e48a TARGET: review unused symbols
Remove unused functions:
- target_all_handle_event

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-04-10 00:25:35 +08:00
Antonio Borneo 321aa6aa8f TARGET: review scope of functions
Add "static" qualifier to private functions.
Remove unused "extern" in src/ecosboard.c

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-04-10 00:22:46 +08:00
Antonio Borneo 81fab96c0d ARMv7M: review scope of functions
Add "static" qualifier to private functions.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-04-10 00:07:40 +08:00
David Brownell 2a17fd9f9b Restore deleted '!' character
I'm not sure what caused this significant character to get deleted.
it may be related to intermittent Editor or terminal flakes  I've
been seeing lately (sigh).  This fix is trivial.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2010-04-04 01:29:24 -07:00
David Brownell 876bf9bf4c target: are we running algorithm code?
Fixing one bug can easily uncover another  .... in this case,
making sure that we properly invalidate some cached NOR state when
resuming arbitrary target code turned up an issue when the code
wasn't quite arbitrary (and we couldn't know that, but some parts
of OpenOCD assumed the cache would not be invalidated.

Specifically:  some flash drivers (like CFI) update that state in loops
with downloaded algorithms, thus invalidating the state as it's probed.

 + Add a new target state flag, to record whether the target is
  running downloaded algorithm code.

 + Use that flag to add a special case:  "trust" downloaded algorithms
   not to corrupt that cached state, bypassing cache invalidation.

Also update some of the documentation to stipulate that this flavor of
trustworthiness is now *required* ... not just a fortuitous acident.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2010-04-04 00:42:05 -07:00
David Brownell 88fcb5a9ef simplify and unconfuse target_run_algorithm()
For some reason there are *two* schemes for interposing logic into
the run_algorithm() code path...  One is a standard procedural wapper
around the target method invocation.

the other (superfluous) one hacked the method table by splicing
a second procedural wrapper into the method table.  Remove it:

	* Rename its  slightly-more-featureful wrapper so it becomes
	  the standard procedural wrapper, leaving its added logic
	  (where it should have been in the first place.

          Also add a paranoia check, to report targets that don't
	  support algorithms without traversing a NULL pointer, and
	  tweak its code structure a bit so it's easier to modify.

	* Get rid of the superfluous/conusing method table hacks.

This is a net simplification, making it simpler to analyse what's
going on, and then interpose logic . ... by ensuring there's only one
natural place for it to live.

------------

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2010-04-04 00:38:39 -07:00
David Brownell d37a10da52 buildfix
Without this, a system using gcc (GCC) 4.2.4 (Ubuntu 4.2.4-1ubuntu4)
aborts builds after reporting:

tcl.c: In function ‘handle_irscan_command’:
tcl.c:1168: warning: passing argument 1 of ‘buf_set_u32’ discards qualifiers from pointer target type

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2010-04-03 18:36:07 -07:00
Mike Dunn 33e5dd1272 xscale: fix trace buffer functionality when resuming from a breakpoint
Problem: halt at a breakpoint, enable trace buffer ('xscale trace_buffer enable
fill'), then resume.  Wait for debug exception when trace buffer fills (if not
sooner due to another breakpoint, vector catch, etc).  Instead, never halts.
When halted explicitly from OpenOCD and trace buffer dumped, it contains only
one entry; a branch to the address of the original breakpoint.  If the above
steps are repeated, except that the breakpoint is removed before resuming, the
trace buffer fills and the debug exception is generated, as expected.

Cause: related to how a breakpoint is stepped over on resume.  The breakpoint is
temporarily removed, and a hardware breakpoint is set on the next instruction
that will execute.  xscale_debug_entry() is called when that breakpoint hits.
This function checks if the trace buffer is enabled, and if so reads the trace
buffer from the target and then disables the trace (unless multiple trace
buffers are specified by the user when trace is enabled).  Thus you only trace
one instruction before it is disabled.

Solution: kind of a hack on top of a hack, but it's simple.  Anything better
would involve some refactoring.  This has been tested and trace now works as
intended, except that the very first instruction is not part of the trace when
resuming from a breakpoint.

TODO: still many issues with trace: doesn't work during single-stepping (trace
buffer is flushed each step), 'xscale analyze_trace' works only marginally for
a trace captured in 'fill' mode, and not at all for a trace captured in 'wrap'
mode.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-03-29 20:24:02 +02:00
David Brownell d60ebc0ab5 jtag/tcl.c cleanup -- split out "adapter.c"
Clean up the jtag/tcl.c file, which was one of the biggest and
messiest ones in that directory.  Do it by splitting out all the
generic adapter commands to a separate "adapter.c" file (leaving
the "tcl.c" file holding only JTAG utilities).

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

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2010-03-27 10:07:13 -07:00