summaryrefslogtreecommitdiff
path: root/src/target/target.c
Commit message (Collapse)AuthorAgeFilesLines
* use COMMAND_REGISTER macroZachary T Welch2009-11-241-27/+27
| | | | | Replaces direct calls to register_command() with a macro, to allow its parameters to be changed and callers updated in phases.
* 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>
* target: create/use register_cache_invalidate()David Brownell2009-11-191-4/+4
| | | | | | | | | | | | | | | 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>
* use COMMAND_PARSE_ON_OFF where appropriateZachary T Welch2009-11-181-14/+5
| | | | Updates all command parsing of "on" and "off" arguments.
* fix regression in md/mw commandsZachary T Welch2009-11-181-4/+2
| | | | | | | 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.
* command_handler: change 'cmd_ctx' to CMD_CTXZachary T Welch2009-11-171-65/+65
| | | | Convert all command handler 'cmd_ctx' parameter usage with CMD_CTX.
* command_handler: change 'args' to CMD_ARGVZachary T Welch2009-11-171-58/+58
| | | | | This patch converts all instances of 'args' in COMMAND_HANDLER routines to use CMD_ARGV macro.
* command_handler: change to 'argc' to CMD_ARGCZachary T Welch2009-11-171-44/+44
| | | | | This patch converts all instances of 'argc' in COMMAND_HANDLER routines to use CMD_ARGC.
* target: simplify register get/set opsDavid Brownell2009-11-171-4/+2
| | | | | | | | | | | 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>
* fileio: improve API typesZachary T Welch2009-11-161-5/+5
| | | | | | | | | | | | | 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.
* struct fileio: improve member typesZachary T Welch2009-11-161-1/+1
| | | | | | Add const keyword to file url and cast to free(). Make size an ssize_t and chase all format strings that use it.
* rename CEIL as DIV_ROUND_UPZachary T Welch2009-11-161-1/+1
| | | | | Improves the name of this macro, moves it to types.h, and adds a block of Doxygen comments to describe what it does.
* target: don't implicitly include "breakpoint.h"David Brownell2009-11-161-0/+1
| | | | | | | | | | | 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>
* target: make "examined" flag be per-targetDavid Brownell2009-11-151-13/+6
| | | | | | | | | | | | | | | | | | 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>
* Fix for md* commands, similar to mw*.Krzysztof Dziuba2009-11-141-1/+2
|
* Invalid command syntax errors with MWW.Dean Glazeski2009-11-141-1/+2
| | | | | 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.
* compile with cygwin (32-bit)Ferdinand Postema2009-11-141-7/+9
| | | | | | | | Changed some printf format strings.. [dbrownell@users.sourceforge.net: shrink lines, fix indents] Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* command_context_t -> struct command_contextZachary T Welch2009-11-131-14/+14
| | | | Remove misleading typedef and redundant suffix from struct command_context.
* target_t -> struct targetZachary T Welch2009-11-131-113/+113
| | | | Remove misleading typedef and redundant suffix from struct target.
* reg_t -> struct regZachary T Welch2009-11-131-3/+3
| | | | Remove misleading typedef and redundant suffix from struct reg.
* target_type_t -> struct target_typeZachary T Welch2009-11-131-20/+20
| | | | Remove misleading typedef and redundant suffix from struct target_type.
* image_t -> struct imageZachary T Welch2009-11-131-4/+4
| | | | | | | 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.
* trace_t -> struct traceZachary T Welch2009-11-131-1/+1
| | | | Remove misleading typedef and redundant suffix from struct trace.
* breakpoint_t -> struct breakpointZachary T Welch2009-11-131-3/+3
| | | | Remove misleading typedef and redundant suffix from struct breakpoint.
* target_event_action_t -> struct target_event_actionZachary T Welch2009-11-131-3/+3
| | | | Remove misleading typedef and redundant suffix from struct target_event_action.
* target_timer_callback_t -> struct target_timer_callbackZachary T Welch2009-11-131-10/+10
| | | | Remove misleading typedef and redundant suffix from struct target_timer_callback.
* target_event_callback_t -> struct target_event_callbackZachary T Welch2009-11-131-8/+8
| | | | Remove misleading typedef and redundant suffix from struct target_event_callback.
* working_area_t -> struct working_areaZachary T Welch2009-11-131-9/+9
| | | | Remove misleading typedef and redundant suffix from struct working_area.
* reg_arch_type_t -> struct reg_arch_typeZachary T Welch2009-11-131-2/+2
| | | | Remove misleading typedef and redundant suffix from struct reg_arch_type.
* reg_cache_t -> struct reg_cacheZachary T Welch2009-11-131-2/+2
| | | | Remove misleading typedef and redundant suffix from struct reg_cache.
* watchpoint_t -> struct watchpointZachary T Welch2009-11-131-3/+3
| | | | Remove misleading typedef and redundant suffix from struct watchpoint.
* reg_param_t -> struct reg_paramZachary T Welch2009-11-131-2/+2
| | | | Remove misleading typedef and redundant suffix from struct reg_param.
* mem_param_t -> struct mem_paramZachary T Welch2009-11-131-2/+2
| | | | Remove misleading typedef and redundant suffix from struct mem_param.
* jtag_tap_t -> struct jtag_tapZachary T Welch2009-11-131-1/+1
| | | | | Search and destroy the jtag_tap_t typedef. This also cleans up a layering violation, removing the declaration from types.h.
* fileio_t -> struct fileioZachary T Welch2009-11-131-1/+1
| | | | Remove useless structure typedef.
* add CMD_NAME macro for command handlersZachary T Welch2009-11-131-3/+3
| | | | | By introducing the CMD_NAME macro, this parameter may be integrated as args[-1] in command.[ch], without touching any other call sites.
* use CALL_COMMAND_HANDLER instead of direct callsZachary T Welch2009-11-131-5/+5
| | | | | | 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.
* use COMMAND_HELPER for command helper functionsZachary T Welch2009-11-131-5/+4
| | | | | Define the numerous helpers that inherit command handler parameters using the COMMAND_HELPER macro.
* use COMMAND_HANDLER macro to define all commandsZachary T Welch2009-11-131-25/+23
|
* add const keyword to some APIsZachary T Welch2009-11-111-1/+1
| | | | | | 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.
* 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>
* Target: minor cleanupDavid Brownell2009-11-101-9/+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>
* 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>
* 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-091-33/+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-091-4/+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>
* 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.
* 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>
* Improve target.c command argument parsing.Zachary T Welch2009-11-051-88/+36
| | | | | Passes cmd_ctx into parse_load_image_command_args for reporting the parsing errors therein.
* target: fix ordering of arguments to mcr and mrc commandsØyvind Harboe2009-11-051-7/+7
| | | | | | Now matches machine code syntax and old arm11 syntax. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>