summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
...
* ARM: "armv4_5" command prefix becomes "arm"David Brownell2009-11-162-9/+18
| | | | | | | | | | Rename the "armv4_5" command prefix to straight "arm" so it makes more sense for newer cores. Add a simple compatibility script. Make sure all the commands give the same "not an ARM" diagnostic message (and fail properly) when called against non-ARM targets. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* JTAG: fix autoprobe failure.David Brownell2009-11-161-2/+10
| | | | | | | Fix bug noted by Øyvind: terminate the IR length autoscan when the IR is too long, or otherwise broken. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* fileio: improve API typesZachary T Welch2009-11-1612-64/+66
| | | | | | | | | | | | | 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-166-7/+7
| | | | | | Add const keyword to file url and cast to free(). Make size an ssize_t and chase all format strings that use it.
* helper/log: improve API parameter typesZachary T Welch2009-11-162-19/+16
| | | | | | | Uses unsigned type to pass line numbers. Use uint64_t to pass sleep routines their milliseconds. Updates sleep routines to use this type and improve whitespace.
* use Jim_CmdProc in jim_registerZachary T Welch2009-11-162-2/+4
| | | | The jim_register command just needed to use the type defined by jim.h.
* improve constness of open_file_from_pathZachary T Welch2009-11-162-2/+2
|
* make command line options constZachary T Welch2009-11-161-1/+1
| | | | | The getopt_long call allows a const struct option, so mark ours const too.
* ARM: standard disassembler uses Thumb2 entryDavid Brownell2009-11-162-38/+38
| | | | | | | | | | | | | | | | | Tweak "standard" ARM disassembler diagnostics to fail if the target is not "an ARM" (vs. not "an ARMV4/5"), so it makes more sense for cores inheriting this as the "generic" disassembler. Also, to use the Thumb2 entry instead of the original Thumb entry. This makes it work better for both newer cores (which support those added instructions) and for BL and BLX instructions on older cores. (Those instructions are 32-bits, which requires curious state-aware code to go through a 16-bit decode interface...) Plus minor cleanups, notably to have fewer exit paths and to make sure they all return failure codes. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* target: don't include "log.h" from "armv4_5.h"David Brownell2009-11-162-1/+1
| | | | | | | No point in multiple includes, and that file doesn't use its functions any more. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* ARM: move mode functions out of headerDavid Brownell2009-11-162-40/+56
| | | | | | | | | They're really too big to inline, at least for code that's not in any performance-critical loops. Also move the associated string table to the rodata section. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* JTAG: no LOG_WARNING() for taps without IDCODEDavid Brownell2009-11-161-1/+1
| | | | Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* binarybuffer: regression fixDavid Brownell2009-11-161-2/+4
| | | | | | | The "improve inline binarybuffer helpers" mis-handled bytes with the high bit set; treat them as unsigned, not signed. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* "types.h" doxygen fixDavid Brownell2009-11-161-2/+2
| | | | Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* target: less implicit inclusion of "etm.h"David Brownell2009-11-169-2/+13
| | | | | | | Don't include it in more headers than necessary; just use it in the few files that actually need it. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* move ARRAY_SIZE macro to types.hZachary T Welch2009-11-1614-59/+49
| | | | | | | | The ARRAY_SIZE macro was defined in several target files, so move it to types.h. This patch also removes two other identical macros: DIM (from jtag.h) and asizeof (from arm11.h).
* armv7m: make core reg read/write use unsignedZachary T Welch2009-11-162-6/+6
| | | | | | Eliminate redundant check that gets covered by using unsigned type. Created to eliminate noise from subsequent patches, but this kind of conversion will be beneficial in similar ways throughout the tree.
* remove TAP_SCAN_BYTES macroZachary T Welch2009-11-164-11/+9
| | | | Use DIV_ROUND_UP(n, 8) instead of TAP_SCAN_BYTES macro.
* rename CEIL as DIV_ROUND_UPZachary T Welch2009-11-1619-53/+60
| | | | | Improves the name of this macro, moves it to types.h, and adds a block of Doxygen comments to describe what it does.
* move container_of to types.hZachary T Welch2009-11-162-13/+15
| | | | | | The container_of macro is useful as a general solution. It belongs in types.h, rather than target.h where it was introduced. Requires the offsetof macro, which comes from <stddef.h> (moved as well).
* nand_command_get_device_by_num: make COMMAND_HELPERZachary T Welch2009-11-162-10/+11
| | | | | Use COMMAND_HELPER macro to define nand_command_get_device_by_num. Use CALL_COMMAND_HANDLER to invoke it.
* flash_command_get_bank_by_num: make COMMAND_HELPERZachary T Welch2009-11-1611-41/+41
| | | | | Use COMMAND_HELPER macro to declare flash_command_get_bank_by_num. This is required for COMMAND_PARSE_NUMBER macro.
* cleanup jtag minidriversZachary T Welch2009-11-162-31/+0
| | | | | Remove two vestigial externs from our JTAG minidriver source files. Also, removes many extra blank lines from the minidummy driver.
* Add 'nand verify' commandZachary T Welch2009-11-161-0/+65
| | | | | | | | | | | Add the 'nand verify' command to perform a dump and fake-write simultaneously, checking the read bits against those generated by the write process. Appropriate user documentation for this command has been added to the user guide as well. The algorithm presently makes a relatively naive comparison. Some chips that use ECC may not verify correctly using this implementation, but the new documentation provides details about this limitation.
* Add FILEIO_NONE access mode.Zachary T Welch2009-11-161-0/+1
| | | | | | | In some cases, the FILEIO_NONE access mode may be useful as a parameter to indicate that file access should be disabled. High-level routines can use it to skip file access calls, as 'fileio_open' will fail presently if called to open a file using this mode.
* Use nand_fileio_* in write/dump commands.Zachary T Welch2009-11-161-248/+46
| | | | | | | | | | | This patch eliminates duplicated code in the the NAND 'dump' and 'write' by using the new static helper functions. These changes also fix a possible memory leak in nand dump command, in the case that the dump file failed to open. Overall, the changes should be functionally equivalent, but the resulting code will be easier to improve and extend further.
* Add nand_fileio_* helper APIs.Zachary T Welch2009-11-161-0/+216
| | | | | | | | | | | | | | | This patch provides helpers APIs that will eliminate duplicated code in the the NAND 'dump' and 'write' commands by factoring their common code into static helper functions. These helpers may be useful for creating new commands, as shown in the final patch to 'verify' flash from a file. Several previously unreported error conditions now generate messages and propogate the return codes, such as when the file fails to open and bad arguments are given. These changes will fix a possible memory leak in nand dump command, in the case that the dump file failed to open. Overall, the changes should be functionally equivalent, but the resulting code will be easier to improve and extend consistently.
* binarybuffer: add API documentationZachary T Welch2009-11-161-3/+41
| | | | | Adds Doxygen documentation for a number of the binarybuffer APIs, including "unexpected" behavior exposed during review on the list.
* improve inline binarybuffer helpersZachary T Welch2009-11-161-7/+8
| | | | Use void*, unsigned, and bool types with inline helpers.
* improve buf_set_buf helperZachary T Welch2009-11-162-5/+8
| | | | | Use void * and unsigned types for buffer and their sizes. Allows it to be used with more than uint8_t * without casts.
* improve buf_set_onesZachary T Welch2009-11-162-10/+11
| | | | Use memset instead of loop. Improve types, using void * and unsigned.
* improve buf_cpy helperZachary T Welch2009-11-162-9/+11
| | | | | Use memcpy for bulk of copy, improve final byte handling. Improve types by using void * for buffers and unsigned for size.
* improve buf_cmp and buf_cmp_mask helpersZachary T Welch2009-11-162-39/+40
| | | | | | | | Rewrite buf_cmp to use memcpy for bulk of comparison. Add static helper to perform comparison of trailing byte, which uses another static helper to perform a maksed comparison. The masked comparison helper is used by the buf_cmp_mask to simplify its loop. Improve types to use void *, unsigned, and return bool.
* improve str_to_buf and buf_to_str helpersZachary T Welch2009-11-162-65/+67
| | | | | Improve types: use void * and unsigned. Move all variables to point of first use. Move radix guessing logic to new str_radix_guess helper.
* binarybuffer: move variables to point of first useZachary T Welch2009-11-162-28/+9
| | | | Reduce some noise from subsequent patches.
* binarybuffer: fix whitespace related issuesZachary T Welch2009-11-162-23/+18
| | | | Add inter-operator whitespace. Improve existing documentation.
* #include "target.h" less wildlyDavid Brownell2009-11-1617-15/+10
| | | | | | | | | Don't include "target.h" from more headers than necessary. This avoids needless interdependencies and duplicated include paths. Don't needlessly include it in source files, either. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* target: no implicit #includes of "register.h"David Brownell2009-11-1627-10/+21
| | | | | | | | | | | | 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>
* target: less implicit inclusion of "command.h"David Brownell2009-11-1610-14/+3
| | | | | | | | | | Lots of files still include it, often through needless duplicate inclusion of "log.h"; sigh. This cleans up the inclusion graph a bunch, so there are fewer inclusion paths, but it doesn't change much otherwise. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* target: don't implicitly include "algorithm.h"David Brownell2009-11-1616-5/+18
| | | | | | | | | | | | | | Most files in the tree seem to have ended up including this, and *quite* needlessly ... only code implementing or using downloadable algorithms 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. Also: "algorithm.h" doesn't need to include "types.h" again; it already comes from a different header. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* target: don't implicitly include "breakpoint.h"David Brownell2009-11-1612-2/+12
| | | | | | | | | | | 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>
* ARM11: use now-generic memory utilsDavid Brownell2009-11-151-11/+2
| | | | | | | | | | | | Now the ARM11 cores can use the renamed arm_checksum_memory() and arm_blank_check_memory() routines ... do so. Sanity checked with "flash erase_check" of both NOR banks on an OMAP2420 ... the algorithm code dumped four lines of of "poll" status after each of almost 520 blocks (yes, *very* annoying) but gave plausible results after producing that spam. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* ARM11: fixup method tableDavid Brownell2009-11-152-47/+43
| | | | | | | | | Three changes: remove ARM11_HANDLER() in favor of normal structure initialization syntax; fix goofy indentation in that structure; and don't needlessly export arm11_register_commands(), it's only called through that method table. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* ARM: memory utils aren't ARM7/ARM9 dependentDavid Brownell2009-11-1515-178/+209
| | | | | | | | | | | | | | | | 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>
* target: make "examined" flag be per-targetDavid Brownell2009-11-155-44/+53
| | | | | | | | | | | | | | | | | | 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>
* arm-jtag-ew,jlink: switch to COMMAND_HANDLERZachary T Welch2009-11-152-29/+23
| | | | | These drivers were overlooked during the recent upgrade. Convert them, moving their registration routines to eliminate their declarations.
* rlink: fix overzealous sedZachary T Welch2009-11-151-5/+5
| | | | Fix an instance where my cleanup when awry.
* remove unused arm_jtag_buf_to_* helpersZachary T Welch2009-11-142-106/+0
| | | | | | Removes unused arm_jtag_buf_* helpers from arm_jtag.[ch]. These could reappear if patches are provided to conver the tree to use them, but this code should not be in the master tree until that series is ready.
* remove unused buf_to_u32_handlerZachary T Welch2009-11-142-12/+0
| | | | | | Purge an unused routine from the tree and remove a layering violation. If this code is needed, it should reappear somwhere in src/jtag/, where struct scan_field gets defined.
* struct scan_field_s -> struct scan_fieldZachary T Welch2009-11-144-27/+27
| | | | | Remove obsolete suffix from struct scan_field. Somehow, these definitions did not get updated but did not cause any errors.