aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2009-11-22ARM11: remove disabled register hooksDavid Brownell2-93/+3
Minor cleanup of ARM11 register handling: remove disabled register hooks. This should all be handled by shared code, and this stuff is just clutter. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-21jtag: remove useless forward declarationsZachary T Welch5-140/+76
Removes some more useless forward declarations from a few JTAG drivers. Moves interface and bit-bang structure defitions below their callbacks.
2009-11-21allow jtag interfaces to lack commandsZachary T Welch1-2/+5
Allow JTAG interface drivers to skip registering an register_commands callback when it will just be empty.
2009-11-21show script search dirs in debug logAndreas Fritiofson1-0/+2
Add this to ease debugging why the standard scripts aren't found on the default script search path in some build/install enviroments. Especially on Windows it's not straight forward where openocd actually looks for the scripts. Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-20ARM: pass 'struct reg *' to register r/w routinesDavid Brownell8-73/+83
Implementations need to access the register struct they modify; make it easier and less error-prone to identify the instance. (This removes over 10% of the ARMV4_5_CORE_REG_MODE nastiness...) Plus some minor fixes noted when making these updates: ARM7/ARM9 accessor methods should be static; don't leave CPSR wrongly marked "dirty"; note significant XScale omissions in register handling; and have armv4_5_build_reg_cache() record its result. Rename "struct armv4_5_core_reg" as "struct arm_reg"; it's used for more than those older architecture generations. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-20ARM7/ARM9: remove old "debug commands"David Brownell2-182/+35
Remove two commands that were documented as "debug commands" and where "you probably don't want to use this". We never intended to support them, and at least one problem report boiled down to using this when it shouldn't have been used. Update the docs on the existing register commands to talk a bit more about register access and cache behavior. (Those debug commands existed largely to *bypass* the cache.) And fix some minor doc goofs that snuck in with recent changes, renaming "armv4_5" as "arm" and "arm9tdmi" as "arm9". Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-20maintain command lists in sorted orderZachary T Welch1-7/+17
Use insertion sort to the command link lists. The only practical effect of this is to order the output of the new 'help' command.
2009-11-20add add_help_text command handlerZachary T Welch2-44/+67
Rewrite means for scripts to register help text for commands. These cause the new commands to be stored in the command heirarchy, with built-in commands; however, they will never be invoked there because they do not receive a command handler. The same trick is used for the Jim commands. Remove the old helpers that were used to register commands.
2009-11-20provide command context during cmd_initZachary T Welch1-0/+2
For the startup.tcl code to use built-in commands, the context must be associated with the interpreter temporarily. This will be required to add help text.
2009-11-20improve 'help' commandZachary T Welch3-20/+55
Rewrites 'help' command in C, using new 'cmd_help' for display. Adds the built-in 'help' COMMAND_HANDLER to provide better output than the TCL-based script command (e.g. heirarchical listing of commands). The help string is stored in the command structure, though it conitnues to be pushed into the Jim environment. The current idiomatic usage suggests the addition of a usage field as well, to provide two levels of detail for users to consume (i.e. terse usage list, or verbose help).
2009-11-20factor help script command into partsZachary T Welch1-28/+34
Creates a helper function, cmd_help, which displays the help string for a single command. Presently, it is called from the loop in help. The routine has been extended to allow indentation of command groups, so an improved help command can improve the display of information.
2009-11-20refactor command registrationZachary T Welch3-83/+118
Refactors the command registration to use helpers to simplify the code. The unregistration routines were made more flexible by allowing them to operate on a single command, such that one can remove all of a commands children in one step (perhaps before adding back a 'config' subcommand that allows getting the others back). Eliminates a bit of duplicated code and adds full API documentation for these routines.
2009-11-20change command_find helper interfaceZachary T Welch1-4/+3
Avoid requiring double pointers where a single would suffice.
2009-11-20factor script_command argv allocationZachary T Welch1-27/+38
Splits argument allocation out from script command, reusing free() code.
2009-11-20target.cfg: TAP id for Hilscher netX 500David Brownell2-9/+15
Based on email from "Martin Kaul <martin.kaul@leuze.de>". Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-20fix flash/nand name parsingZachary T Welch1-1/+3
Start driver.num check from end, and make sure the numeric part is actually a number. Fix problems trying to parse bank names.
2009-11-19Cortex-A8: better context restoreDavid Brownell1-13/+67
The previous version never wrote dirty registers for non-current CPU modes ... fix that. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-19Cortex-A8: mode supportDavid Brownell1-30/+116
We *should* be able to read and write registers in any core mode, instead of being stuck with whatever mode the core was when we entered debug state. This patch makes them work. Note that the current restore_context() only handles the current mode; writing to other-mode registers is a NOP without a followup patch fixing that. Also, that SPSR access needed some bugfixes; it was confused with CPSR. Secure monitor mode also seems dubious; there's probably more to be done before that's sufficiently understood by the debugger. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-19target: create/use register_cache_invalidate()David Brownell14-77/+47
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-19NAND verify doesn't advance.Dean Glazeski1-1/+1
Fix to move the device address up as the contents are verified. Signed-off-by: Zachary T Welch <zw@superlucidity.net>
2009-11-19document new flash syntaxZachary T Welch1-2/+6
Updates the user documentation with the new syntax for defining flash and nand banks.
2009-11-19update 'nand device' usage in scriptsZachary T Welch3-4/+8
Add $_FLASHNAME variable to update 'nand device' command syntax.
2009-11-19add support for naming NAND banksZachary T Welch2-3/+11
Requires users to name their nand banks, allowing them to be used instead of bank numbers in script commands.
2009-11-19refactor handle_nand_device_commandZachary T Welch1-62/+62
Move bulk of for-loop to a new static command helper function. Adds handle_nand_list_drivers command handler, registered as 'nand drivers'. Improves command help text and error reporting.
2009-11-19update 'flash bank' usage in scriptsZachary T Welch58-69/+138
Sets $_FLASHNAME to "$_CHIPNAME.flash" and passes it as the first argument to 'flash bank'.
2009-11-19add support for naming flash banksZachary T Welch2-2/+10
Requires users to name their flash banks, allowing them to be used instead of bank numbers in script commands.
2009-11-19refactor handle_flash_bank_commandZachary T Welch1-17/+13
Move variables to point of first use, reducing their scope. Add driver_name temporary to help arguments be changed later. Eliminates the useless 'found' variable, changing the code to terminate the loop immediate and return its success.
2009-11-19rename flash and nand command helpersZachary T Welch13-44/+44
After adding support for referencing banks by name, renames the COMMAND_HELPERs appropriately: flash_command_get_bank_by_num -> flash_command_get_bank nand_command_get_device_by_num -> flash_command_get_device
2009-11-19allow flash/nand banks commands to accept namesZachary T Welch7-4/+154
Add get_flash_bank_by_name (and get_nand_device_by_name) helpers to retrieves struct flash_bank * (struct nand_device *) given a driver name and an (optional) driver-specific bank index. These are used to extend flash_command_get_bank_by_num (and nand_command_get_device_by_num) to allow all flash (nand) commands to reference defined banks by name, not just by number. To avoid some code duplication, add the flash/common.[ch] files to hold functionality common to both types driver. The first two methods are helpers for the above routines to find a bank specified by a "name" or "name.index" string. get_flash_name_index() finds the '.index' portion, while flash_driver_name_matches() performs the string portion matching.
2009-11-19ARM: remove per-register mallocDavid Brownell2-1/+2
Just pre-allocate memory for the cached register value. Shrinks heap overhead; increases locality-of-reference. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-19ARM: streamline register initDavid Brownell1-74/+88
Combine register names with other per-register data into a single template structure. This saves space, and makes it easier to change how registers get handled (by shrinking the number of places that care about cache indices). Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-19Cortex-A8: parts of examine() run just onceDavid Brownell1-4/+15
The examine() method has some conceptual breakage. Cope with it by manually splitting out the run-once parts from the after-each-reset parts ... this gets rid of memory leaks and speeds up resets after the first one. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-19nand_fileio_parse_args parses wrong param for sizeDean Glazeski1-1/+1
This changes the size parameter from argv[2] to argv[3], which is what it's supposed to be. Signed-off-by: Zachary T Welch <zw@superlucidity.net>
2009-11-19ARMv7-A: use standard ARM core statesDavid Brownell5-31/+43
We don't want an ARMv7-specific core state enumeration just to add ThumbEE state. Update the generic stuff to handle that, and replace the V7-specific bits with it. For Cortex-A8: on debug entry, check both the T and J bits instead of just the T bit. When the J bit is set, set the right state and warn appropriately. (And while we're at it, move the generic arm struct to the front of the v7a structure, for somewhat better code generation.) Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-19ARMv7-A: use standard ARM core_mode symbolsDavid Brownell2-16/+3
The only way ARMv7-A modes differ from ARMv4/ARMv5 flavors is that v7-A is allowed to include "Secure monitor" support. That's now handled by our standard top-level ARM code ... so phase out the stuff that's specific to ARMv7-A. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-18fix zy1000 command handlerZachary T Welch1-13/+11
Rewrite ZY1000 power command handler to use new macros, simplify logic. Remove unused port command handler declaration.
2009-11-18remove fast command and jim_global_longZachary T Welch3-35/+2
Removing the fast command eliminates the fast_and_dangerous global, which was used only by arm7_9_common as an initializer. The command is not called in the tree; instead, more explicit commands are used. The jim_global_long function was not used anywhere in the tree.
2009-11-18update src/hello.c with parsing examplesZachary T Welch1-1/+54
Adds the foo/bar commands to provide more working examples of command argument parsing, including the new handle_command_parse_bool helper. Updates hello command help text to provide useful information.
2009-11-18change all bool parsers to accept any valueZachary T Welch2-6/+5
This patch changes the behavior of all boolean parsing callers to accept any one of "true/enable/on/yes/1" or "false/disable/off/no/0". Since one particular pair will be most appropriate in any given situation, the specific macros should continue to be used in order to display the most informative error messages possible.
2009-11-18add handle_command_parse_bool command helperZachary T Welch3-51/+69
Rewrite arm11_handle_bool to provide a generic on/off command helper. Refactors COMMAND_PARSE_BOOL to use new command_parse_bool helper, which gets reused by the new command_parse_bool_any helper. This later helper is called by the new command helper function to accepts any on/off, enable/disable, true/false, yes/no, or 0/1 parameter.
2009-11-18use COMMAND_PARSE_ENABLE macro where appropriateZachary T Welch6-158/+41
Updates all command parsing of simple "enable" and "disable" arguments. A few case in the tree use a tri-state or extended arguments, which cannot use this simple macro. Simlifies the xscale icache/dcache command handler logic.
2009-11-18use COMMAND_PARSE_ON_OFF where appropriateZachary T Welch5-50/+17
Updates all command parsing of "on" and "off" arguments.
2009-11-18add COMMAND_PARSE_BOOL macro and friendsZachary T Welch1-0/+28
Adds several macros similar to COMMAND_PARSE_NUMBER, but for parsing boolean command arguments. Two flavors are provided to provide drop-in compatibility with existing code, allow for the elimination of a lot of code bloat while improving the error checking and reporting. COMMAND_PARSE_ON_OFF parses "on"/"off" command parameters. COMMAND_PARSE_ENABLE parses "enable"/"disable" command parameters. Both print the error and return an error out of the calling function.
2009-11-18ARM: rework "arm reg" output for new modeDavid Brownell1-35/+113
Change the layout to show the "Secure Monitor" registers too, when they're present. Instead of lining registers for each of six (or seven) modes up in adjacent vertical columns, display each mode's registers (or shadows) in a single block, avoiding duplicate value displays. This also lets us shrink the line length to fits in standard 80 character lines ... six or seven 18-character columns can't fit. Relabel "r13" as "sp", so it's more meaningful. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-18Cortex-A8: xPSR handling updatesDavid Brownell1-17/+20
When we read the CPSR on debug entry, update the CPSR cache in all cases, not just when the current processor state is User or System. Plus minor cleanup of how the (too-many) other registers' cache entries get updated. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-18ARM: add a default full_context() methodDavid Brownell2-12/+27
If the core doesn't provide an optimized version of this method, provide one without core-specific optimizations. Use this to make Cortex-A8 support the "arm reg" command. Related: make the two register access methods properly static, have the "set" log a "not halted" error too, and make sure that the "valid" flag is set on successful reads. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-18ARM: simplify ARMv7-A register handlingDavid Brownell3-188/+50
ARMv7-A doesn't need to duplicate all the standard ARM code for register handling. - Switch Cortex-A8 to use the standard register code - Remove duplicated infrastructure from ARMv7-A - Have ARMv7-A arch_state() show CPSR, like other ARMs Add comments to show where the Cortex-A8 isn't actually doing the right thing for register reads/writes, unless core happens to be in the right mode to start with. (Looks like maybe there may be generic confusion between saved/current PSR values in all the ARM code ...) Make related ARMv7-A and Cortex-A8 symbols properly static. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-18ARM: setup "secure monitor mode" shadow regsDavid Brownell2-21/+53
Teach the "armv4_5" register code to understand about the secure monitor mode: - Add the other three shadowed registers to the arrays - Support another internal mode number (sigh) in mappings - Catch malloc/calloc failures building that register cache This should kick in for Cortex-A8 and ARM1176. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-18ARM: add "core_type" field to "struct arm"David Brownell4-5/+31
It's used to flag cores with the "TrustZone" extension, and is used in subsequent patches to set up support for the registers shadowed by its new secure monitor mode. The ARM1176 and Cortex-A8 both support this new mode. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-18fix segfault at startupZachary T Welch1-1/+1
The previous changes to move the startup TCL code resulted in segfaults during startup. This seemingly innocuous patch fixes the problem. I would explain why changing from 'foo[]' to '*foo' caused this issue, but the difference seems superficial. For now, this hot fix will do, but this issue might bear further scrutiny.