You can subscribe to this list here.
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(75) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2009 |
Jan
(70) |
Feb
(20) |
Mar
(52) |
Apr
(149) |
May
(387) |
Jun
(466) |
Jul
(133) |
Aug
(87) |
Sep
(122) |
Oct
(140) |
Nov
(185) |
Dec
(105) |
2010 |
Jan
(85) |
Feb
(45) |
Mar
(75) |
Apr
(17) |
May
(41) |
Jun
(52) |
Jul
(33) |
Aug
(29) |
Sep
(36) |
Oct
(15) |
Nov
(26) |
Dec
(34) |
2011 |
Jan
(26) |
Feb
(25) |
Mar
(26) |
Apr
(29) |
May
(20) |
Jun
(27) |
Jul
(15) |
Aug
(32) |
Sep
(13) |
Oct
(64) |
Nov
(60) |
Dec
(10) |
2012 |
Jan
(64) |
Feb
(63) |
Mar
(39) |
Apr
(43) |
May
(54) |
Jun
(11) |
Jul
(30) |
Aug
(45) |
Sep
(11) |
Oct
(70) |
Nov
(24) |
Dec
(23) |
2013 |
Jan
(17) |
Feb
(8) |
Mar
(35) |
Apr
(40) |
May
(20) |
Jun
(24) |
Jul
(36) |
Aug
(25) |
Sep
(42) |
Oct
(40) |
Nov
(9) |
Dec
(21) |
2014 |
Jan
(29) |
Feb
(24) |
Mar
(60) |
Apr
(22) |
May
(22) |
Jun
(46) |
Jul
(11) |
Aug
(23) |
Sep
(26) |
Oct
(10) |
Nov
(14) |
Dec
(2) |
2015 |
Jan
(28) |
Feb
(47) |
Mar
(33) |
Apr
(58) |
May
(5) |
Jun
(1) |
Jul
|
Aug
(8) |
Sep
(12) |
Oct
(25) |
Nov
(58) |
Dec
(21) |
2016 |
Jan
(12) |
Feb
(40) |
Mar
(2) |
Apr
(1) |
May
(67) |
Jun
(2) |
Jul
(5) |
Aug
(36) |
Sep
|
Oct
(24) |
Nov
(17) |
Dec
(50) |
2017 |
Jan
(14) |
Feb
(16) |
Mar
(2) |
Apr
(35) |
May
(14) |
Jun
(16) |
Jul
(3) |
Aug
(3) |
Sep
|
Oct
(19) |
Nov
|
Dec
(16) |
2018 |
Jan
(55) |
Feb
(11) |
Mar
(34) |
Apr
(14) |
May
(4) |
Jun
(20) |
Jul
(39) |
Aug
(16) |
Sep
(17) |
Oct
(16) |
Nov
(20) |
Dec
(30) |
2019 |
Jan
(29) |
Feb
(24) |
Mar
(37) |
Apr
(26) |
May
(19) |
Jun
(21) |
Jul
(2) |
Aug
(3) |
Sep
(9) |
Oct
(12) |
Nov
(12) |
Dec
(12) |
2020 |
Jan
(47) |
Feb
(36) |
Mar
(54) |
Apr
(44) |
May
(37) |
Jun
(19) |
Jul
(32) |
Aug
(13) |
Sep
(16) |
Oct
(24) |
Nov
(32) |
Dec
(11) |
2021 |
Jan
(14) |
Feb
(5) |
Mar
(40) |
Apr
(32) |
May
(42) |
Jun
(31) |
Jul
(29) |
Aug
(47) |
Sep
(38) |
Oct
(17) |
Nov
(74) |
Dec
(33) |
2022 |
Jan
(11) |
Feb
(15) |
Mar
(40) |
Apr
(21) |
May
(39) |
Jun
(44) |
Jul
(19) |
Aug
(46) |
Sep
(79) |
Oct
(35) |
Nov
(21) |
Dec
(15) |
2023 |
Jan
(56) |
Feb
(13) |
Mar
(43) |
Apr
(28) |
May
(60) |
Jun
(15) |
Jul
(29) |
Aug
(28) |
Sep
(32) |
Oct
(21) |
Nov
(42) |
Dec
(39) |
2024 |
Jan
(35) |
Feb
(17) |
Mar
(28) |
Apr
(7) |
May
(14) |
Jun
(35) |
Jul
(30) |
Aug
(35) |
Sep
(30) |
Oct
(28) |
Nov
(38) |
Dec
(18) |
2025 |
Jan
(21) |
Feb
(28) |
Mar
(36) |
Apr
(35) |
May
(34) |
Jun
(58) |
Jul
(9) |
Aug
(37) |
Sep
|
Oct
|
Nov
|
Dec
|
From: Øyvind H. <go...@us...> - 2010-04-28 08:45:24
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 49b7905cae66ee9e011c71aff758fafba823f87f (commit) from 56a21c9cb1e4785e2ca3aac16c7a6bb17874d9aa (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 49b7905cae66ee9e011c71aff758fafba823f87f Author: Ãyvind Harboe <oyv...@zy...> Date: Wed Apr 28 08:01:28 2010 +0200 nor: remove bogus output about padding sections padding of 0 bytes is actually no padding, do not output warning about padding in that case. Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/flash/nor/core.c b/src/flash/nor/core.c index 15e460a..b8dda96 100644 --- a/src/flash/nor/core.c +++ b/src/flash/nor/core.c @@ -611,7 +611,8 @@ int flash_write_unlock(struct target *target, struct image *image, run_size += image->sections[++section_last].size; run_size += pad_bytes; - LOG_INFO("Padding image section %d with %d bytes", section_last-1, pad_bytes); + if (pad_bytes > 0) + LOG_INFO("Padding image section %d with %d bytes", section_last-1, pad_bytes); } /* fit the run into bank constraints */ ----------------------------------------------------------------------- Summary of changes: src/flash/nor/core.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2010-04-26 07:09:54
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 56a21c9cb1e4785e2ca3aac16c7a6bb17874d9aa (commit) via e0285dbe73594b640d9db2473821413097cbafc4 (commit) from 4f1296d1510715b5504f39909dadae79698aa27a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 56a21c9cb1e4785e2ca3aac16c7a6bb17874d9aa Author: Marek Vasut <mar...@gm...> Date: Mon Apr 26 03:34:03 2010 +0200 Add Voipac PXA270 module support This patch adds support for the Voipac PXA270 module. Including NOR flash. Signed-off-by: Marek Vasut <mar...@gm...> diff --git a/tcl/board/voipac.cfg b/tcl/board/voipac.cfg new file mode 100644 index 0000000..c59277e --- /dev/null +++ b/tcl/board/voipac.cfg @@ -0,0 +1,12 @@ +# Config for Voipac PXA270/PXA270M module. + +set CHIPNAME voipac +source [find target/pxa270.cfg] + +# The board supports separate reset lines +# Override this in the interface config for parallel dongles +reset_config trst_and_srst separate + +# flash bank <driver> <base> <size> <chip_width> <bus_width> +flash bank $_CHIPNAME.flash0 cfi 0x00000000 0x2000000 2 2 $_TARGETNAME +flash bank $_CHIPNAME.flash1 cfi 0x02000000 0x2000000 2 2 $_TARGETNAME commit e0285dbe73594b640d9db2473821413097cbafc4 Author: Marek Vasut <mar...@gm...> Date: Mon Apr 26 03:08:00 2010 +0200 Add VPACLink interface definition This patch adds definition file for the Voipac VPACLink JTAG adaptor. The adaptor is combined JTAG/UART device. Signed-off-by: Marek Vasut <mar...@gm...> diff --git a/tcl/interface/vpaclink.cfg b/tcl/interface/vpaclink.cfg new file mode 100644 index 0000000..a4795d3 --- /dev/null +++ b/tcl/interface/vpaclink.cfg @@ -0,0 +1,10 @@ +# +# Voipac VPACLink +# +# http://voipac.com/27M-JTG-000 +# + +interface ft2232 +ft2232_device_desc "VPACLink A" +ft2232_layout oocdlink +ft2232_vid_pid 0x0403 0x6010 ----------------------------------------------------------------------- Summary of changes: tcl/board/voipac.cfg | 12 ++++++++++++ tcl/interface/vpaclink.cfg | 10 ++++++++++ 2 files changed, 22 insertions(+), 0 deletions(-) create mode 100644 tcl/board/voipac.cfg create mode 100644 tcl/interface/vpaclink.cfg hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2010-04-24 16:58:02
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 4f1296d1510715b5504f39909dadae79698aa27a (commit) from c6cd253ae105a9542f051d4af3fda7e9a1c7140b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 4f1296d1510715b5504f39909dadae79698aa27a Author: Mike Dunn <mik...@ne...> Date: Wed Apr 21 13:40:51 2010 -0400 xscale: add support for length arg to wp command This patch adds support for the length argument to the xscale implementation of the wp command. Per discussion with David, the length argument specifies the range of addresses over which a memory access should generate a debug exception. This patch utilizes the "mask" feature of the xscale debug hardware to implement the correct functionality of the length argument. Some limitations imposed by the hardware are: - The length must be a power of two, with a minumum of 4. - Two data breakpoint registers are available, allowing for two watchpoints. However, if the length of a watchpoint is greater than four, both registers are used (the second for a mask value), limiting the number of watchpoints to one. This patch also removes a useless call to xscale_get_reg(dbcon) in xscale_set_watchpoint() (value had already been read from the register cache, and the same previously read value is then modified and written back). I have been using and testing this patch for a couple days. Questions, corrections, criticisms of course gratefully received. diff --git a/src/target/xscale.c b/src/target/xscale.c index ddc73d2..ed0eef3 100644 --- a/src/target/xscale.c +++ b/src/target/xscale.c @@ -2266,7 +2266,7 @@ static int xscale_set_watchpoint(struct target *target, struct watchpoint *watchpoint) { struct xscale_common *xscale = target_to_xscale(target); - uint8_t enable = 0; + uint32_t enable = 0; struct reg *dbcon = &xscale->reg_cache->reg_list[XSCALE_DBCON]; uint32_t dbcon_value = buf_get_u32(dbcon->value, 0, 32); @@ -2276,8 +2276,6 @@ static int xscale_set_watchpoint(struct target *target, return ERROR_TARGET_NOT_HALTED; } - xscale_get_reg(dbcon); - switch (watchpoint->rw) { case WPT_READ: @@ -2293,6 +2291,24 @@ static int xscale_set_watchpoint(struct target *target, LOG_ERROR("BUG: watchpoint->rw neither read, write nor access"); } + /* For watchpoint across more than one word, both DBR registers must + be enlisted, with the second used as a mask. */ + if (watchpoint->length > 4) + { + if (xscale->dbr0_used || xscale->dbr1_used) + { + LOG_ERROR("BUG: sufficient hardware comparators unavailable"); + return ERROR_TARGET_RESOURCE_NOT_AVAILABLE; + } + + /* Write mask value to DBR1, based on the length argument. + * Address bits ignored by the comparator are those set in mask. */ + xscale_set_reg_u32(&xscale->reg_cache->reg_list[XSCALE_DBR1], + watchpoint->length - 1); + xscale->dbr1_used = 1; + enable |= 0x100; /* DBCON[M] */ + } + if (!xscale->dbr0_used) { xscale_set_reg_u32(&xscale->reg_cache->reg_list[XSCALE_DBR0], watchpoint->address); @@ -2312,7 +2328,7 @@ static int xscale_set_watchpoint(struct target *target, else { LOG_ERROR("BUG: no hardware comparator available"); - return ERROR_OK; + return ERROR_TARGET_RESOURCE_NOT_AVAILABLE; } return ERROR_OK; @@ -2328,13 +2344,30 @@ static int xscale_add_watchpoint(struct target *target, return ERROR_TARGET_RESOURCE_NOT_AVAILABLE; } - if ((watchpoint->length != 1) && (watchpoint->length != 2) && (watchpoint->length != 4)) + if (watchpoint->value) + LOG_WARNING("xscale does not support value, mask arguments; ignoring"); + + /* check that length is a power of two */ + for (uint32_t len = watchpoint->length; len != 1; len /= 2) { - return ERROR_TARGET_RESOURCE_NOT_AVAILABLE; + if (len % 2) + { + LOG_ERROR("xscale requires that watchpoint length is a power of two"); + return ERROR_COMMAND_ARGUMENT_INVALID; + } } - xscale->dbr_available--; + if (watchpoint->length == 4) /* single word watchpoint */ + { + xscale->dbr_available--; /* one DBR reg used */ + return ERROR_OK; + } + /* watchpoints across multiple words require both DBR registers */ + if (xscale->dbr_available < 2) + return ERROR_TARGET_RESOURCE_NOT_AVAILABLE; + + xscale->dbr_available = 0; return ERROR_OK; } @@ -2359,7 +2392,14 @@ static int xscale_unset_watchpoint(struct target *target, if (watchpoint->set == 1) { - dbcon_value &= ~0x3; + if (watchpoint->length > 4) + { + dbcon_value &= ~0x103; /* clear DBCON[M] as well */ + xscale->dbr1_used = 0; /* DBR1 was used for mask */ + } + else + dbcon_value &= ~0x3; + xscale_set_reg_u32(dbcon, dbcon_value); xscale->dbr0_used = 0; } @@ -2389,6 +2429,9 @@ static int xscale_remove_watchpoint(struct target *target, struct watchpoint *wa xscale_unset_watchpoint(target, watchpoint); } + if (watchpoint->length > 4) + xscale->dbr_available++; /* both DBR regs now available */ + xscale->dbr_available++; return ERROR_OK; ----------------------------------------------------------------------- Summary of changes: src/target/xscale.c | 59 ++++++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 51 insertions(+), 8 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2010-04-24 16:52:19
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via c6cd253ae105a9542f051d4af3fda7e9a1c7140b (commit) via 48e282aa00e8746a3e5e4234c915a4c5f9909063 (commit) from cc5f3c85de7632a32f41b435c54b83487a3aa622 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit c6cd253ae105a9542f051d4af3fda7e9a1c7140b Author: michal smulski <mic...@oo...> Date: Sat Apr 24 16:51:34 2010 +0200 telo: update configuration scripts to matched master branch Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/tcl/board/telo.cfg b/tcl/board/telo.cfg index a60cb02..1c0ad76 100644 --- a/tcl/board/telo.cfg +++ b/tcl/board/telo.cfg @@ -58,4 +58,4 @@ set _FLASHNAME $_CHIPNAME.flash flash bank $_FLASHNAME cfi 0x20000000 0x01000000 2 2 $_TARGETNAME # writing data to memory does not work without this -memwrite burst disable \ No newline at end of file +arm11 memwrite burst disable \ No newline at end of file diff --git a/tcl/target/c100config.tcl b/tcl/target/c100config.tcl index b08f909..17a9476 100644 --- a/tcl/target/c100config.tcl +++ b/tcl/target/c100config.tcl @@ -403,9 +403,9 @@ proc flashUBOOT {file} { flash erase_sector 0 0 3 puts "Programming u-boot" putsUART0 "Programming u-boot..." - memwrite burst enable + arm11 memwrite burst enable flash write_image $file $EXP_CS0_BASEADDR - memwrite burst disable + arm11 memwrite burst disable putsUART0 "done.\n" putsUART0 "Rebooting, please wait!\n" reboot diff --git a/tcl/target/c100helper.tcl b/tcl/target/c100helper.tcl index 1fd58b6..477fe5c 100644 --- a/tcl/target/c100helper.tcl +++ b/tcl/target/c100helper.tcl @@ -325,7 +325,7 @@ proc setupDDR2 {} { if {$tmp == "128M"} { configureDDR2regs_128M } elseif {$tmp == "256M"} { - configureDDR2regs_256B + configureDDR2regs_256M } else { puts "Don't know how to configure DDR2 setup?" } diff --git a/tcl/target/telo.cfg b/tcl/target/telo.cfg deleted file mode 100644 index aa9ff22..0000000 --- a/tcl/target/telo.cfg +++ /dev/null @@ -1,61 +0,0 @@ -source [find target/c100.cfg] -# basic register defintion for C100 -source [find target/c100regs.tcl] -# board-config info -source [find target/c100config.tcl] -# C100 helper functions -source [find target/c100helper.tcl] - - -# Telo board & C100 support trst and srst -# Note that libftd2xx.so tries to assert srst -# which break this script -# use libftdi.so library instead with this script -# make the reset asserted to -# allow RC circuit to discharge for: [ms] -adapter_nsrst_assert_width 100 -jtag_ntrst_assert_width 100 -# don't talk to JTAG after reset for: [ms] -adapter_nsrst_delay 100 -jtag_ntrst_delay 100 -reset_config trst_and_srst separate - - - - -# issue telnet: reset init -# issue gdb: monitor reset init -$_TARGETNAME configure -event reset-init { - adapter_khz 100 - # this will setup Telo board - setupTelo - #turn up the JTAG speed - adapter_khz 3000 - puts "JTAG speed now 3MHz" - puts "type helpC100 to get help on C100" -} - -$_TARGETNAME configure -event reset-deassert-post { - # Force target into ARM state. -# soft_reset_halt # not implemented on ARM11 - puts "Detected SRSRT asserted on C100.CPU" - -} - -$_TARGETNAME configure -event reset-assert-post { - puts "Assering reset" - #sleep 10 -} - -proc power_restore {} { puts "Sensed power restore. No action." } -proc srst_deasserted {} { puts "Sensed nSRST deasserted. No action." } - - -# boots from NOR on CS0: 8 MBytes CFI flash, 16-bit bus -# it's really 16MB but the upper 8mb is controller via gpio -# openocd does not support 'complex reads/writes' to NOR -set _FLASHNAME $_CHIPNAME.flash -flash bank $_FLASHNAME cfi 0x20000000 0x01000000 2 2 $_TARGETNAME - -# writing data to memory does not work without this -memwrite burst disable commit 48e282aa00e8746a3e5e4234c915a4c5f9909063 Author: michal smulski <mic...@oo...> Date: Sat Apr 24 16:50:27 2010 +0200 adapter: allow adjusting srst assert with Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/jtag/adapter.c b/src/jtag/adapter.c index b262a9a..50e2a02 100644 --- a/src/jtag/adapter.c +++ b/src/jtag/adapter.c @@ -366,6 +366,23 @@ COMMAND_HANDLER(handle_adapter_nsrst_delay_command) return ERROR_OK; } +COMMAND_HANDLER(handle_adapter_nsrst_assert_width_command) +{ + if (CMD_ARGC > 1) + return ERROR_COMMAND_SYNTAX_ERROR; + if (CMD_ARGC == 1) + { + unsigned width; + COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], width); + + jtag_set_nsrst_assert_width(width); + } + command_print(CMD_CTX, "adapter_nsrst_assert_width: %u", jtag_get_nsrst_assert_width()); + return ERROR_OK; +} + + + COMMAND_HANDLER(handle_adapter_khz_command) { if (CMD_ARGC > 1) @@ -421,6 +438,13 @@ static const struct command_registration interface_command_handlers[] = { .usage = "[milliseconds]", }, { + .name = "adapter_nsrst_assert_width", + .handler = handle_adapter_nsrst_assert_width_command, + .mode = COMMAND_ANY, + .help = "delay after asserting SRST in ms", + .usage = "[milliseconds]", + }, + { .name = "interface", .handler = handle_interface_command, .mode = COMMAND_CONFIG, ----------------------------------------------------------------------- Summary of changes: src/jtag/adapter.c | 24 +++++++++++++++++ tcl/board/telo.cfg | 2 +- tcl/target/c100config.tcl | 4 +- tcl/target/c100helper.tcl | 2 +- tcl/target/telo.cfg | 61 --------------------------------------------- 5 files changed, 28 insertions(+), 65 deletions(-) delete mode 100644 tcl/target/telo.cfg hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2010-04-20 22:18:48
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via cc5f3c85de7632a32f41b435c54b83487a3aa622 (commit) from e4056cca2d10da3a746ebfa01799165140640071 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit cc5f3c85de7632a32f41b435c54b83487a3aa622 Author: michal smulski <mic...@oo...> Date: Tue Apr 20 22:18:04 2010 +0200 docs: improve load_image docs add docs for missing args. Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/doc/openocd.texi b/doc/openocd.texi index 5273d5d..cfba79f 100644 --- a/doc/openocd.texi +++ b/doc/openocd.texi @@ -5671,10 +5671,20 @@ separately. @end deffn @anchor{load_image} -@deffn Command {load_image} filename address [@option{bin}|@option{ihex}|@option{elf}] -Load image from file @var{filename} to target memory at @var{address}. +@deffn Command {load_image} filename address [@option{bin}|@option{ihex}|@option{elf}] @option{min_addr} @option{max_length}] +Load image from file @var{filename} to target memory offset by @var{address} from its load address. The file format may optionally be specified -(@option{bin}, @option{ihex}, or @option{elf}) +(@option{bin}, @option{ihex}, or @option{elf}). +In addition the following arguments may be specifed: +@var{min_addr} - ignore data below @var{min_addr} (this is w.r.t. to the target's load address + @var{address}) +@var{max_length} - maximum number of bytes to load. +@example +proc load_image_bin @{fname foffset address length @} @{ + # Load data from fname filename at foffset offset to + # target at address. Load at most length bytes. + load_image $fname [expr $address - $foffset] bin $address $length +@} +@end example @end deffn @deffn Command {test_image} filename [address [@option{bin}|@option{ihex}|@option{elf}]] ----------------------------------------------------------------------- Summary of changes: doc/openocd.texi | 16 +++++++++++++--- 1 files changed, 13 insertions(+), 3 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2010-04-20 09:08:07
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via e4056cca2d10da3a746ebfa01799165140640071 (commit) from ddf7aabc6726956315f21394559ba1c543fcbf36 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit e4056cca2d10da3a746ebfa01799165140640071 Author: Ãyvind Harboe <oyv...@zy...> Date: Tue Apr 20 09:05:07 2010 +0200 doc: gdb-attach can fix gdb connect issues Flash probing must succeed for e.g. gdb load and automatic hardware/software breakpoints to work. Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/doc/openocd.texi b/doc/openocd.texi index bb8f3ab..5273d5d 100644 --- a/doc/openocd.texi +++ b/doc/openocd.texi @@ -3784,7 +3784,8 @@ proc my_attach_proc @{ @} @{ mychip.cpu configure -event gdb-attach my_attach_proc mychip.cpu configure -event gdb-attach @{ echo "Reset..." - reset halt + # To make flash probe and gdb load to flash work we need a reset init. + reset init @} @end example @@ -3804,7 +3805,11 @@ The following target events are defined: @* Currently not used (goal: when JTAG examine starts) @end ignore @item @b{gdb-attach} -@* When GDB connects +@* When GDB connects. This is before any communication with the target, so this +can be used to set up the target so it is possible to probe flash. Probing flash +is necessary during gdb connect if gdb load is to write the image to flash. Another +use of the flash memory map is for GDB to automatically hardware/software breakpoints +depending on whether the breakpoint is in RAM or read only memory. @item @b{gdb-detach} @* When GDB disconnects @item @b{gdb-end} ----------------------------------------------------------------------- Summary of changes: doc/openocd.texi | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2010-04-20 08:58:21
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via ddf7aabc6726956315f21394559ba1c543fcbf36 (commit) from 620310bcc64a0ba9103c4c05300fe9d25cc92b12 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit ddf7aabc6726956315f21394559ba1c543fcbf36 Author: Andreas Fritiofson <and...@gm...> Date: Sat Apr 17 01:03:39 2010 +0200 stm32x: allow flash probe on a running target If the flash has not yet been probed and GDB connects while the target is running, the flash probe triggered by GDB's memory map read will fail. In that case the returned memory map will be empty, causing a subsequent load from within GDB to fail. There's not much you can do from GDB to recover, other than a restart; a 'mon reset init' and manual 'mon flash probe' won't help since GDB has already made up its mind about the memory map. It seems there's no reason to require the target to be halted when probing the flash. Remove the check to let a valid memory map be provided to GDB even when connecting to a running target. Signed-off-by: Andreas Fritiofson <and...@gm...> diff --git a/src/flash/nor/stm32x.c b/src/flash/nor/stm32x.c index 845d589..818c474 100644 --- a/src/flash/nor/stm32x.c +++ b/src/flash/nor/stm32x.c @@ -676,12 +676,6 @@ static int stm32x_probe(struct flash_bank *bank) uint32_t device_id; int page_size; - if (bank->target->state != TARGET_HALTED) - { - LOG_ERROR("Target not halted"); - return ERROR_TARGET_NOT_HALTED; - } - stm32x_info->probed = 0; /* read stm32 device id register */ ----------------------------------------------------------------------- Summary of changes: src/flash/nor/stm32x.c | 6 ------ 1 files changed, 0 insertions(+), 6 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: David B. <dbr...@us...> - 2010-04-16 05:14:44
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 620310bcc64a0ba9103c4c05300fe9d25cc92b12 (commit) from b886049c74de147b1ce6f7f0173ecd71323c5c64 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 620310bcc64a0ba9103c4c05300fe9d25cc92b12 Author: David Brownell <dbr...@us...> Date: Thu Apr 15 19:48:55 2010 -0700 NOR/core bugfix: restore invariants The The patch labeled "CFI CORE: bug-fix protect single sector" was merged rged without some requested bugfixes. Most significantly it broke invariants in the code, invalidating descriptions and changing the calling convention for underlying drivers. (It (Also wasn't CFI-specific...) Fix that, and Include an update from Antonio Borneo for the degenerate "nothing to do" case, (although that's still in the wrong location. which is presumably why that is it was working in some cases but not all.) src/flash/nor/core.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) Signed-off-by: David Brownell <dbr...@us...> diff --git a/src/flash/nor/core.c b/src/flash/nor/core.c index 18012c6..15e460a 100644 --- a/src/flash/nor/core.c +++ b/src/flash/nor/core.c @@ -56,7 +56,10 @@ int flash_driver_protect(struct flash_bank *bank, int set, int first, int last) int retval; bool updated = false; - /* NOTE: "first == last" means protect just that sector */ + /* NOTE: "first == last" means (un?)protect just that sector. + code including Lower level ddrivers may rely on this "first <= last" + * invariant. + */ /* callers may not supply illegal parameters ... */ if (first < 0 || first > last || last >= bank->num_sectors) @@ -90,10 +93,10 @@ scan: * REVISIT we could handle discontiguous regions by issuing * more than one driver request. How much would that matter? */ - if (i == first) { + if (i == first && i != last) { updated = true; first++; - } else if (i == last) { + } else if (i == last && i != first) { updated = true; last--; } @@ -107,11 +110,19 @@ scan: goto scan; } - /* Single sector, already protected? Nothing to do! */ - if (first > last) + /* Single sector, already protected? Nothing to do! + * We may have trimmed our parameters into this degenerate case. + * + * FIXME repeating the "is_protected==set" test is a giveaway that + * this fast-exit belongs earlier, in the trim-it-down loop; mve. + * */ + if (first == last && bank->sectors[first].is_protected == set) return ERROR_OK; + /* Note that we don't pass illegal parameters to drivers; any + * trimming just turns one valid range into another one. + */ retval = bank->driver->protect(bank, set, first, last); if (retval != ERROR_OK) { ----------------------------------------------------------------------- Summary of changes: src/flash/nor/core.c | 21 ++++++++++++++++----- 1 files changed, 16 insertions(+), 5 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2010-04-15 19:22:12
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via b886049c74de147b1ce6f7f0173ecd71323c5c64 (commit) via c9e58238c3b1ae181a7d54bc5255ef98771493c2 (commit) from ee139164114460d5c4c1a720e28740a7dceca712 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit b886049c74de147b1ce6f7f0173ecd71323c5c64 Author: Antonio Borneo <bor...@gm...> Date: Wed Apr 14 16:51:16 2010 +0800 NOR/CFI: remove redundant code Arguments for "flash bank" command are already parsed and put in "bank" struct. Removed code to parse them again. Signed-off-by: Antonio Borneo <bor...@gm...> diff --git a/src/flash/nor/cfi.c b/src/flash/nor/cfi.c index 325dce9..a64d78f 100644 --- a/src/flash/nor/cfi.c +++ b/src/flash/nor/cfi.c @@ -598,12 +598,8 @@ FLASH_BANK_COMMAND_HANDLER(cfi_flash_bank_command) return ERROR_FLASH_BANK_INVALID; } - uint16_t chip_width, bus_width; - COMMAND_PARSE_NUMBER(u16, CMD_ARGV[3], chip_width); - COMMAND_PARSE_NUMBER(u16, CMD_ARGV[4], bus_width); - - if ((chip_width > CFI_MAX_CHIP_WIDTH) - || (bus_width > CFI_MAX_BUS_WIDTH)) + if ((bank->chip_width > CFI_MAX_CHIP_WIDTH) + || (bank->bus_width > CFI_MAX_BUS_WIDTH)) { LOG_ERROR("chip and bus width have to specified in bytes"); return ERROR_FLASH_BANK_INVALID; commit c9e58238c3b1ae181a7d54bc5255ef98771493c2 Author: Antonio Borneo <bor...@gm...> Date: Wed Apr 14 16:32:30 2010 +0800 NOR/CFI: fix order of arguments check Syntax of "flash bank" command requires: - chip_width as CMD_ARGV[3] - bus_width as CMD_ARGV[4] Actual code swaps the arguments. Bug has no run time impact since wrong variables are only used to check value and both are checked against same constraint. Signed-off-by: Antonio Borneo <bor...@gm...> diff --git a/src/flash/nor/cfi.c b/src/flash/nor/cfi.c index 4dad7b6..325dce9 100644 --- a/src/flash/nor/cfi.c +++ b/src/flash/nor/cfi.c @@ -599,8 +599,8 @@ FLASH_BANK_COMMAND_HANDLER(cfi_flash_bank_command) } uint16_t chip_width, bus_width; - COMMAND_PARSE_NUMBER(u16, CMD_ARGV[3], bus_width); - COMMAND_PARSE_NUMBER(u16, CMD_ARGV[4], chip_width); + COMMAND_PARSE_NUMBER(u16, CMD_ARGV[3], chip_width); + COMMAND_PARSE_NUMBER(u16, CMD_ARGV[4], bus_width); if ((chip_width > CFI_MAX_CHIP_WIDTH) || (bus_width > CFI_MAX_BUS_WIDTH)) ----------------------------------------------------------------------- Summary of changes: src/flash/nor/cfi.c | 8 ++------ 1 files changed, 2 insertions(+), 6 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2010-04-15 19:19:49
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via ee139164114460d5c4c1a720e28740a7dceca712 (commit) from d31bbc33fab65a27edfd142202b90011bd471406 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit ee139164114460d5c4c1a720e28740a7dceca712 Author: Mike Dunn <mik...@ne...> Date: Tue Apr 13 13:34:52 2010 -0400 xscale: fix analyze_trace for trace data collected in wrap mode This patch fixes the xscale_analyze_trace() function. This function was defective for a trace collected in 'fill' mode (hiccups with repeated instructions) and completely broken when buffer overflowed in 'wrap' mode. The reason for the latter case is that the checkpoint registers were interpreted incorrectly when two checkpoints are present in the trace (which will be true in 'wrap' mode once the buffer fills). In this case, checkpoint1 register will contain the older entry, and checkpoint0 the newer. The original code assumed the opposite. I eventually gave up trying to understand all the logic of the function, and rewrote it. I think it's much cleaner and understandable now. I have been using and testing this for a few weeks now. I'm confident it hasn't regressed in any way. Also added capability to handle (as best as possible) the case where an instruction can not be read from the loaded trace image; e.g., partial image. This was a 'TODO' comment in the original xscale_analyze_trace(). Outside of xcsale_analyze_trace(), these (related) changes were made: - Remove pc_ok and current_pc elements from struct xscale_trace. These elements and associated logic are useless clutter because the very first entry placed in the trace buffer is always an indirect jump to the address at which execution resumed. This type of trace entry includes the literal address in the trace buffer, so the initial address of the trace is immediately determined from the trace buffer contents and does not need to be recorded when trace is enabled. - Added num_checkpoints to struct xscale_trace_data, which is necessary in order to correctly interpret the checkpoint register contents. - In xscale_read_trace() - Fix potential array out-of-bounds condition. - Eliminate partial address entries when parsing trace (can occur in wrap mode). - Count and record number of checkpoints in trace. - Added small, inlined utility function xscale_display_instruction() to help make the code more concise and clear. TODO: - Save processor state (arm or thumb) in struct xscale_trace when trace is enabled so that trace can be analyzed correctly (currently assumes arm mode). - Add element to struct xscale_trace that records (when trace is enabled) whether vector table is relocated high (to 0xffff0000) or not, so that a branch to an exception vector is traced correctly (curently assumes vectors at 0x0). diff --git a/src/target/xscale.c b/src/target/xscale.c index 24c0794..ddc73d2 100644 --- a/src/target/xscale.c +++ b/src/target/xscale.c @@ -1277,12 +1277,6 @@ static int xscale_resume(struct target *target, int current, * clean the trace buffer if it is to be enabled (0x62) */ if (xscale->trace.buffer_enabled) { - /* if trace buffer is set to 'fill' mode, save starting pc */ - if (xscale->trace.buffer_fill > 0) - { - xscale->trace.pc_ok = 1; - xscale->trace.current_pc = buf_get_u32(armv4_5->pc->value, 0, 32); - } xscale_send_u32(target, 0x62); xscale_send_u32(target, 0x31); } @@ -2521,6 +2515,7 @@ static int xscale_read_trace(struct target *target) uint32_t trace_buffer[258]; int is_address[256]; int i, j; + unsigned int num_checkpoints = 0; if (target->state != TARGET_HALTED) { @@ -2537,23 +2532,27 @@ static int xscale_read_trace(struct target *target) /* parse buffer backwards to identify address entries */ for (i = 255; i >= 0; i--) { + /* also count number of checkpointed entries */ + if ((trace_buffer[i] & 0xe0) == 0xc0) + num_checkpoints++; + is_address[i] = 0; if (((trace_buffer[i] & 0xf0) == 0x90) || ((trace_buffer[i] & 0xf0) == 0xd0)) { - if (i >= 3) + if (i > 0) is_address[--i] = 1; - if (i >= 2) + if (i > 0) is_address[--i] = 1; - if (i >= 1) + if (i > 0) is_address[--i] = 1; - if (i >= 0) + if (i > 0) is_address[--i] = 1; } } - /* search first non-zero entry */ + /* search first non-zero entry that is not part of an address */ for (j = 0; (j < 256) && (trace_buffer[j] == 0) && (!is_address[j]); j++) ; @@ -2563,6 +2562,22 @@ static int xscale_read_trace(struct target *target) return ERROR_XSCALE_NO_TRACE_DATA; } + /* account for possible partial address at buffer start (wrap mode only) */ + if (is_address[0]) + { /* first entry is address; complete set of 4? */ + i = 1; + while (i < 4) + if (!is_address[i++]) + break; + if (i < 4) + j += i; /* partial address; can't use it */ + } + + /* if first valid entry is indirect branch, can't use that either (no address) */ + if (((trace_buffer[j] & 0xf0) == 0x90) || ((trace_buffer[j] & 0xf0) == 0xd0)) + j++; + + /* walk linked list to terminating entry */ for (trace_data_p = &xscale->trace.data; *trace_data_p; trace_data_p = &(*trace_data_p)->next) ; @@ -2574,6 +2589,7 @@ static int xscale_read_trace(struct target *target) buf_get_u32(armv4_5->pc->value, 0, 32); (*trace_data_p)->entries = malloc(sizeof(struct xscale_trace_entry) * (256 - j)); (*trace_data_p)->depth = 256 - j; + (*trace_data_p)->num_checkpoints = num_checkpoints; for (i = j; i < 256; i++) { @@ -2587,10 +2603,10 @@ static int xscale_read_trace(struct target *target) return ERROR_OK; } -static int xscale_read_instruction(struct target *target, - struct arm_instruction *instruction) +static int xscale_read_instruction(struct target *target, uint32_t pc, + struct arm_instruction *instruction) { - struct xscale_common *xscale = target_to_xscale(target); + struct xscale_common *const xscale = target_to_xscale(target); int i; int section = -1; size_t size_read; @@ -2603,8 +2619,8 @@ static int xscale_read_instruction(struct target *target, /* search for the section the current instruction belongs to */ for (i = 0; i < xscale->trace.image->num_sections; i++) { - if ((xscale->trace.image->sections[i].base_address <= xscale->trace.current_pc) && - (xscale->trace.image->sections[i].base_address + xscale->trace.image->sections[i].size > xscale->trace.current_pc)) + if ((xscale->trace.image->sections[i].base_address <= pc) && + (xscale->trace.image->sections[i].base_address + xscale->trace.image->sections[i].size > pc)) { section = i; break; @@ -2621,27 +2637,27 @@ static int xscale_read_instruction(struct target *target, { uint8_t buf[4]; if ((retval = image_read_section(xscale->trace.image, section, - xscale->trace.current_pc - xscale->trace.image->sections[section].base_address, + pc - xscale->trace.image->sections[section].base_address, 4, buf, &size_read)) != ERROR_OK) { LOG_ERROR("error while reading instruction: %i", retval); return ERROR_TRACE_INSTRUCTION_UNAVAILABLE; } opcode = target_buffer_get_u32(target, buf); - arm_evaluate_opcode(opcode, xscale->trace.current_pc, instruction); + arm_evaluate_opcode(opcode, pc, instruction); } else if (xscale->trace.core_state == ARM_STATE_THUMB) { uint8_t buf[2]; if ((retval = image_read_section(xscale->trace.image, section, - xscale->trace.current_pc - xscale->trace.image->sections[section].base_address, + pc - xscale->trace.image->sections[section].base_address, 2, buf, &size_read)) != ERROR_OK) { LOG_ERROR("error while reading instruction: %i", retval); return ERROR_TRACE_INSTRUCTION_UNAVAILABLE; } opcode = target_buffer_get_u16(target, buf); - thumb_evaluate_opcode(opcode, xscale->trace.current_pc, instruction); + thumb_evaluate_opcode(opcode, pc, instruction); } else { @@ -2652,207 +2668,234 @@ static int xscale_read_instruction(struct target *target, return ERROR_OK; } -static int xscale_branch_address(struct xscale_trace_data *trace_data, - int i, uint32_t *target) +/* Extract address encoded into trace data. + * Write result to address referenced by argument 'target', or 0 if incomplete. */ +static inline void xscale_branch_address(struct xscale_trace_data *trace_data, + int i, uint32_t *target) { /* if there are less than four entries prior to the indirect branch message * we can't extract the address */ if (i < 4) - { - return -1; - } - - *target = (trace_data->entries[i-1].data) | (trace_data->entries[i-2].data << 8) | - (trace_data->entries[i-3].data << 16) | (trace_data->entries[i-4].data << 24); + *target = 0; + else + *target = (trace_data->entries[i-1].data) | (trace_data->entries[i-2].data << 8) | + (trace_data->entries[i-3].data << 16) | (trace_data->entries[i-4].data << 24); +} - return 0; +static inline void xscale_display_instruction(struct target *target, uint32_t pc, + struct arm_instruction *instruction, + struct command_context *cmd_ctx) +{ + int retval = xscale_read_instruction(target, pc, instruction); + if (retval == ERROR_OK) + command_print(cmd_ctx, "%s", instruction->text); + else + command_print(cmd_ctx, "0x%8.8" PRIx32 "\t<not found in image>", pc); } static int xscale_analyze_trace(struct target *target, struct command_context *cmd_ctx) { - struct xscale_common *xscale = target_to_xscale(target); - int next_pc_ok = 0; - uint32_t next_pc = 0x0; - struct xscale_trace_data *trace_data = xscale->trace.data; - int retval; - - while (trace_data) - { - int i, chkpt; - int rollover; - int branch; - int exception; - xscale->trace.core_state = ARM_STATE_ARM; - - chkpt = 0; - rollover = 0; + struct xscale_common *xscale = target_to_xscale(target); + struct xscale_trace_data *trace_data = xscale->trace.data; + int i, retval; + uint32_t breakpoint_pc; + struct arm_instruction instruction; + uint32_t current_pc = 0; /* initialized when address determined */ + + if (!xscale->trace.image) + LOG_WARNING("No trace image loaded; use 'xscale trace_image'"); + + /* loop for each trace buffer that was loaded from target */ + while (trace_data) + { + int chkpt = 0; /* incremented as checkpointed entries found */ + int j; + + /* FIXME: set this to correct mode when trace buffer is first enabled */ + xscale->trace.core_state = ARM_STATE_ARM; + + /* loop for each entry in this trace buffer */ + for (i = 0; i < trace_data->depth; i++) + { + int exception = 0; + uint32_t chkpt_reg = 0x0; + uint32_t branch_target = 0; + int count; + + /* trace entry type is upper nybble of 'message byte' */ + int trace_msg_type = (trace_data->entries[i].data & 0xf0) >> 4; + + /* Target addresses of indirect branches are written into buffer + * before the message byte representing the branch. Skip past it */ + if (trace_data->entries[i].type == XSCALE_TRACE_ADDRESS) + continue; - for (i = 0; i < trace_data->depth; i++) - { - next_pc_ok = 0; - branch = 0; - exception = 0; + switch (trace_msg_type) + { + case 0: /* Exceptions */ + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + exception = (trace_data->entries[i].data & 0x70) >> 4; + + /* FIXME: vector table may be at ffff0000 */ + branch_target = (trace_data->entries[i].data & 0xf0) >> 2; + break; + + case 8: /* Direct Branch */ + break; + + case 9: /* Indirect Branch */ + xscale_branch_address(trace_data, i, &branch_target); + break; + + case 13: /* Checkpointed Indirect Branch */ + xscale_branch_address(trace_data, i, &branch_target); + if ((trace_data->num_checkpoints == 2) && (chkpt == 0)) + chkpt_reg = trace_data->chkpt1; /* 2 chkpts, this is oldest */ + else + chkpt_reg = trace_data->chkpt0; /* 1 chkpt, or 2 and newest */ + + chkpt++; + break; + + case 12: /* Checkpointed Direct Branch */ + if ((trace_data->num_checkpoints == 2) && (chkpt == 0)) + chkpt_reg = trace_data->chkpt1; /* 2 chkpts, this is oldest */ + else + chkpt_reg = trace_data->chkpt0; /* 1 chkpt, or 2 and newest */ + + /* if no current_pc, checkpoint will be starting point */ + if (current_pc == 0) + branch_target = chkpt_reg; + + chkpt++; + break; + + case 15: /* Roll-over */ + break; + + default: /* Reserved */ + LOG_WARNING("trace is suspect: invalid trace message byte"); + continue; + + } + + /* If we don't have the current_pc yet, but we did get the branch target + * (either from the trace buffer on indirect branch, or from a checkpoint reg), + * then we can start displaying instructions at the next iteration, with + * branch_target as the starting point. + */ + if (current_pc == 0) + { + current_pc = branch_target; /* remains 0 unless branch_target obtained */ + continue; + } + + /* We have current_pc. Read and display the instructions from the image. + * First, display count instructions (lower nybble of message byte). */ + count = trace_data->entries[i].data & 0x0f; + for (j = 0; j < count; j++) + { + xscale_display_instruction(target, current_pc, &instruction, cmd_ctx); + current_pc += xscale->trace.core_state == ARM_STATE_ARM ? 4 : 2; + } + + /* An additional instruction is implicitly added to count for + * rollover and some exceptions: undef, swi, prefetch abort. */ + if ((trace_msg_type == 15) || (exception > 0 && exception < 4)) + { + xscale_display_instruction(target, current_pc, &instruction, cmd_ctx); + current_pc += xscale->trace.core_state == ARM_STATE_ARM ? 4 : 2; + } + + if (trace_msg_type == 15) /* rollover */ + continue; - if (trace_data->entries[i].type == XSCALE_TRACE_ADDRESS) - continue; + if (exception) + { + command_print(cmd_ctx, "--- exception %i ---", exception); + continue; + } + + /* not exception or rollover; next instruction is a branch and is + * not included in the count */ + xscale_display_instruction(target, current_pc, &instruction, cmd_ctx); + + /* for direct branches, extract branch destination from instruction */ + if ((trace_msg_type == 8) || (trace_msg_type == 12)) + { + retval = xscale_read_instruction(target, current_pc, &instruction); + if (retval == ERROR_OK) + current_pc = instruction.info.b_bl_bx_blx.target_address; + else + current_pc = 0; /* branch destination unknown */ - switch ((trace_data->entries[i].data & 0xf0) >> 4) + /* direct branch w/ checkpoint; can also get from checkpoint reg */ + if (trace_msg_type == 12) { - case 0: /* Exceptions */ - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - exception = (trace_data->entries[i].data & 0x70) >> 4; - next_pc_ok = 1; - next_pc = (trace_data->entries[i].data & 0xf0) >> 2; - command_print(cmd_ctx, "--- exception %i ---", (trace_data->entries[i].data & 0xf0) >> 4); - break; - case 8: /* Direct Branch */ - branch = 1; - break; - case 9: /* Indirect Branch */ - branch = 1; - if (xscale_branch_address(trace_data, i, &next_pc) == 0) - { - next_pc_ok = 1; - } - break; - case 13: /* Checkpointed Indirect Branch */ - if (xscale_branch_address(trace_data, i, &next_pc) == 0) - { - next_pc_ok = 1; - if (((chkpt == 0) && (next_pc != trace_data->chkpt0)) - || ((chkpt == 1) && (next_pc != trace_data->chkpt1))) - LOG_WARNING("checkpointed indirect branch target address doesn't match checkpoint"); - } - /* explicit fall-through */ - case 12: /* Checkpointed Direct Branch */ - branch = 1; - if (chkpt == 0) - { - next_pc_ok = 1; - next_pc = trace_data->chkpt0; - chkpt++; - } - else if (chkpt == 1) - { - next_pc_ok = 1; - next_pc = trace_data->chkpt0; - chkpt++; - } - else - { - LOG_WARNING("more than two checkpointed branches encountered"); - } - break; - case 15: /* Roll-over */ - rollover++; - continue; - default: /* Reserved */ - command_print(cmd_ctx, "--- reserved trace message ---"); - LOG_ERROR("BUG: trace message %i is reserved", (trace_data->entries[i].data & 0xf0) >> 4); - return ERROR_OK; + if (current_pc == 0) + current_pc = chkpt_reg; + else if (current_pc != chkpt_reg) /* sanity check */ + LOG_WARNING("trace is suspect: checkpoint register " + "inconsistent with adddress from image"); } - if (xscale->trace.pc_ok) - { - int executed = (trace_data->entries[i].data & 0xf) + rollover * 16; - struct arm_instruction instruction; + if (current_pc == 0) + command_print(cmd_ctx, "address unknown"); - if ((exception == 6) || (exception == 7)) - { - /* IRQ or FIQ exception, no instruction executed */ - executed -= 1; - } + continue; + } - while (executed-- >= 0) - { - if ((retval = xscale_read_instruction(target, &instruction)) != ERROR_OK) - { - /* can't continue tracing with no image available */ - if (retval == ERROR_TRACE_IMAGE_UNAVAILABLE) - { - return retval; - } - else if (retval == ERROR_TRACE_INSTRUCTION_UNAVAILABLE) - { - /* TODO: handle incomplete images */ - } - } - - /* a precise abort on a load to the PC is included in the incremental - * word count, other instructions causing data aborts are not included - */ - if ((executed == 0) && (exception == 4) - && ((instruction.type >= ARM_LDR) && (instruction.type <= ARM_LDM))) - { - if ((instruction.type == ARM_LDM) - && ((instruction.info.load_store_multiple.register_list & 0x8000) == 0)) - { - executed--; - } - else if (((instruction.type >= ARM_LDR) && (instruction.type <= ARM_LDRSH)) - && (instruction.info.load_store.Rd != 15)) - { - executed--; - } - } - - /* only the last instruction executed - * (the one that caused the control flow change) - * could be a taken branch - */ - if (((executed == -1) && (branch == 1)) && - (((instruction.type == ARM_B) || - (instruction.type == ARM_BL) || - (instruction.type == ARM_BLX)) && - (instruction.info.b_bl_bx_blx.target_address != 0xffffffff))) - { - xscale->trace.current_pc = instruction.info.b_bl_bx_blx.target_address; - } - else - { - xscale->trace.current_pc += (xscale->trace.core_state == ARM_STATE_ARM) ? 4 : 2; - } - command_print(cmd_ctx, "%s", instruction.text); - } + /* indirect branch; the branch destination was read from trace buffer */ + if ((trace_msg_type == 9) || (trace_msg_type == 13)) + { + current_pc = branch_target; - rollover = 0; - } + /* sanity check (checkpoint reg is redundant) */ + if ((trace_msg_type == 13) && (chkpt_reg != branch_target)) + LOG_WARNING("trace is suspect: checkpoint register " + "inconsistent with address from trace buffer"); + } - if (next_pc_ok) - { - xscale->trace.current_pc = next_pc; - xscale->trace.pc_ok = 1; - } - } + } /* END: for (i = 0; i < trace_data->depth; i++) */ - for (; xscale->trace.current_pc < trace_data->last_instruction; xscale->trace.current_pc += (xscale->trace.core_state == ARM_STATE_ARM) ? 4 : 2) - { - struct arm_instruction instruction; - if ((retval = xscale_read_instruction(target, &instruction)) != ERROR_OK) - { - /* can't continue tracing with no image available */ - if (retval == ERROR_TRACE_IMAGE_UNAVAILABLE) - { - return retval; - } - else if (retval == ERROR_TRACE_INSTRUCTION_UNAVAILABLE) - { - /* TODO: handle incomplete images */ - } - } - command_print(cmd_ctx, "%s", instruction.text); - } + breakpoint_pc = trace_data->last_instruction; /* used below */ + trace_data = trace_data->next; - trace_data = trace_data->next; - } + } /* END: while (trace_data) */ - return ERROR_OK; + /* Finally... display all instructions up to the value of the pc when the + * debug break occurred (saved when trace data was collected from target). + * This is necessary because the trace only records execution branches and 16 + * consecutive instructions (rollovers), so last few typically missed. + */ + if (current_pc == 0) + return ERROR_OK; /* current_pc was never found */ + + /* how many instructions remaining? */ + int gap_count = (breakpoint_pc - current_pc) / + (xscale->trace.core_state == ARM_STATE_ARM ? 4 : 2); + + /* should never be negative or over 16, but verify */ + if (gap_count < 0 || gap_count > 16) + { + LOG_WARNING("trace is suspect: excessive gap at end of trace"); + return ERROR_OK; /* bail; large number or negative value no good */ + } + + /* display remaining instructions */ + for (i = 0; i < gap_count; i++) + { + xscale_display_instruction(target, current_pc, &instruction, cmd_ctx); + current_pc += xscale->trace.core_state == ARM_STATE_ARM ? 4 : 2; + } + + return ERROR_OK; } static const struct reg_arch_type xscale_reg_type = { @@ -3329,7 +3372,6 @@ COMMAND_HANDLER(xscale_handle_trace_buffer_command) { struct target *target = get_current_target(CMD_CTX); struct xscale_common *xscale = target_to_xscale(target); - struct arm *armv4_5 = &xscale->armv4_5_common; uint32_t dcsr_value; int retval; @@ -3378,20 +3420,6 @@ COMMAND_HANDLER(xscale_handle_trace_buffer_command) xscale->trace.buffer_fill = -1; } - if (xscale->trace.buffer_enabled) - { - /* if we enable the trace buffer in fill-once - * mode we know the address of the first instruction */ - xscale->trace.pc_ok = 1; - xscale->trace.current_pc = - buf_get_u32(armv4_5->pc->value, 0, 32); - } - else - { - /* otherwise the address is unknown, and we have no known good PC */ - xscale->trace.pc_ok = 0; - } - command_print(CMD_CTX, "trace buffer %s (%s)", (xscale->trace.buffer_enabled) ? "enabled" : "disabled", (xscale->trace.buffer_fill > 0) ? "fill" : "wrap"); diff --git a/src/target/xscale.h b/src/target/xscale.h index f20074f..82f4e37 100644 --- a/src/target/xscale.h +++ b/src/target/xscale.h @@ -67,6 +67,7 @@ struct xscale_trace_data uint32_t chkpt0; uint32_t chkpt1; uint32_t last_instruction; + unsigned int num_checkpoints; struct xscale_trace_data *next; }; @@ -77,8 +78,6 @@ struct xscale_trace struct xscale_trace_data *data; /* linked list of collected trace data */ int buffer_enabled; /* whether trace buffer is enabled */ int buffer_fill; /* maximum number of trace runs to read (-1 for wrap-around) */ - int pc_ok; - uint32_t current_pc; enum arm_state core_state; /* current core state (ARM, Thumb) */ }; ----------------------------------------------------------------------- Summary of changes: src/target/xscale.c | 456 +++++++++++++++++++++++++++------------------------ src/target/xscale.h | 3 +- 2 files changed, 243 insertions(+), 216 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2010-04-15 19:12:40
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via d31bbc33fab65a27edfd142202b90011bd471406 (commit) from decad308655edf61094d5d552ab93f9fb2a6d535 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit d31bbc33fab65a27edfd142202b90011bd471406 Author: Antonio Borneo <bor...@gm...> Date: Thu Apr 15 17:11:01 2010 +0800 TCL SCRIPTS: fix command name Some tcl script has underline between the words "flash bank" resulting in 'invalid command name "flash_bank"'. Signed-off-by: Antonio Borneo <bor...@gm...> diff --git a/tcl/board/at91rm9200-dk.cfg b/tcl/board/at91rm9200-dk.cfg index af6e3df..402ed05 100644 --- a/tcl/board/at91rm9200-dk.cfg +++ b/tcl/board/at91rm9200-dk.cfg @@ -10,7 +10,7 @@ $_TARGETNAME configure -event reset-init { at91rm9200_dk_init } #flash bank <name> <driver> <base> <size> <chip_width> <bus_width> <target> set _FLASHNAME $_CHIPNAME.flash -flash_bank $_FLASHNAME cfi 0x10000000 0x00200000 2 2 $_TARGETNAME +flash bank $_FLASHNAME cfi 0x10000000 0x00200000 2 2 $_TARGETNAME proc at91rm9200_dk_init { } { diff --git a/tcl/board/imx27ads.cfg b/tcl/board/imx27ads.cfg index 927647a..e705b1e 100644 --- a/tcl/board/imx27ads.cfg +++ b/tcl/board/imx27ads.cfg @@ -6,7 +6,7 @@ $_TARGETNAME configure -event reset-init { imx27ads_init } # The IMX27 ADS board has a NOR flash on CS0 set _FLASHNAME $_CHIPNAME.flash -flash_bank $_FLASHNAME cfi 0xc0000000 0x00200000 2 2 $_TARGETNAME +flash bank $_FLASHNAME cfi 0xc0000000 0x00200000 2 2 $_TARGETNAME proc imx27ads_init { } { # This setup puts RAM at 0xA0000000 diff --git a/tcl/board/logicpd_imx27.cfg b/tcl/board/logicpd_imx27.cfg index 02afc77..da0b462 100644 --- a/tcl/board/logicpd_imx27.cfg +++ b/tcl/board/logicpd_imx27.cfg @@ -3,7 +3,7 @@ source [find target/imx27.cfg] # The Logic PD board has a NOR flash on CS0 set _FLASHNAME $_CHIPNAME.flash -flash_bank $_FLASHNAME cfi 0xc0000000 0x00200000 2 2 $_TARGETNAME +flash bank $_FLASHNAME cfi 0xc0000000 0x00200000 2 2 $_TARGETNAME # # FIX ME, Add support to ----------------------------------------------------------------------- Summary of changes: tcl/board/at91rm9200-dk.cfg | 2 +- tcl/board/imx27ads.cfg | 2 +- tcl/board/logicpd_imx27.cfg | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2010-04-14 07:37:57
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via decad308655edf61094d5d552ab93f9fb2a6d535 (commit) from a8a9eddca0f8f5d8ab73f22c5a159fe1748272d5 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit decad308655edf61094d5d552ab93f9fb2a6d535 Author: Anton Fedotov <AD....@gm...> Date: Wed Apr 14 07:36:08 2010 +0200 cortex-a8: more MMU support + virt2phys() can now convert virtual address to real + read_memory() and write_memory() are renamed to read_phys_memory() and write_phys_memory() + new read_memory() and write_memory() try to resolve real address if mmu is enambled than perform real address reading/writing + if address is bellow 0xc000000 than TTB0 is used for page table dereference, if above - than TTB1. Linux style of user/kernel address separation + if above fails (i.e address is unspecified) than mode is checked whether it is Supervisor (than TTB1) or User (than TTB0) - Software breakpoints doesn't work. You should invoke "gdb_breakpoint_override hard" before you start debugging + cortex_a8_mmu(), cortex_a8_enable_mmu_caches(), cortex_a8_disable_mmu_caches() are implemented Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/target/cortex_a8.c b/src/target/cortex_a8.c index a548027..aa0e030 100644 --- a/src/target/cortex_a8.c +++ b/src/target/cortex_a8.c @@ -51,6 +51,16 @@ static int cortex_a8_dap_read_coreregister_u32(struct target *target, uint32_t *value, int regnum); static int cortex_a8_dap_write_coreregister_u32(struct target *target, uint32_t value, int regnum); +static int cortex_a8_mmu(struct target *target, int *enabled); +static int cortex_a8_virt2phys(struct target *target, + uint32_t virt, uint32_t *phys); +static void cortex_a8_disable_mmu_caches(struct target *target, int mmu, + int d_u_cache, int i_cache); +static void cortex_a8_enable_mmu_caches(struct target *target, int mmu, + int d_u_cache, int i_cache); +static uint32_t cortex_a8_get_ttb(struct target *target); + + /* * FIXME do topology discovery using the ROM; don't * assume this is an OMAP3. Also, allow for multiple ARMv7-A @@ -1269,111 +1279,158 @@ static int cortex_a8_deassert_reset(struct target *target) * ap number for every access. */ +static int cortex_a8_read_phys_memory(struct target *target, + uint32_t address, uint32_t size, + uint32_t count, uint8_t *buffer) +{ + struct armv7a_common *armv7a = target_to_armv7a(target); + struct adiv5_dap *swjdp = &armv7a->dap; + int retval = ERROR_INVALID_ARGUMENTS; + + /* cortex_a8 handles unaligned memory access */ + +// ??? dap_ap_select(swjdp, swjdp_memoryap); + LOG_DEBUG("Reading memory at real address 0x%x; size %d; count %d", address, size, count); + if (count && buffer) { + switch (size) { + case 4: + retval = mem_ap_read_buf_u32(swjdp, buffer, 4 * count, address); + break; + case 2: + retval = mem_ap_read_buf_u16(swjdp, buffer, 2 * count, address); + break; + case 1: + retval = mem_ap_read_buf_u8(swjdp, buffer, count, address); + break; + } + } + + return retval; +} + static int cortex_a8_read_memory(struct target *target, uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer) { - struct armv7a_common *armv7a = target_to_armv7a(target); - struct adiv5_dap *swjdp = &armv7a->dap; - int retval = ERROR_INVALID_ARGUMENTS; + int enabled = 0; + uint32_t virt, phys; /* cortex_a8 handles unaligned memory access */ // ??? dap_ap_select(swjdp, swjdp_memoryap); + LOG_DEBUG("Reading memory at address 0x%x; size %d; count %d", address, size, count); + cortex_a8_mmu(target, &enabled); + if(enabled) + { + virt = address; + cortex_a8_virt2phys(target, virt, &phys); + LOG_DEBUG("Reading at virtual address. Translating v:0x%x to r:0x%x", virt, phys); + address = phys; + } + + return cortex_a8_read_phys_memory(target, address, size, count, buffer); +} - if (count && buffer) { - switch (size) { - case 4: - retval = mem_ap_read_buf_u32(swjdp, buffer, 4 * count, address); - break; - case 2: - retval = mem_ap_read_buf_u16(swjdp, buffer, 2 * count, address); - break; - case 1: - retval = mem_ap_read_buf_u8(swjdp, buffer, count, address); - break; - } - } - - return retval; +static int cortex_a8_write_phys_memory(struct target *target, + uint32_t address, uint32_t size, + uint32_t count, uint8_t *buffer) +{ + struct armv7a_common *armv7a = target_to_armv7a(target); + struct adiv5_dap *swjdp = &armv7a->dap; + int retval = ERROR_INVALID_ARGUMENTS; + +// ??? dap_ap_select(swjdp, swjdp_memoryap); + + LOG_DEBUG("Writing memory to real address 0x%x; size %d; count %d", address, size, count); + if (count && buffer) { + switch (size) { + case 4: + retval = mem_ap_write_buf_u32(swjdp, buffer, 4 * count, address); + break; + case 2: + retval = mem_ap_write_buf_u16(swjdp, buffer, 2 * count, address); + break; + case 1: + retval = mem_ap_write_buf_u8(swjdp, buffer, count, address); + break; + } + } + + /* REVISIT this op is generic ARMv7-A/R stuff */ + if (retval == ERROR_OK && target->state == TARGET_HALTED) + { + struct arm_dpm *dpm = armv7a->armv4_5_common.dpm; + + retval = dpm->prepare(dpm); + if (retval != ERROR_OK) + return retval; + + /* The Cache handling will NOT work with MMU active, the + * wrong addresses will be invalidated! + * + * For both ICache and DCache, walk all cache lines in the + * address range. Cortex-A8 has fixed 64 byte line length. + * + * REVISIT per ARMv7, these may trigger watchpoints ... + */ + + /* invalidate I-Cache */ + if (armv7a->armv4_5_mmu.armv4_5_cache.i_cache_enabled) + { + /* ICIMVAU - Invalidate Cache single entry + * with MVA to PoU + * MCR p15, 0, r0, c7, c5, 1 + */ + for (uint32_t cacheline = address; + cacheline < address + size * count; + cacheline += 64) { + retval = dpm->instr_write_data_r0(dpm, + ARMV4_5_MCR(15, 0, 0, 7, 5, 1), + cacheline); + } + } + + /* invalidate D-Cache */ + if (armv7a->armv4_5_mmu.armv4_5_cache.d_u_cache_enabled) + { + /* DCIMVAC - Invalidate data Cache line + * with MVA to PoC + * MCR p15, 0, r0, c7, c6, 1 + */ + for (uint32_t cacheline = address; + cacheline < address + size * count; + cacheline += 64) { + retval = dpm->instr_write_data_r0(dpm, + ARMV4_5_MCR(15, 0, 0, 7, 6, 1), + cacheline); + } + } + + /* (void) */ dpm->finish(dpm); + } + + return retval; } static int cortex_a8_write_memory(struct target *target, uint32_t address, - uint32_t size, uint32_t count, uint8_t *buffer) + uint32_t size, uint32_t count, uint8_t *buffer) { - struct armv7a_common *armv7a = target_to_armv7a(target); - struct adiv5_dap *swjdp = &armv7a->dap; - int retval = ERROR_INVALID_ARGUMENTS; - -// ??? dap_ap_select(swjdp, swjdp_memoryap); - - if (count && buffer) { - switch (size) { - case 4: - retval = mem_ap_write_buf_u32(swjdp, buffer, 4 * count, address); - break; - case 2: - retval = mem_ap_write_buf_u16(swjdp, buffer, 2 * count, address); - break; - case 1: - retval = mem_ap_write_buf_u8(swjdp, buffer, count, address); - break; - } - } - - /* REVISIT this op is generic ARMv7-A/R stuff */ - if (retval == ERROR_OK && target->state == TARGET_HALTED) - { - struct arm_dpm *dpm = armv7a->armv4_5_common.dpm; - - retval = dpm->prepare(dpm); - if (retval != ERROR_OK) - return retval; - - /* The Cache handling will NOT work with MMU active, the - * wrong addresses will be invalidated! - * - * For both ICache and DCache, walk all cache lines in the - * address range. Cortex-A8 has fixed 64 byte line length. - * - * REVISIT per ARMv7, these may trigger watchpoints ... - */ - - /* invalidate I-Cache */ - if (armv7a->armv4_5_mmu.armv4_5_cache.i_cache_enabled) - { - /* ICIMVAU - Invalidate Cache single entry - * with MVA to PoU - * MCR p15, 0, r0, c7, c5, 1 - */ - for (uint32_t cacheline = address; - cacheline < address + size * count; - cacheline += 64) { - retval = dpm->instr_write_data_r0(dpm, - ARMV4_5_MCR(15, 0, 0, 7, 5, 1), - cacheline); - } - } - - /* invalidate D-Cache */ - if (armv7a->armv4_5_mmu.armv4_5_cache.d_u_cache_enabled) - { - /* DCIMVAC - Invalidate data Cache line - * with MVA to PoC - * MCR p15, 0, r0, c7, c6, 1 - */ - for (uint32_t cacheline = address; - cacheline < address + size * count; - cacheline += 64) { - retval = dpm->instr_write_data_r0(dpm, - ARMV4_5_MCR(15, 0, 0, 7, 6, 1), - cacheline); - } - } - - /* (void) */ dpm->finish(dpm); - } - - return retval; + int enabled = 0; + uint32_t virt, phys; + +// ??? dap_ap_select(swjdp, swjdp_memoryap); + + LOG_DEBUG("Writing memory to address 0x%x; size %d; count %d", address, size, count); + cortex_a8_mmu(target, &enabled); + if(enabled) + { + virt = address; + cortex_a8_virt2phys(target, virt, &phys); + LOG_DEBUG("Writing to virtual address. Translating v:0x%x to r:0x%x", virt, phys); + address = phys; + } + + return cortex_a8_write_phys_memory(target, address, size, + count, buffer); } static int cortex_a8_bulk_write_memory(struct target *target, uint32_t address, @@ -1580,6 +1637,9 @@ static int cortex_a8_init_arch_info(struct target *target, cortex_a8->fast_reg_read = 0; + /* Set default value */ + cortex_a8->current_address_mode = ARM_MODE_ANY; + /* register arch-specific functions */ armv7a->examine_debug_reason = NULL; @@ -1587,11 +1647,11 @@ static int cortex_a8_init_arch_info(struct target *target, armv7a->pre_restore_context = NULL; armv7a->armv4_5_mmu.armv4_5_cache.ctype = -1; -// armv7a->armv4_5_mmu.get_ttb = armv7a_get_ttb; - armv7a->armv4_5_mmu.read_memory = cortex_a8_read_memory; - armv7a->armv4_5_mmu.write_memory = cortex_a8_write_memory; -// armv7a->armv4_5_mmu.disable_mmu_caches = armv7a_disable_mmu_caches; -// armv7a->armv4_5_mmu.enable_mmu_caches = armv7a_enable_mmu_caches; + armv7a->armv4_5_mmu.get_ttb = cortex_a8_get_ttb; + armv7a->armv4_5_mmu.read_memory = cortex_a8_read_phys_memory; + armv7a->armv4_5_mmu.write_memory = cortex_a8_write_phys_memory; + armv7a->armv4_5_mmu.disable_mmu_caches = cortex_a8_disable_mmu_caches; + armv7a->armv4_5_mmu.enable_mmu_caches = cortex_a8_enable_mmu_caches; armv7a->armv4_5_mmu.has_tiny_pages = 1; armv7a->armv4_5_mmu.mmu_enabled = 0; @@ -1616,6 +1676,160 @@ static int cortex_a8_target_create(struct target *target, Jim_Interp *interp) return ERROR_OK; } +static uint32_t cortex_a8_get_ttb(struct target *target) +{ + struct cortex_a8_common *cortex_a8 = target_to_cortex_a8(target); + struct armv7a_common *armv7a = &cortex_a8->armv7a_common; + uint32_t ttb = 0, retval = ERROR_OK; + + /* current_address_mode is set inside cortex_a8_virt2phys() + where we can determine if address belongs to user or kernel */ + if(cortex_a8->current_address_mode == ARM_MODE_SVC) + { + /* MRC p15,0,<Rt>,c1,c0,0 ; Read CP15 System Control Register */ + retval = armv7a->armv4_5_common.mrc(target, 15, + 0, 1, /* op1, op2 */ + 2, 0, /* CRn, CRm */ + &ttb); + } + else if(cortex_a8->current_address_mode == ARM_MODE_USR) + { + /* MRC p15,0,<Rt>,c1,c0,0 ; Read CP15 System Control Register */ + retval = armv7a->armv4_5_common.mrc(target, 15, + 0, 0, /* op1, op2 */ + 2, 0, /* CRn, CRm */ + &ttb); + } + /* we don't know whose address is: user or kernel + we assume that if we are in kernel mode then + address belongs to kernel else if in user mode + - to user */ + else if(armv7a->armv4_5_common.core_mode == ARM_MODE_SVC) + { + /* MRC p15,0,<Rt>,c1,c0,0 ; Read CP15 System Control Register */ + retval = armv7a->armv4_5_common.mrc(target, 15, + 0, 1, /* op1, op2 */ + 2, 0, /* CRn, CRm */ + &ttb); + } + else if(armv7a->armv4_5_common.core_mode == ARM_MODE_USR) + { + /* MRC p15,0,<Rt>,c1,c0,0 ; Read CP15 System Control Register */ + retval = armv7a->armv4_5_common.mrc(target, 15, + 0, 0, /* op1, op2 */ + 2, 0, /* CRn, CRm */ + &ttb); + } + /* finaly we don't know whose ttb to use: user or kernel */ + else + LOG_ERROR("Don't know how to get ttb for current mode!!!"); + + ttb &= 0xffffc000; + + return ttb; +} + +static void cortex_a8_disable_mmu_caches(struct target *target, int mmu, + int d_u_cache, int i_cache) +{ + struct cortex_a8_common *cortex_a8 = target_to_cortex_a8(target); + struct armv7a_common *armv7a = &cortex_a8->armv7a_common; + uint32_t cp15_control; + + /* read cp15 control register */ + armv7a->armv4_5_common.mrc(target, 15, + 0, 0, /* op1, op2 */ + 1, 0, /* CRn, CRm */ + &cp15_control); + + + if (mmu) + cp15_control &= ~0x1U; + + if (d_u_cache) + cp15_control &= ~0x4U; + + if (i_cache) + cp15_control &= ~0x1000U; + + armv7a->armv4_5_common.mcr(target, 15, + 0, 0, /* op1, op2 */ + 1, 0, /* CRn, CRm */ + cp15_control); +} + +static void cortex_a8_enable_mmu_caches(struct target *target, int mmu, + int d_u_cache, int i_cache) +{ + struct cortex_a8_common *cortex_a8 = target_to_cortex_a8(target); + struct armv7a_common *armv7a = &cortex_a8->armv7a_common; + uint32_t cp15_control; + + /* read cp15 control register */ + armv7a->armv4_5_common.mrc(target, 15, + 0, 0, /* op1, op2 */ + 1, 0, /* CRn, CRm */ + &cp15_control); + + if (mmu) + cp15_control |= 0x1U; + + if (d_u_cache) + cp15_control |= 0x4U; + + if (i_cache) + cp15_control |= 0x1000U; + + armv7a->armv4_5_common.mcr(target, 15, + 0, 0, /* op1, op2 */ + 1, 0, /* CRn, CRm */ + cp15_control); +} + + +static int cortex_a8_mmu(struct target *target, int *enabled) +{ + if (target->state != TARGET_HALTED) { + LOG_ERROR("%s: target not halted", __func__); + return ERROR_TARGET_INVALID; + } + + *enabled = target_to_cortex_a8(target)->armv7a_common.armv4_5_mmu.mmu_enabled; + return ERROR_OK; +} + +static int cortex_a8_virt2phys(struct target *target, + uint32_t virt, uint32_t *phys) +{ + int type; + uint32_t cb; + int domain; + uint32_t ap; + struct cortex_a8_common *cortex_a8 = target_to_cortex_a8(target); + // struct armv7a_common *armv7a = &cortex_a8->armv7a_common; + struct armv7a_common *armv7a = target_to_armv7a(target); + + /* We assume that virtual address is separated + between user and kernel in Linux style: + 0x00000000-0xbfffffff - User space + 0xc0000000-0xffffffff - Kernel space */ + if( virt < 0xc0000000 ) /* Linux user space */ + cortex_a8->current_address_mode = ARM_MODE_USR; + else /* Linux kernel */ + cortex_a8->current_address_mode = ARM_MODE_SVC; + uint32_t ret = armv4_5_mmu_translate_va(target, + &armv7a->armv4_5_mmu, virt, &type, &cb, &domain, &ap); + /* Reset the flag. We don't want someone else to use it by error */ + cortex_a8->current_address_mode = ARM_MODE_ANY; + + if (type == -1) + { + return ret; + } + *phys = ret; + return ERROR_OK; +} + COMMAND_HANDLER(cortex_a8_handle_cache_info_command) { struct target *target = get_current_target(CMD_CTX); @@ -1703,4 +1917,10 @@ struct target_type cortexa8_target = { .target_create = cortex_a8_target_create, .init_target = cortex_a8_init_target, .examine = cortex_a8_examine, + + .read_phys_memory = cortex_a8_read_phys_memory, + .write_phys_memory = cortex_a8_write_phys_memory, + .mmu = cortex_a8_mmu, + .virt2phys = cortex_a8_virt2phys, + }; diff --git a/src/target/cortex_a8.h b/src/target/cortex_a8.h index cc2e009..7e116e4 100644 --- a/src/target/cortex_a8.h +++ b/src/target/cortex_a8.h @@ -72,6 +72,9 @@ struct cortex_a8_common /* Use cortex_a8_read_regs_through_mem for fast register reads */ int fast_reg_read; + /* Flag that helps to resolve what ttb to use: user or kernel */ + int current_address_mode; + struct armv7a_common armv7a_common; }; ----------------------------------------------------------------------- Summary of changes: src/target/cortex_a8.c | 416 ++++++++++++++++++++++++++++++++++++----------- src/target/cortex_a8.h | 3 + 2 files changed, 321 insertions(+), 98 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2010-04-12 16:59:36
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via a8a9eddca0f8f5d8ab73f22c5a159fe1748272d5 (commit) via 41cb9118536db5e5e2836ad6c75daae1d21b6f4a (commit) via f549dadb858cbf1bff1b3369dbdb2cc7d8f083a4 (commit) via 689fa8ad8c9bf40a98bd09303c80b67f72b7ac1f (commit) via da741a51f2dadc66db450a2f44c7c64c886e977a (commit) via f1be0e6af2e204805a8bc2e8cadf828b9fa46c98 (commit) via 2ea78551ab3388032ad78cdeefac7ab75e3bb134 (commit) via 4809dbb2d7aa3b949a555876aad945d3916a8c87 (commit) via 11fd673f0c315346ef065289b164da58dd1fd4c6 (commit) via b2495c010148b8343f8f70f6ee558f505a2c7409 (commit) via 787a5067fbe0eaf05ad2f41a64c3eac776905724 (commit) via fdb9199001080e2d268da77f97365ab7b7f138d2 (commit) via d7246f452f4da9767e9ebdd6fb43b982954c02bf (commit) via c936cb334b9e60c3326675912c97faafb379d3ed (commit) via 5926b5a94fd4e29e0e020c2f87b542fd51bd5d6f (commit) via a6307fed9100877df2def268acece81078e06d6f (commit) via 617811ac664504303cf65a69c1b3f8ca262def0b (commit) via aaf848596c13f26026bcbd1071f7614e818ea766 (commit) via 9acd453d9f1d7d9ef90343f84ffc43ce6e1b434d (commit) via 069f88cfac1199657a7e4c9988b0bc86eca99ac9 (commit) via 300f0f53c54fab5dd994a8bc42edbdc6115ef7b9 (commit) via 402d3292bbd6e04ffefb1bdf7ab61f3bfc36c44a (commit) via 61c06359915cbaef5b8538d2600ecbc17d4b387c (commit) via 0c82bea44acf491164c96efd88c1a831fbf6ce67 (commit) via c0b5ca6d17273aff849bc6546c7388562b751225 (commit) via b2468e3c4f09cd4e9f204aeb885dfdbbeb0a8dbb (commit) via 46781080347af4f207cec108dfc2f96da61dcbfa (commit) via ec1c90e3cd53446939b4655f55166bff6b3d39f4 (commit) via 8ffdefcc59ee0a8d305ac5a9f28b38ad89dea7c5 (commit) via de27d28df90ab3ed190b55ffa4d2a2cbf491732c (commit) via 8a871560f99779b279623540588f7295fe041781 (commit) via 4a1bd5b80603f73593fd7094d7da41ff72130461 (commit) via 0f3bbcf09683904c1f21b6961cbb0f36b07043c0 (commit) via 263b4b9057b4e34eec8b39c4f165d370cb51a9e3 (commit) via 3f0b17e48af9e3481084e1e9e697012b6824df43 (commit) via 321aa6aa8fe9f6c07649776722a341bbfda028ee (commit) via 81fab96c0d0da02e8debc07079d5f6fe699dff45 (commit) from 2a17fd9f9b51516a830ba4b3ae2f2284929ff266 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit a8a9eddca0f8f5d8ab73f22c5a159fe1748272d5 Author: Antonio Borneo <bor...@gm...> Date: Sun Apr 11 01:31:42 2010 +0800 TARGET/ARM7_9_COMMON: review scope of symbols Add "static" qualifier to private functions. Signed-off-by: Antonio Borneo <bor...@gm...> diff --git a/src/target/arm7_9_common.c b/src/target/arm7_9_common.c index 8f63f3c..9f1bb2e 100644 --- a/src/target/arm7_9_common.c +++ b/src/target/arm7_9_common.c @@ -184,7 +184,7 @@ static int arm7_9_set_software_breakpoints(struct arm7_9_common *arm7_9) * @param target Pointer to an ARM7/9 target to setup * @return Result of clearing the watchpoints on the target */ -int arm7_9_setup(struct target *target) +static int arm7_9_setup(struct target *target) { struct arm7_9_common *arm7_9 = target_to_arm7_9(target); @@ -202,7 +202,7 @@ int arm7_9_setup(struct target *target) * queue. For software breakpoints, this will be the status of the * required memory reads and writes */ -int arm7_9_set_breakpoint(struct target *target, struct breakpoint *breakpoint) +static int arm7_9_set_breakpoint(struct target *target, struct breakpoint *breakpoint) { struct arm7_9_common *arm7_9 = target_to_arm7_9(target); int retval = ERROR_OK; @@ -331,7 +331,7 @@ int arm7_9_set_breakpoint(struct target *target, struct breakpoint *breakpoint) * queue. For software breakpoints, this will be the status of the * required memory reads and writes */ -int arm7_9_unset_breakpoint(struct target *target, struct breakpoint *breakpoint) +static int arm7_9_unset_breakpoint(struct target *target, struct breakpoint *breakpoint) { int retval = ERROR_OK; struct arm7_9_common *arm7_9 = target_to_arm7_9(target); @@ -506,7 +506,7 @@ int arm7_9_remove_breakpoint(struct target *target, struct breakpoint *breakpoin * @return Error status if watchpoint set fails or the result of executing the * JTAG queue */ -int arm7_9_set_watchpoint(struct target *target, struct watchpoint *watchpoint) +static int arm7_9_set_watchpoint(struct target *target, struct watchpoint *watchpoint) { int retval = ERROR_OK; struct arm7_9_common *arm7_9 = target_to_arm7_9(target); @@ -577,7 +577,7 @@ int arm7_9_set_watchpoint(struct target *target, struct watchpoint *watchpoint) * @return Error status while trying to unset the watchpoint or the result of * executing the JTAG queue */ -int arm7_9_unset_watchpoint(struct target *target, struct watchpoint *watchpoint) +static int arm7_9_unset_watchpoint(struct target *target, struct watchpoint *watchpoint) { int retval = ERROR_OK; struct arm7_9_common *arm7_9 = target_to_arm7_9(target); @@ -729,7 +729,7 @@ int arm7_9_execute_sys_speed(struct target *target) * @param target Pointer to the target to issue commands to * @return Always ERROR_OK */ -int arm7_9_execute_fast_sys_speed(struct target *target) +static int arm7_9_execute_fast_sys_speed(struct target *target) { static int set = 0; static uint8_t check_value[4], check_mask[4]; @@ -804,7 +804,7 @@ int arm7_9_target_request_data(struct target *target, uint32_t size, uint8_t *bu * @return ERROR_OK unless there are issues with the JTAG queue or when reading * from the Embedded ICE unit */ -int arm7_9_handle_target_request(void *priv) +static int arm7_9_handle_target_request(void *priv) { int retval = ERROR_OK; struct target *target = priv; @@ -1095,7 +1095,7 @@ int arm7_9_deassert_reset(struct target *target) * @param target Pointer to the ARM7/9 target to have halt cleared * @return Always ERROR_OK */ -int arm7_9_clear_halt(struct target *target) +static int arm7_9_clear_halt(struct target *target) { struct arm7_9_common *arm7_9 = target_to_arm7_9(target); struct reg *dbg_ctrl = &arm7_9->eice_cache->reg_list[EICE_DBG_CTRL]; @@ -1483,7 +1483,7 @@ static int arm7_9_debug_entry(struct target *target) * @return Error if the target is not halted, has an invalid core mode, or if * the JTAG queue fails to execute */ -int arm7_9_full_context(struct target *target) +static int arm7_9_full_context(struct target *target) { int i; int retval; @@ -1579,7 +1579,7 @@ int arm7_9_full_context(struct target *target) * @return Error status if the target is not halted or the core mode in the * armv4_5 struct is invalid. */ -int arm7_9_restore_context(struct target *target) +static int arm7_9_restore_context(struct target *target) { struct arm7_9_common *arm7_9 = target_to_arm7_9(target); struct arm *armv4_5 = &arm7_9->armv4_5_common; @@ -1735,7 +1735,7 @@ int arm7_9_restore_context(struct target *target) * @param target Pointer to the ARM7/9 target to be restarted * @return Result of executing the JTAG queue */ -int arm7_9_restart_core(struct target *target) +static int arm7_9_restart_core(struct target *target) { struct arm7_9_common *arm7_9 = target_to_arm7_9(target); struct arm_jtag *jtag_info = &arm7_9->jtag_info; @@ -1757,7 +1757,7 @@ int arm7_9_restart_core(struct target *target) * * @param target Pointer to the ARM7/9 target to enable watchpoints on */ -void arm7_9_enable_watchpoints(struct target *target) +static void arm7_9_enable_watchpoints(struct target *target) { struct watchpoint *watchpoint = target->watchpoints; @@ -1775,7 +1775,7 @@ void arm7_9_enable_watchpoints(struct target *target) * * @param target Pointer to the ARM7/9 target to enable breakpoints on */ -void arm7_9_enable_breakpoints(struct target *target) +static void arm7_9_enable_breakpoints(struct target *target) { struct breakpoint *breakpoint = target->breakpoints; @@ -2828,7 +2828,7 @@ COMMAND_HANDLER(handle_arm7_9_dcc_downloads_command) return ERROR_OK; } -int arm7_9_setup_semihosting(struct target *target, int enable) +static int arm7_9_setup_semihosting(struct target *target, int enable) { struct arm7_9_common *arm7_9 = target_to_arm7_9(target); diff --git a/src/target/arm7_9_common.h b/src/target/arm7_9_common.h index 71f9a9d..a741c59 100644 --- a/src/target/arm7_9_common.h +++ b/src/target/arm7_9_common.h @@ -123,7 +123,6 @@ int arm7_9_poll(struct target *target); int arm7_9_target_request_data(struct target *target, uint32_t size, uint8_t *buffer); -int arm7_9_setup(struct target *target); int arm7_9_assert_reset(struct target *target); int arm7_9_deassert_reset(struct target *target); int arm7_9_reset_request_halt(struct target *target); @@ -132,8 +131,6 @@ int arm7_9_soft_reset_halt(struct target *target); int arm7_9_prepare_reset_halt(struct target *target); int arm7_9_halt(struct target *target); -int arm7_9_full_context(struct target *target); -int arm7_9_restore_context(struct target *target); int arm7_9_resume(struct target *target, int current, uint32_t address, int handle_breakpoints, int debug_execution); int arm7_9_step(struct target *target, int current, uint32_t address, int handle_breakpoints); int arm7_9_read_memory(struct target *target, uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer); commit 41cb9118536db5e5e2836ad6c75daae1d21b6f4a Author: Antonio Borneo <bor...@gm...> Date: Sun Apr 11 01:19:41 2010 +0800 NOR/TMS470: review scope of symbols Add "static" qualifier to private functions and data. Signed-off-by: Antonio Borneo <bor...@gm...> diff --git a/src/flash/nor/tms470.c b/src/flash/nor/tms470.c index af635d4..edb43af 100644 --- a/src/flash/nor/tms470.c +++ b/src/flash/nor/tms470.c @@ -29,7 +29,7 @@ Internal Support, Helpers ---------------------------------------------------------------------- */ -const struct flash_sector TMS470R1A256_SECTORS[] = { +static const struct flash_sector TMS470R1A256_SECTORS[] = { {0x00000000, 0x00002000, -1, -1}, {0x00002000, 0x00002000, -1, -1}, {0x00004000, 0x00002000, -1, -1}, @@ -49,7 +49,7 @@ const struct flash_sector TMS470R1A256_SECTORS[] = { #define TMS470R1A256_NUM_SECTORS \ ARRAY_SIZE(TMS470R1A256_SECTORS) -const struct flash_sector TMS470R1A288_BANK0_SECTORS[] = { +static const struct flash_sector TMS470R1A288_BANK0_SECTORS[] = { {0x00000000, 0x00002000, -1, -1}, {0x00002000, 0x00002000, -1, -1}, {0x00004000, 0x00002000, -1, -1}, @@ -59,7 +59,7 @@ const struct flash_sector TMS470R1A288_BANK0_SECTORS[] = { #define TMS470R1A288_BANK0_NUM_SECTORS \ ARRAY_SIZE(TMS470R1A288_BANK0_SECTORS) -const struct flash_sector TMS470R1A288_BANK1_SECTORS[] = { +static const struct flash_sector TMS470R1A288_BANK1_SECTORS[] = { {0x00040000, 0x00010000, -1, -1}, {0x00050000, 0x00010000, -1, -1}, {0x00060000, 0x00010000, -1, -1}, @@ -69,7 +69,7 @@ const struct flash_sector TMS470R1A288_BANK1_SECTORS[] = { #define TMS470R1A288_BANK1_NUM_SECTORS \ ARRAY_SIZE(TMS470R1A288_BANK1_SECTORS) -const struct flash_sector TMS470R1A384_BANK0_SECTORS[] = { +static const struct flash_sector TMS470R1A384_BANK0_SECTORS[] = { {0x00000000, 0x00002000, -1, -1}, {0x00002000, 0x00002000, -1, -1}, {0x00004000, 0x00004000, -1, -1}, @@ -85,7 +85,7 @@ const struct flash_sector TMS470R1A384_BANK0_SECTORS[] = { #define TMS470R1A384_BANK0_NUM_SECTORS \ ARRAY_SIZE(TMS470R1A384_BANK0_SECTORS) -const struct flash_sector TMS470R1A384_BANK1_SECTORS[] = { +static const struct flash_sector TMS470R1A384_BANK1_SECTORS[] = { {0x00020000, 0x00008000, -1, -1}, {0x00028000, 0x00008000, -1, -1}, {0x00030000, 0x00008000, -1, -1}, @@ -95,7 +95,7 @@ const struct flash_sector TMS470R1A384_BANK1_SECTORS[] = { #define TMS470R1A384_BANK1_NUM_SECTORS \ ARRAY_SIZE(TMS470R1A384_BANK1_SECTORS) -const struct flash_sector TMS470R1A384_BANK2_SECTORS[] = { +static const struct flash_sector TMS470R1A384_BANK2_SECTORS[] = { {0x00040000, 0x00008000, -1, -1}, {0x00048000, 0x00008000, -1, -1}, {0x00050000, 0x00008000, -1, -1}, @@ -667,7 +667,7 @@ static int tms470_flash_initialize_internal_state_machine(struct flash_bank *ban /* ---------------------------------------------------------------------- */ -int tms470_flash_status(struct flash_bank *bank) +static int tms470_flash_status(struct flash_bank *bank) { struct target *target = bank->target; int result = ERROR_OK; commit f549dadb858cbf1bff1b3369dbdb2cc7d8f083a4 Author: Antonio Borneo <bor...@gm...> Date: Sun Apr 11 01:16:14 2010 +0800 TARGET/MIPS32: review scope of functions Add "static" qualifier to private functions. Signed-off-by: Antonio Borneo <bor...@gm...> diff --git a/src/target/mips32.c b/src/target/mips32.c index b0cb79c..de8253f 100644 --- a/src/target/mips32.c +++ b/src/target/mips32.c @@ -31,7 +31,7 @@ #include "algorithm.h" #include "register.h" -char* mips32_core_reg_list[] = +static char* mips32_core_reg_list[] = { "zero", "at", "v0", "v1", "a0", "a1", "a2", "a3", "t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7", @@ -40,12 +40,12 @@ char* mips32_core_reg_list[] = "status", "lo", "hi", "badvaddr", "cause", "pc" }; -const char *mips_isa_strings[] = +static const char *mips_isa_strings[] = { "MIPS32", "MIPS16e" }; -struct mips32_core_reg mips32_core_reg_list_arch_info[MIPS32NUMCOREREGS] = +static struct mips32_core_reg mips32_core_reg_list_arch_info[MIPS32NUMCOREREGS] = { {0, NULL, NULL}, {1, NULL, NULL}, @@ -93,9 +93,9 @@ struct mips32_core_reg mips32_core_reg_list_arch_info[MIPS32NUMCOREREGS] = #define MIPS32NUMFPREGS 34 + 18 -uint8_t mips32_gdb_dummy_fp_value[] = {0, 0, 0, 0}; +static uint8_t mips32_gdb_dummy_fp_value[] = {0, 0, 0, 0}; -struct reg mips32_gdb_dummy_fp_reg = +static struct reg mips32_gdb_dummy_fp_reg = { .name = "GDB dummy floating-point register", .value = mips32_gdb_dummy_fp_value, @@ -105,7 +105,7 @@ struct reg mips32_gdb_dummy_fp_reg = .arch_info = NULL, }; -int mips32_get_core_reg(struct reg *reg) +static int mips32_get_core_reg(struct reg *reg) { int retval; struct mips32_core_reg *mips32_reg = reg->arch_info; @@ -122,7 +122,7 @@ int mips32_get_core_reg(struct reg *reg) return retval; } -int mips32_set_core_reg(struct reg *reg, uint8_t *buf) +static int mips32_set_core_reg(struct reg *reg, uint8_t *buf) { struct mips32_core_reg *mips32_reg = reg->arch_info; struct target *target = mips32_reg->target; @@ -140,7 +140,7 @@ int mips32_set_core_reg(struct reg *reg, uint8_t *buf) return ERROR_OK; } -int mips32_read_core_reg(struct target *target, int num) +static int mips32_read_core_reg(struct target *target, int num) { uint32_t reg_value; struct mips32_core_reg *mips_core_reg; @@ -160,7 +160,7 @@ int mips32_read_core_reg(struct target *target, int num) return ERROR_OK; } -int mips32_write_core_reg(struct target *target, int num) +static int mips32_write_core_reg(struct target *target, int num) { uint32_t reg_value; struct mips32_core_reg *mips_core_reg; diff --git a/src/target/mips32.h b/src/target/mips32.h index 94d29ff..7ffe95f 100644 --- a/src/target/mips32.h +++ b/src/target/mips32.h @@ -41,8 +41,6 @@ enum mips32_isa_mode MIPS32_ISA_MIPS16E = 1, }; -extern const char *mips_isa_strings[]; - struct mips32_comparator { int used; commit 689fa8ad8c9bf40a98bd09303c80b67f72b7ac1f Author: Antonio Borneo <bor...@gm...> Date: Sun Apr 11 01:11:11 2010 +0800 TARGET/MIPS32_PRACC: review scope of functions Add "static" qualifier to private functions. Signed-off-by: Antonio Borneo <bor...@gm...> diff --git a/src/target/mips32_pracc.c b/src/target/mips32_pracc.c index 19ba886..d96867a 100644 --- a/src/target/mips32_pracc.c +++ b/src/target/mips32_pracc.c @@ -90,6 +90,24 @@ struct mips32_pracc_context struct mips_ejtag *ejtag_info; }; +static int mips32_pracc_read_mem8(struct mips_ejtag *ejtag_info, + uint32_t addr, int count, uint8_t *buf); +static int mips32_pracc_read_mem16(struct mips_ejtag *ejtag_info, + uint32_t addr, int count, uint16_t *buf); +static int mips32_pracc_read_mem32(struct mips_ejtag *ejtag_info, + uint32_t addr, int count, uint32_t *buf); +static int mips32_pracc_read_u32(struct mips_ejtag *ejtag_info, + uint32_t addr, uint32_t *buf); + +static int mips32_pracc_write_mem8(struct mips_ejtag *ejtag_info, + uint32_t addr, int count, uint8_t *buf); +static int mips32_pracc_write_mem16(struct mips_ejtag *ejtag_info, + uint32_t addr, int count, uint16_t *buf); +static int mips32_pracc_write_mem32(struct mips_ejtag *ejtag_info, + uint32_t addr, int count, uint32_t *buf); +static int mips32_pracc_write_u32(struct mips_ejtag *ejtag_info, + uint32_t addr, uint32_t *buf); + static int wait_for_pracc_rw(struct mips_ejtag *ejtag_info, uint32_t *ctrl) { uint32_t ejtag_ctrl; @@ -284,7 +302,7 @@ int mips32_pracc_read_mem(struct mips_ejtag *ejtag_info, uint32_t addr, int size return ERROR_OK; } -int mips32_pracc_read_mem32(struct mips_ejtag *ejtag_info, uint32_t addr, int count, uint32_t *buf) +static int mips32_pracc_read_mem32(struct mips_ejtag *ejtag_info, uint32_t addr, int count, uint32_t *buf) { static const uint32_t code[] = { /* start: */ @@ -354,7 +372,7 @@ int mips32_pracc_read_mem32(struct mips_ejtag *ejtag_info, uint32_t addr, int co return retval; } -int mips32_pracc_read_u32(struct mips_ejtag *ejtag_info, uint32_t addr, uint32_t *buf) +static int mips32_pracc_read_u32(struct mips_ejtag *ejtag_info, uint32_t addr, uint32_t *buf) { static const uint32_t code[] = { /* start: */ @@ -387,7 +405,7 @@ int mips32_pracc_read_u32(struct mips_ejtag *ejtag_info, uint32_t addr, uint32_t return retval; } -int mips32_pracc_read_mem16(struct mips_ejtag *ejtag_info, uint32_t addr, int count, uint16_t *buf) +static int mips32_pracc_read_mem16(struct mips_ejtag *ejtag_info, uint32_t addr, int count, uint16_t *buf) { static const uint32_t code[] = { /* start: */ @@ -464,7 +482,7 @@ int mips32_pracc_read_mem16(struct mips_ejtag *ejtag_info, uint32_t addr, int co return ERROR_OK; } -int mips32_pracc_read_mem8(struct mips_ejtag *ejtag_info, uint32_t addr, int count, uint8_t *buf) +static int mips32_pracc_read_mem8(struct mips_ejtag *ejtag_info, uint32_t addr, int count, uint8_t *buf) { static const uint32_t code[] = { /* start: */ @@ -559,7 +577,7 @@ int mips32_pracc_write_mem(struct mips_ejtag *ejtag_info, uint32_t addr, int siz return ERROR_OK; } -int mips32_pracc_write_mem32(struct mips_ejtag *ejtag_info, uint32_t addr, int count, uint32_t *buf) +static int mips32_pracc_write_mem32(struct mips_ejtag *ejtag_info, uint32_t addr, int count, uint32_t *buf) { static const uint32_t code[] = { /* start: */ @@ -608,7 +626,7 @@ int mips32_pracc_write_mem32(struct mips_ejtag *ejtag_info, uint32_t addr, int c return ERROR_OK; } -int mips32_pracc_write_u32(struct mips_ejtag *ejtag_info, uint32_t addr, uint32_t *buf) +static int mips32_pracc_write_u32(struct mips_ejtag *ejtag_info, uint32_t addr, uint32_t *buf) { static const uint32_t code[] = { /* start: */ @@ -640,7 +658,7 @@ int mips32_pracc_write_u32(struct mips_ejtag *ejtag_info, uint32_t addr, uint32_ return ERROR_OK; } -int mips32_pracc_write_mem16(struct mips_ejtag *ejtag_info, uint32_t addr, int count, uint16_t *buf) +static int mips32_pracc_write_mem16(struct mips_ejtag *ejtag_info, uint32_t addr, int count, uint16_t *buf) { static const uint32_t code[] = { /* start: */ @@ -698,7 +716,7 @@ int mips32_pracc_write_mem16(struct mips_ejtag *ejtag_info, uint32_t addr, int c return ERROR_OK; } -int mips32_pracc_write_mem8(struct mips_ejtag *ejtag_info, uint32_t addr, int count, uint8_t *buf) +static int mips32_pracc_write_mem8(struct mips_ejtag *ejtag_info, uint32_t addr, int count, uint8_t *buf) { static const uint32_t code[] = { /* start: */ diff --git a/src/target/mips32_pracc.h b/src/target/mips32_pracc.h index f8b00d0..f2c2680 100644 --- a/src/target/mips32_pracc.h +++ b/src/target/mips32_pracc.h @@ -47,24 +47,6 @@ int mips32_pracc_write_mem(struct mips_ejtag *ejtag_info, int mips32_pracc_fastdata_xfer(struct mips_ejtag *ejtag_info, struct working_area *source, int write, uint32_t addr, int count, uint32_t *buf); -int mips32_pracc_read_mem8(struct mips_ejtag *ejtag_info, - uint32_t addr, int count, uint8_t *buf); -int mips32_pracc_read_mem16(struct mips_ejtag *ejtag_info, - uint32_t addr, int count, uint16_t *buf); -int mips32_pracc_read_mem32(struct mips_ejtag *ejtag_info, - uint32_t addr, int count, uint32_t *buf); -int mips32_pracc_read_u32(struct mips_ejtag *ejtag_info, - uint32_t addr, uint32_t *buf); - -int mips32_pracc_write_mem8(struct mips_ejtag *ejtag_info, - uint32_t addr, int count, uint8_t *buf); -int mips32_pracc_write_mem16(struct mips_ejtag *ejtag_info, - uint32_t addr, int count, uint16_t *buf); -int mips32_pracc_write_mem32(struct mips_ejtag *ejtag_info, - uint32_t addr, int count, uint32_t *buf); -int mips32_pracc_write_u32(struct mips_ejtag *ejtag_info, - uint32_t addr, uint32_t *buf); - int mips32_pracc_read_regs(struct mips_ejtag *ejtag_info, uint32_t *regs); int mips32_pracc_write_regs(struct mips_ejtag *ejtag_info, uint32_t *regs); commit da741a51f2dadc66db450a2f44c7c64c886e977a Author: Antonio Borneo <bor...@gm...> Date: Sun Apr 11 01:03:53 2010 +0800 TARGET/MIPS32_DMAACC: review scope of functions Add "static" qualifier to private functions. Signed-off-by: Antonio Borneo <bor...@gm...> diff --git a/src/target/mips32_dmaacc.c b/src/target/mips32_dmaacc.c index 7d3c2da..d756928 100644 --- a/src/target/mips32_dmaacc.c +++ b/src/target/mips32_dmaacc.c @@ -28,6 +28,19 @@ #include "mips32_dmaacc.h" +static int mips32_dmaacc_read_mem8(struct mips_ejtag *ejtag_info, + uint32_t addr, int count, uint8_t *buf); +static int mips32_dmaacc_read_mem16(struct mips_ejtag *ejtag_info, + uint32_t addr, int count, uint16_t *buf); +static int mips32_dmaacc_read_mem32(struct mips_ejtag *ejtag_info, + uint32_t addr, int count, uint32_t *buf); + +static int mips32_dmaacc_write_mem8(struct mips_ejtag *ejtag_info, + uint32_t addr, int count, uint8_t *buf); +static int mips32_dmaacc_write_mem16(struct mips_ejtag *ejtag_info, + uint32_t addr, int count, uint16_t *buf); +static int mips32_dmaacc_write_mem32(struct mips_ejtag *ejtag_info, + uint32_t addr, int count, uint32_t *buf); /* * The following logic shamelessly cloned from HairyDairyMaid's wrt54g_debrick @@ -364,7 +377,7 @@ int mips32_dmaacc_read_mem(struct mips_ejtag *ejtag_info, uint32_t addr, int siz return ERROR_OK; } -int mips32_dmaacc_read_mem32(struct mips_ejtag *ejtag_info, uint32_t addr, int count, uint32_t *buf) +static int mips32_dmaacc_read_mem32(struct mips_ejtag *ejtag_info, uint32_t addr, int count, uint32_t *buf) { int i; int retval; @@ -377,7 +390,7 @@ int mips32_dmaacc_read_mem32(struct mips_ejtag *ejtag_info, uint32_t addr, int c return ERROR_OK; } -int mips32_dmaacc_read_mem16(struct mips_ejtag *ejtag_info, uint32_t addr, int count, uint16_t *buf) +static int mips32_dmaacc_read_mem16(struct mips_ejtag *ejtag_info, uint32_t addr, int count, uint16_t *buf) { int i; int retval; @@ -390,7 +403,7 @@ int mips32_dmaacc_read_mem16(struct mips_ejtag *ejtag_info, uint32_t addr, int c return ERROR_OK; } -int mips32_dmaacc_read_mem8(struct mips_ejtag *ejtag_info, uint32_t addr, int count, uint8_t *buf) +static int mips32_dmaacc_read_mem8(struct mips_ejtag *ejtag_info, uint32_t addr, int count, uint8_t *buf) { int i; int retval; @@ -418,7 +431,7 @@ int mips32_dmaacc_write_mem(struct mips_ejtag *ejtag_info, uint32_t addr, int si return ERROR_OK; } -int mips32_dmaacc_write_mem32(struct mips_ejtag *ejtag_info, uint32_t addr, int count, uint32_t *buf) +static int mips32_dmaacc_write_mem32(struct mips_ejtag *ejtag_info, uint32_t addr, int count, uint32_t *buf) { int i; int retval; @@ -431,7 +444,7 @@ int mips32_dmaacc_write_mem32(struct mips_ejtag *ejtag_info, uint32_t addr, int return ERROR_OK; } -int mips32_dmaacc_write_mem16(struct mips_ejtag *ejtag_info, uint32_t addr, int count, uint16_t *buf) +static int mips32_dmaacc_write_mem16(struct mips_ejtag *ejtag_info, uint32_t addr, int count, uint16_t *buf) { int i; int retval; @@ -444,7 +457,7 @@ int mips32_dmaacc_write_mem16(struct mips_ejtag *ejtag_info, uint32_t addr, int return ERROR_OK; } -int mips32_dmaacc_write_mem8(struct mips_ejtag *ejtag_info, uint32_t addr, int count, uint8_t *buf) +static int mips32_dmaacc_write_mem8(struct mips_ejtag *ejtag_info, uint32_t addr, int count, uint8_t *buf) { int i; int retval; diff --git a/src/target/mips32_dmaacc.h b/src/target/mips32_dmaacc.h index c1aa07d..fdf8cae 100644 --- a/src/target/mips32_dmaacc.h +++ b/src/target/mips32_dmaacc.h @@ -39,18 +39,4 @@ int mips32_dmaacc_read_mem(struct mips_ejtag *ejtag_info, int mips32_dmaacc_write_mem(struct mips_ejtag *ejtag_info, uint32_t addr, int size, int count, void *buf); -int mips32_dmaacc_read_mem8(struct mips_ejtag *ejtag_info, - uint32_t addr, int count, uint8_t *buf); -int mips32_dmaacc_read_mem16(struct mips_ejtag *ejtag_info, - uint32_t addr, int count, uint16_t *buf); -int mips32_dmaacc_read_mem32(struct mips_ejtag *ejtag_info, - uint32_t addr, int count, uint32_t *buf); - -int mips32_dmaacc_write_mem8(struct mips_ejtag *ejtag_info, - uint32_t addr, int count, uint8_t *buf); -int mips32_dmaacc_write_mem16(struct mips_ejtag *ejtag_info, - uint32_t addr, int count, uint16_t *buf); -int mips32_dmaacc_write_mem32(struct mips_ejtag *ejtag_info, - uint32_t addr, int count, uint32_t *buf); - #endif commit f1be0e6af2e204805a8bc2e8cadf828b9fa46c98 Author: Antonio Borneo <bor...@gm...> Date: Sat Apr 10 22:25:22 2010 +0800 HELPER/LOG: review unused symbols Remove unused functions: - log_catch - log_rethrow - log_try Signed-off-by: Antonio Borneo <bor...@gm...> diff --git a/src/helper/log.c b/src/helper/log.c index 7450fef..7ace930 100644 --- a/src/helper/log.c +++ b/src/helper/log.c @@ -114,44 +114,6 @@ static void log_forward(const char *file, unsigned line, const char *function, c } } -void log_try(void) -{ - log_forward_count++; -} - -void log_catch(void) -{ - assert(log_forward_count>0); - log_forward_count--; -} - -void log_rethrow(void) -{ - log_catch(); - if (log_forward_count==0) - { - struct store_log_forward *log; - - log = log_head; - while (log != NULL) - { - log_forward(log->file, log->line, log->function, log->string); - - struct store_log_forward *t=log; - log = log->next; - - free((void *)t->file); - free((void *)t->function); - free((void *)t->string); - free(t); - - } - - log_head = NULL; - } -} - - /* The log_puts() serves to somewhat different goals: * * - logging diff --git a/src/helper/log.h b/src/helper/log.h index b936fee..2852140 100644 --- a/src/helper/log.h +++ b/src/helper/log.h @@ -80,14 +80,6 @@ void kept_alive(void); void alive_sleep(uint64_t ms); void busy_sleep(uint64_t ms); -/* log entries can be paused and replayed roughly according to the try/catch/rethrow - * concepts in C++ - */ -void log_try(void); -void log_catch(void); -void log_rethrow(void); - - typedef void (*log_callback_fn)(void *priv, const char *file, unsigned line, const char *function, const char *string); commit 2ea78551ab3388032ad78cdeefac7ab75e3bb134 Author: Antonio Borneo <bor...@gm...> Date: Sat Apr 10 22:20:41 2010 +0800 TARGET/MIPS_EJTAG: review scope of functions Add "static" qualifier to private functions. Signed-off-by: Antonio Borneo <bor...@gm...> diff --git a/src/target/mips_ejtag.c b/src/target/mips_ejtag.c index 98b27f0..84ad529 100644 --- a/src/target/mips_ejtag.c +++ b/src/target/mips_ejtag.c @@ -72,7 +72,7 @@ int mips_ejtag_get_idcode(struct mips_ejtag *ejtag_info, uint32_t *idcode) return ERROR_OK; } -int mips_ejtag_get_impcode(struct mips_ejtag *ejtag_info, uint32_t *impcode) +static int mips_ejtag_get_impcode(struct mips_ejtag *ejtag_info, uint32_t *impcode) { struct scan_field field; @@ -154,7 +154,7 @@ int mips_ejtag_drscan_8(struct mips_ejtag *ejtag_info, uint32_t *data) return ERROR_OK; } -int mips_ejtag_step_enable(struct mips_ejtag *ejtag_info) +static int mips_ejtag_step_enable(struct mips_ejtag *ejtag_info) { static const uint32_t code[] = { MIPS32_MTC0(1,31,0), /* move $1 to COP0 DeSave */ @@ -170,7 +170,8 @@ int mips_ejtag_step_enable(struct mips_ejtag *ejtag_info) return ERROR_OK; } -int mips_ejtag_step_disable(struct mips_ejtag *ejtag_info) + +static int mips_ejtag_step_disable(struct mips_ejtag *ejtag_info) { static const uint32_t code[] = { MIPS32_MTC0(15,31,0), /* move $15 to COP0 DeSave */ diff --git a/src/target/mips_ejtag.h b/src/target/mips_ejtag.h index f302a70..694cb34 100644 --- a/src/target/mips_ejtag.h +++ b/src/target/mips_ejtag.h @@ -134,7 +134,6 @@ int mips_ejtag_set_instr(struct mips_ejtag *ejtag_info, int new_instr); int mips_ejtag_enter_debug(struct mips_ejtag *ejtag_info); int mips_ejtag_exit_debug(struct mips_ejtag *ejtag_info); -int mips_ejtag_get_impcode(struct mips_ejtag *ejtag_info, uint32_t *impcode); int mips_ejtag_get_idcode(struct mips_ejtag *ejtag_info, uint32_t *idcode); int mips_ejtag_drscan_32(struct mips_ejtag *ejtag_info, uint32_t *data); int mips_ejtag_drscan_8(struct mips_ejtag *ejtag_info, uint32_t *data); commit 4809dbb2d7aa3b949a555876aad945d3916a8c87 Author: Antonio Borneo <bor...@gm...> Date: Sat Apr 10 22:14:34 2010 +0800 NOR/CFI: review scope of functions Add "static" qualifier to private functions. Signed-off-by: Antonio Borneo <bor...@gm...> diff --git a/src/flash/nor/cfi.c b/src/flash/nor/cfi.c index 5f7ed1e..4dad7b6 100644 --- a/src/flash/nor/cfi.c +++ b/src/flash/nor/cfi.c @@ -244,7 +244,7 @@ static void cfi_intel_clear_status_register(struct flash_bank *bank) cfi_send_command(bank, 0x50, flash_address(bank, 0, 0x0)); } -uint8_t cfi_intel_wait_status_busy(struct flash_bank *bank, int timeout) +static uint8_t cfi_intel_wait_status_busy(struct flash_bank *bank, int timeout) { uint8_t status; @@ -285,7 +285,7 @@ uint8_t cfi_intel_wait_status_busy(struct flash_bank *bank, int timeout) return status; } -int cfi_spansion_wait_status_busy(struct flash_bank *bank, int timeout) +static int cfi_spansion_wait_status_busy(struct flash_bank *bank, int timeout) { uint8_t status, oldstatus; struct cfi_flash_bank *cfi_info = bank->driver_priv; @@ -1810,7 +1810,7 @@ static int cfi_write_words(struct flash_bank *bank, uint8_t *word, uint32_t word return ERROR_FLASH_OPERATION_FAILED; } -int cfi_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count) +static int cfi_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count) { struct cfi_flash_bank *cfi_info = bank->driver_priv; struct target *target = bank->target; commit 11fd673f0c315346ef065289b164da58dd1fd4c6 Author: Antonio Borneo <bor...@gm...> Date: Sat Apr 10 22:12:20 2010 +0800 TARGET/DSP563XX_ONCE: review scope of functions Add "static" qualifier to private functions. Signed-off-by: Antonio Borneo <bor...@gm...> diff --git a/src/target/dsp563xx_once.c b/src/target/dsp563xx_once.c index 0186751..416cb6b 100644 --- a/src/target/dsp563xx_once.c +++ b/src/target/dsp563xx_once.c @@ -30,7 +30,7 @@ #include "dsp563xx_once.h" /** single word instruction */ -int dsp563xx_once_ir_exec(struct jtag_tap *tap, uint8_t instr, uint8_t rw, +static int dsp563xx_once_ir_exec(struct jtag_tap *tap, uint8_t instr, uint8_t rw, uint8_t go, uint8_t ex) { dsp563xx_write_dr_u8(tap, 0, @@ -41,7 +41,7 @@ int dsp563xx_once_ir_exec(struct jtag_tap *tap, uint8_t instr, uint8_t rw, } /** single word instruction */ -int dsp563xx_once_ir_exec_nq(struct jtag_tap *tap, uint8_t instr, uint8_t rw, +static int dsp563xx_once_ir_exec_nq(struct jtag_tap *tap, uint8_t instr, uint8_t rw, uint8_t go, uint8_t ex) { dsp563xx_write_dr_u8(tap, 0, diff --git a/src/target/dsp563xx_once.h b/src/target/dsp563xx_once.h index 871f622..942cd65 100644 --- a/src/target/dsp563xx_once.h +++ b/src/target/dsp563xx_once.h @@ -57,12 +57,6 @@ #define DSP563XX_ONCE_OPABEX 0x011 /* trace buffer/inc ptr */ #define DSP563XX_ONCE_NOREG 0x01F /* no register selected */ -/** single word instruction */ -int dsp563xx_once_ir_exec(struct jtag_tap *tap, uint8_t instr, uint8_t rw, - uint8_t go, uint8_t ex); -/** single word instruction */ -int dsp563xx_once_ir_exec_nq(struct jtag_tap *tap, uint8_t instr, uint8_t rw, - uint8_t go, uint8_t ex); /** once read register */ int dsp563xx_once_reg_read(struct jtag_tap *tap, uint8_t reg, uint32_t * data); /** once write register */ commit b2495c010148b8343f8f70f6ee558f505a2c7409 Author: Antonio Borneo <bor...@gm...> Date: Sat Apr 10 22:04:03 2010 +0800 OPENOCD: review scope of functions Add "static" qualifier to private functions. Signed-off-by: Antonio Borneo <bor...@gm...> diff --git a/src/openocd.c b/src/openocd.c index 54c454d..81c2dcd 100644 --- a/src/openocd.c +++ b/src/openocd.c @@ -202,7 +202,7 @@ static const struct command_registration openocd_command_handlers[] = { COMMAND_REGISTRATION_DONE }; -int openocd_register_commands(struct command_context *cmd_ctx) +static int openocd_register_commands(struct command_context *cmd_ctx) { return register_commands(cmd_ctx, NULL, openocd_command_handlers); } commit 787a5067fbe0eaf05ad2f41a64c3eac776905724 Author: Antonio Borneo <bor...@gm...> Date: Sat Apr 10 22:01:16 2010 +0800 JTAG/COMMANDS: review scope of functions Add "static" qualifier to private functions. Signed-off-by: Antonio Borneo <bor...@gm...> diff --git a/src/jtag/commands.c b/src/jtag/commands.c index 6951f03..d236fe9 100644 --- a/src/jtag/commands.c +++ b/src/jtag/commands.c @@ -121,7 +121,7 @@ void* cmd_queue_alloc(size_t size) return t + offset; } -void cmd_queue_free(void) +static void cmd_queue_free(void) { struct cmd_queue_page *page = cmd_queue_pages; diff --git a/src/jtag/commands.h b/src/jtag/commands.h index 692eee4..87bd9c5 100644 --- a/src/jtag/commands.h +++ b/src/jtag/commands.h @@ -158,7 +158,6 @@ struct jtag_command { extern struct jtag_command* jtag_command_queue; void* cmd_queue_alloc(size_t size); -void cmd_queue_free(void); void jtag_queue_command(struct jtag_command *cmd); void jtag_command_queue_reset(void); commit fdb9199001080e2d268da77f97365ab7b7f138d2 Author: Antonio Borneo <bor...@gm...> Date: Sat Apr 10 21:54:37 2010 +0800 BINARYBUFFER: review scope of data and functions Add "static" qualifier to private data and functions. Signed-off-by: Antonio Borneo <bor...@gm...> diff --git a/src/helper/binarybuffer.c b/src/helper/binarybuffer.c index 081cc03..3a16cce 100644 --- a/src/helper/binarybuffer.c +++ b/src/helper/binarybuffer.c @@ -27,7 +27,7 @@ #include "log.h" #include "binarybuffer.h" -const unsigned char bit_reverse_table256[] = +static const unsigned char bit_reverse_table256[] = { 0x00, 0x80, 0x40, 0xC0, 0x20, 0xA0, 0x60, 0xE0, 0x10, 0x90, 0x50, 0xD0, 0x30, 0xB0, 0x70, 0xF0, 0x08, 0x88, 0x48, 0xC8, 0x28, 0xA8, 0x68, 0xE8, 0x18, 0x98, 0x58, 0xD8, 0x38, 0xB8, 0x78, 0xF8, @@ -161,7 +161,7 @@ uint32_t flip_u32(uint32_t value, unsigned int num) return c; } -int ceil_f_to_u32(float x) +static int ceil_f_to_u32(float x) { if (x < 0) /* return zero for negative numbers */ return 0; commit d7246f452f4da9767e9ebdd6fb43b982954c02bf Author: Antonio Borneo <bor...@gm...> Date: Sat Apr 10 21:52:33 2010 +0800 NOR/STR7X: review scope of data Add "static" qualifier to private data. Signed-off-by: Antonio Borneo <bor...@gm...> diff --git a/src/flash/nor/str7x.c b/src/flash/nor/str7x.c index fa1744c..d5e8e28 100644 --- a/src/flash/nor/str7x.c +++ b/src/flash/nor/str7x.c @@ -31,7 +31,7 @@ #include <target/algorithm.h> -struct str7x_mem_layout mem_layout_str7bank0[] = { +static struct str7x_mem_layout mem_layout_str7bank0[] = { {0x00000000, 0x02000, 0x01}, {0x00002000, 0x02000, 0x02}, {0x00004000, 0x02000, 0x04}, @@ -42,7 +42,7 @@ struct str7x_mem_layout mem_layout_str7bank0[] = { {0x00030000, 0x10000, 0x80} }; -struct str7x_mem_layout mem_layout_str7bank1[] = { +static struct str7x_mem_layout mem_layout_str7bank1[] = { {0x00000000, 0x02000, 0x10000}, {0x00002000, 0x02000, 0x20000} }; commit c936cb334b9e60c3326675912c97faafb379d3ed Author: Antonio Borneo <bor...@gm...> Date: Sat Apr 10 21:50:15 2010 +0800 NAND/TCL: review scope of functions Add "static" qualifier to private functions. Signed-off-by: Antonio Borneo <bor...@gm...> diff --git a/src/flash/nand/core.h b/src/flash/nand/core.h index e4fb18b..a8e7466 100644 --- a/src/flash/nand/core.h +++ b/src/flash/nand/core.h @@ -221,7 +221,6 @@ int nand_calculate_ecc_kw(struct nand_device *nand, const uint8_t *dat, uint8_t *ecc_code); int nand_register_commands(struct command_context *cmd_ctx); -int nand_init(struct command_context *cmd_ctx); /// helper for parsing a nand device command argument string COMMAND_HELPER(nand_command_get_device, unsigned name_index, diff --git a/src/flash/nand/tcl.c b/src/flash/nand/tcl.c index 29b4b69..86dbd67 100644 --- a/src/flash/nand/tcl.c +++ b/src/flash/nand/tcl.c @@ -512,7 +512,7 @@ static const struct command_registration nand_exec_command_handlers[] = { COMMAND_REGISTRATION_DONE }; -int nand_init(struct command_context *cmd_ctx) +static int nand_init(struct command_context *cmd_ctx) { if (!nand_devices) return ERROR_OK; @@ -536,12 +536,14 @@ COMMAND_HANDLER(handle_nand_init_command) LOG_DEBUG("Initializing NAND devices..."); return nand_init(CMD_CTX); } -int nand_list_walker(struct nand_flash_controller *c, void *x) + +static int nand_list_walker(struct nand_flash_controller *c, void *x) { struct command_context *cmd_ctx = (struct command_context *)x; command_print(cmd_ctx, " %s", c->name); return ERROR_OK; } + COMMAND_HANDLER(handle_nand_list_drivers) { command_print(CMD_CTX, "Available NAND flash controller drivers:"); commit 5926b5a94fd4e29e0e020c2f87b542fd51bd5d6f Author: Antonio Borneo <bor...@gm...> Date: Sat Apr 10 20:11:40 2010 +0800 MFLASH: review scope of functions Add "static" qualifier to private functions. Signed-off-by: Antonio Borneo <bor...@gm...> diff --git a/src/flash/mflash.c b/src/flash/mflash.c index 289fe5e..d307858 100644 --- a/src/flash/mflash.c +++ b/src/flash/mflash.c @@ -1302,7 +1302,7 @@ static const struct command_registration mflash_exec_command_handlers[] = { COMMAND_REGISTRATION_DONE }; -int mflash_init_drivers(struct command_context *cmd_ctx) +static int mflash_init_drivers(struct command_context *cmd_ctx) { if (!mflash_bank) return ERROR_OK; diff --git a/src/flash/mflash.h b/src/flash/mflash.h index 358d253..bb3cd05 100644 --- a/src/flash/mflash.h +++ b/src/flash/mflash.h @@ -142,7 +142,6 @@ struct mflash_bank }; int mflash_register_commands(struct command_context *cmd_ctx); -int mflash_init_drivers(struct command_context *cmd_ctx); #define MG_MFLASH_SECTOR_SIZE (0x200) /* 512Bytes = 2^9 */ #define MG_MFLASH_SECTOR_SIZE_MASK (0x200-1) commit a6307fed9100877df2def268acece81078e06d6f Author: Antonio Borneo <bor...@gm...> Date: Sat Apr 10 20:09:59 2010 +0800 NAND/ARM_IO: review scope of functions Add "static" qualifier to private functions. Signed-off-by: Antonio Borneo <bor...@gm...> diff --git a/src/flash/nand/arm_io.c b/src/flash/nand/arm_io.c index 0cd39c0..7c7148e 100644 --- a/src/flash/nand/arm_io.c +++ b/src/flash/nand/arm_io.c @@ -43,7 +43,7 @@ * @param area Pointer to a pointer to a working area to copy code to * @return Success or failure of the operation */ -int arm_code_to_working_area(struct target *target, +static int arm_code_to_working_area(struct target *target, const uint32_t *code, unsigned code_size, unsigned additional, struct working_area **area) { commit 617811ac664504303cf65a69c1b3f8ca262def0b Author: Antonio Borneo <bor...@gm...> Date: Sat Apr 10 20:08:41 2010 +0800 NAND/CORE: review scope of functions Add "static" qualifier to private functions. Move function's comment from core.h to core.c. Signed-off-by: Antonio Borneo <bor...@gm...> diff --git a/src/flash/nand/core.c b/src/flash/nand/core.c index 50d8249..9013812 100644 --- a/src/flash/nand/core.c +++ b/src/flash/nand/core.c @@ -160,7 +160,14 @@ static struct nand_ecclayout nand_oob_8 = { }; #endif -struct nand_device *get_nand_device_by_name(const char *name) +/** + * Returns the flash bank specified by @a name, which matches the + * driver name and a suffix (option) specify the driver-specific + * bank number. The suffix consists of the '.' and the driver-specific + * bank number: when two davinci banks are defined, then 'davinci.1' refers + * to the second (e.g. DM355EVM). + */ +static struct nand_device *get_nand_device_by_name(const char *name) { unsigned requested = get_flash_name_index(name); unsigned found = 0; diff --git a/src/flash/nand/core.h b/src/flash/nand/core.h index d2d1571..e4fb18b 100644 --- a/src/flash/nand/core.h +++ b/src/flash/nand/core.h @@ -197,15 +197,6 @@ enum oob_formats }; -/** - * Returns the flash bank specified by @a name, which matches the - * driver name and a suffix (option) specify the driver-specific - * bank number. The suffix consists of the '.' and the driver-specific - * bank number: when two davinci banks are defined, then 'davinci.1' refers - * to the second (e.g. DM355EVM). - */ -struct nand_device *get_nand_device_by_name(const char *name); - struct nand_device *get_nand_device_by_num(int num); int nand_page_command(struct nand_device *nand, uint32_t page, commit aaf848596c13f26026bcbd1071f7614e818ea766 Author: Antonio Borneo <bor...@gm...> Date: Sat Apr 10 20:03:19 2010 +0800 NAND/MX3: review scope of data Add "static" qualifier to private data. Signed-off-by: Antonio Borneo <bor...@gm...> diff --git a/src/flash/nand/mx3.c b/src/flash/nand/mx3.c index 4823534..7d9cc8b 100644 --- a/src/flash/nand/mx3.c +++ b/src/flash/nand/mx3.c @@ -47,7 +47,7 @@ static const char sram_buffer_bounds_err_msg[] = "trying to access out of SRAM buffer bound (addr=0x%" PRIx32 ")"; static const char get_status_register_err_msg[] = "can't get NAND status"; static uint32_t in_sram_address; -unsigned char sign_of_sequental_byte_read; +static unsigned char sign_of_sequental_byte_read; static int test_iomux_settings (struct target * target, uint32_t value, uint32_t mask, const char *text); commit 9acd453d9f1d7d9ef90343f84ffc43ce6e1b434d Author: Antonio Borneo <bor...@gm...> Date: Sat Apr 10 19:58:15 2010 +0800 NOR/ADUC702X: review scope of data Add "static" qualifier to private data. Signed-off-by: Antonio Borneo <bor...@gm...> diff --git a/src/flash/nor/aduc702x.c b/src/flash/nor/aduc702x.c index 88072b9..57c591d 100644 --- a/src/flash/nor/aduc702x.c +++ b/src/flash/nor/aduc702x.c @@ -343,7 +343,7 @@ static int aduc702x_write_single(struct flash_bank *bank, uint8_t *buffer, uint3 return ERROR_OK; } -int aduc702x_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count) +static int aduc702x_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count) { int retval; commit 069f88cfac1199657a7e4c9988b0bc86eca99ac9 Author: Antonio Borneo <bor...@gm...> Date: Sat Apr 10 19:56:24 2010 +0800 NOR/AVRF: review scope of data Add "static" qualifier to private data. Signed-off-by: Antonio Borneo <bor...@gm...> diff --git a/src/flash/nor/avrf.c b/src/flash/nor/avrf.c index 5b40ad7..15b8b27 100644 --- a/src/flash/nor/avrf.c +++ b/src/flash/nor/avrf.c @@ -50,7 +50,7 @@ #define AVR_JTAG_REG_ProgrammingCommand_Len 15 #define AVR_JTAG_REG_FlashDataByte_Len 16 -struct avrf_type avft_chips_info[] = +static struct avrf_type avft_chips_info[] = { /* name, chip_id, flash_page_size, flash_page_num, * eeprom_page_size, eeprom_page_num commit 300f0f53c54fab5dd994a8bc42edbdc6115ef7b9 Author: Antonio Borneo <bor...@gm...> Date: Sat Apr 10 19:54:22 2010 +0800 NOR/CORE: review scope of data Add "static" qualifier to private data. Signed-off-by: Antonio Borneo <bor...@gm...> diff --git a/src/flash/nor/core.c b/src/flash/nor/core.c index 8b581b0..18012c6 100644 --- a/src/flash/nor/core.c +++ b/src/flash/nor/core.c @@ -36,7 +36,7 @@ * primarily support access from Tcl scripts or from GDB. */ -struct flash_bank *flash_banks; +static struct flash_bank *flash_banks; int flash_driver_erase(struct flash_bank *bank, int first, int last) { commit 402d3292bbd6e04ffefb1bdf7ab61f3bfc36c44a Author: Antonio Borneo <bor...@gm...> Date: Sat Apr 10 19:38:15 2010 +0800 NOR/DRIVERS: review scope of functions Add "static" qualifier to private functions. Remove unused "extern" in src/ecosboard.c Signed-off-by: Antonio Borneo <bor...@gm...> diff --git a/src/ecosboard.c b/src/ecosboard.c index 4249e1b..1e3152e 100644 --- a/src/ecosboard.c +++ b/src/ecosboard.c @@ -99,9 +99,6 @@ static bool writeLog = true; char hwaddr[512]; - -extern struct flash_driver *flash_drivers[]; - #ifdef CYGPKG_PROFILE_GPROF #include <cyg/profile/profile.h> diff --git a/src/flash/nor/drivers.c b/src/flash/nor/drivers.c index 7f71d83..3e09a00 100644 --- a/src/flash/nor/drivers.c +++ b/src/flash/nor/drivers.c @@ -44,7 +44,7 @@ extern struct flash_driver faux_flash; * The list of built-in flash drivers. * @todo Make this dynamically extendable with loadable modules. */ -struct flash_driver *flash_drivers[] = { +static struct flash_driver *flash_drivers[] = { &lpc2000_flash, &lpc288x_flash, &lpc2900_flash, commit 61c06359915cbaef5b8538d2600ecbc17d4b387c Author: Antonio Borneo <bor...@gm...> Date: Sat Apr 10 19:29:51 2010 +0800 STR9XPEC: review scope of functions Add "static" qualifier to private functions. Signed-off-by: Antonio Borneo <bor...@gm...> diff --git a/src/flash/nor/str9xpec.c b/src/flash/nor/str9xpec.c index a93b6a2..861d70b 100644 --- a/src/flash/nor/str9xpec.c +++ b/src/flash/nor/str9xpec.c @@ -33,7 +33,7 @@ static int str9xpec_erase_area(struct flash_bank *bank, int first, int last); static int str9xpec_set_address(struct flash_bank *bank, uint8_t sector); static int str9xpec_write_options(struct flash_bank *bank); -int str9xpec_set_instr(struct jtag_tap *tap, uint32_t new_instr, tap_state_t end_state) +static int str9xpec_set_instr(struct jtag_tap *tap, uint32_t new_instr, tap_state_t end_state) { if (tap == NULL) { return ERROR_TARGET_INVALID; commit 0c82bea44acf491164c96efd88c1a831fbf6ce67 Author: Antonio Borneo <bor...@gm...> Date: Sat Apr 10 19:28:13 2010 +0800 TCL: review scope of functions Add "static" qualifier to private functions. Signed-off-by: Antonio Borneo <bor...@gm...> diff --git a/src/flash/nor/core.h b/src/flash/nor/core.h index 98763b7..68220af 100644 --- a/src/flash/nor/core.h +++ b/src/flash/nor/core.h @@ -97,8 +97,6 @@ struct flash_bank /// Registers the 'flash' subsystem commands int flash_register_commands(struct command_context *cmd_ctx); -/// Initializes the 'flash' subsystem drivers -int flash_init_drivers(struct command_context *cmd_ctx); /** * Erases @a length bytes in the @a target flash, starting at @a addr. diff --git a/src/flash/nor/tcl.c b/src/flash/nor/tcl.c index fc7169f..aed55c0 100644 --- a/src/flash/nor/tcl.c +++ b/src/flash/nor/tcl.c @@ -774,7 +774,7 @@ static const struct command_registration flash_exec_command_handlers[] = { COMMAND_REGISTRATION_DONE }; -int flash_init_drivers(struct command_context *cmd_ctx) +static int flash_init_drivers(struct command_context *cmd_ctx) { if (!flash_bank_list()) return ERROR_OK; commit c0b5ca6d17273aff849bc6546c7388562b751225 Author: Antonio Borneo <bor...@gm...> Date: Sat Apr 10 19:25:32 2010 +0800 TIME_SUPPORT: review unused symbols Remove unused functions: - timeval_add Signed-off-by: Antonio Borneo <bor...@gm...> diff --git a/src/helper/time_support.c b/src/helper/time_support.c index 1934315..1f55bc2 100644 --- a/src/helper/time_support.c +++ b/src/helper/time_support.c @@ -51,13 +51,6 @@ int timeval_subtract(struct timeval *result, struct timeval *x, struct timeval * return x->tv_sec < y->tv_sec; } -/* add two struct timeval values */ -int timeval_add(struct timeval *result, struct timeval *x, struct timeval *y) -{ - memcpy(result, x, sizeof(struct timeval)); - return timeval_add_time(result, y->tv_sec, y->tv_usec); -} - int timeval_add_time(struct timeval *result, long sec, long usec) { result->tv_sec += sec; diff --git a/src/helper/time_support.h b/src/helper/time_support.h index a2d180a..fab432d 100644 --- a/src/helper/time_support.h +++ b/src/helper/time_support.h @@ -38,7 +38,6 @@ #endif int timeval_subtract(struct timeval *result, struct timeval *x, struct timeval *y); -int timeval_add(struct timeval *result, struct timeval *x, struct timeval *y); int timeval_add_time(struct timeval *result, long sec, long usec); /// @returns gettimeofday() timeval as 64-bit in ms commit b2468e3c4f09cd4e9f204aeb885dfdbbeb0a8dbb Author: Antonio Borneo <bor...@gm...> Date: Sat Apr 10 17:23:06 2010 +0800 HELLO: review unused symbols Remove unused functions: - hello_register_commands Signed-off-by: Antonio Borneo <bor...@gm...> diff --git a/src/hello.c b/src/hello.c index 8cd5fab..d3fce3d 100644 --- a/src/hello.c +++ b/src/hello.c @@ -121,8 +121,3 @@ const struct command_registration hello_command_handlers[] = { }, COMMAND_REGISTRATION_DONE }; - -int hello_register_commands(struct command_context *cmd_ctx) -{ - return register_commands(cmd_ctx, NULL, hello_command_handlers); -} diff --git a/src/hello.h b/src/hello.h index fc674ad..f41c67a 100644 --- a/src/hello.h +++ b/src/hello.h @@ -20,12 +20,8 @@ #ifndef OPENOCD_HELLO_H #define OPENOCD_HELLO_H -struct command_context; struct command_registration; -/// Register the hello commands in the specified command_context -int hello_register_commands(struct command_context *cmd_ctx); - /** * Export the registration for the hello command group, so it can be * embedded in example drivers. commit 46781080347af4f207cec108dfc2f96da61dcbfa Author: Antonio Borneo <bor...@gm...> Date: Sat Apr 10 17:06:16 2010 +0800 PLD: review scope of functions Add "static" qualifier to private functions. Signed-off-by: Antonio Borneo <bor...@gm...> diff --git a/src/pld/pld.c b/src/pld/pld.c index 5ed7596..90067e3 100644 --- a/src/pld/pld.c +++ b/src/pld/pld.c @@ -206,7 +206,8 @@ static const struct command_registration pld_exec_command_handlers[] = { }, COMMAND_REGISTRATION_DONE }; -int pld_init(struct command_context *cmd_ctx) + +static int pld_init(struct command_context *cmd_ctx) { if (!pld_devices) return ERROR_OK; diff --git a/src/pld/pld.h b/src/pld/pld.h index cd92ff0..d306246 100644 --- a/src/pld/pld.h +++ b/src/pld/pld.h @@ -46,8 +46,6 @@ struct pld_device int pld_register_commands(struct command_context *cmd_ctx); -int pld_init(struct command_context *cmd_ctx); - struct pld_device *get_pld_device_by_num(int num); #define ERROR_PLD_DEVICE_INVALID (-1000) commit ec1c90e3cd53446939b4655f55166bff6b3d39f4 Author: Antonio Borneo <bor...@gm...> Date: Sat Apr 10 17:03:02 2010 +0800 ADI_V5_JTAG: review scope of data Add "static" qualifier to private data. Signed-off-by: Antonio Borneo <bor...@gm...> diff --git a/src/target/adi_v5_jtag.c b/src/target/adi_v5_jtag.c index 0d795fb..04c6ae7 100644 --- a/src/target/adi_v5_jtag.c +++ b/src/target/adi_v5_jtag.c @@ -429,7 +429,7 @@ const struct dap_ops jtag_dp_ops = { }; -const uint8_t swd2jtag_bitseq[] = { +static const uint8_t swd2jtag_bitseq[] = { /* More than 50 TCK/SWCLK cycles with TMS/SWDIO high, * putting both JTAG and SWD logic into reset state. */ commit 8ffdefcc59ee0a8d305ac5a9f28b38ad89dea7c5 Author: Antonio Borneo <bor...@gm...> Date: Sat Apr 10 17:01:06 2010 +0800 ARM920T: review scope of functions Add "static" qualifier to private functions. Signed-off-by: Antonio Borneo <bor...@gm...> diff --git a/src/target/arm920t.c b/src/target/arm920t.c index 99f7dca..658315b 100644 --- a/src/target/arm920t.c +++ b/src/target/arm920t.c @@ -788,7 +788,7 @@ static int arm920t_mcr(struct target *target, int cpnum, uint32_t CRn, uint32_t CRm, uint32_t value); -int arm920t_init_arch_info(struct target *target, +static int arm920t_init_arch_info(struct target *target, struct arm920t_common *arm920t, struct jtag_tap *tap) { struct arm7_9_common *arm7_9 = &arm920t->arm7_9_common; commit de27d28df90ab3ed190b55ffa4d2a2cbf491732c Author: Antonio Borneo <bor...@gm...> Date: Sat Apr 10 16:59:50 2010 +0800 ARM_JTAG: review scope of functions Add "static" qualifier to private functions. Signed-off-by: Antonio Borneo <bor...@gm...> diff --git a/src/target/arm_jtag.c b/src/target/arm_jtag.c index 8cc4428..3a552ee 100644 --- a/src/target/arm_jtag.c +++ b/src/target/arm_jtag.c @@ -82,7 +82,7 @@ int arm_jtag_scann_inner(struct arm_jtag *jtag_info, uint32_t new_scan_chain, ta return retval; } -int arm_jtag_reset_callback(enum jtag_event event, void *priv) +static int arm_jtag_reset_callback(enum jtag_event event, void *priv) { struct arm_jtag *jtag_info = priv; commit 8a871560f99779b279623540588f7295fe041781 Author: Antonio Borneo <bor...@gm...> Date: Sat Apr 10 16:57:49 2010 +0800 ARM_SIMULATOR: review scope of functions Add "static" qualifier to private functions. Signed-off-by: Antonio Borneo <bor...@gm...> diff --git a/src/target/arm_simulator.c b/src/target/arm_simulator.c index 908c613..730f588 100644 --- a/src/target/arm_simulator.c +++ b/src/target/arm_simulator.c @@ -279,7 +279,7 @@ static int thumb_pass_branch_condition(uint32_t cpsr, uint16_t opcode) * if the dry_run_pc argument is provided, no state is changed, * but the new pc is stored in the variable pointed at by the argument */ -int arm_simulate_step_core(struct target *target, +static int arm_simulate_step_core(struct target *target, uint32_t *dry_run_pc, struct arm_sim_interface *sim) { uint32_t current_pc = sim->get_reg(sim, 15); diff --git a/src/target/arm_simulator.h b/src/target/arm_simulator.h index bd5458e..b332a17 100644 --- a/src/target/arm_simulator.h +++ b/src/target/arm_simulator.h @@ -40,8 +40,4 @@ struct arm_sim_interface /* armv4_5 version */ int arm_simulate_step(struct target *target, uint32_t *dry_run_pc); -/* a generic arm simulator. Caller must implement the sim interface */ -int arm_simulate_step_core(struct target *target, - uint32_t *dry_run_pc, struct arm_sim_interface *sim); - #endif /* ARM_SIMULATOR_H */ commit 4a1bd5b80603f73593fd7094d7da41ff72130461 Author: Antonio Borneo <bor...@gm...> Date: Sat Apr 10 16:46:59 2010 +0800 ARMV4_5_MMU: review unused symbols Remove unused data: - armv4_5_mmu_page_type_names Remove prototype of not existing function: - armv4mmu_translate_va Signed-off-by: Antonio Borneo <bor...@gm...> diff --git a/src/target/armv4_5_mmu.c b/src/target/armv4_5_mmu.c index 4d2fbee..fc1dde7 100644 --- a/src/target/armv4_5_mmu.c +++ b/src/target/armv4_5_mmu.c @@ -26,13 +26,6 @@ #include "armv4_5_mmu.h" -uint32_t armv4mmu_translate_va(struct target *target, struct armv4_5_mmu_common *armv4_5_mmu, uint32_t va, int *type, uint32_t *cb, int *domain, uint32_t *ap); - -char* armv4_5_mmu_page_type_names[] = -{ - "section", "large page", "small page", "tiny page" -}; - uint32_t armv4_5_mmu_translate_va(struct target *target, struct armv4_5_mmu_common *armv4_5_mmu, uint32_t va, int *type, uint32_t *cb, int *domain, uint32_t *ap) { uint32_t first_lvl_descriptor = 0x0; commit 0f3bbcf09683904c1f21b6961cbb0f36b07043c0 Author: Antonio Borneo <bor...@gm...> Date: Sat Apr 10 16:46:01 2010 +0800 ARMV4_5: review scope of data Add "static" qualifier to private data. Signed-off-by: Antonio Borneo <bor...@gm...> diff --git a/src/target/arm.h b/src/target/arm.h index 99bd983..ce8cbe1 100644 --- a/src/target/arm.h +++ b/src/target/arm.h @@ -80,8 +80,6 @@ enum arm_state { ARM_STATE_THUMB_EE, }; -extern const char *arm_state_strings[]; - #define ARM_COMMON_MAGIC 0x0A450A45 /** diff --git a/src/target/armv4_5.c b/src/target/armv4_5.c index 1e9a296..eeb6694 100644 --- a/src/target/armv4_5.c +++ b/src/target/armv4_5.c @@ -217,7 +217,7 @@ enum arm_mode armv4_5_number_to_mode(int number) } } -const char *arm_state_strings[] = +static const char *arm_state_strings[] = { "ARM", "Thumb", "Jazelle", "ThumbEE", }; commit 263b4b9057b4e34eec8b39c4f165d370cb51a9e3 Author: Antonio Borneo <bor...@gm...> Date: Sat Apr 10 16:44:54 2010 +0800 EMBEDDEDICE: review scope of functions Add "static" qualifier to private functions. Signed-off-by: Antonio Borneo <bor...@gm...> diff --git a/src/target/embeddedice.c b/src/target/embeddedice.c index 69f3a76..7ef4ac4 100644 --- a/src/target/embeddedice.c +++ b/src/target/embeddedice.c @@ -47,6 +47,8 @@ * core entered debug mode. */ +static int embeddedice_set_reg_w_exec(struct reg *reg, uint8_t *buf); + /* * From: ARM9E-S TRM, DDI 0165, table C-4 (and similar, for other cores) */ @@ -469,7 +471,7 @@ void embeddedice_set_reg(struct reg *reg, uint32_t value) * Write an EmbeddedICE register, updating the register cache. * Uses embeddedice_set_reg(); not queued. */ -int embeddedice_set_reg_w_exec(struct reg *reg, uint8_t *buf) +static int embeddedice_set_reg_w_exec(struct reg *reg, uint8_t *buf) { int retval; diff --git a/src/target/embeddedice.h b/src/target/embeddedice.h index d278115..42df8d0 100644 --- a/src/target/embeddedice.h +++ b/src/target/embeddedice.h @@ -106,7 +106,6 @@ void embeddedice_write_reg(struct reg *reg, uint32_t value); void embeddedice_store_reg(struct reg *reg); void embeddedice_set_reg(struct reg *reg, uint32_t value); -int embeddedice_set_reg_w_exec(struct reg *reg, uint8_t *buf); int embeddedice_receive(struct arm_jtag *jtag_info, uint32_t *data, uint32_t size); int embeddedice_send(struct arm_jtag *jtag_info, uint32_t *data, uint32_t size); commit 3f0b17e48af9e3481084e1e9e697012b6824df43 Author: Antonio Borneo <bor...@gm...> Date: Sat Apr 10 00:25:35 2010 +0800 TARGET: review unused symbols Remove unused functions: - target_all_handle_event Signed-off-by: Antonio Borneo <bor...@gm...> diff --git a/src/target/target.c b/src/target/target.c index f1b292a..73594fb 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -3580,22 +3580,6 @@ stat... [truncated message content] |
From: David B. <dbr...@us...> - 2010-04-04 10:30:44
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 2a17fd9f9b51516a830ba4b3ae2f2284929ff266 (commit) from 876bf9bf4cd5fc2640d91811fb69c0d36f9e2c18 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 2a17fd9f9b51516a830ba4b3ae2f2284929ff266 Author: David Brownell <dbr...@us...> Date: Sun Apr 4 01:28:50 2010 -0700 Restore deleted '!' character I'm not sure what caused this significant character to get deleted. it may be related to intermittent Editor or terminal flakes I've been seeing lately (sigh). This fix is trivial. Signed-off-by: David Brownell <dbr...@us...> diff --git a/src/target/target.c b/src/target/target.c index 286933f..f3d63fc 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -658,7 +658,7 @@ int target_run_algorithm(struct target *target, LOG_ERROR("Target not examined yet"); goto done; } - if (target->type->run_algorithm) { + if (!target->type->run_algorithm) { LOG_ERROR("Target type '%s' does not support %s", target_type_name(target), __func__); goto done; ----------------------------------------------------------------------- Summary of changes: src/target/target.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: David B. <dbr...@us...> - 2010-04-04 10:15:35
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 876bf9bf4cd5fc2640d91811fb69c0d36f9e2c18 (commit) via 88fcb5a9ef971e54166de7cd16a3b0be20113b82 (commit) from d37a10da52bc8e6df4e3df2edd02ddbc29fe3bc4 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 876bf9bf4cd5fc2640d91811fb69c0d36f9e2c18 Author: David Brownell <dbr...@us...> Date: Sun Apr 4 00:42:05 2010 -0700 target: are we running algorithm code? Fixing one bug can easily uncover another .... in this case, making sure that we properly invalidate some cached NOR state when resuming arbitrary target code turned up an issue when the code wasn't quite arbitrary (and we couldn't know that, but some parts of OpenOCD assumed the cache would not be invalidated. Specifically: some flash drivers (like CFI) update that state in loops with downloaded algorithms, thus invalidating the state as it's probed. + Add a new target state flag, to record whether the target is running downloaded algorithm code. + Use that flag to add a special case: "trust" downloaded algorithms not to corrupt that cached state, bypassing cache invalidation. Also update some of the documentation to stipulate that this flavor of trustworthiness is now *required* ... not just a fortuitous acident. Signed-off-by: David Brownell <dbr...@us...> diff --git a/src/target/target.c b/src/target/target.c index 75c41d3..286933f 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -478,9 +478,14 @@ int target_resume(struct target *target, int current, uint32_t address, int hand * themselves. We want flash drivers and infrastructure to * be able to rely on (non-invalidated) cached state. * + * For now we require that algorithms provided by OpenOCD are + * used only by code which properly maintains that cached state. + * state + * * REVISIT do the same for NAND ; maybe other flash flavors too... */ - nor_resume(target); + if (!target->running_alg) + nor_resume(target); return retval; } @@ -659,10 +664,12 @@ int target_run_algorithm(struct target *target, goto done; } + target->running_alg = true; retval = target->type->run_algorithm(target, num_mem_params, mem_params, num_reg_params, reg_param, entry_point, exit_point, timeout_ms, arch_info); + target->running_alg = false; done: return retval; diff --git a/src/target/target.h b/src/target/target.h index 7400b7e..562724b 100644 --- a/src/target/target.h +++ b/src/target/target.h @@ -117,6 +117,14 @@ struct target */ bool examined; + /** true iff the target is currently running a downloaded + * "algorithm" instetad of arbitrary user code. OpenOCD code + * invoking algorithms is trusted to maintain correctness of + * any cached state (e.g. for flash status), which arbitrary + * code will have no reason to know about. + */ + bool running_alg; + struct target_event_action *event_action; int reset_halt; /* attempt resetting the CPU into the halted mode? */ commit 88fcb5a9ef971e54166de7cd16a3b0be20113b82 Author: David Brownell <dbr...@us...> Date: Sun Apr 4 00:38:39 2010 -0700 simplify and unconfuse target_run_algorithm() For some reason there are *two* schemes for interposing logic into the run_algorithm() code path... One is a standard procedural wapper around the target method invocation. the other (superfluous) one hacked the method table by splicing a second procedural wrapper into the method table. Remove it: * Rename its slightly-more-featureful wrapper so it becomes the standard procedural wrapper, leaving its added logic (where it should have been in the first place. Also add a paranoia check, to report targets that don't support algorithms without traversing a NULL pointer, and tweak its code structure a bit so it's easier to modify. * Get rid of the superfluous/conusing method table hacks. This is a net simplification, making it simpler to analyse what's going on, and then interpose logic . ... by ensuring there's only one natural place for it to live. ------------ Signed-off-by: David Brownell <dbr...@us...> diff --git a/src/target/target.c b/src/target/target.c index 868241e..75c41d3 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -629,16 +629,46 @@ static int target_soft_reset_halt_imp(struct target *target) return target->type->soft_reset_halt_imp(target); } -static int target_run_algorithm_imp(struct target *target, int num_mem_params, struct mem_param *mem_params, int num_reg_params, struct reg_param *reg_param, uint32_t entry_point, uint32_t exit_point, int timeout_ms, void *arch_info) +/** + * Downloads a target-specific native code algorithm to the target, + * and executes it. * Note that some targets may need to set up, enable, + * and tear down a breakpoint (hard or * soft) to detect algorithm + * termination, while others may support lower overhead schemes where + * soft breakpoints embedded in the algorithm automatically terminate the + * algorithm. + * + * @param target used to run the algorithm + * @param arch_info target-specific description of the algorithm. + */ +int target_run_algorithm(struct target *target, + int num_mem_params, struct mem_param *mem_params, + int num_reg_params, struct reg_param *reg_param, + uint32_t entry_point, uint32_t exit_point, + int timeout_ms, void *arch_info) { + int retval = ERROR_FAIL; + if (!target_was_examined(target)) { LOG_ERROR("Target not examined yet"); - return ERROR_FAIL; + goto done; + } + if (target->type->run_algorithm) { + LOG_ERROR("Target type '%s' does not support %s", + target_type_name(target), __func__); + goto done; } - return target->type->run_algorithm_imp(target, num_mem_params, mem_params, num_reg_params, reg_param, entry_point, exit_point, timeout_ms, arch_info); + + retval = target->type->run_algorithm(target, + num_mem_params, mem_params, + num_reg_params, reg_param, + entry_point, exit_point, timeout_ms, arch_info); + +done: + return retval; } + int target_read_memory(struct target *target, uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer) { @@ -711,17 +741,6 @@ int target_step(struct target *target, } -int target_run_algorithm(struct target *target, - int num_mem_params, struct mem_param *mem_params, - int num_reg_params, struct reg_param *reg_param, - uint32_t entry_point, uint32_t exit_point, - int timeout_ms, void *arch_info) -{ - return target->type->run_algorithm(target, - num_mem_params, mem_params, num_reg_params, reg_param, - entry_point, exit_point, timeout_ms, arch_info); -} - /** * Reset the @c examined flag for the given target. * Pure paranoia -- targets are zeroed on allocation. @@ -785,9 +804,6 @@ static int target_init_one(struct command_context *cmd_ctx, type->soft_reset_halt_imp = target->type->soft_reset_halt; type->soft_reset_halt = target_soft_reset_halt_imp; - type->run_algorithm_imp = target->type->run_algorithm; - type->run_algorithm = target_run_algorithm_imp; - /* Sanity-check MMU support ... stub in what we must, to help * implement it in stages, but warn if we need to do so. */ diff --git a/src/target/target_type.h b/src/target/target_type.h index 70eb962..d3db8b5 100644 --- a/src/target/target_type.h +++ b/src/target/target_type.h @@ -146,8 +146,6 @@ struct target_type */ int (*remove_watchpoint)(struct target *target, struct watchpoint *watchpoint); - /* target algorithm support */ - int (*run_algorithm_imp)(struct target *target, int num_mem_params, struct mem_param *mem_params, int num_reg_params, struct reg_param *reg_param, uint32_t entry_point, uint32_t exit_point, int timeout_ms, void *arch_info); /** * Target algorithm support. Do @b not call this method directly, * use target_run_algorithm() instead. ----------------------------------------------------------------------- Summary of changes: src/target/target.c | 59 ++++++++++++++++++++++++++++++++-------------- src/target/target.h | 8 ++++++ src/target/target_type.h | 2 - 3 files changed, 49 insertions(+), 20 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: David B. <dbr...@us...> - 2010-04-04 03:37:22
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via d37a10da52bc8e6df4e3df2edd02ddbc29fe3bc4 (commit) from 33e5dd12729d995b351ece716e8c835dd8331c71 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit d37a10da52bc8e6df4e3df2edd02ddbc29fe3bc4 Author: David Brownell <dbr...@us...> Date: Sat Apr 3 18:36:07 2010 -0700 buildfix Without this, a system using gcc (GCC) 4.2.4 (Ubuntu 4.2.4-1ubuntu4) aborts builds after reporting: tcl.c: In function âhandle_irscan_commandâ: tcl.c:1168: warning: passing argument 1 of âbuf_set_u32â discards qualifiers from pointer target type Signed-off-by: David Brownell <dbr...@us...> diff --git a/src/jtag/tcl.c b/src/jtag/tcl.c index 7dc7fb7..579ca9e 100644 --- a/src/jtag/tcl.c +++ b/src/jtag/tcl.c @@ -1165,7 +1165,8 @@ COMMAND_HANDLER(handle_irscan_command) retval = parse_u32(CMD_ARGV[i * 2 + 1], &value); if (ERROR_OK != retval) goto error_return; - buf_set_u32((void *)fields[i].out_value, 0, field_size, value); +void *v = (void *)fields[i].out_value; + buf_set_u32(v, 0, field_size, value); fields[i].in_value = NULL; } ----------------------------------------------------------------------- Summary of changes: src/jtag/tcl.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2010-03-29 20:25:04
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 33e5dd12729d995b351ece716e8c835dd8331c71 (commit) from d60ebc0ab535e54f76e734d00d9ac1b5c9b6eb93 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 33e5dd12729d995b351ece716e8c835dd8331c71 Author: Mike Dunn <mik...@ne...> Date: Sun Mar 28 15:48:32 2010 -0400 xscale: fix trace buffer functionality when resuming from a breakpoint Problem: halt at a breakpoint, enable trace buffer ('xscale trace_buffer enable fill'), then resume. Wait for debug exception when trace buffer fills (if not sooner due to another breakpoint, vector catch, etc). Instead, never halts. When halted explicitly from OpenOCD and trace buffer dumped, it contains only one entry; a branch to the address of the original breakpoint. If the above steps are repeated, except that the breakpoint is removed before resuming, the trace buffer fills and the debug exception is generated, as expected. Cause: related to how a breakpoint is stepped over on resume. The breakpoint is temporarily removed, and a hardware breakpoint is set on the next instruction that will execute. xscale_debug_entry() is called when that breakpoint hits. This function checks if the trace buffer is enabled, and if so reads the trace buffer from the target and then disables the trace (unless multiple trace buffers are specified by the user when trace is enabled). Thus you only trace one instruction before it is disabled. Solution: kind of a hack on top of a hack, but it's simple. Anything better would involve some refactoring. This has been tested and trace now works as intended, except that the very first instruction is not part of the trace when resuming from a breakpoint. TODO: still many issues with trace: doesn't work during single-stepping (trace buffer is flushed each step), 'xscale analyze_trace' works only marginally for a trace captured in 'fill' mode, and not at all for a trace captured in 'wrap' mode. Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/target/xscale.c b/src/target/xscale.c index e578a77..24c0794 100644 --- a/src/target/xscale.c +++ b/src/target/xscale.c @@ -1206,6 +1206,7 @@ static int xscale_resume(struct target *target, int current, if (breakpoint != NULL) { uint32_t next_pc; + int saved_trace_buffer_enabled; /* there's a breakpoint at the current PC, we have to step over it */ LOG_DEBUG("unset breakpoint at 0x%8.8" PRIx32 "", breakpoint->address); @@ -1225,15 +1226,8 @@ static int xscale_resume(struct target *target, int current, /* restore banked registers */ retval = xscale_restore_banked(target); - /* send resume request (command 0x30 or 0x31) - * clean the trace buffer if it is to be enabled (0x62) */ - if (xscale->trace.buffer_enabled) - { - xscale_send_u32(target, 0x62); - xscale_send_u32(target, 0x31); - } - else - xscale_send_u32(target, 0x30); + /* send resume request */ + xscale_send_u32(target, 0x30); /* send CPSR */ xscale_send_u32(target, @@ -1254,9 +1248,16 @@ static int xscale_resume(struct target *target, int current, LOG_DEBUG("writing PC with value 0x%8.8" PRIx32, buf_get_u32(armv4_5->pc->value, 0, 32)); + /* disable trace data collection in xscale_debug_entry() */ + saved_trace_buffer_enabled = xscale->trace.buffer_enabled; + xscale->trace.buffer_enabled = 0; + /* wait for and process debug entry */ xscale_debug_entry(target); + /* re-enable trace buffer, if enabled previously */ + xscale->trace.buffer_enabled = saved_trace_buffer_enabled; + LOG_DEBUG("disable single-step"); xscale_disable_single_step(target); @@ -1276,6 +1277,12 @@ static int xscale_resume(struct target *target, int current, * clean the trace buffer if it is to be enabled (0x62) */ if (xscale->trace.buffer_enabled) { + /* if trace buffer is set to 'fill' mode, save starting pc */ + if (xscale->trace.buffer_fill > 0) + { + xscale->trace.pc_ok = 1; + xscale->trace.current_pc = buf_get_u32(armv4_5->pc->value, 0, 32); + } xscale_send_u32(target, 0x62); xscale_send_u32(target, 0x31); } ----------------------------------------------------------------------- Summary of changes: src/target/xscale.c | 25 ++++++++++++++++--------- 1 files changed, 16 insertions(+), 9 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: David B. <dbr...@us...> - 2010-03-27 18:09:02
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via d60ebc0ab535e54f76e734d00d9ac1b5c9b6eb93 (commit) from a092e8d237e7d23b1b952c4d400d8210523f9ce2 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit d60ebc0ab535e54f76e734d00d9ac1b5c9b6eb93 Author: David Brownell <dbr...@us...> Date: Sat Mar 27 10:07:13 2010 -0700 jtag/tcl.c cleanup -- split out "adapter.c" Clean up the jtag/tcl.c file, which was one of the biggest and messiest ones in that directory. Do it by splitting out all the generic adapter commands to a separate "adapter.c" file (leaving the "tcl.c" file holding only JTAG utilities). Also rename the little-used "jtag interface" to "adapter_name", which should have been at least re-categorized earlier (it's not jtag-only). Signed-off-by: David Brownell <dbr...@us...> diff --git a/NEWS b/NEWS index 0b9a6a4..a744da3 100644 --- a/NEWS +++ b/NEWS @@ -6,9 +6,10 @@ and other issues not mentioned here. JTAG Layer: New driver for "Bus Pirate" Rename various commands so they're not JTAG-specific - There are migration procedures for these, but you should + There are migration procedures for most of these, but you should convert your scripts to the new names, since those procedures will not be around forever. + jtag jinterface ... is now adapter_name jtag_khz ... is now adapter_khz jtag_nsrst_delay ... is now adapter_nsrst_delay jtag_nsrst_assert_width ... is now adapter_nsrst_assert_width diff --git a/doc/openocd.texi b/doc/openocd.texi index 83a6369..bb8f3ab 100644 --- a/doc/openocd.texi +++ b/doc/openocd.texi @@ -2093,12 +2093,12 @@ target. @end deffn @deffn Command {interface_list} -List the interface drivers that have been built into +List the debug adapter drivers that have been built into the running copy of OpenOCD. @end deffn -@deffn Command {jtag interface} -Returns the name of the interface driver being used. +@deffn Command {adapter_name} +Returns the name of the debug adapter driver being used. @end deffn @section Interface Drivers diff --git a/src/jtag/Makefile.am b/src/jtag/Makefile.am index 3f132d4..875fbcb 100644 --- a/src/jtag/Makefile.am +++ b/src/jtag/Makefile.am @@ -53,6 +53,7 @@ minidriver_imp.h: $(MINIDRIVER_IMP_DIR)/minidriver_imp.h libjtag_la_SOURCES = \ + adapter.c \ core.c \ interface.c \ interfaces.c \ diff --git a/src/jtag/adapter.c b/src/jtag/adapter.c new file mode 100644 index 0000000..b262a9a --- /dev/null +++ b/src/jtag/adapter.c @@ -0,0 +1,459 @@ +/*************************************************************************** + * Copyright (C) 2005 by Dominic Rath * + * Dom...@gm... * + * * + * Copyright (C) 2007-2010 Ãyvind Harboe * + * oyv...@zy... * + * * + * Copyright (C) 2009 SoftPLC Corporation * + * http://softplc.com * + * di...@so... * + * * + * Copyright (C) 2009 Zachary T Welch * + * zw...@su... * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "jtag.h" +#include "minidriver.h" +#include "interface.h" +#include "interfaces.h" + +#ifdef HAVE_STRINGS_H +#include <strings.h> +#endif + +/** + * @file + * Holds support for configuring debug adapters from TCl scripts. + */ + +extern struct jtag_interface *jtag_interface; + + + +static int +jim_adapter_name(Jim_Interp *interp, int argc, Jim_Obj *const *argv) +{ + Jim_GetOptInfo goi; + Jim_GetOpt_Setup(&goi, interp, argc-1, argv + 1); + + /* return the name of the interface */ + /* TCL code might need to know the exact type... */ + /* FUTURE: we allow this as a means to "set" the interface. */ + if (goi.argc != 0) { + Jim_WrongNumArgs(goi.interp, 1, goi.argv-1, "(no params)"); + return JIM_ERR; + } + const char *name = jtag_interface ? jtag_interface->name : NULL; + Jim_SetResultString(goi.interp, name ? : "undefined", -1); + return JIM_OK; +} + + +static int default_khz(int khz, int *jtag_speed) +{ + LOG_ERROR("Translation from khz to jtag_speed not implemented"); + return ERROR_FAIL; +} + +static int default_speed_div(int speed, int *khz) +{ + LOG_ERROR("Translation from jtag_speed to khz not implemented"); + return ERROR_FAIL; +} + +static int default_power_dropout(int *dropout) +{ + *dropout = 0; /* by default we can't detect power dropout */ + return ERROR_OK; +} + +static int default_srst_asserted(int *srst_asserted) +{ + *srst_asserted = 0; /* by default we can't detect srst asserted */ + return ERROR_OK; +} + +COMMAND_HANDLER(handle_interface_list_command) +{ + if (strcmp(CMD_NAME, "interface_list") == 0 && CMD_ARGC > 0) + return ERROR_COMMAND_SYNTAX_ERROR; + + command_print(CMD_CTX, "The following debug interfaces are available:"); + for (unsigned i = 0; NULL != jtag_interfaces[i]; i++) + { + const char *name = jtag_interfaces[i]->name; + command_print(CMD_CTX, "%u: %s", i + 1, name); + } + + return ERROR_OK; +} + +COMMAND_HANDLER(handle_interface_command) +{ + /* check whether the interface is already configured */ + if (jtag_interface) + { + LOG_WARNING("Interface already configured, ignoring"); + return ERROR_OK; + } + + /* interface name is a mandatory argument */ + if (CMD_ARGC != 1 || CMD_ARGV[0][0] == '\0') + return ERROR_COMMAND_SYNTAX_ERROR; + + for (unsigned i = 0; NULL != jtag_interfaces[i]; i++) + { + if (strcmp(CMD_ARGV[0], jtag_interfaces[i]->name) != 0) + continue; + + if (NULL != jtag_interfaces[i]->commands) + { + int retval = register_commands(CMD_CTX, NULL, + jtag_interfaces[i]->commands); + if (ERROR_OK != retval) + return retval; + } + + jtag_interface = jtag_interfaces[i]; + + if (jtag_interface->khz == NULL) + jtag_interface->khz = default_khz; + if (jtag_interface->speed_div == NULL) + jtag_interface->speed_div = default_speed_div; + if (jtag_interface->power_dropout == NULL) + jtag_interface->power_dropout = default_power_dropout; + if (jtag_interface->srst_asserted == NULL) + jtag_interface->srst_asserted = default_srst_asserted; + + return ERROR_OK; + } + + /* no valid interface was found (i.e. the configuration option, + * didn't match one of the compiled-in interfaces + */ + LOG_ERROR("The specified debug interface was not found (%s)", CMD_ARGV[0]); + CALL_COMMAND_HANDLER(handle_interface_list_command); + return ERROR_JTAG_INVALID_INTERFACE; +} + +COMMAND_HANDLER(handle_reset_config_command) +{ + int new_cfg = 0; + int mask = 0; + + /* Original versions cared about the order of these tokens: + * reset_config signals [combination [trst_type [srst_type]]] + * They also clobbered the previous configuration even on error. + * + * Here we don't care about the order, and only change values + * which have been explicitly specified. + */ + for (; CMD_ARGC; CMD_ARGC--, CMD_ARGV++) { + int tmp = 0; + int m; + + /* gating */ + m = RESET_SRST_NO_GATING; + if (strcmp(*CMD_ARGV, "srst_gates_jtag") == 0) + /* default: don't use JTAG while SRST asserted */; + else if (strcmp(*CMD_ARGV, "srst_nogate") == 0) + tmp = RESET_SRST_NO_GATING; + else + m = 0; + if (mask & m) { + LOG_ERROR("extra reset_config %s spec (%s)", + "gating", *CMD_ARGV); + return ERROR_INVALID_ARGUMENTS; + } + if (m) + goto next; + + /* signals */ + m = RESET_HAS_TRST | RESET_HAS_SRST; + if (strcmp(*CMD_ARGV, "none") == 0) + tmp = RESET_NONE; + else if (strcmp(*CMD_ARGV, "trst_only") == 0) + tmp = RESET_HAS_TRST; + else if (strcmp(*CMD_ARGV, "srst_only") == 0) + tmp = RESET_HAS_SRST; + else if (strcmp(*CMD_ARGV, "trst_and_srst") == 0) + tmp = RESET_HAS_TRST | RESET_HAS_SRST; + else + m = 0; + if (mask & m) { + LOG_ERROR("extra reset_config %s spec (%s)", + "signal", *CMD_ARGV); + return ERROR_INVALID_ARGUMENTS; + } + if (m) + goto next; + + /* combination (options for broken wiring) */ + m = RESET_SRST_PULLS_TRST | RESET_TRST_PULLS_SRST; + if (strcmp(*CMD_ARGV, "separate") == 0) + /* separate reset lines - default */; + else if (strcmp(*CMD_ARGV, "srst_pulls_trst") == 0) + tmp |= RESET_SRST_PULLS_TRST; + else if (strcmp(*CMD_ARGV, "trst_pulls_srst") == 0) + tmp |= RESET_TRST_PULLS_SRST; + else if (strcmp(*CMD_ARGV, "combined") == 0) + tmp |= RESET_SRST_PULLS_TRST | RESET_TRST_PULLS_SRST; + else + m = 0; + if (mask & m) { + LOG_ERROR("extra reset_config %s spec (%s)", + "combination", *CMD_ARGV); + return ERROR_INVALID_ARGUMENTS; + } + if (m) + goto next; + + /* trst_type (NOP without HAS_TRST) */ + m = RESET_TRST_OPEN_DRAIN; + if (strcmp(*CMD_ARGV, "trst_open_drain") == 0) + tmp |= RESET_TRST_OPEN_DRAIN; + else if (strcmp(*CMD_ARGV, "trst_push_pull") == 0) + /* push/pull from adapter - default */; + else + m = 0; + if (mask & m) { + LOG_ERROR("extra reset_config %s spec (%s)", + "trst_type", *CMD_ARGV); + return ERROR_INVALID_ARGUMENTS; + } + if (m) + goto next; + + /* srst_type (NOP without HAS_SRST) */ + m |= RESET_SRST_PUSH_PULL; + if (strcmp(*CMD_ARGV, "srst_push_pull") == 0) + tmp |= RESET_SRST_PUSH_PULL; + else if (strcmp(*CMD_ARGV, "srst_open_drain") == 0) + /* open drain from adapter - default */; + else + m = 0; + if (mask & m) { + LOG_ERROR("extra reset_config %s spec (%s)", + "srst_type", *CMD_ARGV); + return ERROR_INVALID_ARGUMENTS; + } + if (m) + goto next; + + /* caller provided nonsense; fail */ + LOG_ERROR("unknown reset_config flag (%s)", *CMD_ARGV); + return ERROR_INVALID_ARGUMENTS; + +next: + /* Remember the bits which were specified (mask) + * and their new values (new_cfg). + */ + mask |= m; + new_cfg |= tmp; + } + + /* clear previous values of those bits, save new values */ + if (mask) { + int old_cfg = jtag_get_reset_config(); + + old_cfg &= ~mask; + new_cfg |= old_cfg; + jtag_set_reset_config(new_cfg); + } else + new_cfg = jtag_get_reset_config(); + + + /* + * Display the (now-)current reset mode + */ + char *modes[5]; + + /* minimal JTAG has neither SRST nor TRST (so that's the default) */ + switch (new_cfg & (RESET_HAS_TRST | RESET_HAS_SRST)) { + case RESET_HAS_SRST: + modes[0] = "srst_only"; + break; + case RESET_HAS_TRST: + modes[0] = "trst_only"; + break; + case RESET_TRST_AND_SRST: + modes[0] = "trst_and_srst"; + break; + default: + modes[0] = "none"; + break; + } + + /* normally SRST and TRST are decoupled; but bugs happen ... */ + switch (new_cfg & (RESET_SRST_PULLS_TRST | RESET_TRST_PULLS_SRST)) { + case RESET_SRST_PULLS_TRST: + modes[1] = "srst_pulls_trst"; + break; + case RESET_TRST_PULLS_SRST: + modes[1] = "trst_pulls_srst"; + break; + case RESET_SRST_PULLS_TRST | RESET_TRST_PULLS_SRST: + modes[1] = "combined"; + break; + default: + modes[1] = "separate"; + break; + } + + /* TRST-less connectors include Altera, Xilinx, and minimal JTAG */ + if (new_cfg & RESET_HAS_TRST) { + if (new_cfg & RESET_TRST_OPEN_DRAIN) + modes[3] = " trst_open_drain"; + else + modes[3] = " trst_push_pull"; + } else + modes[3] = ""; + + /* SRST-less connectors include TI-14, Xilinx, and minimal JTAG */ + if (new_cfg & RESET_HAS_SRST) { + if (new_cfg & RESET_SRST_NO_GATING) + modes[2] = " srst_nogate"; + else + modes[2] = " srst_gates_jtag"; + + if (new_cfg & RESET_SRST_PUSH_PULL) + modes[4] = " srst_push_pull"; + else + modes[4] = " srst_open_drain"; + } else { + modes[2] = ""; + modes[4] = ""; + } + + command_print(CMD_CTX, "%s %s%s%s%s", + modes[0], modes[1], + modes[2], modes[3], modes[4]); + + return ERROR_OK; +} + +COMMAND_HANDLER(handle_adapter_nsrst_delay_command) +{ + if (CMD_ARGC > 1) + return ERROR_COMMAND_SYNTAX_ERROR; + if (CMD_ARGC == 1) + { + unsigned delay; + COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], delay); + + jtag_set_nsrst_delay(delay); + } + command_print(CMD_CTX, "adapter_nsrst_delay: %u", jtag_get_nsrst_delay()); + return ERROR_OK; +} + +COMMAND_HANDLER(handle_adapter_khz_command) +{ + if (CMD_ARGC > 1) + return ERROR_COMMAND_SYNTAX_ERROR; + + int retval = ERROR_OK; + if (CMD_ARGC == 1) + { + unsigned khz = 0; + COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], khz); + + retval = jtag_config_khz(khz); + if (ERROR_OK != retval) + return retval; + } + + int cur_speed = jtag_get_speed_khz(); + retval = jtag_get_speed_readable(&cur_speed); + if (ERROR_OK != retval) + return retval; + + if (cur_speed) + command_print(CMD_CTX, "%d kHz", cur_speed); + else + command_print(CMD_CTX, "RCLK - adaptive"); + + return retval; +} + +static const struct command_registration interface_command_handlers[] = { + { + .name = "adapter_khz", + .handler = handle_adapter_khz_command, + .mode = COMMAND_ANY, + .help = "With an argument, change to the specified maximum " + "jtag speed. For JTAG, 0 KHz signifies adaptive " + " clocking. " + "With or without argument, display current setting.", + .usage = "[khz]", + }, + { + .name = "adapter_name", + .mode = COMMAND_ANY, + .jim_handler = jim_adapter_name, + .help = "Returns the name of the currently " + "selected adapter (driver)", + }, + { + .name = "adapter_nsrst_delay", + .handler = handle_adapter_nsrst_delay_command, + .mode = COMMAND_ANY, + .help = "delay after deasserting SRST in ms", + .usage = "[milliseconds]", + }, + { + .name = "interface", + .handler = handle_interface_command, + .mode = COMMAND_CONFIG, + .help = "Select a debug adapter interface (driver)", + .usage = "driver_name", + }, + { + .name = "interface_list", + .handler = handle_interface_list_command, + .mode = COMMAND_ANY, + .help = "List all built-in debug adapter interfaces (drivers)", + }, + { + .name = "reset_config", + .handler = handle_reset_config_command, + .mode = COMMAND_ANY, + .help = "configure adapter reset behavior", + .usage = "[none|trst_only|srst_only|trst_and_srst] " + "[srst_pulls_trst|trst_pulls_srst|combined|separate] " + "[srst_gates_jtag|srst_nogate] " + "[trst_push_pull|trst_open_drain] " + "[srst_push_pull|srst_open_drain]", + }, + COMMAND_REGISTRATION_DONE +}; + +/** + * Register the commands which deal with arbitrary debug adapter drivers. + * + * @todo Remove internal assumptions that all debug adapters use JTAG for + * transport. Various types and data structures are not named generically. + */ +int interface_register_commands(struct command_context *ctx) +{ + return register_commands(ctx, NULL, interface_command_handlers); +} diff --git a/src/jtag/startup.tcl b/src/jtag/startup.tcl index 3a36886..496fdc8 100644 --- a/src/jtag/startup.tcl +++ b/src/jtag/startup.tcl @@ -78,7 +78,7 @@ proc srst_asserted {} { # BEGIN MIGRATION AIDS ... these adapter operations originally had # JTAG-specific names despite the fact that the operations were not -# specific to JTAG. +# specific to JTAG, or otherewise had troublesome/misleading names. # # FIXME phase these aids out after about April 2011 # diff --git a/src/jtag/tcl.c b/src/jtag/tcl.c index 25516cf..7dc7fb7 100644 --- a/src/jtag/tcl.c +++ b/src/jtag/tcl.c @@ -40,6 +40,11 @@ #include <strings.h> #endif +/** + * @file + * Holds support for accessing JTAG-specific mechanisms from TCl scripts. + */ + static const Jim_Nvp nvp_jtag_tap_event[] = { { .value = JTAG_TRST_ASSERTED, .name = "post-reset" }, { .value = JTAG_TAP_EVENT_SETUP, .name = "setup" }, @@ -671,24 +676,6 @@ static void jtag_tap_handle_event(struct jtag_tap *tap, enum jtag_event e) } } -static int -jim_jtag_interface(Jim_Interp *interp, int argc, Jim_Obj *const *argv) -{ - Jim_GetOptInfo goi; - Jim_GetOpt_Setup(&goi, interp, argc-1, argv + 1); - - /* return the name of the interface */ - /* TCL code might need to know the exact type... */ - /* FUTURE: we allow this as a means to "set" the interface. */ - if (goi.argc != 0) { - Jim_WrongNumArgs(goi.interp, 1, goi.argv-1, "(no params)"); - return JIM_ERR; - } - const char *name = jtag_interface ? jtag_interface->name : NULL; - Jim_SetResultString(goi.interp, name ? : "undefined", -1); - return JIM_OK; -} - static int jim_jtag_arp_init(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { Jim_GetOptInfo goi; @@ -863,12 +850,6 @@ static const struct command_registration jtag_subcommand_handlers[] = { .help = "initialize jtag scan chain", }, { - .name = "interface", - .mode = COMMAND_ANY, - .jim_handler = jim_jtag_interface, - .help = "Returns the name of the currently selected interface.", - }, - { .name = "arp_init", .mode = COMMAND_ANY, .jim_handler = jim_jtag_arp_init, @@ -957,93 +938,6 @@ void jtag_notify_event(enum jtag_event event) } -static int default_khz(int khz, int *jtag_speed) -{ - LOG_ERROR("Translation from khz to jtag_speed not implemented"); - return ERROR_FAIL; -} - -static int default_speed_div(int speed, int *khz) -{ - LOG_ERROR("Translation from jtag_speed to khz not implemented"); - return ERROR_FAIL; -} - -static int default_power_dropout(int *dropout) -{ - *dropout = 0; /* by default we can't detect power dropout */ - return ERROR_OK; -} - -static int default_srst_asserted(int *srst_asserted) -{ - *srst_asserted = 0; /* by default we can't detect srst asserted */ - return ERROR_OK; -} - -COMMAND_HANDLER(handle_interface_list_command) -{ - if (strcmp(CMD_NAME, "interface_list") == 0 && CMD_ARGC > 0) - return ERROR_COMMAND_SYNTAX_ERROR; - - command_print(CMD_CTX, "The following debug interfaces are available:"); - for (unsigned i = 0; NULL != jtag_interfaces[i]; i++) - { - const char *name = jtag_interfaces[i]->name; - command_print(CMD_CTX, "%u: %s", i + 1, name); - } - - return ERROR_OK; -} - -COMMAND_HANDLER(handle_interface_command) -{ - /* check whether the interface is already configured */ - if (jtag_interface) - { - LOG_WARNING("Interface already configured, ignoring"); - return ERROR_OK; - } - - /* interface name is a mandatory argument */ - if (CMD_ARGC != 1 || CMD_ARGV[0][0] == '\0') - return ERROR_COMMAND_SYNTAX_ERROR; - - for (unsigned i = 0; NULL != jtag_interfaces[i]; i++) - { - if (strcmp(CMD_ARGV[0], jtag_interfaces[i]->name) != 0) - continue; - - if (NULL != jtag_interfaces[i]->commands) - { - int retval = register_commands(CMD_CTX, NULL, - jtag_interfaces[i]->commands); - if (ERROR_OK != retval) - return retval; - } - - jtag_interface = jtag_interfaces[i]; - - if (jtag_interface->khz == NULL) - jtag_interface->khz = default_khz; - if (jtag_interface->speed_div == NULL) - jtag_interface->speed_div = default_speed_div; - if (jtag_interface->power_dropout == NULL) - jtag_interface->power_dropout = default_power_dropout; - if (jtag_interface->srst_asserted == NULL) - jtag_interface->srst_asserted = default_srst_asserted; - - return ERROR_OK; - } - - /* no valid interface was found (i.e. the configuration option, - * didn't match one of the compiled-in interfaces - */ - LOG_ERROR("The specified debug interface was not found (%s)", CMD_ARGV[0]); - CALL_COMMAND_HANDLER(handle_interface_list_command); - return ERROR_JTAG_INVALID_INTERFACE; -} - COMMAND_HANDLER(handle_scan_chain_command) { struct jtag_tap *tap; @@ -1096,217 +990,6 @@ COMMAND_HANDLER(handle_scan_chain_command) return ERROR_OK; } -COMMAND_HANDLER(handle_reset_config_command) -{ - int new_cfg = 0; - int mask = 0; - - /* Original versions cared about the order of these tokens: - * reset_config signals [combination [trst_type [srst_type]]] - * They also clobbered the previous configuration even on error. - * - * Here we don't care about the order, and only change values - * which have been explicitly specified. - */ - for (; CMD_ARGC; CMD_ARGC--, CMD_ARGV++) { - int tmp = 0; - int m; - - /* gating */ - m = RESET_SRST_NO_GATING; - if (strcmp(*CMD_ARGV, "srst_gates_jtag") == 0) - /* default: don't use JTAG while SRST asserted */; - else if (strcmp(*CMD_ARGV, "srst_nogate") == 0) - tmp = RESET_SRST_NO_GATING; - else - m = 0; - if (mask & m) { - LOG_ERROR("extra reset_config %s spec (%s)", - "gating", *CMD_ARGV); - return ERROR_INVALID_ARGUMENTS; - } - if (m) - goto next; - - /* signals */ - m = RESET_HAS_TRST | RESET_HAS_SRST; - if (strcmp(*CMD_ARGV, "none") == 0) - tmp = RESET_NONE; - else if (strcmp(*CMD_ARGV, "trst_only") == 0) - tmp = RESET_HAS_TRST; - else if (strcmp(*CMD_ARGV, "srst_only") == 0) - tmp = RESET_HAS_SRST; - else if (strcmp(*CMD_ARGV, "trst_and_srst") == 0) - tmp = RESET_HAS_TRST | RESET_HAS_SRST; - else - m = 0; - if (mask & m) { - LOG_ERROR("extra reset_config %s spec (%s)", - "signal", *CMD_ARGV); - return ERROR_INVALID_ARGUMENTS; - } - if (m) - goto next; - - /* combination (options for broken wiring) */ - m = RESET_SRST_PULLS_TRST | RESET_TRST_PULLS_SRST; - if (strcmp(*CMD_ARGV, "separate") == 0) - /* separate reset lines - default */; - else if (strcmp(*CMD_ARGV, "srst_pulls_trst") == 0) - tmp |= RESET_SRST_PULLS_TRST; - else if (strcmp(*CMD_ARGV, "trst_pulls_srst") == 0) - tmp |= RESET_TRST_PULLS_SRST; - else if (strcmp(*CMD_ARGV, "combined") == 0) - tmp |= RESET_SRST_PULLS_TRST | RESET_TRST_PULLS_SRST; - else - m = 0; - if (mask & m) { - LOG_ERROR("extra reset_config %s spec (%s)", - "combination", *CMD_ARGV); - return ERROR_INVALID_ARGUMENTS; - } - if (m) - goto next; - - /* trst_type (NOP without HAS_TRST) */ - m = RESET_TRST_OPEN_DRAIN; - if (strcmp(*CMD_ARGV, "trst_open_drain") == 0) - tmp |= RESET_TRST_OPEN_DRAIN; - else if (strcmp(*CMD_ARGV, "trst_push_pull") == 0) - /* push/pull from adapter - default */; - else - m = 0; - if (mask & m) { - LOG_ERROR("extra reset_config %s spec (%s)", - "trst_type", *CMD_ARGV); - return ERROR_INVALID_ARGUMENTS; - } - if (m) - goto next; - - /* srst_type (NOP without HAS_SRST) */ - m |= RESET_SRST_PUSH_PULL; - if (strcmp(*CMD_ARGV, "srst_push_pull") == 0) - tmp |= RESET_SRST_PUSH_PULL; - else if (strcmp(*CMD_ARGV, "srst_open_drain") == 0) - /* open drain from adapter - default */; - else - m = 0; - if (mask & m) { - LOG_ERROR("extra reset_config %s spec (%s)", - "srst_type", *CMD_ARGV); - return ERROR_INVALID_ARGUMENTS; - } - if (m) - goto next; - - /* caller provided nonsense; fail */ - LOG_ERROR("unknown reset_config flag (%s)", *CMD_ARGV); - return ERROR_INVALID_ARGUMENTS; - -next: - /* Remember the bits which were specified (mask) - * and their new values (new_cfg). - */ - mask |= m; - new_cfg |= tmp; - } - - /* clear previous values of those bits, save new values */ - if (mask) { - int old_cfg = jtag_get_reset_config(); - - old_cfg &= ~mask; - new_cfg |= old_cfg; - jtag_set_reset_config(new_cfg); - } else - new_cfg = jtag_get_reset_config(); - - - /* - * Display the (now-)current reset mode - */ - char *modes[5]; - - /* minimal JTAG has neither SRST nor TRST (so that's the default) */ - switch (new_cfg & (RESET_HAS_TRST | RESET_HAS_SRST)) { - case RESET_HAS_SRST: - modes[0] = "srst_only"; - break; - case RESET_HAS_TRST: - modes[0] = "trst_only"; - break; - case RESET_TRST_AND_SRST: - modes[0] = "trst_and_srst"; - break; - default: - modes[0] = "none"; - break; - } - - /* normally SRST and TRST are decoupled; but bugs happen ... */ - switch (new_cfg & (RESET_SRST_PULLS_TRST | RESET_TRST_PULLS_SRST)) { - case RESET_SRST_PULLS_TRST: - modes[1] = "srst_pulls_trst"; - break; - case RESET_TRST_PULLS_SRST: - modes[1] = "trst_pulls_srst"; - break; - case RESET_SRST_PULLS_TRST | RESET_TRST_PULLS_SRST: - modes[1] = "combined"; - break; - default: - modes[1] = "separate"; - break; - } - - /* TRST-less connectors include Altera, Xilinx, and minimal JTAG */ - if (new_cfg & RESET_HAS_TRST) { - if (new_cfg & RESET_TRST_OPEN_DRAIN) - modes[3] = " trst_open_drain"; - else - modes[3] = " trst_push_pull"; - } else - modes[3] = ""; - - /* SRST-less connectors include TI-14, Xilinx, and minimal JTAG */ - if (new_cfg & RESET_HAS_SRST) { - if (new_cfg & RESET_SRST_NO_GATING) - modes[2] = " srst_nogate"; - else - modes[2] = " srst_gates_jtag"; - - if (new_cfg & RESET_SRST_PUSH_PULL) - modes[4] = " srst_push_pull"; - else - modes[4] = " srst_open_drain"; - } else { - modes[2] = ""; - modes[4] = ""; - } - - command_print(CMD_CTX, "%s %s%s%s%s", - modes[0], modes[1], - modes[2], modes[3], modes[4]); - - return ERROR_OK; -} - -COMMAND_HANDLER(handle_adapter_nsrst_delay_command) -{ - if (CMD_ARGC > 1) - return ERROR_COMMAND_SYNTAX_ERROR; - if (CMD_ARGC == 1) - { - unsigned delay; - COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], delay); - - jtag_set_nsrst_delay(delay); - } - command_print(CMD_CTX, "adapter_nsrst_delay: %u", jtag_get_nsrst_delay()); - return ERROR_OK; -} - COMMAND_HANDLER(handle_jtag_ntrst_delay_command) { if (CMD_ARGC > 1) @@ -1322,21 +1005,6 @@ COMMAND_HANDLER(handle_jtag_ntrst_delay_command) return ERROR_OK; } -COMMAND_HANDLER(handle_adapter_nsrst_assert_width_command) -{ - if (CMD_ARGC > 1) - return ERROR_COMMAND_SYNTAX_ERROR; - if (CMD_ARGC == 1) - { - unsigned delay; - COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], delay); - - jtag_set_nsrst_assert_width(delay); - } - command_print(CMD_CTX, "adapter_nsrst_assert_width: %u", jtag_get_nsrst_assert_width()); - return ERROR_OK; -} - COMMAND_HANDLER(handle_jtag_ntrst_assert_width_command) { if (CMD_ARGC > 1) @@ -1352,35 +1020,6 @@ COMMAND_HANDLER(handle_jtag_ntrst_assert_width_command) return ERROR_OK; } -COMMAND_HANDLER(handle_adapter_khz_command) -{ - if (CMD_ARGC > 1) - return ERROR_COMMAND_SYNTAX_ERROR; - - int retval = ERROR_OK; - if (CMD_ARGC == 1) - { - unsigned khz = 0; - COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], khz); - - retval = jtag_config_khz(khz); - if (ERROR_OK != retval) - return retval; - } - - int cur_speed = jtag_get_speed_khz(); - retval = jtag_get_speed_readable(&cur_speed); - if (ERROR_OK != retval) - return retval; - - if (cur_speed) - command_print(CMD_CTX, "%d kHz", cur_speed); - else - command_print(CMD_CTX, "RCLK - adaptive"); - - return retval; -} - COMMAND_HANDLER(handle_jtag_rclk_command) { if (CMD_ARGC > 1) @@ -1608,69 +1247,6 @@ COMMAND_HANDLER(handle_tms_sequence_command) return ERROR_OK; } -static const struct command_registration interface_command_handlers[] = { - { - .name = "adapter_khz", - .handler = handle_adapter_khz_command, - .mode = COMMAND_ANY, - .help = "With an argument, change to the specified maximum " - "jtag speed. For JTAG, 0 KHz signifies adaptive " - " clocking. " - "With or without argument, display current setting.", - .usage = "[khz]", - }, - { - .name = "adapter_nsrst_assert_width", - .handler = handle_adapter_nsrst_assert_width_command, - .mode = COMMAND_ANY, - .help = "delay after asserting SRST in ms", - .usage = "[milliseconds]", - }, - { - .name = "adapter_nsrst_delay", - .handler = handle_adapter_nsrst_delay_command, - .mode = COMMAND_ANY, - .help = "delay after deasserting SRST in ms", - .usage = "[milliseconds]", - }, - { - .name = "interface", - .handler = handle_interface_command, - .mode = COMMAND_CONFIG, - .help = "Select a debug adapter interface (driver)", - .usage = "driver_name", - }, - { - .name = "interface_list", - .handler = handle_interface_list_command, - .mode = COMMAND_ANY, - .help = "List all built-in debug adapter interfaces (drivers)", - }, - { - .name = "reset_config", - .handler = handle_reset_config_command, - .mode = COMMAND_ANY, - .help = "configure adapter reset behavior", - .usage = "[none|trst_only|srst_only|trst_and_srst] " - "[srst_pulls_trst|trst_pulls_srst|combined|separate] " - "[srst_gates_jtag|srst_nogate] " - "[trst_push_pull|trst_open_drain] " - "[srst_push_pull|srst_open_drain]", - }, - COMMAND_REGISTRATION_DONE -}; - -/** - * Register the commands which deal with arbitrary debug adapter drivers. - * - * @todo Remove internal assumptions that all debug adapters use JTAG for - * transport. Various types and data structures are not named generically. - */ -int interface_register_commands(struct command_context *ctx) -{ - return register_commands(ctx, NULL, interface_command_handlers); -} - static const struct command_registration jtag_command_handlers[] = { { .name = "jtag_rclk", ----------------------------------------------------------------------- Summary of changes: NEWS | 3 +- doc/openocd.texi | 6 +- src/jtag/Makefile.am | 1 + src/jtag/adapter.c | 459 ++++++++++++++++++++++++++++++++++++++++++++++++++ src/jtag/startup.tcl | 2 +- src/jtag/tcl.c | 434 +---------------------------------------------- 6 files changed, 471 insertions(+), 434 deletions(-) create mode 100644 src/jtag/adapter.c hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2010-03-26 09:16:00
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via a092e8d237e7d23b1b952c4d400d8210523f9ce2 (commit) from 27b98c2fa548a46bbd2e3f5417160bbfb6eb89a1 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit a092e8d237e7d23b1b952c4d400d8210523f9ce2 Author: Antonio Borneo <bor...@gm...> Date: Fri Mar 26 15:54:33 2010 +0800 NOR TCL: fix usage message The command "flash bank" has updated syntax. Add the mandatory parameter <target> to the usage message that prints in case of error. Signed-off-by: Antonio Borneo <bor...@gm...> diff --git a/src/flash/nor/tcl.c b/src/flash/nor/tcl.c index 38cb655..fc7169f 100644 --- a/src/flash/nor/tcl.c +++ b/src/flash/nor/tcl.c @@ -789,7 +789,7 @@ COMMAND_HANDLER(handle_flash_bank_command) if (CMD_ARGC < 7) { LOG_ERROR("usage: flash bank <name> <driver> " - "<base> <size> <chip_width> <bus_width>"); + "<base> <size> <chip_width> <bus_width> <target>"); return ERROR_COMMAND_SYNTAX_ERROR; } // save bank name and advance arguments for compatibility ----------------------------------------------------------------------- Summary of changes: src/flash/nor/tcl.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2010-03-26 08:44:12
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 27b98c2fa548a46bbd2e3f5417160bbfb6eb89a1 (commit) from ed81249129d4b43159843712efa408660cf4c03d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 27b98c2fa548a46bbd2e3f5417160bbfb6eb89a1 Author: Antonio Borneo <bor...@gm...> Date: Fri Mar 26 15:17:46 2010 +0800 TCL scripts: update to current "flash bank" syntax While "flash bank" syntax has been changed long ago, several tcl script are still not fully update. Fix following cases related with "cfi" driver: - syntax error: the mandatory <name> parameter is missing - warning: the <target> parameter is a number, instead of the target name - the comment line above the command does not report actual syntax Signed-off-by: Antonio Borneo <bor...@gm...> diff --git a/tcl/board/at91rm9200-dk.cfg b/tcl/board/at91rm9200-dk.cfg index 476f5a8..af6e3df 100644 --- a/tcl/board/at91rm9200-dk.cfg +++ b/tcl/board/at91rm9200-dk.cfg @@ -8,8 +8,9 @@ source [find target/at91rm9200.cfg] $_TARGETNAME configure -event gdb-attach { reset init } $_TARGETNAME configure -event reset-init { at91rm9200_dk_init } -#flash bank <driver> <base> <size> <chip_width> <bus_width> -flash_bank cfi 0x10000000 0x00200000 2 2 0 +#flash bank <name> <driver> <base> <size> <chip_width> <bus_width> <target> +set _FLASHNAME $_CHIPNAME.flash +flash_bank $_FLASHNAME cfi 0x10000000 0x00200000 2 2 $_TARGETNAME proc at91rm9200_dk_init { } { diff --git a/tcl/board/balloon3-cpu.cfg b/tcl/board/balloon3-cpu.cfg index ecb1a28..468b867 100644 --- a/tcl/board/balloon3-cpu.cfg +++ b/tcl/board/balloon3-cpu.cfg @@ -8,7 +8,7 @@ source [find target/pxa270.cfg] # Override this in the interface config for parallel dongles reset_config trst_and_srst separate -# flash bank <driver> <base> <size> <chip_width> <bus_width> +# flash bank <name> <driver> <base> <size> <chip_width> <bus_width> <target> # 29LV650 64Mbit Flash set _FLASHNAME $_CHIPNAME.flash -flash bank $_FLASHNAME cfi 0x00000000 0x800000 2 2 0 +flash bank $_FLASHNAME cfi 0x00000000 0x800000 2 2 $_TARGETNAME diff --git a/tcl/board/digi_connectcore_wi-9c.cfg b/tcl/board/digi_connectcore_wi-9c.cfg index ad40d53..096af1b 100644 --- a/tcl/board/digi_connectcore_wi-9c.cfg +++ b/tcl/board/digi_connectcore_wi-9c.cfg @@ -125,6 +125,6 @@ $_TARGETNAME configure -work-area-phys 0x00000000 -work-area-size 0x1000 -work-a ##################### #M29DW323DB - not working -#flash bank cfi <base> <size> <chip width> <bus width> <target#> +#flash bank <name> cfi <base> <size> <chip width> <bus width> <target> set _FLASHNAME $_CHIPNAME.flash -flash bank $_FLASHNAME cfi 0x50000000 0x0400000 2 2 0 +flash bank $_FLASHNAME cfi 0x50000000 0x0400000 2 2 $_TARGETNAME diff --git a/tcl/board/dm6446evm.cfg b/tcl/board/dm6446evm.cfg index 39607fe..dcd1c4e 100644 --- a/tcl/board/dm6446evm.cfg +++ b/tcl/board/dm6446evm.cfg @@ -31,7 +31,8 @@ if { [info exists J4_OPTION] } { if { $CS2_MODE == "NOR" } { # 16 Mbytes address space; 16 bit bus width # (older boards used 32MB parts, with upper 16 MB unusable) - flash bank cfi 0x02000000 0x01000000 2 2 $_TARGETNAME + set _FLASHNAME $_CHIPNAME.flash + flash bank $_FLASHNAME cfi 0x02000000 0x01000000 2 2 $_TARGETNAME proc flashprobe {} { flash probe 0 } } elseif { $CS2_MODE == "NAND" } { # 64 Mbyte small page; 8 bit bus width diff --git a/tcl/board/hammer.cfg b/tcl/board/hammer.cfg index d366a45..ea3da81 100644 --- a/tcl/board/hammer.cfg +++ b/tcl/board/hammer.cfg @@ -32,6 +32,6 @@ $_TARGETNAME configure -event reset-init { #flash configuration -#flash bank <driver> <base> <size> <chip_width> <bus_width> [driver_options ...] +#flash bank <name> <driver> <base> <size> <chip_width> <bus_width> <target> [driver_options ...] set _FLASHNAME $_CHIPNAME.flash -flash bank $_FLASHNAME cfi 0x00000000 0x1000000 2 2 0 +flash bank $_FLASHNAME cfi 0x00000000 0x1000000 2 2 $_TARGETNAME diff --git a/tcl/board/imx27ads.cfg b/tcl/board/imx27ads.cfg index 664b470..927647a 100644 --- a/tcl/board/imx27ads.cfg +++ b/tcl/board/imx27ads.cfg @@ -5,7 +5,8 @@ $_TARGETNAME configure -event gdb-attach { reset init } $_TARGETNAME configure -event reset-init { imx27ads_init } # The IMX27 ADS board has a NOR flash on CS0 -flash_bank cfi 0xc0000000 0x00200000 2 2 0 +set _FLASHNAME $_CHIPNAME.flash +flash_bank $_FLASHNAME cfi 0xc0000000 0x00200000 2 2 $_TARGETNAME proc imx27ads_init { } { # This setup puts RAM at 0xA0000000 diff --git a/tcl/board/logicpd_imx27.cfg b/tcl/board/logicpd_imx27.cfg index b068f1a..02afc77 100644 --- a/tcl/board/logicpd_imx27.cfg +++ b/tcl/board/logicpd_imx27.cfg @@ -2,7 +2,8 @@ source [find target/imx27.cfg] # The Logic PD board has a NOR flash on CS0 -flash_bank cfi 0xc0000000 0x00200000 2 2 0 +set _FLASHNAME $_CHIPNAME.flash +flash_bank $_FLASHNAME cfi 0xc0000000 0x00200000 2 2 $_TARGETNAME # # FIX ME, Add support to diff --git a/tcl/board/topas910.cfg b/tcl/board/topas910.cfg index 303fc77..333b016 100644 --- a/tcl/board/topas910.cfg +++ b/tcl/board/topas910.cfg @@ -114,6 +114,6 @@ arm7_9 dcc_downloads enable # Enable faster DCC downloads # Flash configuration ##################### -#flash bank cfi <base> <size> <chip width> <bus width> <target#> +#flash bank <name> cfi <base> <size> <chip width> <bus width> <target> set _FLASHNAME $_CHIPNAME.flash -flash bank $_FLASHNAME cfi 0x20000000 0x2000000 2 2 0 +flash bank $_FLASHNAME cfi 0x20000000 0x2000000 2 2 $_TARGETNAME diff --git a/tcl/board/topasa900.cfg b/tcl/board/topasa900.cfg index aa3f77f..065cd31 100644 --- a/tcl/board/topasa900.cfg +++ b/tcl/board/topasa900.cfg @@ -120,7 +120,7 @@ arm7_9 dcc_downloads enable # Enable faster DCC downloads # Flash configuration ##################### -#flash bank cfi <base> <size> <chip width> <bus width> <target#> +#flash bank <name> cfi <base> <size> <chip width> <bus width> <target> set _FLASHNAME $_CHIPNAME.flash -flash bank $_FLASHNAME cfi 0x20000000 0x1000000 2 2 0 +flash bank $_FLASHNAME cfi 0x20000000 0x1000000 2 2 $_TARGETNAME diff --git a/tcl/board/unknown_at91sam9260.cfg b/tcl/board/unknown_at91sam9260.cfg index ad7b13c..845de6b 100644 --- a/tcl/board/unknown_at91sam9260.cfg +++ b/tcl/board/unknown_at91sam9260.cfg @@ -90,8 +90,8 @@ $_TARGETNAME configure -event reset-init { # Flash configuration ##################### -#flash bank cfi <base> <size> <chip width> <bus width> <target#> +#flash bank <name> cfi <base> <size> <chip width> <bus width> <target> set _FLASHNAME $_CHIPNAME.flash -flash bank $_FLASHNAME cfi 0x10000000 0x01000000 2 2 0 +flash bank $_FLASHNAME cfi 0x10000000 0x01000000 2 2 $_TARGETNAME diff --git a/tcl/board/x300t.cfg b/tcl/board/x300t.cfg index d914180..9d9a320 100644 --- a/tcl/board/x300t.cfg +++ b/tcl/board/x300t.cfg @@ -7,9 +7,9 @@ source [find target/smp8634.cfg] $_TARGETNAME configure -event reset-init { x300t_init } # 1MB CFI capable flash -# flash bank <driver> <base> <size> <chip_width> <bus_width> +# flash bank <name> <driver> <base> <size> <chip_width> <bus_width> <target> set _FLASHNAME $_CHIPNAME.flash -flash bank $_FLASHNAME cfi 0xac000000 0x100000 2 2 0 +flash bank $_FLASHNAME cfi 0xac000000 0x100000 2 2 $_TARGETNAME proc x300t_init { } { # Setup SDRAM config and flash mapping diff --git a/tcl/target/at91sam9260_ext_RAM_ext_flash.cfg b/tcl/target/at91sam9260_ext_RAM_ext_flash.cfg index 034a348..d2bf66f 100644 --- a/tcl/target/at91sam9260_ext_RAM_ext_flash.cfg +++ b/tcl/target/at91sam9260_ext_RAM_ext_flash.cfg @@ -54,7 +54,7 @@ $_TARGETNAME configure -event reset-deassert-post {at91sam_init} # Flash configuration -#flash bank cfi <base> <size> <chip width> <bus width> <target#> +#flash bank <name> cfi <base> <size> <chip width> <bus width> <target> set _FLASHNAME $_CHIPNAME.flash flash bank $_FLASHNAME cfi 0x10000000 0x01000000 2 2 $_TARGETNAME ----------------------------------------------------------------------- Summary of changes: tcl/board/at91rm9200-dk.cfg | 5 +++-- tcl/board/balloon3-cpu.cfg | 4 ++-- tcl/board/digi_connectcore_wi-9c.cfg | 4 ++-- tcl/board/dm6446evm.cfg | 3 ++- tcl/board/hammer.cfg | 4 ++-- tcl/board/imx27ads.cfg | 3 ++- tcl/board/logicpd_imx27.cfg | 3 ++- tcl/board/topas910.cfg | 4 ++-- tcl/board/topasa900.cfg | 4 ++-- tcl/board/unknown_at91sam9260.cfg | 4 ++-- tcl/board/x300t.cfg | 4 ++-- tcl/target/at91sam9260_ext_RAM_ext_flash.cfg | 2 +- 12 files changed, 24 insertions(+), 20 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2010-03-25 20:47:57
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via ed81249129d4b43159843712efa408660cf4c03d (commit) from ed6756fb23fc7383ec7a4a831a8750a6cf5eaa4e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit ed81249129d4b43159843712efa408660cf4c03d Author: Ãyvind Harboe <oyv...@zy...> Date: Thu Mar 4 19:58:42 2010 +0100 zy1000: dev tool first cut peek/poke over tcp/ip, used for debug/research purposes only. Long term JTAG over TCP/IP might be an offshoot. The performance is usable for development/testing purposes. Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/jtag/zy1000/jtag_minidriver.h b/src/jtag/zy1000/jtag_minidriver.h index 43d0c97..d556699 100644 --- a/src/jtag/zy1000/jtag_minidriver.h +++ b/src/jtag/zy1000/jtag_minidriver.h @@ -38,8 +38,11 @@ int diag_printf(const char *fmt, ...); #else /* redirect this to TCP/IP */ -#define ZY1000_PEEK(a, b) b = 1; -#define ZY1000_POKE(a, b) +#define ZY1000_JTAG_BASE 0 +extern void zy1000_tcpout(uint32_t address, uint32_t data); +extern uint32_t zy1000_tcpin(uint32_t address); +#define ZY1000_PEEK(a, b) b=zy1000_tcpin(a) +#define ZY1000_POKE(a, b) zy1000_tcpout(a, b) #endif diff --git a/src/jtag/zy1000/zy1000.c b/src/jtag/zy1000/zy1000.c index 907b965..80731aa 100644 --- a/src/jtag/zy1000/zy1000.c +++ b/src/jtag/zy1000/zy1000.c @@ -50,6 +50,7 @@ #include <jtag/interface.h> #include <time.h> +#include <netinet/tcp.h> #if BUILD_ECOSBOARD #include "zy1000_version.h" @@ -262,6 +263,18 @@ COMMAND_HANDLER(handle_power_command) return ERROR_OK; } +#if !BUILD_ECOSBOARD +static char *tcp_server = "notspecified"; +static int jim_zy1000_server(Jim_Interp *interp, int argc, Jim_Obj *const *argv) +{ + if (argc != 2) + return JIM_ERR; + + tcp_server = strdup(Jim_GetString(argv[1], NULL)); + + return JIM_OK; +} +#endif #if BUILD_ECOSBOARD /* Give TELNET a way to find out what version this is */ @@ -415,25 +428,6 @@ zylinjtag_Jim_Command_powerstatus(Jim_Interp *interp, - -int zy1000_init(void) -{ -#if BUILD_ECOSBOARD - LOG_USER("%s", ZYLIN_OPENOCD_VERSION); -#endif - - ZY1000_POKE(ZY1000_JTAG_BASE + 0x10, 0x30); // Turn on LED1 & LED2 - - setPower(true); // on by default - - - /* deassert resets. Important to avoid infinite loop waiting for SRST to deassert */ - zy1000_reset(0, 0); - zy1000_speed(jtag_get_speed()); - - return ERROR_OK; -} - int zy1000_quit(void) { @@ -710,12 +704,6 @@ int interface_jtag_add_clocks(int num_cycles) return zy1000_jtag_add_clocks(num_cycles, cmd_queue_cur_state, cmd_queue_cur_state); } -int interface_jtag_add_sleep(uint32_t us) -{ - jtag_sleep(us); - return ERROR_OK; -} - int interface_add_tms_seq(unsigned num_bits, const uint8_t *seq, enum tap_state state) { /*wait for the fifo to be empty*/ @@ -967,6 +955,14 @@ static const struct command_registration zy1000_commands[] = { .help = "Print version info for zy1000.", .usage = "['openocd'|'zy1000'|'date'|'time'|'pcb'|'fpga']", }, +#else + { + .name = "zy1000_server", + .mode = COMMAND_ANY, + .jim_handler = jim_zy1000_server, + .help = "Tcpip address for ZY1000 server.", + .usage = "address", + }, #endif { .name = "powerstatus", @@ -987,6 +983,320 @@ static const struct command_registration zy1000_commands[] = { }; +static int tcp_ip = -1; + +/* Write large packets if we can */ +static size_t out_pos; +static uint8_t out_buffer[16384]; +static size_t in_pos; +static size_t in_write; +static uint8_t in_buffer[16384]; + +static bool flush_writes(void) +{ + bool ok = (write(tcp_ip, out_buffer, out_pos) == (int)out_pos); + out_pos = 0; + return ok; +} + +static bool writeLong(uint32_t l) +{ + int i; + for (i = 0; i < 4; i++) + { + uint8_t c = (l >> (i*8))&0xff; + out_buffer[out_pos++] = c; + if (out_pos >= sizeof(out_buffer)) + { + if (!flush_writes()) + { + return false; + } + } + } + return true; +} + +static bool readLong(uint32_t *out_data) +{ + if (out_pos > 0) + { + if (!flush_writes()) + { + return false; + } + } + + uint32_t data = 0; + int i; + for (i = 0; i < 4; i++) + { + uint8_t c; + if (in_pos == in_write) + { + /* read more */ + int t; + t = read(tcp_ip, in_buffer, sizeof(in_buffer)); + if (t < 1) + { + return false; + } + in_write = (size_t) t; + in_pos = 0; + } + c = in_buffer[in_pos++]; + + data |= (c << (i*8)); + } + *out_data = data; + return true; +} + +enum ZY1000_CMD +{ + ZY1000_CMD_POKE = 0x0, + ZY1000_CMD_PEEK = 0x8, + ZY1000_CMD_SLEEP = 0x1, +}; + + +#if !BUILD_ECOSBOARD + +#include <sys/socket.h> /* for socket(), connect(), send(), and recv() */ +#include <arpa/inet.h> /* for sockaddr_in and inet_addr() */ + +/* We initialize this late since we need to know the server address + * first. + */ +static void tcpip_open(void) +{ + if (tcp_ip >= 0) + return; + + struct sockaddr_in echoServAddr; /* Echo server address */ + + /* Create a reliable, stream socket using TCP */ + if ((tcp_ip = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) + { + fprintf(stderr, "Failed to connect to zy1000 server\n"); + exit(-1); + } + + /* Construct the server address structure */ + memset(&echoServAddr, 0, sizeof(echoServAddr)); /* Zero out structure */ + echoServAddr.sin_family = AF_INET; /* Internet address family */ + echoServAddr.sin_addr.s_addr = inet_addr(tcp_server); /* Server IP address */ + echoServAddr.sin_port = htons(7777); /* Server port */ + + /* Establish the connection to the echo server */ + if (connect(tcp_ip, (struct sockaddr *) &echoServAddr, sizeof(echoServAddr)) < 0) + { + fprintf(stderr, "Failed to connect to zy1000 server\n"); + exit(-1); + } + + int flag = 1; + setsockopt(tcp_ip, /* socket affected */ + IPPROTO_TCP, /* set option at TCP level */ + TCP_NODELAY, /* name of option */ + (char *)&flag, /* the cast is historical cruft */ + sizeof(int)); /* length of option value */ + +} + + +/* send a poke */ +void zy1000_tcpout(uint32_t address, uint32_t data) +{ + tcpip_open(); + if (!writeLong((ZY1000_CMD_POKE << 24) | address)|| + !writeLong(data)) + { + fprintf(stderr, "Could not write to zy1000 server\n"); + exit(-1); + } +} + +uint32_t zy1000_tcpin(uint32_t address) +{ + tcpip_open(); + uint32_t data; + if (!writeLong((ZY1000_CMD_PEEK << 24) | address)|| + !readLong(&data)) + { + fprintf(stderr, "Could not read from zy1000 server\n"); + exit(-1); + } + return data; +} + +int interface_jtag_add_sleep(uint32_t us) +{ + tcpip_open(); + if (!writeLong((ZY1000_CMD_SLEEP << 24))|| + !writeLong(us)) + { + fprintf(stderr, "Could not read from zy1000 server\n"); + exit(-1); + } + return ERROR_OK; +} + + +#endif + +#if BUILD_ECOSBOARD +static char tcpip_stack[2048]; + +static cyg_thread tcpip_thread_object; +static cyg_handle_t tcpip_thread_handle; + +/* Infinite loop peeking & poking */ +static void tcpipserver(void) +{ + for (;;) + { + uint32_t address; + if (!readLong(&address)) + return; + enum ZY1000_CMD c = (address >> 24) & 0xff; + address &= 0xffffff; + switch (c) + { + case ZY1000_CMD_POKE: + { + uint32_t data; + if (!readLong(&data)) + return; + address &= ~0x80000000; + ZY1000_POKE(address + ZY1000_JTAG_BASE, data); + break; + } + case ZY1000_CMD_PEEK: + { + uint32_t data; + ZY1000_PEEK(address + ZY1000_JTAG_BASE, data); + if (!writeLong(data)) + return; + break; + } + case ZY1000_CMD_SLEEP: + { + uint32_t data; + if (!readLong(&data)) + return; + jtag_sleep(data); + break; + } + default: + return; + } + } +} + + +static void tcpip_server(cyg_addrword_t data) +{ + int so_reuseaddr_option = 1; + + int fd; + if ((fd = socket(AF_INET, SOCK_STREAM, 0)) == -1) + { + LOG_ERROR("error creating socket: %s", strerror(errno)); + exit(-1); + } + + setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (void*) &so_reuseaddr_option, + sizeof(int)); + + struct sockaddr_in sin; + unsigned int address_size; + address_size = sizeof(sin); + memset(&sin, 0, sizeof(sin)); + sin.sin_family = AF_INET; + sin.sin_addr.s_addr = INADDR_ANY; + sin.sin_port = htons(7777); + + if (bind(fd, (struct sockaddr *) &sin, sizeof(sin)) == -1) + { + LOG_ERROR("couldn't bind to socket: %s", strerror(errno)); + exit(-1); + } + + if (listen(fd, 1) == -1) + { + LOG_ERROR("couldn't listen on socket: %s", strerror(errno)); + exit(-1); + } + + + for (;;) + { + tcp_ip = accept(fd, (struct sockaddr *) &sin, &address_size); + if (tcp_ip < 0) + { + continue; + } + + int flag = 1; + setsockopt(tcp_ip, /* socket affected */ + IPPROTO_TCP, /* set option at TCP level */ + TCP_NODELAY, /* name of option */ + (char *)&flag, /* the cast is historical cruft */ + sizeof(int)); /* length of option value */ + + bool save_poll = jtag_poll_get_enabled(); + + /* polling will screw up the "connection" */ + jtag_poll_set_enabled(false); + + tcpipserver(); + + jtag_poll_set_enabled(save_poll); + + close(tcp_ip); + + } + close(fd); + +} + +int interface_jtag_add_sleep(uint32_t us) +{ + jtag_sleep(us); + return ERROR_OK; +} + +#endif + + +int zy1000_init(void) +{ +#if BUILD_ECOSBOARD + LOG_USER("%s", ZYLIN_OPENOCD_VERSION); +#endif + + ZY1000_POKE(ZY1000_JTAG_BASE + 0x10, 0x30); // Turn on LED1 & LED2 + + setPower(true); // on by default + + + /* deassert resets. Important to avoid infinite loop waiting for SRST to deassert */ + zy1000_reset(0, 0); + zy1000_speed(jtag_get_speed()); + + +#if BUILD_ECOSBOARD + cyg_thread_create(1, tcpip_server, (cyg_addrword_t) 0, "tcip/ip server", + (void *) tcpip_stack, sizeof(tcpip_stack), + &tcpip_thread_handle, &tcpip_thread_object); + cyg_thread_resume(tcpip_thread_handle); +#endif + + return ERROR_OK; +} + + struct jtag_interface zy1000_interface = { ----------------------------------------------------------------------- Summary of changes: src/jtag/zy1000/jtag_minidriver.h | 7 +- src/jtag/zy1000/zy1000.c | 360 ++++++++++++++++++++++++++++++++++--- 2 files changed, 340 insertions(+), 27 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2010-03-25 20:47:41
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via ed6756fb23fc7383ec7a4a831a8750a6cf5eaa4e (commit) from 010492a1ede305d2375602afa26f50281fea3e2f (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit ed6756fb23fc7383ec7a4a831a8750a6cf5eaa4e Author: Ãyvind Harboe <oyv...@zy...> Date: Thu Mar 25 13:06:23 2010 +0100 target: fix poll off I don't know when "poll off" broke, but "poll off" didn't stop background polling of target. The polling status flag simply wasn't checked in the handle_target timer callback. All target polling(including power/reset state) is now stopped upon "poll off". Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/target/target.c b/src/target/target.c index 2c88a6f..868241e 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -1784,6 +1784,12 @@ static int handle_target(void *priv) Jim_Interp *interp = (Jim_Interp *)priv; int retval = ERROR_OK; + if (!is_jtag_poll_safe()) + { + /* polling is disabled currently */ + return ERROR_OK; + } + /* we do not want to recurse here... */ static int recursive = 0; if (! recursive) ----------------------------------------------------------------------- Summary of changes: src/target/target.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2010-03-25 12:47:29
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 010492a1ede305d2375602afa26f50281fea3e2f (commit) from e736468b0e25f255db60cfd6cb2f6a2e470ba50e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 010492a1ede305d2375602afa26f50281fea3e2f Author: Daniel Bäder <op...@eh...> Date: Thu Mar 25 11:24:42 2010 +0100 change %x and %d to PRIx32 and PRId32 where needed for cygwin diff --git a/src/flash/nand/lpc3180.c b/src/flash/nand/lpc3180.c index 6562e04..40324f2 100644 --- a/src/flash/nand/lpc3180.c +++ b/src/flash/nand/lpc3180.c @@ -817,7 +817,7 @@ static int lpc3180_write_page(struct nand_device *nand, uint32_t page, uint8_t * target_free_working_area(target,pworking_area); - LOG_INFO("Page = 0x%x was written.",page); + LOG_INFO("Page = 0x%" PRIx32 " was written.",page); } else @@ -1112,7 +1112,7 @@ static int lpc3180_read_page(struct nand_device *nand, uint32_t page, uint8_t *d target_read_memory(target, target_mem_base+DATA_OFFS, 4, nand->page_size == 2048?512:128, page_buffer); memcpy(data, page_buffer, data_size); - LOG_INFO("Page = 0x%x was read.",page); + LOG_INFO("Page = 0x%" PRIx32 " was read.",page); /* check hw generated ECC for each 256 bytes block with the saved ECC in flash spare area*/ int idx = nand->page_size/0x200 ; @@ -1120,9 +1120,9 @@ static int lpc3180_read_page(struct nand_device *nand, uint32_t page, uint8_t *d target_read_memory(target, target_mem_base+ECC_OFFS, 4, 8, ecc_hw_buffer); for(i=0;i<idx;i++){ if( (0x00ffffff&*(uint32_t *)(ecc_hw_buffer+i*8)) != (0x00ffffff&*(uint32_t *)(ecc_flash_buffer+8+i*16)) ) - LOG_WARNING("ECC mismatch at 256 bytes size block= %d at page= 0x%x",i*2+1,page); + LOG_WARNING("ECC mismatch at 256 bytes size block= %d at page= 0x%" PRIx32,i*2+1,page); if( (0x00ffffff&*(uint32_t *)(ecc_hw_buffer+4+i*8)) != (0x00ffffff&*(uint32_t *)(ecc_flash_buffer+12+i*16)) ) - LOG_WARNING("ECC mismatch at 256 bytes size block= %d at page= 0x%x",i*2+2,page); + LOG_WARNING("ECC mismatch at 256 bytes size block= %d at page= 0x%" PRIx32,i*2+2,page); } } diff --git a/src/flash/nor/pic32mx.c b/src/flash/nor/pic32mx.c index 36744e6..2540342 100644 --- a/src/flash/nor/pic32mx.c +++ b/src/flash/nor/pic32mx.c @@ -558,7 +558,7 @@ static int pic32mx_probe(struct flash_bank *bank) } } - LOG_INFO("flash size = %dkbytes", num_pages / 1024); + LOG_INFO("flash size = %" PRId32 "kbytes", num_pages / 1024); /* calculate numbers of pages */ num_pages /= page_size; diff --git a/src/target/arm_adi_v5.c b/src/target/arm_adi_v5.c index 1b97e33..8b18fa3 100644 --- a/src/target/arm_adi_v5.c +++ b/src/target/arm_adi_v5.c @@ -967,7 +967,7 @@ int ahbap_debugport_init(struct adiv5_dap *dap) retval = dap_queue_ap_read(dap, AP_REG_IDR, &idreg); retval = dap_queue_ap_read(dap, AP_REG_BASE, &romaddr); - LOG_DEBUG("MEM-AP #%d ID Register 0x%" PRIx32 + LOG_DEBUG("MEM-AP #%" PRId32 " ID Register 0x%" PRIx32 ", Debug ROM Address 0x%" PRIx32, dap->apsel, idreg, romaddr); diff --git a/src/target/arm_dpm.c b/src/target/arm_dpm.c index 8e8cc17..213afbd 100644 --- a/src/target/arm_dpm.c +++ b/src/target/arm_dpm.c @@ -718,7 +718,7 @@ static int dpm_bpwp_setup(struct arm_dpm *dpm, struct dpm_bpwp *xp, xp->control = control; xp->dirty = true; - LOG_DEBUG("BPWP: addr %8.8x, control %x, number %d", + LOG_DEBUG("BPWP: addr %8.8" PRIx32 ", control %" PRIx32 ", number %d", xp->address, control, xp->number); /* hardware is updated in write_dirty_registers() */ ----------------------------------------------------------------------- Summary of changes: src/flash/nand/lpc3180.c | 8 ++++---- src/flash/nor/pic32mx.c | 2 +- src/target/arm_adi_v5.c | 2 +- src/target/arm_dpm.c | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2010-03-25 11:13:02
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via e736468b0e25f255db60cfd6cb2f6a2e470ba50e (commit) from 4af724df238eb30569c2845b6160ef4e7f894ad1 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit e736468b0e25f255db60cfd6cb2f6a2e470ba50e Author: Ãyvind Harboe <oyv...@zy...> Date: Thu Mar 4 19:03:26 2010 +0100 zy1000: allow it to build on linux host for testing purposes For testing and checking the build this can be useful, it doesn't have any practical application outside development. Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/jtag/zy1000/jtag_minidriver.h b/src/jtag/zy1000/jtag_minidriver.h index 1dcf23a..43d0c97 100644 --- a/src/jtag/zy1000/jtag_minidriver.h +++ b/src/jtag/zy1000/jtag_minidriver.h @@ -17,14 +17,14 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#include <cyg/hal/hal_io.h> // low level i/o -#include <cyg/hal/hal_intr.h> // low level i/o - -//#define VERBOSE(a) a -#define VERBOSE(a) - /* used to test manual mode */ #define TEST_MANUAL() 0 +#define VERBOSE(a) + +#if BUILD_ECOSBOARD + +#include <cyg/hal/hal_io.h> // low level i/o +#include <cyg/hal/hal_intr.h> // low level i/o #if 0 int diag_printf(const char *fmt, ...); @@ -35,10 +35,20 @@ int diag_printf(const char *fmt, ...); #define ZY1000_POKE(a, b) HAL_WRITE_UINT32(a, b) #endif +#else + +/* redirect this to TCP/IP */ +#define ZY1000_PEEK(a, b) b = 1; +#define ZY1000_POKE(a, b) + +#endif + + + // FIFO empty? static __inline__ void waitIdle(void) { - cyg_uint32 empty; + uint32_t empty; do { ZY1000_PEEK(ZY1000_JTAG_BASE + 0x10, empty); @@ -53,7 +63,7 @@ static __inline__ void waitQueue(void) static __inline__ void sampleShiftRegister(void) { #if 0 - cyg_uint32 dummy; + uint32_t dummy; waitIdle(); ZY1000_PEEK(ZY1000_JTAG_BASE + 0xc, dummy); #endif @@ -61,7 +71,7 @@ static __inline__ void sampleShiftRegister(void) static __inline__ void setCurrentState(enum tap_state state) { - cyg_uint32 a; + uint32_t a; a = state; int repeat = 0; if (state == TAP_RESET) @@ -82,9 +92,9 @@ static __inline__ void setCurrentState(enum tap_state state) * Enter state and cause repeat transitions *out* of that state. So if the endState != state, then * the transition from state to endState counts as a transition out of state. */ -static __inline__ void shiftValueInner(const enum tap_state state, const enum tap_state endState, int repeat, cyg_uint32 value) +static __inline__ void shiftValueInner(const enum tap_state state, const enum tap_state endState, int repeat, uint32_t value) { - cyg_uint32 a,b; + uint32_t a,b; a = state; b = endState; waitQueue(); diff --git a/src/jtag/zy1000/zy1000.c b/src/jtag/zy1000/zy1000.c index b8abc89..907b965 100644 --- a/src/jtag/zy1000/zy1000.c +++ b/src/jtag/zy1000/zy1000.c @@ -48,13 +48,15 @@ #include <target/embeddedice.h> #include <jtag/minidriver.h> #include <jtag/interface.h> +#include <time.h> + + +#if BUILD_ECOSBOARD #include "zy1000_version.h" #include <cyg/hal/hal_io.h> // low level i/o #include <cyg/hal/hal_diag.h> -#include <time.h> - #ifdef CYGPKG_HAL_NIOS2 #include <cyg/hal/io.h> #include <cyg/firmwareutil/firmwareutil.h> @@ -66,6 +68,7 @@ #define ZYLIN_OPENOCD GIT_OPENOCD_VERSION #define ZYLIN_OPENOCD_VERSION "ZY1000 " ZYLIN_VERSION " " ZYLIN_DATE +#endif static int zy1000_khz(int khz, int *jtag_speed) { @@ -96,7 +99,7 @@ static int zy1000_speed_div(int speed, int *khz) static bool readPowerDropout(void) { - cyg_uint32 state; + uint32_t state; // sample and clear power dropout ZY1000_POKE(ZY1000_JTAG_BASE + 0x10, 0x80); ZY1000_PEEK(ZY1000_JTAG_BASE + 0x10, state); @@ -108,7 +111,7 @@ static bool readPowerDropout(void) static bool readSRST(void) { - cyg_uint32 state; + uint32_t state; // sample and clear SRST sensing ZY1000_POKE(ZY1000_JTAG_BASE + 0x10, 0x00000040); ZY1000_PEEK(ZY1000_JTAG_BASE + 0x10, state); @@ -260,6 +263,7 @@ COMMAND_HANDLER(handle_power_command) } +#if BUILD_ECOSBOARD /* Give TELNET a way to find out what version this is */ static int jim_zy1000_version(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { @@ -308,7 +312,7 @@ static int jim_zy1000_version(Jim_Interp *interp, int argc, Jim_Obj *const *argv * and actual FPGA */ static char *fpga_id = "0x12345678 0x12345678 0x12345678 0x12345678"; - cyg_uint32 id, timestamp; + uint32_t id, timestamp; HAL_READ_UINT32(SYSID_BASE, id); HAL_READ_UINT32(SYSID_BASE+4, timestamp); sprintf(fpga_id, "0x%08x 0x%08x 0x%08x 0x%08x", id, timestamp, SYSID_ID, SYSID_TIMESTAMP); @@ -333,7 +337,7 @@ static int jim_zy1000_version(Jim_Interp *interp, int argc, Jim_Obj *const *argv return JIM_OK; } - +#endif #ifdef CYGPKG_HAL_NIOS2 @@ -353,7 +357,7 @@ static void report_info(void *data, const char * format, va_list args) struct cyg_upgrade_info firmware_info = { - (cyg_uint8 *)0x84000000, + (uint8_t *)0x84000000, "/ram/firmware.phi", "Firmware", 0x0300000, @@ -401,7 +405,7 @@ zylinjtag_Jim_Command_powerstatus(Jim_Interp *interp, return JIM_ERR; } - cyg_uint32 status; + uint32_t status; ZY1000_PEEK(ZY1000_JTAG_BASE + 0x10, status); Jim_SetResult(interp, Jim_NewIntObj(interp, (status&0x80) != 0)); @@ -414,7 +418,9 @@ zylinjtag_Jim_Command_powerstatus(Jim_Interp *interp, int zy1000_init(void) { +#if BUILD_ECOSBOARD LOG_USER("%s", ZYLIN_OPENOCD_VERSION); +#endif ZY1000_POKE(ZY1000_JTAG_BASE + 0x10, 0x30); // Turn on LED1 & LED2 @@ -438,7 +444,7 @@ int zy1000_quit(void) int interface_jtag_execute_queue(void) { - cyg_uint32 empty; + uint32_t empty; waitIdle(); ZY1000_PEEK(ZY1000_JTAG_BASE + 0x10, empty); @@ -460,18 +466,18 @@ int interface_jtag_execute_queue(void) -static cyg_uint32 getShiftValue(void) +static uint32_t getShiftValue(void) { - cyg_uint32 value; + uint32_t value; waitIdle(); ZY1000_PEEK(ZY1000_JTAG_BASE + 0xc, value); VERBOSE(LOG_INFO("getShiftValue %08x", value)); return value; } #if 0 -static cyg_uint32 getShiftValueFlip(void) +static uint32_t getShiftValueFlip(void) { - cyg_uint32 value; + uint32_t value; waitIdle(); ZY1000_PEEK(ZY1000_JTAG_BASE + 0x18, value); VERBOSE(LOG_INFO("getShiftValue %08x (flipped)", value)); @@ -480,10 +486,10 @@ static cyg_uint32 getShiftValueFlip(void) #endif #if 0 -static void shiftValueInnerFlip(const tap_state_t state, const tap_state_t endState, int repeat, cyg_uint32 value) +static void shiftValueInnerFlip(const tap_state_t state, const tap_state_t endState, int repeat, uint32_t value) { VERBOSE(LOG_INFO("shiftValueInner %s %s %d %08x (flipped)", tap_state_name(state), tap_state_name(endState), repeat, value)); - cyg_uint32 a,b; + uint32_t a,b; a = state; b = endState; ZY1000_POKE(ZY1000_JTAG_BASE + 0xc, value); @@ -511,7 +517,7 @@ static __inline void scanBits(const uint8_t *out_value, uint8_t *in_value, int n // we have (num_bits + 7)/8 bytes of bits to toggle out. // bits are pushed out LSB to MSB - cyg_uint32 value; + uint32_t value; value = 0; if (out_value != NULL) { @@ -953,6 +959,7 @@ static const struct command_registration zy1000_commands[] = { "With no arguments, prints status.", .usage = "('on'|'off)", }, +#if BUILD_ECOSBOARD { .name = "zy1000_version", .mode = COMMAND_ANY, @@ -960,6 +967,7 @@ static const struct command_registration zy1000_commands[] = { .help = "Print version info for zy1000.", .usage = "['openocd'|'zy1000'|'date'|'time'|'pcb'|'fpga']", }, +#endif { .name = "powerstatus", .mode = COMMAND_ANY, ----------------------------------------------------------------------- Summary of changes: src/jtag/zy1000/jtag_minidriver.h | 32 +++++++++++++++++++---------- src/jtag/zy1000/zy1000.c | 40 ++++++++++++++++++++++-------------- 2 files changed, 45 insertions(+), 27 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2010-03-25 07:50:04
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 4af724df238eb30569c2845b6160ef4e7f894ad1 (commit) via ec28c674af428a968ddc8b0242913bde07b901c7 (commit) from d7dba8d346bed622ab4269723d1d1c8992d3353b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 4af724df238eb30569c2845b6160ef4e7f894ad1 Author: Antonio Borneo <bor...@gm...> Date: Wed Mar 24 13:45:29 2010 +0800 telnet_server: review unused symbols Remove unused function Signed-off-by: Antonio Borneo <bor...@gm...> diff --git a/src/server/telnet_server.c b/src/server/telnet_server.c index 46c8836..10caee3 100644 --- a/src/server/telnet_server.c +++ b/src/server/telnet_server.c @@ -580,18 +580,6 @@ static int telnet_connection_closed(struct connection *connection) return ERROR_OK; } -int telnet_set_prompt(struct connection *connection, char *prompt) -{ - struct telnet_connection *t_con = connection->priv; - - if (t_con->prompt != NULL) - free(t_con->prompt); - - t_con->prompt = strdup(prompt); - - return ERROR_OK; -} - int telnet_init(char *banner) { struct telnet_service *telnet_service = malloc(sizeof(struct telnet_service)); commit ec28c674af428a968ddc8b0242913bde07b901c7 Author: Antonio Borneo <bor...@gm...> Date: Wed Mar 24 13:44:40 2010 +0800 telnet_server: review scope of functions Add "static" qualifier to private functions. Signed-off-by: Antonio Borneo <bor...@gm...> diff --git a/src/server/telnet_server.c b/src/server/telnet_server.c index 94c8943..46c8836 100644 --- a/src/server/telnet_server.c +++ b/src/server/telnet_server.c @@ -44,7 +44,8 @@ static char *negotiate = * we write to it, we will fail. Subsequent write operations will * succeed. Shudder! */ -int telnet_write(struct connection *connection, const void *data, int len) +static int telnet_write(struct connection *connection, const void *data, + int len) { struct telnet_connection *t_con = connection->priv; if (t_con->closed) @@ -58,14 +59,14 @@ int telnet_write(struct connection *connection, const void *data, int len) return ERROR_SERVER_REMOTE_CLOSED; } -int telnet_prompt(struct connection *connection) +static int telnet_prompt(struct connection *connection) { struct telnet_connection *t_con = connection->priv; return telnet_write(connection, t_con->prompt, strlen(t_con->prompt)); } -int telnet_outputline(struct connection *connection, const char *line) +static int telnet_outputline(struct connection *connection, const char *line) { int len; @@ -93,14 +94,14 @@ int telnet_outputline(struct connection *connection, const char *line) return ERROR_OK; } -int telnet_output(struct command_context *cmd_ctx, const char* line) +static int telnet_output(struct command_context *cmd_ctx, const char* line) { struct connection *connection = cmd_ctx->output_handler_priv; return telnet_outputline(connection, line); } -void telnet_log_callback(void *priv, const char *file, unsigned line, +static void telnet_log_callback(void *priv, const char *file, unsigned line, const char *function, const char *string) { struct connection *connection = priv; @@ -132,7 +133,7 @@ void telnet_log_callback(void *priv, const char *file, unsigned line, telnet_write(connection, "\b", 1); } -int telnet_new_connection(struct connection *connection) +static int telnet_new_connection(struct connection *connection) { struct telnet_connection *telnet_connection = malloc(sizeof(struct telnet_connection)); struct telnet_service *telnet_service = connection->service->priv; @@ -177,7 +178,8 @@ int telnet_new_connection(struct connection *connection) return ERROR_OK; } -void telnet_clear_line(struct connection *connection, struct telnet_connection *t_con) +static void telnet_clear_line(struct connection *connection, + struct telnet_connection *t_con) { /* move to end of line */ if (t_con->line_cursor < t_con->line_size) @@ -194,7 +196,7 @@ void telnet_clear_line(struct connection *connection, struct telnet_connection * t_con->line_cursor = 0; } -int telnet_input(struct connection *connection) +static int telnet_input(struct connection *connection) { int bytes_read; unsigned char buffer[TELNET_BUFFER_SIZE]; @@ -540,7 +542,7 @@ int telnet_input(struct connection *connection) return ERROR_OK; } -int telnet_connection_closed(struct connection *connection) +static int telnet_connection_closed(struct connection *connection) { struct telnet_connection *t_con = connection->priv; int i; ----------------------------------------------------------------------- Summary of changes: src/server/telnet_server.c | 32 +++++++++++--------------------- 1 files changed, 11 insertions(+), 21 deletions(-) hooks/post-receive -- Main OpenOCD repository |