summaryrefslogtreecommitdiff
path: root/src/target
Commit message (Collapse)AuthorAgeFilesLines
...
* ETM: start support for ETMv2+David Brownell2009-11-122-23/+129
| | | | | | | | | | | | | | | | | ARM11 and newer cores include updated ETM modules. Recognize their version codes and some key config differences. Sanity checked on an OMAP2, with an ETM11RV r0p1 (ETMv3.1). This still handles only scan chain 6, with at most 128 registers. Newer cores (mostly, Cortex) will need to use the DAP instead. Note that the newer ETM modules don't quite fit the quirky config model of the older ones ... having more port widths is easy, but the modes aren't the same. That still needs to change. Fix a curious bug ... how did the register cache NOT get saved?? Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* ETM: remove old mid-level ETM handleDavid Brownell2009-11-117-11/+8
| | | | | | | | | | | | | | | | | | Now that nothing uses the old ETM handle any more, remove it. Add minimal header tweaks, letting non-ARM7 and non-ARM9 cores access ETM facilities. Now ARM11 could support standard ETM (and ETB) access as soon as it derives from "struct arm" ... its scanchain 6 is used access the ETM, just like ARM7 and ARM9. The Cortex parts (both M3 and A8) will need modified access methods (via ETM init parameters), so they use the DAP. Our first A8 target (OMAP3) needs that for both ETM and ETB, but the M3 ETM isn't very useful without SWO trace support (it's painfully stripped down), so that support won't be worth adding for a while. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* ETM: use new toplevel ETM handleDavid Brownell2009-11-111-58/+50
| | | | | | | | Make ETM itself use the new toplevel ETM handle, instead of the to-be-removed lower level one. As of this patch, nothing should be using the old ARM7/ARM9-specific handle. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* ETM: update port driversDavid Brownell2009-11-113-42/+41
| | | | | | | | | | Make both useful ETM port drivers (etb, etm_dummy) use the new toplevel ETM handle, instead of the to-be-removed lower level one. Do the same for the "oocd-trace" prototype too; and fix its error reporting paths: return failure codes, don't exit(), etc Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* ETM: update arm[79]tdmi_examine()David Brownell2009-11-112-8/+10
| | | | | | | Make ARM7 and ARM9 cores use the new toplevel ETM handle to trigger ETM setup, not the to-be-removed lower level one. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* ARM: start generalized base typeDavid Brownell2009-11-112-19/+34
| | | | | | | | | | | | | | | | Rename "struct armv4_5_common_s" as "struct arm". It needs a bit more work to be properly generic, and to move out of this header, but it's the best start we have on that today. Add and initialize an optional ETM pointer, since that will be the first thing that gets generalized. The intent being: all ARMs should eventually derive from this "struct arm", so they can reuse the current ETM logic. (And later, more.) Currently the ARM cores that *don't* so derive are only ARMv7-M (and thus Cortex-M3) and ARM11. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* remove more useless declarationsZachary T Welch2009-11-111-13/+12
| | | | | Removes forward declarations by moving command registration after defintion of the command handlers.
* cortex_a8: remove declarations, use static keywordZachary T Welch2009-11-112-112/+82
|
* add const keyword to some APIsZachary T Welch2009-11-115-7/+9
| | | | | | 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.
* change argv to args in command handlersZachary T Welch2009-11-111-5/+5
| | | | | | | | | | | Subsequent patches expect all command handlers to use a uniform parameter naming scheme. In the entire tree, these two files used standard 'argv' instead of our non-standard 'args'. This patch opts to reduces the noise required to unify the command handlers, using dominant 'args' form. A future patch may be used to convert us back to the standard argv, but that requires coordination with all developers to minimize disruptions.
* makefiles: improve build orderZachary T Welch2009-11-111-51/+76
| | | | | | | | | | | Separates various groups of files to be built in logical succession. In each layer, the core module (target.c, nand.c, etc.) is built _after_ their helper modules (e.g. image.c, nand_ecc.c) but _before_ any of their drivers (e.g. arm966e.c, mx3_nand.c). This allows problems introduced at the bottom of the stack to result in build failures as soon as possible, as the helpers and core should wrap portions of them.
* ETM cleanupDavid Brownell2009-11-114-131/+120
| | | | | | | | | | | | | | | | Various cleanups of ETM related code. - Saner error return paths - Simplify arm7_9 init ... no need for extra zeroing! - Shrink some lines - Tweak some diagnostics - Use shorter name for ETM struct type. - Don't exit() and similar. The diagnostics look forward to having this ETM code work with more than just ARM7/ARM9. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* fix bug in ARM720: bugfixZachary T Welch2009-11-101-1/+1
|
* ARM720: bugfixDavid Brownell2009-11-101-1/+2
| | | | | | | The "ARM720 uses the new inheritance/nesting scheme" patch wrongly scrubbed a calloc() from arm720t_target_create(). Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* target: MMU-aware init for memory read/writeDavid Brownell2009-11-101-23/+42
| | | | | | | | | | | | | | | | | | 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>
* arm11: add etmr/etmw registers to access ETM via DBGTAP scan chainMichael Bruck2009-11-103-0/+142
| | | | | | | | First cut of these commands. Øyvind tinkered a bit with the number parsing to bring it up to speed + rebased it. Ready for testing. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* ARM11: remove old mrc/mcr commandsØyvind Harboe2009-11-101-102/+0
| | | | | | Switch to new commands in config scripts Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* Target: minor cleanupDavid Brownell2009-11-102-13/+21
| | | | | | | | - 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>
* ARM920: implement basic MMU opsDavid Brownell2009-11-101-0/+22
| | | | | | mmu() works; virt2phys() fails and logs an error. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* ARM720: implement basic MMU opsDavid Brownell2009-11-101-0/+22
| | | | | | mmu() works; virt2phys() fails and logs an error. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* Target: fix bad error messagesDavid Brownell2009-11-101-7/+10
| | | | | | And shrink a few too-long lines. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* svf,xsvf,arm7_9_common: trim forard declarationsZachary T Welch2009-11-091-35/+38
| | | | Remove forward declarations by reordering command registration.
* target.c: remove useless declarationsZachary T Welch2009-11-091-103/+127
| | | | | This patch removes the last batch of forward references from the tree, moving the target command registration routines to the end of the file.
* Revert "target: add target->type->has_mmu fn"David Brownell2009-11-093-48/+5
| | | | | | | | | | | | | | | | 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>
* finish removing deprecated/obsolete commandsDavid Brownell2009-11-093-6/+4
| | | | | | | | | | | | | | | | | | | | 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>
* src/target: remove 'extern' and wrap headersZachary T Welch2009-11-0926-190/+296
| | | | Remove extern keywords from function prototypes and wrap long lines.
* target.h: remove extern keyword and wrapZachary T Welch2009-11-091-53/+72
| | | | Removes 'extern' keyword from function prototypes and wraps long lines.
* EmbeddedICE: minor cleanupsDavid Brownell2009-11-091-52/+101
| | | | | | | Add comments (Doxygen and normal), remove unused code, shrink some overlong lines. Get rid of a forward decl. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* Overhaul time support APIZachary T Welch2009-11-091-53/+30
| | | | | | | | | | | | | | | | | | | 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.
* Add private header for ARM11 internals.Zachary T Welch2009-11-084-50/+74
| | | | | | | Reduces confusion about location of associated routines and reduces clutter in the arm11 header. Removes extra whitespace around the lines touched by these changes.
* ARM11: remove exports and forward declsZachary T Welch2009-11-082-164/+138
| | | | | Unneeded exports cause confusion about the module interfaces. Make almost everything static in the arm11.c module.
* ARM: minor simulator cleanupDavid Brownell2009-11-081-25/+49
| | | | | | | | Make several functions be static. Shrink some of the overlong lines. Use pure tab indents in some places that mixed in spaces. This gives a minor object code shrink (about 2% on amd64). Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* Cortex-M3: fix (debug) message priorityDavid Brownell2009-11-081-1/+1
| | | | Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* Merge branch 'master' of ↵David Brownell2009-11-061-0/+1
|\ | | | | | | ssh://dbrownell@openocd.git.sourceforge.net/gitroot/openocd/openocd
| * Fix arm11 vcr command parsing.Zachary T Welch2009-11-061-0/+1
| |
* | target: don't swap MMU/no-MMU work areasDavid Brownell2009-11-061-16/+17
|/ | | | | | | | | | | | | | | 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>
* ARM: shrink offsetsDavid Brownell2009-11-056-8/+8
| | | | | | | | | | | | | | | | | | Move various embedded target structs to the beginnings of their containers ... pretty much the way C++ or Obj-C would for single inheritance. This shrinks code that accesses those embedded structs by letting common offsets use smaller instructions. Sample before/after sizes (on amd64): 17181 312 0 17493 4455 arm920t.o 16810 312 0 17122 42e2 arm920t.o Where the "after" is the smaller number, with this patch over the ones leveraging that embedding knowledge. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* ARM: other code uses the new inheritance/nesting schemeDavid Brownell2009-11-056-104/+78
| | | | | | | Remove most remaining uses of target->arch_info from ARM infrastructure, where it hasn't already been updated. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* Cortex-A8: use the new inheritance/nesting schemeDavid Brownell2009-11-054-125/+51
| | | | | | | Use target_to_armv7a() etc, replacing needless pointer traversals. Stop using X->arch_info scheme in most ARMv7-A and Cortex-A8 code. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* ARM7TDMI uses the new inheritance/nesting schemeDavid Brownell2009-11-052-70/+28
| | | | | | | | | Use target_to_arm7_9(), replacing needless pointer traversals. Also: remove now-useless contents of arm7tdmi struct; it's almost ready to be removed. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* ARM720 uses the new inheritance/nesting schemeDavid Brownell2009-11-051-80/+30
| | | | | | | | Use target_to_arm720(), replacing needless pointer traversals and simplifying a bunch of nasty code. Stop setting arch_info for arm720 type parts, it's not used any longer. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* XScale uses the new inheritance/nesting schemeDavid Brownell2009-11-052-190/+118
| | | | | | | Use target_to_xscale(), replacing needless pointer traversals and simplifying a bunch of code. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* ARM9TDMI uses the new inheritance/nesting schemeDavid Brownell2009-11-052-109/+33
| | | | | | | Replace needless pointer traversals and simplify. Also remove most remaining contents from arm9tdmi struct; it's almost removable. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* ARM966 uses the new inheritance/nesting schemeDavid Brownell2009-11-051-52/+11
| | | | | | Use target_to_arm966(), replacing needless pointer traversals. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* ARM926 uses the new inheritance/nesting schemeDavid Brownell2009-11-051-125/+46
| | | | | | | Use target_to_arm926(), replacing needless pointer traversals and simplifying a bunch of code. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* FA526 uses the new inheritance/nesting schemeDavid Brownell2009-11-051-26/+7
| | | | | | Replace needless pointer traversals, simplify. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* ARM920 uses the new inheritance/nesting schemeDavid Brownell2009-11-052-142/+71
| | | | | | | | Use target_to_arm920(), replacing needless pointer traversals and simplifying. Stop setting arm9tdmi->arch_info for arm920 type parts, it's not used any longer. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* Cortex-M3: use the new inheritance/nesting schemeDavid Brownell2009-11-054-135/+113
| | | | | | | | | | | | Use new target_to_cm3() and target_to_armv7m() inlines, instead of a series of x->arch_info conversions. Remove arch_info, since nothing uses it. Also fix an omission: the Cortex-M3 commands didn't verify that they were operating on that kind of target. Add comment about the ARMv7M version of that omission. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* target: provide container_of()David Brownell2009-11-0512-0/+91
| | | | | | | | | | | | | | | | | | | | | | | | | Provide a cleaner way to handle single inheritance of targets in C, using the same model Linux does: structs containing other structs, un-nested via calls to a "container_of()" macro that are packaged in typesafe inline functions. Targets already use this containment idiom, but make it much more complicated because they un-nest using embedded "void *" pointers ... in chains of up to five per target, which is all pure needless complication. (Example: arm92x core, arm9tdmi, arm7_9, armv4_5 ... on top of the base "target" class.) Applying this scheme consistently simplifies things, and gets rid of many error-prone untyped pointers. It won't change any part of the type model though -- it just simplifies things. (And facilitates more cleanup later on.) Rule of thumb: where there's an X->arch_info void* pointer, access to that pointer can and should be removed. It may be convenient to set up pointers to some of the embedded structs; and shrink their current "*_common" names (annoyingly long). Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* ARM7TDMI: remove forward declsDavid Brownell2009-11-052-92/+88
| | | | | | | | | | | | The forward decls are just code clutter; remove them, by moving their references after definitions. This is another file which never needed even one internal forward declaration. Also shrink a few overly-long lines with function declarations or definitions; get rid of arm7tdmi_register_commands(), it's not needed (just delegated); minor whitespace declutter. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>