summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
...
* ARM11: remove unused state and exportsDavid Brownell2009-11-224-32/+25
| | | | | | | | | For now there's no point in saving this stuff after examine() checks it out as OK. Ditto exporting symbols that aren't used outside of the module which defines them. In fact, those two things needlessly complicate the code... Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* ARM11: macro cleanupDavid Brownell2009-11-222-72/+39
| | | | | | | | | | | | | | | | | Make this code look more like the rest of the OpenOCD code. - Use calloc() directly, not NEW() ... and fix some potential memory leaks while we're at it. - Remove FNC_INFO ... it's a NOP that just clutters things, and it's trivial for developers to add tracing as needed. - Replace FNC_INFO_NOTIMPLEMENTED with LOG_WARNING calls; ditto. And stop having those call sites wrongly succeed! - Waste less space with the CHECK_RETVAL() macro. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* mips: remove dynamic arrays - reduces stack usageØyvind Harboe2009-11-221-5/+15
| | | | | | Allocate working memory dynamically. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* mips: use const for code sequencesØyvind Harboe2009-11-222-13/+13
| | | | | | | | This will allow data to be allocated in read only memory instead of on the stack. Speeds things up and reduces stack usage. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* arm11: do not use dynamic arraysØyvind Harboe2009-11-221-3/+6
| | | | | | Allocate working memory dynamically, caught by checkstack.pl Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* arm926ejs: fix warningsØyvind Harboe2009-11-221-2/+2
| | | | | | | | buf_set_u32() operated on an uninitialized stack variable with non-byte boundaries, which led to warnings about reading uninitialized stack. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* ARM: use arm_reg_current()David Brownell2009-11-223-61/+74
| | | | | | | | | | Start using the arm_reg_current() call. This shrinks and speeds the affected code. It can also prevent some coredumps coming from invalid CPSR values ... the ARMV4_5_CORE_REG_MODE() macro returns bogus registers if e.g. "Secure Monitor" mode isn't supported by the current CPU. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* ARM11: remove needless string format #ifdefferyDavid Brownell2009-11-223-21/+22
| | | | | | | | We don't need to use size_t in these places; so it's easy to be rid of the need for this #ifdef and its MS-derived portability problems. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* target: make register flags "bool"David Brownell2009-11-221-2/+2
| | | | | | Mostly for clarity, but it also saves code and data space. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* ARM: remove 'armv4_5_common_s' migration #defineDavid Brownell2009-11-2212-56/+53
| | | | | | Finish migrating from the old symbol to the new one. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* flash: dynamically allocate working storageØyvind Harboe2009-11-221-16/+52
| | | | | | Allocate working memory rather than using stack. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* target: reduce stack usageØyvind Harboe2009-11-221-6/+20
| | | | | | | 4096 byte buffer allocated dynamically. Better for embedded OS's. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* zy1000: un-break uart command after command handler refactoringØyvind Harboe2009-11-221-15/+19
| | | | | | Switched it to jim command to insulate it from command refactoring. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* embedded: reduce stack usageØyvind Harboe2009-11-221-4/+9
| | | | | | | Allocate working structures on stack to avoid issues with path lengths + reduce stack usage. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* embedded: do not allocate large temporary structures on stackØyvind Harboe2009-11-221-6/+61
| | | | | | | With -O3 when inlining aggressively the total stack usage will be the sum of many fn's, which can easily get out of hand. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* embedded: save stackØyvind Harboe2009-11-221-9/+15
| | | | | | | and also do not recaluate the crc32_table upon every invocation. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* zy1000: fix breakage in command parsing code for power commandØyvind Harboe2009-11-221-1/+1
| | | | Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* build: fix breakage in building bin2charØyvind Harboe2009-11-221-1/+1
| | | | | | | bin2char build relied on $(builddir) which is not defined for arm-elf X builds at least. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* ARM: arm_set_cpsr() handles T and J bitsDavid Brownell2009-11-227-79/+52
| | | | | | | | | | | | | | 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>
* ARM: define two register utilitiesDavid Brownell2009-11-228-48/+122
| | | | | | | | | | | | | | 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>
* ARM: simplify CPSR handlingDavid Brownell2009-11-2211-87/+103
| | | | | | | | | | | | | | 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>
* ARM11: remove disabled register hooksDavid Brownell2009-11-222-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>
* jtag: remove useless forward declarationsZachary T Welch2009-11-215-140/+76
| | | | | Removes some more useless forward declarations from a few JTAG drivers. Moves interface and bit-bang structure defitions below their callbacks.
* allow jtag interfaces to lack commandsZachary T Welch2009-11-211-2/+5
| | | | | Allow JTAG interface drivers to skip registering an register_commands callback when it will just be empty.
* show script search dirs in debug logAndreas Fritiofson2009-11-211-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>
* ARM: pass 'struct reg *' to register r/w routinesDavid Brownell2009-11-208-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>
* ARM7/ARM9: remove old "debug commands"David Brownell2009-11-201-130/+0
| | | | | | | | | | | | | | | 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>
* maintain command lists in sorted orderZachary T Welch2009-11-201-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.
* add add_help_text command handlerZachary T Welch2009-11-202-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.
* provide command context during cmd_initZachary T Welch2009-11-201-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.
* improve 'help' commandZachary T Welch2009-11-203-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).
* factor help script command into partsZachary T Welch2009-11-201-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.
* refactor command registrationZachary T Welch2009-11-203-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.
* change command_find helper interfaceZachary T Welch2009-11-201-4/+3
| | | | Avoid requiring double pointers where a single would suffice.
* factor script_command argv allocationZachary T Welch2009-11-201-27/+38
| | | | Splits argument allocation out from script command, reusing free() code.
* fix flash/nand name parsingZachary T Welch2009-11-201-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.
* Cortex-A8: better context restoreDavid Brownell2009-11-191-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>
* Cortex-A8: mode supportDavid Brownell2009-11-191-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>
* target: create/use register_cache_invalidate()David Brownell2009-11-1914-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>
* NAND verify doesn't advance.Dean Glazeski2009-11-191-1/+1
| | | | | | Fix to move the device address up as the contents are verified. Signed-off-by: Zachary T Welch <zw@superlucidity.net>
* add support for naming NAND banksZachary T Welch2009-11-192-3/+11
| | | | | Requires users to name their nand banks, allowing them to be used instead of bank numbers in script commands.
* refactor handle_nand_device_commandZachary T Welch2009-11-191-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.
* add support for naming flash banksZachary T Welch2009-11-192-2/+10
| | | | | Requires users to name their flash banks, allowing them to be used instead of bank numbers in script commands.
* refactor handle_flash_bank_commandZachary T Welch2009-11-191-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.
* rename flash and nand command helpersZachary T Welch2009-11-1913-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
* allow flash/nand banks commands to accept namesZachary T Welch2009-11-197-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.
* ARM: remove per-register mallocDavid Brownell2009-11-192-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>
* ARM: streamline register initDavid Brownell2009-11-191-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>
* Cortex-A8: parts of examine() run just onceDavid Brownell2009-11-191-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>
* nand_fileio_parse_args parses wrong param for sizeDean Glazeski2009-11-191-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>