Commit Graph

125 Commits

Author SHA1 Message Date
Andreas Fritiofson dc574aa1da target/arm: Remove usage of struct arm_jtag in ARMv7 targets
The Cortex-A and Cortex-M keeps an arm_jtag struct around just to be
able to pass a pointer to it to one common JTAG function which anyway
only uses the TAP field.

Refactor the function to take a TAP directly, remove the legacy struct
from cortex instances and store the TAP pointer only in the DAP.

Cortex-M makes a call to arm_jtag_setup_connection() with the struct
but the function does nothing useful for a Cortex-M target so remove
the call.

Change-Id: I3b33709ef55372ef14522ed4337e9f2e817ae3ab
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/3142
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
2015-12-29 20:27:01 +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
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
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
Spencer Oliver 3a550e5b5f cleanup: rename armv4_5 to arm for readability
Nothing more than a name change, just to make reading
the code a bit simpler.

Change-Id: I73a16b7302b48ce07d9688162955aae71d11eb45
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/390
Tested-by: jenkins
Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
2012-01-23 11:38:26 +00:00
Spencer Oliver 0c2f8b6eb8 cmd: add missing usage vars
we should have caught them all - hopefully.

Change-Id: I35435317fccaf5ad0216244d69f76db6857bb582
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/381
Tested-by: jenkins
Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
2012-01-18 21:45:02 +00:00
Freddie Chopin f6315d5e5b Fix "unused variable" warnings (errors) detected with GCC 4.7.0 - trivial fixes 2011-06-04 09:35:13 +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 44ef0327dd debug: debug entry error propagation
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-07-19 22:13:49 +02:00
Øyvind Harboe 6a237c23c1 arm: add error propagation for enable/disable mmu caches
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-07-19 22:13:48 +02:00
Øyvind Harboe 70fee9207b arm: add error propagation to generic get_ttb fn
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-07-19 22:13:48 +02:00
Øyvind Harboe da5979c38d arm720t: -Wshadow warning fix
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-06-15 23:17:00 +02:00
Antonio Borneo bac52fbac8 TARGET: removed unused parameters
Parameters "domain" and "ap" of function armv4_5_mmu_translate_va()
are not used.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-06-12 16:41:46 +02:00
Antonio Borneo 9e62f86f24 TARGET: removed unsed parameter
Parameter "type" of function armv4_5_mmu_translate_va()
is now not used.
Remove the parameter and the "enum" listing its values.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-06-12 12:08:12 +02:00
Antonio Borneo ce58ab9a4e TARGET: fix handling return code of MMU translation
Function armv4_5_mmu_translate_va() now properly signals
errors in the return value.
Remove former error handling by setting variable "type" to
value "-1".

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2010-06-12 12:08:06 +02:00
Øyvind Harboe 0538081246 arm mmu: error propagation added for address translation
The return value for MMU translation was a mess, either
error or value.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-06-11 15:53:23 +02:00
Øyvind Harboe 7f6bab0c4c jtag: retire jtag_get/set_end_state()
Voila! This get rids of mysteries about what what
state the TAP is in.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-03-19 08:31:44 +01:00
Øyvind Harboe ec108ff59e jtag: retire one instance of jtag_get_end_state() usage
Less global variables....

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-03-18 12:08:11 +01:00
Øyvind Harboe 36df240cea jtag: cut down on usage of unintended modification of global end state
jtag_get/set_end_state() is now deprecated.

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

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

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-03-18 08:43:19 +01:00
Øyvind Harboe e018c7c1d2 jtag: retire tap field
jtag_add_dr/ir_scan() now takes the tap as the first
argument, rather than for each of the fields passed
in.

The code never exercised the path where there was
more than one tap being scanned, who knows if it even
worked.

This simplifies the implementation and reduces clutter
in the calling code.

use jtag_add_ir/dr_plain_scan() for more fancy situations.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-03-08 08:12:25 +01:00
David Brownell 1aac72d243 ARM: keep a handle to the PC
Keep a handle to the PC in "struct arm", and use it.
This register is used a fair amount, so this is a net
minor code shrink (other than some line length fixes),
but mostly it's to make things more readable.

For XScale, fix a dodgy sequence while stepping.  It
was initializing a variable to a non-NULL value, then
updating it to handle the step-over-active-breakpoint
case, and then later testing for non-NULL to see if
it should reverse that step-over-active logic.  It
should have done like ARM7/ARM9 does: init to NULL.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2010-02-21 14:34:33 -08:00
Øyvind Harboe d4d4b11a77 arm720t: virt2phys callback added
This is a copy and paste of arm926ejs. Not tested, but
ready for testing at least. There is a good chance that
it will work if the generic armv4_5 fn's are robust enough...

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-02-12 08:39:56 +01:00
Øyvind Harboe b8e930e3bf arm7/9: enable check that DCC downloads have been enabled
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-01-13 12:00:02 +01:00
David Brownell e0b6e5deef ARM720: help/usage updates
Deprecate the "pass an instruction opcode" flavor of cp15 access
in favor of the "arm mcr ..." and "arm mrc ..." commands, which
offer fewer ways to break things.

Use the same EBNF syntax in the code as for the user's guide.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2010-01-07 16:25:03 -08:00
David Brownell 19ad7f828b ARM: don't clone arm_arch_state() code
Have various ARM cores delegate to arm_arch_state() to display
basic information, instead of duplicating that logic.

This shrinks the code, makes them all report when semihosting
is active, and highlights which data are specific to this core.
(Like ARM720 not having separate instruction and data caches.)

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-07 14:57:44 -08:00
David Brownell 0529c14bfe ARM: rename some generic routines
Rename some (mostly) generic ARM functions:

    armv4_5_arch_state()       --> arm_arch_state()
    armv4_5_get_gdb_reg_list() --> arm_get_gdb_reg_list()
    armv4_5_init_arch_info()   --> arm_init_arch_info()

Cores using the microcontroller profile may want a different
arch_state() routine though.

(Also fix strange indentation in arm_arch_state: use tabs only!
And update a call to it, removing assignment-in-conditional.)

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-07 14:57:44 -08:00
David Brownell a4a2808c2a ARM: move opcode macros to <target/arm_opcodes.h>
Move the ARM opcode macros from <target/armv4_5.h>, and a few
Thumb2 ones from <target/armv7m.h>, to more appropriate homes
in a new <target/arm_opcodes.h> file.

Removed duplicate opcodes from that v7m/Thumb2 set.  Protected
a few macro argument references by adding missing parentheses.

Tightening up some of the line lengths turned up a curious artifact:
the macros for the Thumb opcodes are all 32 bits wide, not 16 bits.
There's currently no explanation for why it's done that way...

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-07 14:57:43 -08:00
David Brownell 7b0314c377 ARM: remove mrc_opcode(), use MRC() or MCR()
Get rid of mrc_opcode() in favor of ARMV4_5_MRC() or, where
arm*20t should have used it, ARMV4_5_MCR() instead.

Basically, *writing* coprocessor registers shouldn't have
used the *read* opcode ... and both should stick to standard
opcode constructors, not rearranging parameter sequence any
more than already needed.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-07 14:57:43 -08:00
David Brownell 56e0171420 ARM: rename armv4_5_state_* as arm_state_*
And make arm_state_strings[] be const.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-04 19:39:25 -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
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 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 e905fe6e75 arm720t: use register_commands() 2009-11-24 21:37:35 -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
David Brownell ab5ac33fd4 ARM: remove 'armv4_5_common_s' migration #define
Finish migrating from the old symbol to the new one.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-22 10:27:29 -08:00
David Brownell dd9894f481 ARM: arm_set_cpsr() handles T and J bits
Have arm_set_cpsr() handle the two core state flags, updating
the CPU state.  This eliminates code in various debug_entry()
paths, and marginally improves handling of the J bit.

Catch and comment a few holes in the handling of the J bit on
ARM926ejs cores ... it's unlikely our users will care about
Jazelle mode, but we can at least warn of Impending Doom.  If
anyone does use it, these breadcrumbs may help them to find
the right path through the code.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-22 03:41:14 -08:00
David Brownell ff810723e0 ARM: define two register utilities
Define arm_reg_current() ... returning handle to a given register,
and encapsulating the current mode's register shadowing.  It's got
one current use, for reporting the current register set to GDB.
This will let later patches clean up much ARMV4_5_CORE_REG_MODE()
nastiness, saving a bit of code.

Define and use arm_set_cpsr() ... initially it updates the cached
CPSR and sets up state used by arm_reg_current(), plus any SPSR
handle.   (Later: can also set up for T and J bits.)

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-22 03:38:34 -08:00
David Brownell 5706fd7860 ARM: simplify CPSR handling
Stash a pointer to the CPSR in the "struct arm", to help get rid
of the (common) references to its index in the register cache.

This removes almost all references to CPSR offsets outside of the
toplevel ARM code ... except a pair related to the current ARM11
"simulator" logic (which should be removable soonish).

This is a net minor code shrink of a few hundred bytes of object
code, and also makes the code more readable.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-22 03:37:21 -08:00
David Brownell ec93209f51 ARM: add arm_mode_name()
Add and use arm_mode_name() to map from PSR bits to user
meaningful names.   It uses a new table which, later, can
be used to hold other mode-coupled data.

Add definitions for the "Secure Monitor" mode, as seen on
some ARM11 cores (like ARM1176) and on Cortex-A8.  The
previous mode name scheme didn't understand that mode.

Remove the old mechanism ... there were two copies, caused
by Cortex-A8 needing to add "Secure Monitor" mode support.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-17 23:50:23 -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 812ab89f58 ARM7TDMI: remove now-needless "struct arm7tdmi"
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-17 01:09:06 -08:00
David Brownell 8193f17c3a target: no implicit #includes of "register.h"
Same deal:  "register.h" got needlessly included all over the
place because of being in a few widely included headers.

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

Also, don't need that extra "types.h" inclusion.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-16 00:35:14 -08:00
David Brownell 269040bbad ARM: memory utils aren't ARM7/ARM9 dependent
The arm7_9_checksum_memory() and arm7_9_blank_check_memory()
routines are not actually specific to the ARM7 and ARM9 core
generations ... they can work for any core which can run
algorithms using basic ARM (not Thumb) instructions.

Rename them; move the declarations to a more generic site;
likewise move the code (and tidy it a bit in the process).

NOTE:  the blank_check() method falsely returned a success
status (0) on one error path, when the algorithm failed.
Fixed this bug.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-15 10:35:34 -08:00
David Brownell aafb916bea ARM7/ARM9: use shared examine() method
No point in having two identical examine methods for the
ARM7TDMI and ARM9TDMI drivers; move, rename, shrink, share.

Add a bit of doxygen; stop needlessly exporting a method.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-13 16:26:39 -08:00
Zachary T Welch ef746e27c5 command_t -> struct command
Remove misleading typedef and redundant suffix from struct command.
2009-11-13 13:30:50 -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