Commit Graph

692 Commits

Author SHA1 Message Date
Andreas Fritiofson
2d73fd8686 target: Don't poll until the target is examined.
The timer callback is started on target init, but it makes no sense to
poll until the target is fully setup.

Change-Id: I118201e125e39be3d0a920e3ef9a3f68a2035f39
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/2041
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-03-17 12:46:14 +00:00
Andreas Fritiofson
17fddb4289 stlink: Use callback to increase frequency of trace data sampling
The ST-LINK/V2 has limited internal buffering, such that trace data
can be missed if the target is generating data at a rate quicker than
the OpenOCD trace sampling. The issue of lost data is compounded since
individual TPIU packets may be split across individual STLINK_TRACE_EP
reads, and misleading results can occur if mid-packet loss occurs.

This patch increases the frequency of checking for pending trace data
with the aim of minimising such losses. Note: With the limited (I/O
and memory) bandwidth of the ST-LINK/V2 there cannot, however, be a
guarantee against trace data loss.

The timer callback is only added when enabling tracing, and is removed
when tracing is disabled.

Change-Id: Ibde9794b77793d3068f88cb5c1a26f9ceadcbd8a
Signed-off-by: James G. Smith <jsmith@ecoscentric.com>
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1661
Tested-by: jenkins
2014-03-07 21:19:12 +00:00
Adrian Burns
1338cf60b9 quark_x10xx: add new target quark_x10xx
Intel Quark X10xx SoC debug support added
Lakemont version 1 (LMT1) is the x86 core in Quark X10xx SoC
Generic x86 32-bit code is in x86_32_common.c/h

Change-Id: If2bf77275cd0277a82558cd9895b4c66155cf368
Signed-off-by: adrian.burns@intel.com
Reviewed-on: http://openocd.zylin.com/1829
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2014-02-11 13:07:29 +00:00
Spencer Oliver
47d4224d48 doc: add missing reg command argument 'force'
The argument 'force' enables a user to bypass the internal cache and read
a target register directly. However it is missing from the user guide.

Change-Id: I26f689eec20b38a0dc5294626b25df566b554446
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1897
Tested-by: jenkins
2014-02-04 20:53:49 +00:00
Andreas Fritiofson
e65817653f target: Add test bench for memory access functions
Change-Id: I86e6fe4d0b4d580389ae5e1d3f4813d1e25b2613
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1629
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-01-11 22:21:04 +00:00
Dongxue Zhang
4516eebaba [PATCH 1/2]support64: Add functions into types and target
Add functions into types.h, target.c, target.h to operate 64bits data.
Prepare for 64bits mips target.

Change-Id: I668a8a5ac12ba754ae310fa6e92cfc91af850b1c
Signed-off-by: Dongxue Zhang <elta.era@gmail.com>
Reviewed-on: http://openocd.zylin.com/1700
Tested-by: jenkins
Reviewed-by: Mathias Küster <kesmtp@freenet.de>
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2013-12-01 12:39:36 +00:00
Mathias K
a3c0f05461 target: fix mem2array/array2mem
if data size is bigger than transfer buffer, all portions are
 transferred from/to the same target address - address advance
 after successful transmission missed.

Change-Id: I79a6c388af197ac062d2807e397a2d7947400520
Signed-off-by: Sergey A. Borshch <sb-sf@users.sourceforge.net>
Signed-off-by: Mathias K <kesmtp@freenet.de>
Reviewed-on: http://openocd.zylin.com/1679
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Tested-by: jenkins
2013-10-31 21:11:48 +00:00
Andreas Fritiofson
517ba0690d Clean up const usage to avoid excessive casting
Don't use const on pointers that hold heap allocated data, because that
means functions that free them must cast away the const.

Do use const on pointer parameters or fields that needn't be modified.

Remove pointer casts that are no longer needed after fixing the constness.

Change-Id: I5d206f5019982fd1950bc6d6d07b6062dc24e886
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1668
Tested-by: jenkins
Reviewed-by: Mathias Küster <kesmtp@freenet.de>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-10-31 20:42:34 +00:00
Paul Fertser
f132fcf636 Clean up many C99 integer types format specifiers
This eliminates most of the warnings reported when building for
arm-none-eabi (newlib).

Hsiangkai, there're many similar warnings left in your nds32 files, I
didn't have the nerve to clean them all, probably you could pick it
up.

Change-Id: Id3bbe2ed2e3f1396290e55bea4c45068165a4810
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/1674
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-10-31 20:40:03 +00:00
Spencer Oliver
1c975fe30b cortex_m: target implementation renames cortex_m3 to cortex_m
We changed the actual target name quite a while ago.
This changes the actual target function names/defines to also match
this change.

Change-Id: I4f22fb107636db2279865b45350c9c776e608a75
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1626
Tested-by: jenkins
2013-10-10 20:51:03 +00:00
Franck Jullien
4e79b48e2c Add new target type: OpenRISC
Add support for OpenRISC target. This implementation
supports the adv_debug_sys debug unit core. The mohor
dbg_if is not supported. Support for mohor TAP core
and Altera Virtual JTAG core are also provided.

Change-Id: I3b1cfab1bbb28e497c4fca6ed1bd3a4362609b72
Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
Reviewed-on: http://openocd.zylin.com/1547
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2013-09-26 09:52:56 +00:00
Andreas Fritiofson
322f7dccea target: Fix strange ordering in target_read_u8
It's been like this since the check was added, in 5aa93a5e.

Change-Id: Iaa0586e0cd1ce57ad92735dcc3e51108a133fe96
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1640
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-09-25 14:44:34 +00:00
Andreas Fritiofson
be74db7341 Restore mwh/mwb functionality.
Half-word and byte writes using mwh/mwb has been completely broken since
bf71e34cbf, because it dispatched all writes, regardless of access size,
to target_write_buffer(), which uses as large accesses as possible.

Partially revert the commit by changing back to the correct write method.

Change-Id: I60731fc576bf4a076a7da02bee7879e121c21d17
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1628
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-09-21 19:26:59 +00:00
Hsiangkai Wang
6d86ded4db target: enhance target profiling
1. gprof uses 2-bytes as minimum bucket size.
2. As user wants to use gprof --sum to summarize multiple
   profiling data files, the range MUST be the same.
   Add new arguments to specify profiling range.

Change-Id: Ie7e6afa6a4d82250e2d194a0eed2b428c1479ea1
Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com>
Reviewed-on: http://openocd.zylin.com/1572
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-09-13 19:37:14 +00:00
Hsiangkai Wang
2803fa3822 target: add profiling interface
Profiling could be target-specific.  Add .profiling interface
to target_type.

Change-Id: Ic0eea9db742971db1350a474fbbb5ed24565922b
Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com>
Reviewed-on: http://openocd.zylin.com/1571
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-09-13 19:37:07 +00:00
Hsiangkai Wang
cf39210725 target: increase the maximum number of buckets
I do not know what is the reasonable number of buckets.
If there are enough buckets, the result will be accurate.

I propose increase the maximum number of buckets to 128K.
If the size of program text section is less than 256KB, every
two bytes will be occupied by one buckets.
(The minimum size of one buckets is 2 bytes in gprof implementation.)

Change-Id: If9147743cefdc36f40f21e6dc73b9b28f28c9e1e
Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com>
Reviewed-on: http://openocd.zylin.com/1608
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-09-13 19:36:49 +00:00
Hsiangkai Wang
d4d62ea8a8 target: Correct profiling calculation
1. high_pc should be (maximum sample + 1) (Refer to gprof source code)
2. bucket index should be

     sample offset
    --------------- x (number of bucket)
	 sample range

For example, if minimum sample is 0 and maximum sample is 5
and the number of bucket is 3.

a = sampled_address - 0
b = 3
c = 6
(a, b, c refer to source code variables)

sampled_address = 0, => a = 0, => bucket_index = 0
sampled_address = 1, => a = 1, => bucket_index = 0
sampled_address = 2, => a = 2, => bucket_index = 1
sampled_address = 3, => a = 3, => bucket_index = 1
sampled_address = 4, => a = 4, => bucket_index = 2
sampled_address = 5, => a = 5, => bucket_index = 2

Change-Id: Ia9fa0e4d9c7183e3e9d7ceaf73e63729f07aa2ce
Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com>
Reviewed-on: http://openocd.zylin.com/1607
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-09-13 19:36:43 +00:00
Hsiangkai Wang
a4bacdcb84 target: Make profiling function more readable
Change variable name 'length' to 'numBuckets'.  It is more readable.

Change-Id: I913cba0746f887adf6da401a46cd5e9ea88d2c6d
Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com>
Reviewed-on: http://openocd.zylin.com/1606
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-09-13 19:36:33 +00:00
Andreas Fritiofson
3377c16420 target: Rewrite read/write buffer default implementations
Rewrite the target_*_buffer_default to generate as large accesses as
possible while maintaining natural alignment.

These versions are easy to extend to generate 8-byte accesses to support
64-bit targets, although it requires some conformity from all target
implementations (i.e. they need to refuse unsupported access sizes with
some defined error code, so we can try again with a smaller one).

Change-Id: I00ddcbb1d2fd33f9f8b99cb448cc93505a2421fc
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1221
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-09-13 19:33:40 +00:00
Andreas Fritiofson
5c2f920cc7 [RFC] target: Move bulk_write_memory to arm7_9
The only remaining user is arm7_9 so remove it from the target API and add
it to struct arm7_9_common to support all its variants with minimal
changes. Many of the variants are likely not correct in the cache/mmu
handling when the bulk write is triggered. This patch does nothing to
change that, except for arm946e, where it was easier to do what might be
the right thing.

Change-Id: Ie73ac07507ff0936fefdb90760046cc8810ed182
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1220
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-09-13 19:33:28 +00:00
Hsiangkai Wang
d86211b1da target: Remove error messages as no .get_gdb_fileio_info
If target does not support semi-hosting function, it has
no need to provide .get_gdb_fileio_info callback. OpenOCD
will use default function target_get_gdb_fileio_info_default.
The default function just return ERROR_FAIL and gdb_server
will treat every halted condition as normal halted and
return "Txx" to gdb.

Change-Id: I9ddb2be3a1145eae2ef5b712bdea89eb2e0fbc20
Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com>
Reviewed-on: http://openocd.zylin.com/1586
Tested-by: jenkins
Reviewed-by: Nemui Trinomius <nemuisan_kawausogasuki@live.jp>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-08-29 08:01:26 +00:00
Paul Fertser
01dde68a4b target: clear running_alg flag after reset
After the target was reset we can be sure it's not running any
algorithm.

This fixes the following failure scenario:

On my STM32F103 board after I start the firmware and then stop and try
to "load" in gdb (before doing mon reset halt), I get

Error: timeout waiting for algorithm, a target reset is recommended

However, target reset doesn't help as the flag is still there ("Error:
Target is already running an algorithm"), so I have no choice but to
restart the OpenOCD process.

I'm not sure yet what exactly prevents load from working after my
firmware is initialised, most probably some interrupt is firing and my
handler produces a fault due to garbled RAM.

Change-Id: Idd977f2780a64d84800e3abd412cffc1ab6801b0
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/1512
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-08-07 21:03:27 +00:00
Hsiangkai Wang
399561eafa gdb_server: add target_debug_reason for program exit detection
Currently, there is no way to notify gdb that program has exited.
Add new target_debug_reason called DBG_REASON_EXIT to notify gdb
the condition has occured. If the debug reason is DBG_REASON_EXIT,
gdb_server will send 'W' packet to tell gdb the process has exited.

Change-Id: I7a371da292716a3e6ac4cc2c31b009a651fe047a
Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com>
Reviewed-on: http://openocd.zylin.com/1242
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-08-07 21:01:43 +00:00
Hsiangkai Wang
0a4c8990c2 gdb_server: support File-I/O Remote Protocol Extension
The File I/O remote protocol extension allows the target to use the
host's file system and console I/O to perform various system calls.

To use the function, targets need to prepare two callback functions:
* get_gdb_finish_info: to get file I/O parameters from target
* gdb_fileio_end: pass file I/O response to target

As target is halted, gdb_server will try to get file-I/O information
from target through target_get_gdb_fileio_info(). If the callback function
returns ERROR_OK, gdb_server will initiate a file-I/O request to gdb.
After gdb finishes system call, gdb will pass response of the system call
to target through target_gdb_fileio_end() and continue to run(continue or step).

To implement the function, I add a new data structure in struct target,
called struct gdb_fileio_info, to record file I/O name and parameters.

Details refer to GDB manual "File-I/O Remote Protocol Extension"

Change-Id: I7f4d45e7c9e967b6d898dc79ba01d86bc46315d3
Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com>
Reviewed-on: http://openocd.zylin.com/1102
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-08-07 21:01:25 +00:00
Hsiangkai Wang
80d412bafc gdb server: new feature, add stop reason in stop reply packet for gdb
In GDB remote serial protocol, the stop reply packet could contain more
detail stop reason. The currently defined stop reasons are listed below.

* watch
* rwatch
* awatch
* library
* replaylog

This commit adds stop reason, watch/rwatch/awatch, in stop reply packet for
just hit watchpoint. As manual indicates, at most one stop reason should be present.

The function needs target to implement new hook, hit_watchpoint. The hook will fill
the hit watchpoint in second parameter. The information will assist gdb to locate
the watchpoint. If no such information, gdb needs to scan all watchpoints by itself.

Refer to GDB Manual, D.3 Stop Reply Packets

Change-Id: I1f70a1a9cc772e88e641b6171f1a009629a43bd1
Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com>
Reviewed-on: http://openocd.zylin.com/1092
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-08-07 21:01:08 +00:00
Hsiangkai Wang
d979d78e97 gdb_server: support gdb target description
* Add a parameter in .get_gdb_reg_list() to return different
  register lists as generating target description.
* Modify STRUCT REG to let gdb generate target description
  according to register information.

The modified structure of register is
struct reg {
        const char *name;
        uint32_t number;  /* for regnum="num" */
        struct reg_feature *feature;  /* for register group feature name */
        bool caller_save;  /* for save-restore="yes|no" */
        void *value;
        bool dirty;
        bool valid;
        bool exist;
        uint32_t size;
        struct reg_data_type *reg_data_type;  /* for type="type" */
        const char *group;  /* for group="general|float|vector" */
        void *arch_info;
        const struct reg_arch_type *type;
};

Change-Id: I2096b67adf94518ba0b8b23d8c6a9f64ad7932b8
Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com>
Reviewed-on: http://openocd.zylin.com/1382
Tested-by: jenkins
Reviewed-by: Franck Jullien <franck.jullien@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2013-08-07 21:00:40 +00:00
Paul Fertser
c658229f92 target: fix halt and wait_halt timeout units
Documentation says they should be given values in milliseconds,
DEFAULT_HALT_TIMEOUT matches that too.

Change-Id: Ic1a30fa90f75b412c43fe50ba187d01c3d0a5fba
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/1504
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-07-17 14:34:29 +00:00
Spencer Oliver
8faa419fad target: use consistent halt timeout
On slow targets we sometimes get false messages about timeouts due to poll
using 1sec rather than the default 5sec timeout.

Change-Id: Icc81c78e0ca86cebf9eeb2f5307cf7a82f1f4ee8
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1466
Tested-by: jenkins
2013-07-15 16:03:31 +00:00
Paul Fertser
80d01ca975 target: remove double const specificator
Double const is bogus and breaks the build on Clang 3.3.

Change-Id: I9f9394d17f66289ac74ae6dd48f3165483b72e9e
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/1489
Reviewed-by: Laszlo Papp <lpapp@kde.org>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Tested-by: jenkins
2013-07-15 09:54:16 +00:00
Spencer Oliver
08d4411b59 update files to correct FSF address
Change-Id: I429f7fd51f77b0e7c86d7a7f110ca31afd76c173
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1426
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2013-06-05 19:52:42 +00:00
Hsiangkai Wang
cf8a3c3d70 nds32: add new target type nds32_v2, nds32_v3, nds32_v3m
Add target code for Andes targets.

Change-Id: Ibf0e1b61b06127ca7d9ed502d98d7e2aeebbbe82
Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com>
Reviewed-on: http://openocd.zylin.com/1259
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-06-05 19:27:35 +00:00
Andreas Fritiofson
a7e3418258 target: Retire target_bulk_write_memory()
The only caller was arm_nandwrite(). Replace that call with
target_write_buffer() instead, which in turn may end up calling the same
bulk_write_memory target API function.

Change-Id: If34c7474df5cf14af3b732fb4774816818f28e79
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1214
Tested-by: jenkins
Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-03-15 15:56:35 +00:00
Andreas Fritiofson
4315142ea0 target: Add default implementation of bulk_write_memory
Remove dummy implementations from all targets except arm7_9 and mips, which
are the only ones with real implementations. Replace with a single default
implementation simply calling target_write_memory().

Change-Id: I9228104240bc0b50661be20bc7909713ccda2164
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1213
Tested-by: jenkins
Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-03-15 15:56:25 +00:00
Evan Hunter
13288a44be arch: Added ARMv7R and Cortex-R4 support
Rewrite to merge Cortex-A and Cortex-R code

Change-Id: I4541557980d43d1bba6e8d1bfeb04f536ed25a00
Signed-off-by: Evan Hunter <ehunter@broadcom.com>
Reviewed-on: http://openocd.zylin.com/358
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-03-15 15:54:05 +00:00
Andreas Fritiofson
9b6de72c2b target: Remove read_memory_imp
Change-Id: Idc6ef3b075ccbb5945df8fea746011cb17175d8f
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1219
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-03-13 12:36:09 +00:00
Andreas Fritiofson
5914310f88 target: Remove write_memory_imp
Change-Id: I5d933bc19443bba8a0193c90471fdd0614324a92
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1218
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-03-13 12:36:04 +00:00
Andreas Fritiofson
80b80ef9b4 target: Remove soft_reset_halt_imp
Change-Id: I12c907584ef73de570eba2dcfeb8477cabc6098f
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1217
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-03-13 12:36:01 +00:00
Spencer Oliver
dcfa3ac7c7 target: use common target_name to access target::cmd_name member
Change-Id: I203b89ef25a072c3b00b504483d5f2a83477fad6
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1182
Tested-by: jenkins
Reviewed-by: Mathias Küster <kesmtp@freenet.de>
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2013-03-06 19:04:31 +00:00
Mathias K
5d80b36552 Move back off timer to target struct
Move the global target back off timer to the target struct. This will
fix the wrong error handling with multi target devices like smp systems.

Change-Id: Ia327182ed5d13ca87323700017a8c40ecc6b25a3
Signed-off-by: Mathias K <kesmtp@freenet.de>
Reviewed-on: http://openocd.zylin.com/1179
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2013-03-05 15:08:52 +00:00
Mathias K
c4e0109644 Add the target name to debug output for better understanding and error identification.
Change-Id: I1054debea6cd3a6548aadeae2d84000a0039814e
Signed-off-by: Mathias K <kesmtp@freenet.de>
Reviewed-on: http://openocd.zylin.com/1178
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-03-05 15:08:27 +00:00
Spencer Oliver
6c467da586 stlink: rename stlink cmd names
As part of the switch to using the hla for the stlink interface we rename
the cmds to a more generic name.

Update scripts to match new names.

Also add handlers for deprecated names.

Change-Id: I6f00743da746e3aa13ce06acfdc93c8049545e07
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/921
Tested-by: jenkins
2012-12-23 21:45:42 +00:00
Spencer Oliver
549d9bc72c target: add deprecated target name support
This enables us to change the target name without breaking any
target scripts.

Change-Id: I635f961e573264d3dab2560f3a803ef1986ccfde
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/919
Tested-by: jenkins
2012-12-23 21:45:23 +00:00
Spencer Oliver
5c2c269336 target: add async algorithm timeout
An issue was observed when using an async algorithm with a target that had
not been previously reset beforehand. The target would enter a infinite
loop within target_run_flash_async_algorithm.

Add a timeout that will at least prevent this issue from happening. and also
suggest the user resets the target.

Change-Id: I5277e0d64e252d3d353e8d5bc9889a37fdc63060
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/949
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2012-11-06 17:38:37 +00:00
Spencer Oliver
cbfc443c7b Revert "target: remove unused working area 'user' field"
This reverts commit 63a23e6fc8

Change-Id: I62778fb3b1dabc6470d582bea9ca64d593999233
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Change-Id: Iaf5a2cf5bdc4a62ba68ad9403e1c1229112970de
Reviewed-on: http://openocd.zylin.com/899
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-10-07 13:26:58 +00:00
Spencer Oliver
63a23e6fc8 target: remove unused working area 'user' field
working_area::user has never been used so lets remove it.

Change-Id: I1200311b34248549c1fe30c9f675e6129b7bebee
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/781
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-08-24 16:52:52 +00:00
Spencer Oliver
a7f320e919 target: add valid smp target check
Check that the target is valid before calling any target functions.

Change-Id: I538fccc79d5ec89976e14beab02cb20490b299bb
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/766
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-08-02 14:30:09 +00:00
Vandra Akos
9ce207a52a target.c, jim_target_md using command_print_sameline
jim_target_md is supposed to print out results with command_print in
hexdump format. It was using command_print which appends a newline character
aftre every invocation. Using command_print_sameline instead

Change-Id: Iaff03021acc38d54b5a082cb58b82aa4449c0715
Signed-off-by: Vandra Akos <axos88@gmail.com>
Reviewed-on: http://openocd.zylin.com/669
Tested-by: jenkins
Reviewed-by: Alexander Osipenko <sipych@gmail.com>
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-07-11 08:08:01 +00:00
Vandra Akos
30aacc0564 target/target.c, jim_target_md refractored
- Added a few lines of comment before the function explaining the usage and the
output generated by the command
 - Added a few lines of comment in the body explaining what is happening to improve
code readability
 - Renamed a few variables to improve readability:
    * a -> addr
    * b -> dwidth
    * c -> count
 - Added a new variable, named byte to contain the number of bytes to read, instead
of overwriting the count parameter, to avoid confusion between the two values.

Change-Id: I5828ec0f5aadaa39becec7b84f198756bb2c3d41
Signed-off-by: Vandra Akos <axos88@gmail.com>
Reviewed-on: http://openocd.zylin.com/665
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-07-11 08:07:22 +00:00
Spencer Oliver
1dd462a6d6 target: enable TARGET_EVENT_EXAMINE_* events
Change-Id: I33efc0994b7bfe0faa2f4e8457fcc3c8e43d3571
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/635
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
Tested-by: jenkins
Reviewed-by: Bill Traynor <wmat@alphatroop.com>
2012-05-21 16:20:07 +00:00
Spencer Oliver
25b855d2d2 target: enable TARGET_EVENT_RESUME_* events
Change-Id: I7d8378f9f34c6674db8c8b29d1a961389578e921
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/640
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
Tested-by: jenkins
Reviewed-by: Bill Traynor <wmat@alphatroop.com>
2012-05-21 16:19:52 +00:00
Spencer Oliver
bb3793c9a4 target: remove legacy target events
These events have been deprecated for a number of years, update any
remaining scripts to the new events.

Change-Id: Ic31ff388545ac8b3a500045699ca92c541b13f12
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/634
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
Tested-by: jenkins
Reviewed-by: Bill Traynor <wmat@alphatroop.com>
2012-05-21 16:19:28 +00:00
Spencer Oliver
482660031a target: remove duplicate target events
Change-Id: Iba9ae441f3e6d48a7dfafe59ed093fef56a34723
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/633
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
Tested-by: jenkins
Reviewed-by: Bill Traynor <wmat@alphatroop.com>
2012-05-21 16:19:02 +00:00
Spencer Oliver
908ee4dc96 build: remove clang unused variable assignment warnings
Change-Id: Ibe5254704d6cd879a318a82c4f50d9da3c14276c
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/600
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-05-04 08:15:40 +00:00
Spencer Oliver
bee7184ce4 target: add target async algorithm support
Currently the stm32f1x flash driver uses an asynchronous algorithm
as part of the block flash programming. This greatly speeds up flash
programming as the target is always running.

Moving the async code to the target enable other targets to use this
added functionality.

Change-Id: I8e53f094c2ef7848a7f86ddb9a35b6edbfc8454a
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/402
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2012-02-26 00:44:25 +00:00
Andreas Fritiofson
2eb564b756 target: add function to get number of bytes available in working area
This is a much cleaner solution to the problem of allocating as much
working area as possible than what is currently being done in most/all flash
drivers (which is: try an arbitrary sized chunk, if it fails, pick a smaller
number, rinse and repeat).

Use this function to find out how much working area is available, limit or
restrict that amount at will and then simply allocate it.

Change-Id: Ib7d5d0b7485aed3e0a4fad60c1bedb7dfd16146f
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/446
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-02-23 14:04:01 +00:00
Andreas Fritiofson
813f4a5411 target: rewrite working area allocator
The existing allocator couldn't reuse a freed allocation if the sizes
didn't match exactly. That led to problems when for example a flash write
routine had allocated all of the working area to speed up operation. A
subsequent verify pass couldn't allocate space for the checksum algorithm
even though all previous allocations had been freed.

This allocator is marginally more complex, but solves the above problem by
splitting larger free areas to fulfill smaller requests and by merging
released areas into adjacent free areas.

An initial free area, covering the entire specified address range, is set
up on first allocation, and all allocations are split off from (and
ultimately merged into) that one. It can also easily be adapted to support
several disjoint working areas for the same target, by setting up several
initial free areas and slightly modifying the merge code.

Change-Id: I6faaf9801312bb19a4fa4474694a0cd1c6e0ab54
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/445
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-02-23 14:02:23 +00:00
Freddie Chopin
4db24acb93 Add init_board procedure executed after init_targets
This adds init_board procedure that behaves exactly the same as
init_targets - it can be overriden by "next level" scripts. This
procedure is executed after init_targets, allowing common stuff (jtag
chain, memory, flash, ...) to be configured in target script (via
init_target) and leaving rest (like additional memory, reset
configuration, reset-init handlers, ...) to be done in init_board.

This makes init_targets scheme more complete and easier to use - current
board scripts will not need new init_targets, because everything can be
"packed" in init_boards. Moreover it solves the problem of variables
being set in init_targets (executed after init), which were not
accessible by "linear" scripts (parsed before init). All that has to be
done is to enclose all code in board config file in init_board
procedure.

Change-Id: I0736b1ff9873a687966407d62b58ccf29a8e597b
Signed-off-by: Freddie Chopin <freddie.chopin@gmail.com>
Reviewed-on: http://openocd.zylin.com/427
Reviewed-by: Chris Morgan <chmorgan@gmail.com>
Tested-by: jenkins
Reviewed-by: Peter Stuge <peter@stuge.se>
2012-02-09 18:09:02 +00:00
Spencer Oliver
374127301e build: cleanup src/target directory
Change-Id: Ia055b6d2b5f6449a38afd0539a8c66e7d7e0c059
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/430
Tested-by: jenkins
2012-02-06 11:00:36 +00:00
Andreas Fritiofson
61f3d4b7e4 target: increase chunk size in dump_image
Replace the big stack-allocated buffer with a much bigger heap-allocated.
There was no explanation for the apparently arbitrary chunk size, and
performance was improved by increasing it, leveling out at about 4k.

Change-Id: I3b06d4469092ec8d89d0ce05bff0b7cf213c5062
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/404
Tested-by: jenkins
Reviewed-by: Marti Bolivar <mbolivar@leaflabs.com>
Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
2012-01-30 19:09:53 +00:00
Michel JAOUEN
2bc51d1abc rtos : ps command
Change-Id: I1b00b6d72f425826c33b0df7dd63114ce642ce93
Signed-off-by: Michel JAOUEN <michel.jaouen@stericsson.com>
Reviewed-on: http://openocd.zylin.com/345
Tested-by: jenkins
Reviewed-by: Evan Hunter <evan@ozhiker.com>
Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
2012-01-15 22:13:03 +00:00
Michel JAOUEN
ebac7c963a rtos : smp support
Change-Id: I583cddf5e62ed77f108786a085569ab8699ad50d
Signed-off-by: Michel JAOUEN <michel.jaouen@stericsson.com>
Reviewed-on: http://openocd.zylin.com/344
Tested-by: jenkins
Reviewed-by: Evan Hunter <evan@ozhiker.com>
Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
2012-01-15 22:11:48 +00:00
Spencer Oliver
2a34cc8eb6 cmd: add missing usage var
Change-Id: I0f05d643b0801b19cc3beb88f0d12d7e4c83ef9c
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/356
Tested-by: jenkins
2012-01-12 20:45:01 +00:00
Mathias K
16b6b5e7a8 Change return value on error.
On wrong parameters a error is signalized to the calling function.

Change-Id: I484443fdb39938e20382edc9246d5ec546a5c960
Signed-off-by: Mathias K <kesmtp@freenet.de>
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Reviewed-on: http://openocd.zylin.com/282
Tested-by: jenkins
Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
2012-01-04 17:56:46 +00:00
Øyvind Harboe
4668bd264c retire ERROR_INVALID_ARGUMENTS and replace with ERROR_COMMAND_SYNTAX_ERROR
Change-Id: I6dee51e1fab1944085391f274a343cdb9014c7a4
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Reviewed-on: http://openocd.zylin.com/300
Tested-by: jenkins
Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-01-04 17:13:46 +00:00
Mathias K
54d6330b78 command: print BUG warning when usage is missing
These error messages will prompt patches to be submitted for missing
.usage or empty fields. All of the below must be resolved before next
release.

The Jim defined commands are excluded from this checklist because the
help text can be set later than during command registration.

strlen(.usage) == 0 means that the command expects no arguments.

Updates to this patch in Gerrit to fix problems below are most
welcome. Anyone can push updated versions of a patch to Gerrit. If
there are no further updates to this patch within a week, it will be
pushed to the master branch to prompt more fixes.

These were caught by launching OpenOCD.

Error: BUG: command 'command' does not have the '.usage' field filled out
Error: BUG: command 'script' does not have the '.usage' field filled out
Error: BUG: command 'power_restore' does not have the '.usage' field filled out
Error: BUG: command 'srst_deasserted' does not have the '.usage' field filled out
Error: BUG: command 'measure_clk' does not have the '.usage' field filled out
Error: BUG: command 'exit' does not have the '.usage' field filled out
Error: BUG: command 'shutdown' does not have the '.usage' field filled out
Error: BUG: command 'gdb_sync' does not have the '.usage' field filled out
Error: BUG: command 'interface_list' does not have the '.usage' field filled out
Error: BUG: command 'target' does not have the '.usage' field filled out
Error: BUG: command 'target init' does not have the '.usage' field filled out
Error: BUG: command 'flash' does not have the '.usage' field filled out
Error: BUG: command 'flash init' does not have the '.usage' field filled out
Error: BUG: command 'flash banks' does not have the '.usage' field filled out
Error: BUG: command 'nand' does not have the '.usage' field filled out
Error: BUG: command 'nand drivers' does not have the '.usage' field filled out
Error: BUG: command 'nand init' does not have the '.usage' field filled out
Error: BUG: command 'pld' does not have the '.usage' field filled out
Error: BUG: command 'pld init' does not have the '.usage' field filled out
Error: BUG: command 'mflash' does not have the '.usage' field filled out
Error: BUG: command 'mflash init' does not have the '.usage' field filled out
Error: BUG: command 'dummy' does not have the '.usage' field filled out
Error: BUG: command 'dummy foo' does not have the '.usage' field filled out
Error: BUG: command 'scan_chain' does not have the '.usage' field filled out
Error: BUG: command 'jtag' does not have the '.usage' field filled out
Error: BUG: command 'jtag init' does not have the '.usage' field filled out
Error: BUG: command 'arm' does not have the '.usage' field filled out
Error: BUG: command 'arm reg' does not have the '.usage' field filled out
Error: BUG: command 'etm' does not have the '.usage' field filled out
Error: BUG: command 'arm7_9' does not have the '.usage' field filled out
Error: BUG: command 'at91eb40a.cpu' does not have the '.usage' field filled out
Error: BUG: command 'at91eb40a.cpu arm' does not have the '.usage' field filled out
Error: BUG: command 'arm reg' does not have the '.usage' field filled out
Error: BUG: command 'at91eb40a.cpu etm' does not have the '.usage' field filled out
Error: BUG: command 'at91eb40a.cpu arm7_9' does not have the '.usage' field filled out
Error: BUG: command 'target_request' does not have the '.usage' field filled out
^C
oyvind@fierce:~/openocd$ openocd -c "interface dummy" -f board/at91eb40a.cfg 2>&1 | grep -w BUG
Error: BUG: command 'command' does not have the '.usage' field filled out
Error: BUG: command 'script' does not have the '.usage' field filled out
Error: BUG: command 'power_restore' does not have the '.usage' field filled out
Error: BUG: command 'srst_deasserted' does not have the '.usage' field filled out
Error: BUG: command 'measure_clk' does not have the '.usage' field filled out
Error: BUG: command 'exit' does not have the '.usage' field filled out
Error: BUG: command 'shutdown' does not have the '.usage' field filled out
Error: BUG: command 'gdb_sync' does not have the '.usage' field filled out
Error: BUG: command 'interface_list' does not have the '.usage' field filled out
Error: BUG: command 'target' does not have the '.usage' field filled out
Error: BUG: command 'target init' does not have the '.usage' field filled out
Error: BUG: command 'flash' does not have the '.usage' field filled out
Error: BUG: command 'flash init' does not have the '.usage' field filled out
Error: BUG: command 'flash banks' does not have the '.usage' field filled out
Error: BUG: command 'nand' does not have the '.usage' field filled out
Error: BUG: command 'nand drivers' does not have the '.usage' field filled out
Error: BUG: command 'nand init' does not have the '.usage' field filled out
Error: BUG: command 'pld' does not have the '.usage' field filled out
Error: BUG: command 'pld init' does not have the '.usage' field filled out
Error: BUG: command 'mflash' does not have the '.usage' field filled out
Error: BUG: command 'mflash init' does not have the '.usage' field filled out
Error: BUG: command 'dummy' does not have the '.usage' field filled out
Error: BUG: command 'dummy foo' does not have the '.usage' field filled out
Error: BUG: command 'scan_chain' does not have the '.usage' field filled out
Error: BUG: command 'jtag' does not have the '.usage' field filled out
Error: BUG: command 'jtag init' does not have the '.usage' field filled out
Error: BUG: command 'arm' does not have the '.usage' field filled out
Error: BUG: command 'arm reg' does not have the '.usage' field filled out
Error: BUG: command 'etm' does not have the '.usage' field filled out
Error: BUG: command 'arm7_9' does not have the '.usage' field filled out
Error: BUG: command 'at91eb40a.cpu' does not have the '.usage' field filled out
Error: BUG: command 'at91eb40a.cpu arm' does not have the '.usage' field filled out
Error: BUG: command 'arm reg' does not have the '.usage' field filled out
Error: BUG: command 'at91eb40a.cpu etm' does not have the '.usage' field filled out
Error: BUG: command 'at91eb40a.cpu arm7_9' does not have the '.usage' field filled out
Error: BUG: command 'target_request' does not have the '.usage' field filled out

Change-Id: I2c3e529530a15d2295a1950ffc59e8f2fc661012
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Signed-off-by: Mathias K <kesmtp@freenet.de>
Reviewed-on: http://openocd.zylin.com/299
Tested-by: jenkins
Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-01-04 17:13:03 +00:00
Mathias K
033d1053ae STM32 ST-LINK target initial release
STM32 ST-LINK target  added.

Change-Id: Ibe2b7a3c0d5a8cf73d8680d6019adbdb62d68fa2
Signed-off-by: Mathias K <kesmtp@freenet.de>
Reviewed-on: http://openocd.zylin.com/279
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-01-03 21:12:37 +00:00
Mathias K
ea54ea5364 target init sanity check
Add a test if the pointer to the target_init function in the target struct
is set before the function pointer is used.

Change-Id: Ie4ea542f64f35efce8c5bce2ced9b881bf283ec1
Signed-off-by: Mathias K <kesmtp@freenet.de>
Reviewed-on: http://openocd.zylin.com/241
Tested-by: jenkins
Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
2011-11-29 14:35:24 +00:00
Spencer Oliver
b462316699 target: fix init_targets script handling
This fixes an issue when init is called before init_targets has been
executed.

Make sure init_targets is called before init.

Change-Id: Icd5bd4c2a8eea2e399d9de4e331a77560e9672ac
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/235
Tested-by: jenkins
Reviewed-by: Peter Stuge <peter@stuge.se>
2011-11-23 23:51:36 +00:00
Øyvind Harboe
08815946f6 bugfixes: tinker a bit with the targets command
return error when target can not be found instead of ERROR_OK,
split fn.

Change-Id: Iba5232d3862a490d0995c3bfece23685bd6856e3
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Reviewed-on: http://openocd.zylin.com/131
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2011-10-31 17:41:44 +00:00
Øyvind Harboe
97806831e2 bugfixes: numerous bugs in error propagation found by clang
Change-Id: I784068325b422d1918e28c08544bc5a1332d712f
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Reviewed-on: http://openocd.zylin.com/130
Tested-by: jenkins
Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
2011-10-27 22:08:35 +00:00
Øyvind Harboe
c9f51acdc3 clang: fix warning w/assert so that clang knows that there will be no division by zero
Change-Id: I98ac62a22f21043bb535a667a4f1f1537ccde2a4
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Reviewed-on: http://openocd.zylin.com/42
Tested-by: jenkins
Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
2011-10-23 11:57:34 +00:00
Spencer Oliver
8cd3832e2b target: whitespace cleanup
Change-Id: I1453f4f3dc0add529da20577e38b8b82d7d00366
Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
Reviewed-on: http://openocd.zylin.com/18
Reviewed-by: Alex Austin <alex.austin@spectrumdsi.com>
Tested-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2011-10-13 20:18:43 +00:00
Michel Jaouen
5a7cff26a5 breakpoint : smp software breakpoint issue
Change-Id: Iefe78bad71d4fdb38ae412ab8fe2f6282836c22e
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Reviewed-on: http://openocd.zylin.com/14
Tested-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2011-10-13 18:54:04 +00:00
Andreas Fritiofson
3f6ef7a40b target: add async algorithm entries to the target type
On supported targets, this may be used to start a long running algorithm in
the background so the target may be interacted with during execution and
later wait for its completion.

The most obvious use case is a double buffered flash algorithm that can
upload the next block of data while the algorithm is flashing the current.

Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2011-10-09 00:00:52 +02:00
Heythem Bouhaja
c8926d1457 cortex_a hybrid & context breakpoints 2011-08-30 18:27:52 +02:00
Stefan Mahr
28f088dc66 target: add helper functions to get/set u16 or u32 array from/to buffer 2011-08-12 12:00:42 +02:00
Øyvind Harboe
7d2bf8805d Revert "dsp5680xx: disable for now, it generates warnings"
This reverts commit d567df02b9.
2011-08-09 20:15:21 +02:00
Øyvind Harboe
d567df02b9 dsp5680xx: disable for now, it generates warnings
Use "git revert <commit>" to revert this commit, then build and
repair and post patch to the mailing list.

Warnings generated with:

nios2-elf-gcc (GCC) 3.4.6 (Altera Nios II 9.1 b222)

openocd/src/target/dsp5680xx.c: In function 'eonce_rx_upper_data':
openocd/src/target/dsp5680xx.c:252: warning: cast increases required
alignment of target type
openocd/src/target/dsp5680xx.c: In function 'eonce_rx_lower_data':
openocd/src/target/dsp5680xx.c:268: warning: cast increases required
alignment of target type
openocd/src/target/dsp5680xx.c: In function 'eonce_pc_store':
openocd/src/target/dsp5680xx.c:508: warning: dereferencing type-punned
pointer will break strict-aliasing rules
openocd/src/target/dsp5680xx.c: In function 'dsp5680xx_read':
openocd/src/target/dsp5680xx.c:736: warning: cast increases required
alignment of target type
openocd/src/target/dsp5680xx.c:737: warning: cast increases required
alignment of target type
openocd/src/target/dsp5680xx.c: In function 'dsp5680xx_write_8':
openocd/src/target/dsp5680xx.c:823: warning: cast increases required
alignment of target type
openocd/src/target/dsp5680xx.c: In function 'dsp5680xx_write':
openocd/src/target/dsp5680xx.c:938: warning: cast increases required
alignment of target type
openocd/src/target/dsp5680xx.c:941: warning: cast increases required
alignment of target type
openocd/src/target/dsp5680xx.c: In function 'dsp5680xx_f_wr':
openocd/src/target/dsp5680xx.c:1355: warning: cast increases required
alignment of target type
2011-06-28 18:39:01 +02:00
Rodrigo L. Rosa
9d4aec6bda partial support for 568013 and 568037, target integration. 2011-05-18 18:47:50 +02:00
Michel Jaouen
b778b36f29 smp : infra for smp minimum support 2011-04-28 12:22:10 +02:00
Broadcom Corporation (Evan Hunter)
b69119668e RTOS Thread awareness support wip
- works on Cortex-M3 with ThreadX and FreeRTOS

Compared to original patch a few nits were fixed:

- remove stricmp usage
- unsigned compare fix
- printf formatting fixes
- fixed a bug with overrunning a memory buffer allocated with malloc.
2011-04-15 08:24:18 +02:00
Øyvind Harboe
2615bf4398 types: write memory now uses const
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2011-04-01 08:59:07 +02:00
Øyvind Harboe
b75bdb7b04 target: add -dbgbase option to target configuration
Really a Cortex-A specific option, but there is no
system in place to support target specific options
currently and there has been no need for such a system
until now.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2011-03-31 09:30:48 +02:00
Øyvind Harboe
fc574c64bb cortex a9: merge cortex a9 and a8 code
better to keep this in a single file.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2011-03-22 09:10:21 +01:00
Mathias K
4332bc32e4 target: allow targets to override memory alignment
Targets can implement read/write_buffer to handle
alignment.
2011-03-17 14:18:16 +01:00
Uwe Hermann
33a17fd359 Fix a bunch of typos.
Fix a bunch of typos.

Most are in code comments, so nothing should break. UNKOWN_COMMAND and
CMD_UNKOWN are not used elsewhere, so correcting the spelling should
also not break anything.
2011-03-17 07:25:25 +01:00
Mathias K
b0bdc4e2f2 24bit buffer support
Hello,

this patch add 24bit support to the target buffer functions and little/big endian functions.

Regards,

Mathias
2011-02-03 12:23:55 +01:00
Aaron Carroll
c34e69cb10 cortex_a9: add source files for Cortex A9 support.
add target and build support for A9

Signed-off-by: Aaron Carroll <aaronc@cse.unsw.edu.au>
2011-01-31 08:57:38 +01:00
Aaron Carroll
aea22bdbd1 Add '-coreid' target option to support multiple cores per TAP.
ARM Cortex-A9 multi-core chips expose a single TAP/DAP which connects
to both cores.  The '-coreid' option selects which core the target
should connect to.

Note that at present, OpenOCD can connect to either core, but not both
simulatenously, until ADI contexts can be shared.

Signed-off-by: Aaron Carroll <aaronc@cse.unsw.edu.au>
2011-01-31 08:53:21 +01:00
Spencer Oliver
dc1c5a7500 target: change working area free data type
We only use the struct working_area member 'free' as a
true/false type so might as well use a bool data type.

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2011-01-04 09:52:20 +00:00
Andrew MacIsaac
50e79d60ce Compilation Warnings on OS X 10.5
I received a number of "-Wshadow" related warnings (treated as errors) while
trying to build on OS X Leopard.  In addition, there were two miscellaneous
other warnings in the flash drivers.  Attached are two patches which correct
these issues and the commit messages to accompany them.

My system has the following configuration (taken from uname -a):

Darwin 9.8.0 Darwin Kernel Version 9.8.0: Wed Jul 15 16:55:01 PDT 2009;
root:xnu-1228.15.4~1/RELEASE_I386 i386

=== Werror_patch.txt Commit Message ===
compilation: fixes for -Wshadow warnings on OS X

These changes fix -Wshadow compilation warnings on OS X 10.5.8

Compiled with the following configure command:

../configure --prefix=/usr/local --enable-maintainer-mode --enable-jlink
--enable-ft2232_libftdi

=== flash_patch.txt Commit Message ===
compilation: fixes for flash driver warnings on OS X

These changes fix two compilation warnings on OS X 10.5.8:

../../../../src/flash/nor/at91sam3.c:2767: warning: redundant redeclaration
of 'at91sam3_flash'
../../../../src/flash/nor/at91sam3.c:101: warning: previous declaration of
'at91sam3_flash' was here

and

../../../../src/flash/nor/stmsmi.c:205: warning: format not a string literal
and no format arguments

Compiled with the following configure command:

../configure --prefix=/usr/local --enable-maintainer-mode --enable-jlink
--enable-ft2232_libftdi
===

Andrew
2010-12-29 22:16:28 +01:00
Øyvind Harboe
8f93c0a3fe target: do not expose error numbers to users
error numbers are only reported at DEBUG log levels and
used internally, they are not part of the user interface.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-12-29 20:59:30 +01:00
Øyvind Harboe
778b789c8e profile: use 100Hz as a default sampling frequency
it's a lie that is somewhere in the vicinity of the
truth. Certainly 64MHz confuses gprof and produces
zero output and no error messages.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-12-01 15:28:56 +01:00
Øyvind Harboe
17634b3760 fastload: fix error handling upon running out of memory
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-11-22 09:16:32 +01:00
ddraskovic
9e3d43cfe7 arm964e: Add support for ARM946E target.
So far most of the people have been using existing ARM966E in the
place of ARM946E, because they have practically the same scan chains.

However, ARM946E has caches, which further complicates JATG handling
via scan-chain. this was preventing single-stepping for ARM946E when
SW breakpoints are used.

This patch thus introduces :
1) Correct cache handling on memory write
2) Possibility to flush whole cache and turn it off during debug, or
just to flush affected lines (faster and better)
3) Correct SW breakpoint handling and correct single-stepping
4) Corrects the bug on CP15 read and write, so CP15 values
are now correctly R/W
2010-11-04 14:52:47 +01:00
Øyvind Harboe
559d08c19e jim tests: use installed
Delete obsolete jim that comes with OpenOCD.
2010-10-29 15:10:51 +02:00
Antonio Borneo
ed44447e3d TARGET: review handle_load_image_command()
Collect variable definitions.
Report syntax error to command dispatcher.
Propagate error when unable to open file.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-10-12 11:22:32 +02:00
Antonio Borneo
2ee47b22c6 TARGET: fix segfault in handle_dump_image_command()
The struct fileio is used after fileio_close().
Move fileio_close() after last usage.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-10-12 11:22:26 +02:00
Øyvind Harboe
3931b99d14 fileio: fileio_size() can now fail
Part of making the fileio API more robust.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-09-29 18:56:07 +02:00
Øyvind Harboe
3a693ef526 fileio: refactor struct fileio to be an opaque structure
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-09-29 08:43:27 +02:00
Oleksandr Tymoshenko
c3d51bf0da avr32: work-in-progress
committed so as to ease cooperation and to let it be improved
over time.

So far it supports:
- halt/resume
- registers inspection
- memory inspection/modification

I'm still getting up to speed with OpenOCD internals and AVR32 so code is a little
bit messy and I'd appreciate any feedback.
2010-08-15 21:51:34 +02:00
Øyvind Harboe
8f779cf66b tcl: remove silly ocd_ prefix to array2mem and mem2array
ocd_ prefix is used internally in OpenOCD as a kludge more
or less to deal with the two kinds of commands that OpenOCD
has.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-08-11 17:24:55 +02:00
Øyvind Harboe
1399e5f753 target: if polling fails, back off
back-off algorithm for polling. Double polling
interval up to 5000ms when it fails.

when polling succeeds, reset backoff.

This avoids flooding logs(as much) when working
with conditions where the target polling will fail.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-08-09 09:10:37 +02:00
Øyvind Harboe
bfa34f88f8 verify_image: print out a statement that there are no further errors
It is useful to know that the printed errors are *all* the
errors there were.

Added missing error handling(found by inspection).

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-08-02 22:22:03 +02:00
Øyvind Harboe
33e7696cfa target: $_TARGET mdw now has a phys option
just like the mdw command

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-06-22 12:43:30 +02:00
Øyvind Harboe
8b82171f75 target: mwX on target object now supporst phys argument
$_TARGETNAME mww phys 0x10 0xdeadbeef

=> write 0xdeadbeef to physical address 0x10

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-06-22 12:36:32 +02:00
Edgar Grimberg
bf8d954352 target: Fix shadow issues on Mac
wait is declared in /usr/include/sys/wait.h

Signed-off-by: Edgar Grimberg <edgar.grimberg@zylin.com>
2010-06-22 08:24:23 +02:00
Øyvind Harboe
64cf05f0c4 target: -Wshdaow warning fix
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-06-15 23:07:45 +02:00
Øyvind Harboe
aa2de47d3c target: fix retval gaffe in mwX commands
failure to write to memory was not propagated.

This is an interesting case of broken error handling:
with exceptions we wouldn't have had this at all,
and I also wonder if there is a GCC option to warn
about these kinds of potential bugs.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-06-14 09:30:37 +02:00
Øyvind Harboe
31bbb3cf0c verify: display up to 128 diff's
Showing up to 128 differences.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-06-08 10:46:33 +02:00
Jon Povey
5fd1c2db9a Change kb/s to KiB/s in messages about kibibytes
Change download rate messages about kibibytes from "kb/s" to "KiB/s" units.
See: http://en.wikipedia.org/wiki/Data_rate_units

Signed-off-by: Jon Povey <jon.povey@racelogic.co.uk>
2010-05-16 13:55:01 +02:00
Øyvind Harboe
737c9b6258 flash: stop caching protection state
There are a million reasons why cached protection state might
be stale: power cycling of target, reset, code executing on
the target, etc.

The "flash protect_check" command is now gone. This is *always*
executed when running a "flash info".

As a bonus for more a more robust approach, lots of code could
be deleted.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-05-05 15:24:25 +02:00
Øyvind Harboe
91b9f3de0b command context: fix errors when running certain commands on startup
Various commands, e.g. "arm mcr xxxx" would fail if invoked upon startup
since it there was no command context defined for the jim interpreter
in that case.

A Jim interpreter is now associated with a command context(telnet,
gdb server's) or the default global command context.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-05-05 15:24:24 +02:00
Øyvind Harboe
8865209545 target: clean up target memory allocation error messages
target memory allocation can be implemented not to show
bogus error messages.

E.g. when trying a big allocation first and then a
smaller one if that fails.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-05-04 09:11:20 +02: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
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
Øyvind Harboe
ed6756fb23 target: fix poll off
I don't know when "poll off" broke, but "poll off" didn't
stop background polling of target. The polling status flag
simply wasn't checked in the handle_target timer callback.

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

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-03-25 20:46:34 +01:00
Øyvind Harboe
cc197c8086 gdb: long running "monitor mww" now works w/gdb
invoke keep_alive() to make sure that the default 2000ms
timeout does not trigger.

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

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

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

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

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

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

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-03-17 12:45:24 +01:00
David Brownell
5fdf9535ce NOR: invalidate cached state on target resume
The NOR infrastructure caches some per-sector state, but
it's not used much ... because the cache is not trustworthy.

This patch addresses one part of that problem, by ensuring
that state cached by NOR drivers gets invalidated once we
resume the target -- since targets may then modify sectors.

Now if we see sector protection or erase status marked as
anything other than "unknown", we should be able to rely
on that as being accurate.  (That is ... if we assume the
drivers initialize and update this state correctly.)

Another part of that problem is that the cached state isn't
much used (being unreliable, it would have been unsafe).
Those issues can be addressed in later patches.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2010-03-03 20:57:49 -08:00
David Brownell
d72e90ae4b target_resume() doxygen
Add doxygen for target_resume() ... referencing the still-unresolved
confusion about what the "debug_execution" parameter means (not all
CPU support code acts the same).

The 'handle_breakpoints" param seems to have resolved the main issue
with its semantics, but it wasn't part of the function spec before.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2010-03-02 15:45:12 -08:00
Øyvind Harboe
91e3268737 gdb: restore behavior from 0.3.1 for srst_asserted and power_restore
srst_asserted and power_restore can now be overriden to do
nothing. By default they will "reset init" the targets and
halt gdb.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-02-01 13:45:09 +01:00
Øyvind Harboe
98f7c2127b target: print reason why GDB halts
If GDB halts unexpectedly, print reason: srst assert or power
out detected.

If polling fails, then things are a bit trickier. We do not
want to spam telnet or the log with polling failed messages.
Leave that case be w/a comment in a code for now.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-01-21 16:20:58 +01:00
Edgar Grimberg
bc088b302b target: Fixed format problem for mdh
Fixed format problem for mdh. It needs to display 4 chars.

Signed-off-by: Edgar Grimberg <edgar.grimberg@zylin.com>
2010-01-21 15:58:59 +01:00
Øyvind Harboe
dc793455e9 target: add check_reset hook
Allow targets to run checks post reset. Used to check
that e.g. DCC downloads have been enabled.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-01-13 12:00:02 +01:00
David Brownell
b800eb0336 *SVF: help/usage updates
Usage messages should use the same EBNF as the User's Guide;
no angle brackets.  Be more complete too ... some params were
missing.

Don't use "&function"; its name is its address.

Unrelated: fix typo in one "target.c" usage message.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2010-01-08 20:16:05 -08:00
David Brownell
dd8f679aa2 target misc: help/usage updates
Provide helptext which was sometimes missing; update some of it
to be more accurate.

Usage syntax messages have the same EBNF as the User's Guide.

Don't use "&function"; functions are like arrays, their address
is their name.  Shrink some overlong lines; remove some empties.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2010-01-07 15:05:26 -08:00
David Brownell
b3bf1d12b2 streamline and document helptext mode displays
Most commands are usable only at runtime; so don't bother saying
that, it's noise.  Moreover, tokens like EXEC are cryptic.  Be
more clear: highlight only the commands which may (also) be used
during the config stage, thus matching the docs more closely.
There are

 - Configuration commands (per documentation)
 - And also some commands that valid at *any* time.

Update the docs to note that "help" now shows this mode info.

This also highlighted a few mistakes in command configuration,
mostly commands listed as "valid at any time" which shouldn't
have been.  This just fixes ones I noted when sanity testing.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2010-01-02 15:52:35 -08:00
Antonio Borneo
3ed254c18a ARM7_9: Fix segfaults
Handlers for commands
 - arm7_9 semihosting <enable | disable>
 - $_TARGETNAME arp_reset assert 1
didn't check if target has already been examined, and could
segfault when using the NULL pointer "arm7_9->eice_cache".

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-30 16:58:27 -08:00
Freddie Chopin
6b1eeb92fe MinGW build fixes
Print "ssize_t" as "%ld" (+ cast to long) not as "%zu".
Official MinGW (gcc 3.4.5) doesn't understand "z" flag.

Signed-off-by: Freddie Chopin <freddie_chopin@op.pl>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-28 13:09:31 -08:00
mkdorg@users.sourceforge.net
646ce814b4 target: add basic dsp563xx support 2009-12-15 18:38:52 +01:00
David Brownell
38e376d232 target: further shrink Jim-awareness
Don't include <helper/jim.h> from target.h ... not everything
which touches targets needs to be able to talk to Jim.  Plus,
most files include this header by another path.

Also, switch the affected files to use the classic sequence
for #included files:  all <framework/headers.h> first, then
the "local_headers.h".  This helps prevent growth of problematic
layering, by minimizing entanglement.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-13 12:52:23 -08:00
David Brownell
f0da635e55 target: remove more exit() calls
These were all basically "can't happen" cases ... like having
state be corrupted by an alpha particle after the previous check
for whether a value was in-range.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-08 13:09:38 -08:00
David Brownell
cbea1ed71f target: remove needless "extern"s
Most of these happened to be in the target.h file.

Some of those are associated with symbols that could be
removed at some point ... e.g. NVP_ASSERT/true and its
sibling NVP_DEASSERT/false.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-08 13:06:41 -08:00
David Brownell
bbb754aa39 target: add debug_reason_name()
Provide and use debug_reason_name() instead of expecting targets
to call Jim_Nvp_value2name_simple().  Less dependency on Jim, and
the code becomes more clear too.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-07 14:57:44 -08:00
Zachary T Welch
cb4a475f6c change #include "jtag.h" to <jtag/jtag.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "jtag.h"

the following form should be used.

	#include <jtag/jtag.h>

The exception is from .c files in the same directory.
2009-12-03 04:24:33 -08:00
Zachary T Welch
6512e5e36b change #include "time_support.h" to <helper/time_support.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "time_support.h"

the following form should be used.

	#include <helper/time_support.h>

The exception is from .c files in the same directory.
2009-12-03 04:22:52 -08:00
Zachary T Welch
4c43afce85 fix 'target init' command registration
The command handler registration was put at the top level, rather
than as a subcommand.  Move it to where it belongs.
2009-12-02 16:16:54 -08:00
Zachary T Welch
62fbb0f545 target: factor init to 'target init'
Adds 'target init' command handler, called as part of 'init'.
2009-12-02 13:26:23 -08:00
Zachary T Welch
e03f3c57a5 target: factor target_init() into pieces
Moves body of target initialization loop into a helper function,
cleaning up its visual flow in the process.
2009-12-02 13:26:23 -08:00
David Brownell
177bbd8891 target: "mcr" and "mrc" are ARM-specific
Switch "mrc" and "mcr" commands to be toplevel ARM operations,
as they should initially have been.

Correct the usage message for both commands:  it matches ARM
documentation (as one wants!) instead of reordering them to
match the funky mrc() and mcr() method usage (sigh).

For Cortex-A8: restore a line that got accidentally dropped,
so the secure monitor mode shadow registers will show again.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-01 00:48:53 -08:00
Zachary T Welch
7b2906de24 do not extern 'interp' from command.c
Adds 'interp' field to command_context, chasing the few remaining
references to the global variable outside of the command module.
2009-11-30 16:29:34 -08:00
Zachary T Welch
8e8a359af2 target: avoid using interp global variable
Adds 'interp' to target_event_action structure to avoid using the
global variable of the same name.
2009-11-30 16:29:34 -08:00
Zachary T Welch
070259cadb explode tcl_target_func into many handlers
Eliminate the monolithic tcl_target_func by registering each of its
commands using the new chained command registration mechanism.

Also chains the target's commands under the CPU command, though these
may not work properly without some further modification.
2009-11-28 13:00:39 -08:00
Zachary T Welch
cb8d567b75 split jim_target into multiple handlers
The 'target' command group was implemented using its own command
dispatching, which can be eliminated by using the new chained command
registration mechanism.  This patch splits the jim_target() function
into individual handlers, which makes them to be visible to the help and
usage commands.  These one-trick handlers are much easier to understand.
2009-11-28 13:00:39 -08:00
David Brownell
acbe054a38 target: uplevel add_{break,watch}point() error checks
In target_type.h it's documented that the target must be
halted for add_breakpoint() ... and with slight ambiguity,
also for its add_watchpoint() sibling.  So rather than
verifying that constraint in the CPU drivers, do it in the
target_add_{break,watch}point() routines.

Add minor paranoia on the remove_*point() paths too:  save
the return value, and print it out in in the LOG_DEBUG message
in case it's nonzero.

Note that with some current cores, like all ARMv7 ones I've
looked at, there's no technical issue preventing watchpoint or
breakpoint add/remove operations on active cores.  This model
seems deeply wired into OpenOCD though.

ALSO:  the ARM targets were fairly "good" about enforcing that
constraint themselves.  The MIPS ones were relied on other code
to catch such stuff, but it's not clear such code existed ...
keep an eye out for new issues on MIPS.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-28 10:40:26 -08:00
David Brownell
4e56a2303b target: groundwork for "reset-assert" event
This defines a "reset-assert" event and a supporting utility
routine, and documents both how targets should implement it
and how config scripts should use it.  Core-specific updates
are needed to make this work.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-27 18:50:20 -08:00
David Brownell
2653b80307 target: create and use target_name()
Several of the sites now using target_type_name() really
ought to be using an instance-specific name.  Create a
function called target_name(), accessing the instance's
own (command) name.

Use it in several places that really should be displaying
instance-specific names.  Also in several places which
were already doing so, but which had no wrapper to call.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-25 16:38:08 -08:00
David Brownell
b715a81f5b target: target_get_name() --> target_type_name()
There are two names that may matter on a per-target basis.
One is a per-instance name (for example, "at91sam7s.cpu").
The other is the name of its type (for example, "arm7tdmi"),
which is shared among multiple targets.

Currently target_get_name() returns the type name, which is
misleading and is rarely appropriate for target diagnostics.
Rename that as target_type_name().

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-25 16:38:08 -08:00
Zachary T Welch
9d4c89f37f add 'testee' target type
Alliteration aside, this should provide the final piece of the puzzle
for developers that want to get started writing a new target type.
In this way, it also seeks to complement the 'dummy' interface driver
and 'faux' NOR flash driver.
2009-11-25 10:29:06 -08:00
Zachary T Welch
17a9dea53a add jim_handler to command_registration
Adding jim_handler field to command_registration allows removing the
register_jim helper.  All command registrations now go through the
register_command{,s}() functions.
2009-11-24 21:37:37 -08:00
Zachary T Welch
66ee303456 remove target_type register_command callback
Uses chaining of command_registration structures to eliminate all
target_type register_callback routines.  Exports the command_handler
registration arrays for those target types that are used by others.
2009-11-24 21:37:36 -08:00
Zachary T Welch
4e67912fb0 target: use register_commands() 2009-11-24 21:37:36 -08:00
Zachary T Welch
833e7f5248 use COMMAND_REGISTER macro
Replaces direct calls to register_command() with a macro, to allow
its parameters to be changed and callers updated in phases.
2009-11-24 21:37:29 -08:00
Øyvind Harboe
aacc5b583c target: reduce stack usage
4096 byte buffer allocated dynamically. Better
for embedded OS's.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2009-11-22 18:58:42 +01:00
David Brownell
71cde5e359 target: create/use register_cache_invalidate()
Create a generic register_cache_invalidate(), and use it to
replace three all-but-identical core-specific routines:

 - armv4_5_invalidate_core_regs()
 - armv7m_invalidate_core_regs
 - mips32_invalidate_core_regs() too.

Make cache->num_regs be unsigned, avoiding various errors.

Net code shrink and simplification.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-19 19:02:10 -08:00
Zachary T Welch
75a37eb5b3 use COMMAND_PARSE_ON_OFF where appropriate
Updates all command parsing of "on" and "off" arguments.
2009-11-18 15:51:07 -08:00
Zachary T Welch
59f32cbe53 fix regression in md/mw commands
The recent migration broke them, the fixes broken them in a new way,
but this should restore them to working order.  Eliminates the
temporary variable, as the CMD_NAME macro can once again be use
in routines that increment CMD_ARGV without nasty side-effects.
2009-11-18 03:34:52 -08:00
Zachary T Welch
2861877b32 command_handler: change 'cmd_ctx' to CMD_CTX
Convert all command handler 'cmd_ctx' parameter usage with CMD_CTX.
2009-11-17 11:40:06 -08:00
Zachary T Welch
23402315ce command_handler: change 'args' to CMD_ARGV
This patch converts all instances of 'args' in COMMAND_HANDLER routines
to use CMD_ARGV macro.
2009-11-17 11:38:07 -08:00
Zachary T Welch
7bf1a86e47 command_handler: change to 'argc' to CMD_ARGC
This patch converts all instances of 'argc' in COMMAND_HANDLER routines
to use CMD_ARGC.
2009-11-17 11:38:06 -08:00
David Brownell
f4788652e4 target: simplify register get/set ops
No need to indirect from registered integers to pointers.
Just stash the pointers directly in the register struct,
and don't even bother registering.

This is a small code shrink, speeds register access just
a smidgeon, and gets rid of another rude exit() path.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-17 09:06:45 -08:00
Zachary T Welch
51862bb98c fileio: improve API types
Use size_t instead of uint32_t when specifying file sizes.  Update all
consumers up through the layers to use size_t when required.  These
changes should be safe, but the higher-levels will need to be updated
further to receive the intended benefits (i.e. large file support).

Add error checking for fileio_read and file_write.  Previously, all
errors were being silently ignored, so this change might cause some
problems for some people in some cases.  However, it gives us the chance
to handle any errors that do occur at higher-levels, rather than burying
our heads in the sand.
2009-11-16 15:47:09 -08:00
Zachary T Welch
69df712d1d struct fileio: improve member types
Add const keyword to file url and cast to free().

Make size an ssize_t and chase all format strings that use it.
2009-11-16 15:47:09 -08:00
Zachary T Welch
a94748ec6d rename CEIL as DIV_ROUND_UP
Improves the name of this macro, moves it to types.h, and adds a block
of Doxygen comments to describe what it does.
2009-11-16 09:58:11 -08:00
David Brownell
aa7c449600 target: don't implicitly include "breakpoint.h"
Most files in the tree seem to have ended up including this,
and *quite* needlessly ... only code implementing or using
breakpoints actually needs these declarations.

So take it out of the header files which included it, and put
it in files which use it ... reduce needless interdependencies.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-16 00:34:57 -08:00
David Brownell
9ac7cdec82 target: make "examined" flag be per-target
Previously this flag was stored in "target_type", so that for example
if there were two ARM7TDMI targets in a scan chain, both would claim
to have been examined although only the first one actually had its
examine() method called.

Move this state to where it should have been in the first place, and
hide a method that didn't need exposure ... the flag is write-once.

Provide some doxygen.  The examine() method is confusing, since it
isn't separating one-time setup from the after-each-reset stuff.  And
the ARM7/ARM9 version is, somewhat undesirably, not leaving the debug
state alone after reset ... probably more of an issue for trace setup
than for watchpoints and breakpoints.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-15 10:35:25 -08:00
Krzysztof Dziuba
c2edc7908f Fix for md* commands, similar to mw*. 2009-11-14 17:39:27 -08:00
Dean Glazeski
c93ae60bce Invalid command syntax errors with MWW.
This fixes an issue due to the new command handler syntax caused by the mw handler playing with the args pointer before
using the CMD_NAME macro.  Fix is to move this call above the lines changing args.
2009-11-14 10:58:35 -08:00
Ferdinand Postema
ab3bdfb2cb compile with cygwin (32-bit)
Changed some printf format strings..

[dbrownell@users.sourceforge.net: shrink lines, fix indents]

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-14 02:22:37 -08:00
Zachary T Welch
98723c4ecd command_context_t -> struct command_context
Remove misleading typedef and redundant suffix from struct command_context.
2009-11-13 13:25:47 -08:00
Zachary T Welch
0f1163e823 target_t -> struct target
Remove misleading typedef and redundant suffix from struct target.
2009-11-13 11:58:14 -08:00
Zachary T Welch
d0dee7ccaf reg_t -> struct reg
Remove misleading typedef and redundant suffix from struct reg.
2009-11-13 11:58:13 -08:00
Zachary T Welch
ac927559c3 target_type_t -> struct target_type
Remove misleading typedef and redundant suffix from struct target_type.
2009-11-13 11:58:13 -08:00
Zachary T Welch
dfecfd5fd4 image_t -> struct image
Remove misleading typedef and redundant suffix from struct image.

Also removes the typedef from enum image_type, as it is used in
image.h only.
2009-11-13 11:58:13 -08:00
Zachary T Welch
4952eadd8f trace_t -> struct trace
Remove misleading typedef and redundant suffix from struct trace.
2009-11-13 11:58:13 -08:00
Zachary T Welch
53c05c8b1d breakpoint_t -> struct breakpoint
Remove misleading typedef and redundant suffix from struct breakpoint.
2009-11-13 11:58:13 -08:00
Zachary T Welch
abd7b40408 target_event_action_t -> struct target_event_action
Remove misleading typedef and redundant suffix from struct target_event_action.
2009-11-13 11:58:13 -08:00
Zachary T Welch
93459582fd target_timer_callback_t -> struct target_timer_callback
Remove misleading typedef and redundant suffix from struct target_timer_callback.
2009-11-13 11:58:12 -08:00
Zachary T Welch
2d5767201b target_event_callback_t -> struct target_event_callback
Remove misleading typedef and redundant suffix from struct target_event_callback.
2009-11-13 11:58:12 -08:00
Zachary T Welch
46fc1d57ac working_area_t -> struct working_area
Remove misleading typedef and redundant suffix from struct working_area.
2009-11-13 11:58:12 -08:00
Zachary T Welch
c2b5d8a6fa reg_arch_type_t -> struct reg_arch_type
Remove misleading typedef and redundant suffix from struct reg_arch_type.
2009-11-13 11:58:12 -08:00
Zachary T Welch
74d09617b9 reg_cache_t -> struct reg_cache
Remove misleading typedef and redundant suffix from struct reg_cache.
2009-11-13 11:58:12 -08:00
Zachary T Welch
72b421418f watchpoint_t -> struct watchpoint
Remove misleading typedef and redundant suffix from struct watchpoint.
2009-11-13 11:58:11 -08:00
Zachary T Welch
b1de5eb9a0 reg_param_t -> struct reg_param
Remove misleading typedef and redundant suffix from struct reg_param.
2009-11-13 11:58:09 -08:00
Zachary T Welch
6c965a3da9 mem_param_t -> struct mem_param
Remove misleading typedef and redundant suffix from struct mem_param.
2009-11-13 11:58:09 -08:00
Zachary T Welch
42ef503d37 jtag_tap_t -> struct jtag_tap
Search and destroy the jtag_tap_t typedef.  This also cleans up a
layering violation, removing the declaration from types.h.
2009-11-13 11:58:04 -08:00
Zachary T Welch
9f212b01be fileio_t -> struct fileio
Remove useless structure typedef.
2009-11-13 11:58:04 -08:00
Zachary T Welch
a585bdf726 add CMD_NAME macro for command handlers
By introducing the CMD_NAME macro, this parameter may be integrated
as args[-1] in command.[ch], without touching any other call sites.
2009-11-13 10:55:00 -08:00
Zachary T Welch
5b6df55a1e use CALL_COMMAND_HANDLER instead of direct calls
By using CALL_COMMAND_HANDLER, parameters can be reordered, added, or
even removed in inherited signatures, without requiring revisiting
all of the various call sites.
2009-11-13 10:51:46 -08:00
Zachary T Welch
63a26b421b use COMMAND_HELPER for command helper functions
Define the numerous helpers that inherit command handler parameters
using the COMMAND_HELPER macro.
2009-11-13 10:51:45 -08:00
Zachary T Welch
cfc4d5c6b7 use COMMAND_HANDLER macro to define all commands 2009-11-13 10:51:45 -08:00
Zachary T Welch
ca594adb5a add const keyword to some APIs
Add 'const' keyword to 'char *' parameters to allow command handlers to
pass constant string arguments.  These changes allow the 'args' command
handler to be changed to 'const' in a subsequent patch.
2009-11-11 11:53:22 -08:00
David Brownell
61af6a6816 target: MMU-aware init for memory read/write
Start switching MMU handling over to a more sensible scheme.
Having an mmu() method enables MMU-aware behaviors.  Not having
one kicks in simpler ones, with no distinction between virtual
and physical addresses.

Currently only a handful of targets have methods to read/write
physical memory:  just arm720, arm920, and arm926.  They should
all initialize OK now, but the arm*20 parts don't do the "extra"
stuff arm926 does (which should arguably be target-generic).

Also simplify how target_init() loops over all targets by making
it be a normal "for" loop, instead of scattering its three parts
to the four winds.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-10 11:58:31 -08:00
David Brownell
2a4d3c03cd Target: minor cleanup
- improve some names -- a "default" prefix is not descriptive
 - add doxygen @todo entries for some issues
 - avr8 isn't ever going to need those MMU hooks

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-10 02:01:20 -08:00
David Brownell
0df56714a0 Target: fix bad error messages
And shrink a few too-long lines.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-10 01:33:59 -08:00
Zachary T Welch
ef6387a0c9 target.c: remove useless declarations
This patch removes the last batch of forward references from the tree,
moving the target command registration routines to the end of the file.
2009-11-09 19:24:06 -08:00
David Brownell
7269ba5eb6 Revert "target: add target->type->has_mmu fn"
This patch introduced a bug preventing flash writes from working
on Cortex-M3 targets like the STM32.  Moreover, it's the wrong
approach for handling no-MMU targets.

The right way to handle no-MMU targets is to provide accessors
for physical addresses, and use them everywhere; and any code
which tries to work with virtual-to-physical mappings should use
a identity mapping (which can be defaulted).

And ... we can tell if a target has an MMU by seeing if it's
got an mmu() method.  No such methood means no MMU.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-09 14:46:23 -08:00
David Brownell
d70d9634bf finish removing deprecated/obsolete commands
It's been about a year since these were deprecated and, in most
cases, removed.  There's no point in carrying that documentation,
or backwards compatibility for "jtag_device" and "jtag_speed",
around forever.  (Or a few remnants of obsolete code...)

Removed a few obsolete uses of "jtag_speed":

 - The Calao stuff hasn't worked since July 2008.  (Those Atmel
   targets need to work with a 32KHz core clock after reset until
   board-specific init-reset code sets up the PLL and enables a
   faster JTAg clock.)
 - Parport speed controls don't actually work (tops out at about
   1 MHz on typical HW).
 - In general, speed controls need to live in board.cfg files (or
   sometimes target.cfg files), not interface.cfg ...

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-09 13:16:32 -08:00
Zachary T Welch
2689f58f2a Overhaul time support API
This patch changes the duration_* API in several ways.  First, it
updates the API to use better names.  Second, string formatting has
been removed from the API (with its associated malloc).  Finally, a
new function added to convert the time into seconds, which can be
used (or formatted) by the caller.  This eliminates hidden calls to
malloc that require associated calls to free().

This patch also removes the useless extern keyword from prototypes,
and it eliminates the duration_t typedef (use 'struct duration').
These API also allows proper error checking, as it is possible for
gettimeofday to fail in certain circumstances.

The consumers have all been chased to use this new API as well, as
there were relatively few cases doing this type of measurement.
In most cases, the code performs additional checks for errors, but
the calling code looks much cleaner in every case.
2009-11-09 01:21:50 -08:00
David Brownell
a9abfa7d06 target: don't swap MMU/no-MMU work areas
Resolve serious bug inserted by the "target: require working
area for physical/virtual addresses to be specified" patch.
It forced use of (invalid) virtual addresses when the MMU
was disabled, and vice versa.

Observed to break at least Cortex-M3, ARM926, ARM7TDMI whenever
work areas are used, such as during bulk writes to flash, DDR2,
SRAM, and so on.

Also, fix overlong lines and whitespace goofs.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-06 14:57:21 -08:00
Zachary T Welch
653ea7b25c Improve target.c command argument parsing.
Passes cmd_ctx into parse_load_image_command_args for reporting the
parsing errors therein.
2009-11-05 18:03:18 -08:00
Øyvind Harboe
051eaf7950 target: fix ordering of arguments to mcr and mrc commands
Now matches machine code syntax and old arm11 syntax.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2009-11-05 23:57:49 +01:00
Øyvind Harboe
4e3c2676f1 target: check args to mrc/mcr.
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2009-11-05 23:57:49 +01:00
Øyvind Harboe
b64503e37f target: Only register mrc mcr commands when one of the targets support them.
This avoids polluting help for targets that can never support mrc/mcr

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2009-11-05 23:56:37 +01:00
David Brownell
98788d7a75 watchpoint_add() cleanup
Fail watchpoint_add() if it's the same address but the
parameters are different ... don't just assume having
the same address means the same watchpoint!  (Note that
overlapping watchpoints aren't detected...)

Handle unrecognized return codes more sanely; don't exit()!
And describe command params right.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-05 01:47:44 -08:00
Øyvind Harboe
d269122f91 target: add target->type->has_mmu fn.
improve default target->read/write_phys_memory, produce
more sensible error messages if the mmu interface
functions have not been implemented yet vs. will
not be implemented(e.g. cortex m3).

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2009-11-05 09:53:31 +01:00
Øyvind Harboe
972924b2ad Make default implementation of mdw/mmw phys return error 'not implemented' 2009-11-05 09:26:08 +01:00
Øyvind Harboe
b5ce7fe812 target: require working area for physical/virtual addresses to be specified
Fixed bug: if virtual address for working memory was not specified
and MMU was enabled, then address 0 would be used.

Require working address to be specified for both MMU enabled
and disabled case.

For some completely inexplicable reason this fixes the regression
in svn 2646 for flash write in arm926ejs target. The logs showed
that MMU was disabled in the case below:

https://lists.berlios.de/pipermail/openocd-development/2009-November/011882.html

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2009-11-03 11:56:05 +01: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
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
Ø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
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
86cbbe8a4a Propagate error from assert, deassert and halt on tcl target object. 2009-10-13 12:10:23 +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
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
Øyvind Harboe
f525f2ef0d Stop GDB when polling fails, srst assert or powerdropout is detected 2009-10-08 14:53:25 +02: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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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