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: Zach W. <zw...@us...> - 2009-12-01 01:36: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 c0630d8a58c525e09aa938c7a50d4c99d39a93a3 (commit) via cee1f39f18296a3aa291b806052c7c3d5a066347 (commit) via 64653b0bbb0b2ac87de83d867f241360087b7588 (commit) via ec6c1962c2398a574a5c413b41483370347b9f5b (commit) from 2264270fe49a447e6f06ec4069a816cc86c3cf0b (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 c0630d8a58c525e09aa938c7a50d4c99d39a93a3 Author: Zachary T Welch <zw...@su...> Date: Sun Nov 29 14:29:24 2009 -0800 only display usable commands in help With the ability to defer 'init', users can access the help system while still in CONFIG mode. This patch omits commands from the help and usage list when they cannot be run in the current command mode, making it much easier to see what can be done at a given time. diff --git a/src/helper/command.c b/src/helper/command.c index ce857dd..ac7c8d8 100644 --- a/src/helper/command.c +++ b/src/helper/command.c @@ -872,6 +872,9 @@ static void command_help_show_wrap(const char *str, unsigned n, unsigned n2) static COMMAND_HELPER(command_help_show, struct command *c, unsigned n, bool show_help) { + if (!command_can_run(CMD_CTX, c)) + return ERROR_OK; + char *cmd_name = command_name(c, ' '); if (NULL == cmd_name) return -ENOMEM; commit cee1f39f18296a3aa291b806052c7c3d5a066347 Author: Zachary T Welch <zw...@su...> Date: Sun Nov 29 14:04:21 2009 -0800 allow deferal of init Adds 'noinit' command to prevent OpenOCD from running 'init' at the end up startup, allowing it to be given from telnet or TCL. This provides the old behavior by default, and users can add this command to their scripts to get the new behavior. diff --git a/src/openocd.c b/src/openocd.c index 287a819..2a65b4d 100644 --- a/src/openocd.c +++ b/src/openocd.c @@ -91,6 +91,16 @@ static int log_target_callback_event_handler(struct target *target, enum target_ int ioutil_init(struct command_context *cmd_ctx); +static bool init_at_startup = true; + +COMMAND_HANDLER(handle_noinit_command) +{ + if (CMD_ARGC != 0) + return ERROR_COMMAND_SYNTAX_ERROR; + init_at_startup = false; + return ERROR_OK; +} + /* OpenOCD can't really handle failure of this command. Patches welcome! :-) */ COMMAND_HANDLER(handle_init_command) { @@ -159,15 +169,24 @@ static const struct command_registration openocd_command_handlers[] = { { .name = "version", .handler = &handle_version_command, - .mode = COMMAND_EXEC, + .mode = COMMAND_ANY, .help = "show program version", }, { + .name = "noinit", + .handler = &handle_noinit_command, + .mode = COMMAND_CONFIG, + .help = "Prevent 'init' from being called at startup.", + }, + { .name = "init", .handler = &handle_init_command, - .mode = COMMAND_ANY, + .mode = COMMAND_CONFIG, .help = "Initializes configured targets and servers. " - "If called more than once, does nothing.", + "Changes command mode from CONFIG to EXEC. " + "Unless 'noinit' is called, this command is " + "called automatically at the end of startup.", + }, COMMAND_REGISTRATION_DONE }; @@ -262,7 +281,7 @@ int openocd_main(int argc, char *argv[]) if (ERROR_OK != ret) return EXIT_FAILURE; - if (1) + if (init_at_startup) { ret = command_run_line(cmd_ctx, "init"); if (ERROR_OK != ret) commit 64653b0bbb0b2ac87de83d867f241360087b7588 Author: Zachary T Welch <zw...@su...> Date: Sun Nov 29 14:04:21 2009 -0800 move server_init() to openocd_main() Moves the telnet and TCL server startup to server_init(), moving their respective command registration in to server_register_commands(). Adds proper error checking for these particular startup processes. Moves the core server startup to openocd_main(), improving related error checking and preparing to defer 'init'. diff --git a/src/openocd.c b/src/openocd.c index 7f6af4c..287a819 100644 --- a/src/openocd.c +++ b/src/openocd.c @@ -38,9 +38,7 @@ #include "mflash.h" #include "server.h" -#include "telnet_server.h" #include "gdb_server.h" -#include "tcl_server.h" #include "httpd.h" #ifdef HAVE_STRINGS_H @@ -149,13 +147,8 @@ COMMAND_HANDLER(handle_init_command) return ERROR_FAIL; LOG_DEBUG("pld init complete"); - /* initialize tcp server */ - server_init(); - /* initialize telnet subsystem */ - telnet_init("Open On-Chip Debugger"); gdb_target_add_all(all_targets); - tcl_init(); /* allows tcl to just connect without going thru telnet */ target_register_event_callback(log_target_callback_event_handler, CMD_CTX); @@ -194,9 +187,7 @@ struct command_context *setup_command_handler(void) register_commands(cmd_ctx, NULL, openocd_command_handlers); /* register subsystem commands */ server_register_commands(cmd_ctx); - telnet_register_commands(cmd_ctx); gdb_register_commands(cmd_ctx); - tcl_register_commands(cmd_ctx); /* tcl server commands */ log_register_commands(cmd_ctx); jtag_register_commands(cmd_ctx); xsvf_register_commands(cmd_ctx); @@ -259,7 +250,7 @@ int openocd_main(int argc, char *argv[]) return EXIT_FAILURE; ret = parse_config_file(cmd_ctx); - if ((ret != ERROR_OK) && (ret != ERROR_COMMAND_CLOSE_CONNECTION)) + if (ret != ERROR_OK) return EXIT_FAILURE; #if BUILD_HTTPD @@ -267,16 +258,21 @@ int openocd_main(int argc, char *argv[]) return EXIT_FAILURE; #endif - if (ret != ERROR_COMMAND_CLOSE_CONNECTION) + ret = server_init(); + if (ERROR_OK != ret) + return EXIT_FAILURE; + + if (1) { - if (command_run_line(cmd_ctx, "init") != ERROR_OK) - return EXIT_FAILURE; + ret = command_run_line(cmd_ctx, "init"); + if (ERROR_OK != ret) + ret = EXIT_FAILURE; + } - /* handle network connections */ + /* handle network connections */ + if (ERROR_OK == ret) server_loop(cmd_ctx); - } - /* shut server down */ server_quit(); #if BUILD_HTTPD @@ -288,6 +284,5 @@ int openocd_main(int argc, char *argv[]) /* free commandline interface */ command_done(cmd_ctx); - - return EXIT_SUCCESS; + return ret; } diff --git a/src/server/server.c b/src/server/server.c index 3ba433e..256c590 100644 --- a/src/server/server.c +++ b/src/server/server.c @@ -30,6 +30,8 @@ #include "server.h" #include "target.h" #include "openocd.h" +#include "tcl_server.h" +#include "telnet_server.h" #include <signal.h> @@ -516,7 +518,11 @@ int server_init(void) signal(SIGABRT, sig_handler); #endif - return ERROR_OK; + int ret = tcl_init(); + if (ERROR_OK != ret) + return ret; + + return telnet_init("Open On-Chip Debugger"); } int server_quit(void) @@ -551,6 +557,14 @@ static const struct command_registration server_command_handlers[] = { int server_register_commands(struct command_context *cmd_ctx) { + int retval = telnet_register_commands(cmd_ctx); + if (ERROR_OK != retval) + return retval; + + retval = tcl_register_commands(cmd_ctx); + if (ERROR_OK != retval) + return retval; + return register_commands(cmd_ctx, NULL, server_command_handlers); } commit ec6c1962c2398a574a5c413b41483370347b9f5b Author: Zachary T Welch <zw...@su...> Date: Sat Nov 28 18:56:23 2009 -0800 improve gdb_init() sequence Rework gdb_init to create flexible APIs (gdb_target_add_{one,all}) and static helper (gdb_target_start) for starting GDB services. Eliminates duplicated code and provides general mechanisms for adding GDB services. The 'init' command is updated to call the new API, and later patches can decouple its policy of adding all targets therein. Provides the new capability to use both piped and TCP servers when multiple targets are defined. The first target fills the pipe, and others will be started on TCP ports (unless disabled, i.e. gdb_port=0). diff --git a/src/openocd.c b/src/openocd.c index 01e9e79..7f6af4c 100644 --- a/src/openocd.c +++ b/src/openocd.c @@ -154,7 +154,7 @@ COMMAND_HANDLER(handle_init_command) /* initialize telnet subsystem */ telnet_init("Open On-Chip Debugger"); - gdb_init(); + gdb_target_add_all(all_targets); tcl_init(); /* allows tcl to just connect without going thru telnet */ target_register_event_callback(log_target_callback_event_handler, CMD_CTX); diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c index 3c099fa..7fb36e4 100644 --- a/src/server/gdb_server.c +++ b/src/server/gdb_server.c @@ -2189,55 +2189,68 @@ int gdb_input(struct connection *connection) return ERROR_OK; } -int gdb_init(void) +static int gdb_target_start(struct target *target, uint16_t port) { - struct gdb_service *gdb_service; - struct target *target = all_targets; + bool use_pipes = 0 == port; + struct gdb_service *gdb_service = malloc(sizeof(struct gdb_service)); + if (NULL == gdb_service) + return -ENOMEM; - if (!target) - { - LOG_WARNING("no gdb ports allocated as no target has been specified"); - return ERROR_OK; - } + gdb_service->target = target; + add_service("gdb", use_pipes ? CONNECTION_PIPE : CONNECTION_TCP, + port, 1, &gdb_new_connection, &gdb_input, + &gdb_connection_closed, gdb_service); + + const char *name = target_name(target); + if (use_pipes) + LOG_DEBUG("gdb service for target '%s' using pipes", name); + else + LOG_DEBUG("gdb service for target '%s' on TCP port %u", name, port); + return ERROR_OK; +} + +int gdb_target_add_one(struct target *target) +{ if (gdb_port == 0 && server_use_pipes == 0) { LOG_INFO("gdb port disabled"); return ERROR_OK; } - if (server_use_pipes) + bool use_pipes = server_use_pipes; + static bool server_started_with_pipes = false; + if (server_started_with_pipes) { - /* only a single gdb connection when using a pipe */ + LOG_WARNING("gdb service permits one target when using pipes"); + if (0 == gdb_port) + return ERROR_OK; - gdb_service = malloc(sizeof(struct gdb_service)); - gdb_service->target = target; + use_pipes = false; + } - add_service("gdb", CONNECTION_PIPE, 0, 1, gdb_new_connection, gdb_input, gdb_connection_closed, gdb_service); + int e = gdb_target_start(target, use_pipes ? 0 : gdb_port++); + if (ERROR_OK == e) + server_started_with_pipes |= use_pipes; - LOG_DEBUG("gdb service for target %s using pipes", - target_name(target)); + return e; +} + +int gdb_target_add_all(struct target *target) +{ + if (NULL == target) + { + LOG_WARNING("gdb services need one or more targets defined"); + return ERROR_OK; } - else + + while (NULL != target) { - unsigned short port = gdb_port; + int retval = gdb_target_add_one(target); + if (ERROR_OK != retval) + return retval; - while (target) - { - gdb_service = malloc(sizeof(struct gdb_service)); - gdb_service->target = target; - - add_service("gdb", CONNECTION_TCP, - port, 1, - gdb_new_connection, gdb_input, - gdb_connection_closed, gdb_service); - - LOG_DEBUG("gdb service for target %s at TCP port %i", - target_name(target), - port); - target = target->next; - port++; - } + target = target->next; } return ERROR_OK; diff --git a/src/server/gdb_server.h b/src/server/gdb_server.h index a8e8dad..0414975 100644 --- a/src/server/gdb_server.h +++ b/src/server/gdb_server.h @@ -52,7 +52,8 @@ struct gdb_service struct target *target; }; -int gdb_init(void); +int gdb_target_add_one(struct target *target); +int gdb_target_add_all(struct target *target); int gdb_register_commands(struct command_context *command_context); #define ERROR_GDB_BUFFER_TOO_SMALL (-800) ----------------------------------------------------------------------- Summary of changes: src/helper/command.c | 3 ++ src/openocd.c | 58 +++++++++++++++++++++------------- src/server/gdb_server.c | 79 +++++++++++++++++++++++++++------------------- src/server/gdb_server.h | 3 +- src/server/server.c | 16 +++++++++- 5 files changed, 102 insertions(+), 57 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2009-11-30 10:29: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 2264270fe49a447e6f06ec4069a816cc86c3cf0b (commit) from 5219b35be63e56d576f6c877162e4e2f50db5294 (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 2264270fe49a447e6f06ec4069a816cc86c3cf0b Author: Ãyvind Harboe <oyv...@zy...> Date: Mon Nov 30 08:43:49 2009 +0100 zy1000: keep up with changes to command structure Add missing COMMAND_REGISTRATION_DONE. For now the command syntax for zy1000 needs to be compatible across 0.3/0.4, the world outside OpenOCD interfaces to zy1000 using the old syntax. Post 0.4 release(0.4.1 even) I'll switch to subcommand scheme. Switch to subcommands post 0.3 lifecycle. Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/jtag/zy1000/zy1000.c b/src/jtag/zy1000/zy1000.c index aeaa914..115b3be 100644 --- a/src/jtag/zy1000/zy1000.c +++ b/src/jtag/zy1000/zy1000.c @@ -803,6 +803,7 @@ static const struct command_registration zy1000_commands[] = { .help = "writes firmware to flash", }, #endif + COMMAND_REGISTRATION_DONE }; ----------------------------------------------------------------------- Summary of changes: src/jtag/zy1000/zy1000.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: David B. <dbr...@us...> - 2009-11-29 22:20: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 5219b35be63e56d576f6c877162e4e2f50db5294 (commit) via 8c8e53baf6a5842046a1d31057ec3c9a0906a0d5 (commit) via e456da073abeb2b45fdeb7ef48bf5f905221524a (commit) via 8c2846ed450a6280aa3fa8b58e796f20405c842d (commit) via 17b7600a59c4fb9245107baac1873c23e792ce43 (commit) from 73ec6d9b891cbecf50058dcfdfefa5d0c4217090 (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 5219b35be63e56d576f6c877162e4e2f50db5294 Author: David Brownell <dbr...@us...> Date: Sun Nov 29 13:06:12 2009 -0800 XScale: clean up full_context() (#2) Streamline the loop by continuing as soon as we know there's no work to be done; this lets us un-indent almost everything. Signed-off-by: David Brownell <dbr...@us...> diff --git a/src/target/xscale.c b/src/target/xscale.c index 6d2d81d..bf5d0af 100644 --- a/src/target/xscale.c +++ b/src/target/xscale.c @@ -1712,50 +1712,41 @@ static int xscale_full_context(struct target *target) mode, j).valid) valid = false; } + if (valid) + continue; - if (!valid) - { - uint32_t tmp_cpsr; - - /* request banked registers */ - xscale_send_u32(target, 0x0); + /* request banked registers */ + xscale_send_u32(target, 0x0); - tmp_cpsr = 0x0; - tmp_cpsr |= mode; - tmp_cpsr |= 0xc0; /* I/F bits */ - - /* send CPSR for desired mode */ - xscale_send_u32(target, tmp_cpsr); + /* send CPSR for desired bank mode */ + xscale_send_u32(target, mode | 0xc0 /* I/F bits */); - /* get banked registers: r8 to r14; and SPSR - * if not in USR/SYS mode - */ - if (mode != ARMV4_5_MODE_SYS) { - /* SPSR */ - r = &ARMV4_5_CORE_REG_MODE( - armv4_5->core_cache, - mode, 16); - - xscale_receive(target, buffer, 8); - - buf_set_u32(r->value, 0, 32, buffer[7]); - r->dirty = false; - r->valid = true; - } else { - xscale_receive(target, buffer, 7); - } + /* get banked registers: r8 to r14; and SPSR + * except in USR/SYS mode + */ + if (mode != ARMV4_5_MODE_SYS) { + /* SPSR */ + r = &ARMV4_5_CORE_REG_MODE(armv4_5->core_cache, + mode, 16); + + xscale_receive(target, buffer, 8); + + buf_set_u32(r->value, 0, 32, buffer[7]); + r->dirty = false; + r->valid = true; + } else { + xscale_receive(target, buffer, 7); + } - /* move data from buffer to register cache */ - for (j = 8; j <= 14; j++) - { - r = &ARMV4_5_CORE_REG_MODE( - armv4_5->core_cache, - mode, j); + /* move data from buffer to register cache */ + for (j = 8; j <= 14; j++) + { + r = &ARMV4_5_CORE_REG_MODE(armv4_5->core_cache, + mode, j); - buf_set_u32(r->value, 0, 32, buffer[j - 8]); - r->dirty = false; - r->valid = true; - } + buf_set_u32(r->value, 0, 32, buffer[j - 8]); + r->dirty = false; + r->valid = true; } } commit 8c8e53baf6a5842046a1d31057ec3c9a0906a0d5 Author: David Brownell <dbr...@us...> Date: Sun Nov 29 13:04:56 2009 -0800 XScale: clean up full_context() (#1) When fetching all the registers, XScale was doing various stupid things like calling number_to_mode() a few dozen times instead of just once, and mapping access to each register three times (again, instead of just once). Stop that. Signed-off-by: David Brownell <dbr...@us...> diff --git a/src/target/xscale.c b/src/target/xscale.c index 0e58f57..6d2d81d 100644 --- a/src/target/xscale.c +++ b/src/target/xscale.c @@ -1697,14 +1697,20 @@ static int xscale_full_context(struct target *target) */ for (i = 1; i < 7; i++) { - int valid = 1; + enum armv4_5_mode mode = armv4_5_number_to_mode(i); + bool valid = true; + struct reg *r; + + if (mode == ARMV4_5_MODE_USR) + continue; /* check if there are invalid registers in the current mode */ - for (j = 0; j <= 16; j++) + for (j = 0; valid && j <= 16; j++) { - if (ARMV4_5_CORE_REG_MODE(armv4_5->core_cache, armv4_5_number_to_mode(i), j).valid == 0) - valid = 0; + if (!ARMV4_5_CORE_REG_MODE(armv4_5->core_cache, + mode, j).valid) + valid = false; } if (!valid) @@ -1715,31 +1721,40 @@ static int xscale_full_context(struct target *target) xscale_send_u32(target, 0x0); tmp_cpsr = 0x0; - tmp_cpsr |= armv4_5_number_to_mode(i); + tmp_cpsr |= mode; tmp_cpsr |= 0xc0; /* I/F bits */ /* send CPSR for desired mode */ xscale_send_u32(target, tmp_cpsr); - /* get banked registers, r8 to r14, and spsr if not in USR/SYS mode */ - if ((armv4_5_number_to_mode(i) != ARMV4_5_MODE_USR) && (armv4_5_number_to_mode(i) != ARMV4_5_MODE_SYS)) - { + /* get banked registers: r8 to r14; and SPSR + * if not in USR/SYS mode + */ + if (mode != ARMV4_5_MODE_SYS) { + /* SPSR */ + r = &ARMV4_5_CORE_REG_MODE( + armv4_5->core_cache, + mode, 16); + xscale_receive(target, buffer, 8); - buf_set_u32(ARMV4_5_CORE_REG_MODE(armv4_5->core_cache, armv4_5->core_mode, 16).value, 0, 32, buffer[7]); - ARMV4_5_CORE_REG_MODE(armv4_5->core_cache, armv4_5_number_to_mode(i), 16).dirty = 0; - ARMV4_5_CORE_REG_MODE(armv4_5->core_cache, armv4_5_number_to_mode(i), 16).valid = 1; - } - else - { + + buf_set_u32(r->value, 0, 32, buffer[7]); + r->dirty = false; + r->valid = true; + } else { xscale_receive(target, buffer, 7); } /* move data from buffer to register cache */ for (j = 8; j <= 14; j++) { - buf_set_u32(ARMV4_5_CORE_REG_MODE(armv4_5->core_cache, armv4_5_number_to_mode(i), j).value, 0, 32, buffer[j - 8]); - ARMV4_5_CORE_REG_MODE(armv4_5->core_cache, armv4_5_number_to_mode(i), j).dirty = 0; - ARMV4_5_CORE_REG_MODE(armv4_5->core_cache, armv4_5_number_to_mode(i), j).valid = 1; + r = &ARMV4_5_CORE_REG_MODE( + armv4_5->core_cache, + mode, j); + + buf_set_u32(r->value, 0, 32, buffer[j - 8]); + r->dirty = false; + r->valid = true; } } } commit e456da073abeb2b45fdeb7ef48bf5f905221524a Author: David Brownell <dbr...@us...> Date: Sun Nov 29 12:58:30 2009 -0800 XScale: debug entry uses new register mapping Use the new mapping interfaces in the debug entry path. SPSR and the banked registers now have smaller and faster accessors ... use them. Signed-off-by: David Brownell <dbr...@us...> diff --git a/src/target/xscale.c b/src/target/xscale.c index b4cb4ff..0e58f57 100644 --- a/src/target/xscale.c +++ b/src/target/xscale.c @@ -973,12 +973,11 @@ static int xscale_debug_entry(struct target *target) arm_mode_name(armv4_5->core_mode)); /* get banked registers, r8 to r14, and spsr if not in USR/SYS mode */ - if ((armv4_5->core_mode != ARMV4_5_MODE_USR) && (armv4_5->core_mode != ARMV4_5_MODE_SYS)) - { + if (armv4_5->spsr) { xscale_receive(target, buffer, 8); - buf_set_u32(ARMV4_5_CORE_REG_MODE(armv4_5->core_cache, armv4_5->core_mode, 16).value, 0, 32, buffer[7]); - ARMV4_5_CORE_REG_MODE(armv4_5->core_cache, armv4_5->core_mode, 16).dirty = 0; - ARMV4_5_CORE_REG_MODE(armv4_5->core_cache, armv4_5->core_mode, 16).valid = 1; + buf_set_u32(armv4_5->spsr->value, 0, 32, buffer[7]); + armv4_5->spsr->dirty = false; + armv4_5->spsr->valid = true; } else { @@ -986,12 +985,14 @@ static int xscale_debug_entry(struct target *target) xscale_receive(target, buffer, 7); } - /* move data from buffer to register cache */ + /* move data from buffer to right banked register in cache */ for (i = 8; i <= 14; i++) { - buf_set_u32(ARMV4_5_CORE_REG_MODE(armv4_5->core_cache, armv4_5->core_mode, i).value, 0, 32, buffer[i - 8]); - ARMV4_5_CORE_REG_MODE(armv4_5->core_cache, armv4_5->core_mode, i).dirty = 0; - ARMV4_5_CORE_REG_MODE(armv4_5->core_cache, armv4_5->core_mode, i).valid = 1; + struct reg *r = arm_reg_current(armv4_5, i); + + buf_set_u32(r->value, 0, 32, buffer[i - 8]); + r->dirty = false; + r->valid = true; } /* examine debug reason */ commit 8c2846ed450a6280aa3fa8b58e796f20405c842d Author: Marek Vasut <mar...@gm...> Date: Sun Nov 29 12:54:41 2009 +0100 create target/pxa3xx.cfg [dbr...@us...; remove pxa255 comment] Signed-off-by: David Brownell <dbr...@us...> diff --git a/tcl/target/pxa3xx.cfg b/tcl/target/pxa3xx.cfg new file mode 100644 index 0000000..5d64986 --- /dev/null +++ b/tcl/target/pxa3xx.cfg @@ -0,0 +1,86 @@ +# Marvell PXA3xx + +if { [info exists CHIPNAME] } { + set _CHIPNAME $CHIPNAME +} else { + set _CHIPNAME pxa3xx +} + +if { [info exists ENDIAN] } { + set _ENDIAN $ENDIAN +} else { + set _ENDIAN little +} + +# IDs for all currently known PXA3xx chips +if { [info exists CPUTAPID_PXA30X_A0 ] } { + set _CPUTAPID_PXA30X_A0 $CPUTAPID_PXA30X_A0 +} else { + set _CPUTAPID_PXA30X_A0 0x0E648013 +} +if { [info exists CPUTAPID_PXA30X_A1 ] } { + set _CPUTAPID_PXA30X_A1 $CPUTAPID_PXA30X_A1 +} else { + set _CPUTAPID_PXA30X_A1 0x1E648013 +} +if { [info exists CPUTAPID_PXA31X_A0 ] } { + set _CPUTAPID_PXA31X_A0 $CPUTAPID_PXA31X_A0 +} else { + set _CPUTAPID_PXA31X_A0 0x0E649013 +} +if { [info exists CPUTAPID_PXA31X_A1 ] } { + set _CPUTAPID_PXA31X_A1 $CPUTAPID_PXA31X_A1 +} else { + set _CPUTAPID_PXA31X_A1 0x1E649013 +} +if { [info exists CPUTAPID_PXA31X_A2 ] } { + set _CPUTAPID_PXA31X_A2 $CPUTAPID_PXA31X_A2 +} else { + set _CPUTAPID_PXA31X_A2 0x2E649013 +} +if { [info exists CPUTAPID_PXA31X_B0 ] } { + set _CPUTAPID_PXA31X_B0 $CPUTAPID_PXA31X_B0 +} else { + set _CPUTAPID_PXA31X_B0 0x3E649013 +} +if { [info exists CPUTAPID_PXA32X_B1 ] } { + set _CPUTAPID_PXA32X_B1 $CPUTAPID_PXA32X_B1 +} else { + set _CPUTAPID_PXA32X_B1 0x5E642013 +} +if { [info exists CPUTAPID_PXA32X_B2 ] } { + set _CPUTAPID_PXA32X_B2 $CPUTAPID_PXA32X_B2 +} else { + set _CPUTAPID_PXA32X_B2 0x6E642013 +} +if { [info exists CPUTAPID_PXA32X_C0 ] } { + set _CPUTAPID_PXA32X_C0 $CPUTAPID_PXA32X_C0 +} else { + set _CPUTAPID_PXA32X_C0 0x7E642013 +} + +# set jtag_nsrst_delay to the delay introduced by your reset circuit +# the rest of the needed delays are built into the openocd program +jtag_nsrst_delay 260 + +# set the jtag_ntrst_delay to the delay introduced by a reset circuit +# the rest of the needed delays are built into the openocd program +jtag_ntrst_delay 250 + +set _TARGETNAME $_CHIPNAME.cpu +jtag newtap $_CHIPNAME cpu -irlen 11 -ircapture 0x1 -irmask 0x7f \ + -expected-id $_CPUTAPID_PXA30X_A0 \ + -expected-id $_CPUTAPID_PXA30X_A1 \ + -expected-id $_CPUTAPID_PXA31X_A0 \ + -expected-id $_CPUTAPID_PXA31X_A1 \ + -expected-id $_CPUTAPID_PXA31X_A2 \ + -expected-id $_CPUTAPID_PXA31X_B0 \ + -expected-id $_CPUTAPID_PXA32X_B1 \ + -expected-id $_CPUTAPID_PXA32X_B2 \ + -expected-id $_CPUTAPID_PXA32X_C0 + +target create $_TARGETNAME xscale -endian $_ENDIAN \ + -chain-position $_TARGETNAME -variant pxa3xx + +# work area in internal RAM. +$_TARGETNAME configure -work-area-phys 0x5c030000 -work-area-size 0x10000 commit 17b7600a59c4fb9245107baac1873c23e792ce43 Author: Marek Vasut <mar...@gm...> Date: Sun Nov 29 12:53:06 2009 +0100 XScale: initial PXA3xx support [dbr...@us...: user's guide; variant param is optional] Signed-off-by: David Brownell <dbr...@us...> diff --git a/doc/openocd.texi b/doc/openocd.texi index b32ed21..ea30092 100644 --- a/doc/openocd.texi +++ b/doc/openocd.texi @@ -3117,6 +3117,7 @@ There are several variants defined: @code{pxa27x} ... instruction register length is 7 bits @item @code{pxa250}, @code{pxa255}, @code{pxa26x} ... instruction register length is 5 bits +@item @code{pxa3xx} ... instruction register length is 11 bits @end itemize @end itemize @end deffn diff --git a/src/target/xscale.c b/src/target/xscale.c index 49653a9..b4cb4ff 100644 --- a/src/target/xscale.c +++ b/src/target/xscale.c @@ -191,7 +191,8 @@ static int xscale_read_dcsr(struct target *target) uint8_t field2_check_mask = 0x1; jtag_set_end_state(TAP_DRPAUSE); - xscale_jtag_set_instr(target->tap, XSCALE_SELDCSR); + xscale_jtag_set_instr(target->tap, + XSCALE_SELDCSR << xscale->xscale_variant); buf_set_u32(&field0, 1, 1, xscale->hold_rst); buf_set_u32(&field0, 2, 1, xscale->external_debug_break); @@ -256,6 +257,7 @@ static int xscale_receive(struct target *target, uint32_t *buffer, int num_words if (num_words == 0) return ERROR_INVALID_ARGUMENTS; + struct xscale_common *xscale = target_to_xscale(target); int retval = ERROR_OK; tap_state_t path[3]; struct scan_field fields[3]; @@ -289,7 +291,8 @@ static int xscale_receive(struct target *target, uint32_t *buffer, int num_words fields[2].check_mask = &field2_check_mask; jtag_set_end_state(TAP_IDLE); - xscale_jtag_set_instr(target->tap, XSCALE_DBGTX); + xscale_jtag_set_instr(target->tap, + XSCALE_DBGTX << xscale->xscale_variant); jtag_add_runtest(1, jtag_get_end_state()); /* ensures that we're in the TAP_IDLE state as the above could be a no-op */ /* repeat until all words have been collected */ @@ -371,7 +374,8 @@ static int xscale_read_tx(struct target *target, int consume) jtag_set_end_state(TAP_IDLE); - xscale_jtag_set_instr(target->tap, XSCALE_DBGTX); + xscale_jtag_set_instr(target->tap, + XSCALE_DBGTX << xscale->xscale_variant); path[0] = TAP_DRSELECT; path[1] = TAP_DRCAPTURE; @@ -469,7 +473,8 @@ static int xscale_write_rx(struct target *target) jtag_set_end_state(TAP_IDLE); - xscale_jtag_set_instr(target->tap, XSCALE_DBGRX); + xscale_jtag_set_instr(target->tap, + XSCALE_DBGRX << xscale->xscale_variant); memset(&fields, 0, sizeof fields); @@ -541,6 +546,7 @@ static int xscale_write_rx(struct target *target) /* send count elements of size byte to the debug handler */ static int xscale_send(struct target *target, uint8_t *buffer, int count, int size) { + struct xscale_common *xscale = target_to_xscale(target); uint32_t t[3]; int bits[3]; int retval; @@ -548,7 +554,8 @@ static int xscale_send(struct target *target, uint8_t *buffer, int count, int si jtag_set_end_state(TAP_IDLE); - xscale_jtag_set_instr(target->tap, XSCALE_DBGRX); + xscale_jtag_set_instr(target->tap, + XSCALE_DBGRX << xscale->xscale_variant); bits[0]=3; t[0]=0; @@ -629,7 +636,8 @@ static int xscale_write_dcsr(struct target *target, int hold_rst, int ext_dbg_br xscale->external_debug_break = ext_dbg_brk; jtag_set_end_state(TAP_IDLE); - xscale_jtag_set_instr(target->tap, XSCALE_SELDCSR); + xscale_jtag_set_instr(target->tap, + XSCALE_SELDCSR << xscale->xscale_variant); buf_set_u32(&field0, 1, 1, xscale->hold_rst); buf_set_u32(&field0, 2, 1, xscale->external_debug_break); @@ -683,6 +691,7 @@ static unsigned int parity (unsigned int v) static int xscale_load_ic(struct target *target, uint32_t va, uint32_t buffer[8]) { + struct xscale_common *xscale = target_to_xscale(target); uint8_t packet[4]; uint8_t cmd; int word; @@ -692,7 +701,8 @@ static int xscale_load_ic(struct target *target, uint32_t va, uint32_t buffer[8] /* LDIC into IR */ jtag_set_end_state(TAP_IDLE); - xscale_jtag_set_instr(target->tap, XSCALE_LDIC); + xscale_jtag_set_instr(target->tap, + XSCALE_LDIC << xscale->xscale_variant); /* CMD is b011 to load a cacheline into the Mini ICache. * Loading into the main ICache is deprecated, and unused. @@ -738,12 +748,14 @@ static int xscale_load_ic(struct target *target, uint32_t va, uint32_t buffer[8] static int xscale_invalidate_ic_line(struct target *target, uint32_t va) { + struct xscale_common *xscale = target_to_xscale(target); uint8_t packet[4]; uint8_t cmd; struct scan_field fields[2]; jtag_set_end_state(TAP_IDLE); - xscale_jtag_set_instr(target->tap, XSCALE_LDIC); + xscale_jtag_set_instr(target->tap, + XSCALE_LDIC << xscale->xscale_variant); /* CMD for invalidate IC line b000, bits [6:4] b000 */ buf_set_u32(&cmd, 0, 6, 0x0); @@ -1479,7 +1491,8 @@ static int xscale_assert_reset(struct target *target) * end up in T-L-R, which would reset JTAG */ jtag_set_end_state(TAP_IDLE); - xscale_jtag_set_instr(target->tap, XSCALE_SELDCSR); + xscale_jtag_set_instr(target->tap, + XSCALE_SELDCSR << xscale->xscale_variant); /* set Hold reset, Halt mode and Trap Reset */ buf_set_u32(xscale->reg_cache->reg_list[XSCALE_DCSR].value, 30, 1, 0x1); @@ -2876,10 +2889,10 @@ static int xscale_init_arch_info(struct target *target, armv4_5 = &xscale->armv4_5_common; - /* store architecture specfic data (none so far) */ + /* store architecture specfic data */ xscale->common_magic = XSCALE_COMMON_MAGIC; - /* we don't really *need* variant info ... */ + /* we don't really *need* a variant param ... */ if (variant) { int ir_length = 0; @@ -2892,6 +2905,8 @@ static int xscale_init_arch_info(struct target *target, || strcmp(variant, "ixp45x") == 0 || strcmp(variant, "ixp46x") == 0) ir_length = 7; + else if (strcmp(variant, "pxa3xx") == 0) + ir_length = 11; else LOG_WARNING("%s: unrecognized variant %s", tap->dotted_name, variant); @@ -2903,6 +2918,12 @@ static int xscale_init_arch_info(struct target *target, } } + /* PXA3xx shifts the JTAG instructions */ + if (tap->ir_length == 11) + xscale->xscale_variant = XSCALE_PXA3XX; + else + xscale->xscale_variant = XSCALE_IXP4XX_PXA2XX; + /* the debug handler isn't installed (and thus not running) at this time */ xscale->handler_address = 0xfe000800; diff --git a/src/target/xscale.h b/src/target/xscale.h index 4f1b54d..0a70ecb 100644 --- a/src/target/xscale.h +++ b/src/target/xscale.h @@ -37,6 +37,10 @@ #define XSCALE_LDIC 0x07 #define XSCALE_SELDCSR 0x09 +/* Possible CPU types */ +#define XSCALE_IXP4XX_PXA2XX 0x0 +#define XSCALE_PXA3XX 0x4 + enum xscale_debug_reason { XSCALE_DBG_REASON_GENERIC, @@ -129,6 +133,9 @@ struct xscale_common uint32_t cp15_control_reg; int fast_memory_access; + + /* CPU variant */ + int xscale_variant; }; static inline struct xscale_common * ----------------------------------------------------------------------- Summary of changes: doc/openocd.texi | 1 + src/target/xscale.c | 136 +++++++++++++++++++++++++++++------------------- src/target/xscale.h | 7 +++ tcl/target/pxa3xx.cfg | 86 +++++++++++++++++++++++++++++++ 4 files changed, 176 insertions(+), 54 deletions(-) create mode 100644 tcl/target/pxa3xx.cfg hooks/post-receive -- Main OpenOCD repository |
From: David B. <dbr...@us...> - 2009-11-29 18:15: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 73ec6d9b891cbecf50058dcfdfefa5d0c4217090 (commit) from 3debd59c5ec2a91146e1d2781bedf2ab36ee0c6c (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 73ec6d9b891cbecf50058dcfdfefa5d0c4217090 Author: David Brownell <dbr...@us...> Date: Sun Nov 29 09:14:52 2009 -0800 ARM11: fix warning on cygwin Previous version of JTAG_DEBUG() macro hid this bug. Signed-off-by: David Brownell <dbr...@us...> diff --git a/src/target/arm11_dbgtap.c b/src/target/arm11_dbgtap.c index ed57d20..cfcb5bf 100644 --- a/src/target/arm11_dbgtap.c +++ b/src/target/arm11_dbgtap.c @@ -205,7 +205,7 @@ int arm11_add_debug_SCAN_N(struct arm11_common * arm11, uint8_t chain, tap_state static void arm11_add_debug_INST(struct arm11_common * arm11, uint32_t inst, uint8_t * flag, tap_state_t state) { - JTAG_DEBUG("INST <= 0x%08x", inst); + JTAG_DEBUG("INST <= 0x%08x", (unsigned) inst); struct scan_field itr[2]; @@ -244,7 +244,9 @@ int arm11_read_DSCR(struct arm11_common * arm11, uint32_t *value) CHECK_RETVAL(jtag_execute_queue()); if (arm11->last_dscr != dscr) - JTAG_DEBUG("DSCR = %08x (OLD %08x)", dscr, arm11->last_dscr); + JTAG_DEBUG("DSCR = %08x (OLD %08x)", + (unsigned) dscr, + (unsigned) arm11->last_dscr); arm11->last_dscr = dscr; @@ -279,7 +281,9 @@ int arm11_write_DSCR(struct arm11_common * arm11, uint32_t dscr) CHECK_RETVAL(jtag_execute_queue()); - JTAG_DEBUG("DSCR <= %08x (OLD %08x)", dscr, arm11->last_dscr); + JTAG_DEBUG("DSCR <= %08x (OLD %08x)", + (unsigned) dscr, + (unsigned) arm11->last_dscr); arm11->last_dscr = dscr; @@ -514,7 +518,8 @@ int arm11_run_instr_data_to_core(struct arm11_common * arm11, uint32_t opcode, u CHECK_RETVAL(jtag_execute_queue()); - JTAG_DEBUG("DTR Data %08x Ready %d nRetry %d", Data, Ready, nRetry); + JTAG_DEBUG("DTR Data %08x Ready %d nRetry %d", + (unsigned) Data, Ready, nRetry); long long then = 0; @@ -710,7 +715,8 @@ int arm11_run_instr_data_from_core(struct arm11_common * arm11, uint32_t opcode, CHECK_RETVAL(jtag_execute_queue()); - JTAG_DEBUG("DTR Data %08x Ready %d nRetry %d", Data, Ready, nRetry); + JTAG_DEBUG("DTR Data %08x Ready %d nRetry %d", + (unsigned) Data, Ready, nRetry); long long then = 0; @@ -838,13 +844,20 @@ int arm11_sc7_run(struct arm11_common * arm11, struct arm11_sc7_action * actions do { - JTAG_DEBUG("SC7 <= Address %02x Data %08x nRW %d", AddressOut, DataOut, nRW); + JTAG_DEBUG("SC7 <= Address %02x Data %08x nRW %d", + (unsigned) AddressOut, + (unsigned) DataOut, + nRW); - arm11_add_dr_scan_vc(ARRAY_SIZE(chain7_fields), chain7_fields, TAP_DRPAUSE); + arm11_add_dr_scan_vc(ARRAY_SIZE(chain7_fields), + chain7_fields, TAP_DRPAUSE); CHECK_RETVAL(jtag_execute_queue()); - JTAG_DEBUG("SC7 => Address %02x Data %08x Ready %d", AddressIn, DataIn, Ready); + JTAG_DEBUG("SC7 => Address %02x Data %08x Ready %d", + (unsigned) AddressIn, + (unsigned) DataIn, + Ready); } while (!Ready); /* 'nRW' is 'Ready' on read out */ @@ -874,7 +887,7 @@ int arm11_sc7_run(struct arm11_common * arm11, struct arm11_sc7_action * actions JTAG_DEBUG("SC7 %02d: %02x %s %08x", (unsigned) i, actions[i].address, actions[i].write ? "<=" : "=>", - actions[i].value); + (unsigned) actions[i].value); } return ERROR_OK; ----------------------------------------------------------------------- Summary of changes: src/target/arm11_dbgtap.c | 31 ++++++++++++++++++++++--------- 1 files changed, 22 insertions(+), 9 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: David B. <dbr...@us...> - 2009-11-29 08:11: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 3debd59c5ec2a91146e1d2781bedf2ab36ee0c6c (commit) from b0858e89c7a7cf761c2f67db835d17840fd830ee (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 3debd59c5ec2a91146e1d2781bedf2ab36ee0c6c Author: David Brownell <dbr...@us...> Date: Sat Nov 28 23:08:05 2009 -0800 bugfix: 'init' changes state, not main() Code other than main() may invoke "init". When it does so, customized handlers may need to run ... so make sure the command context state is updated before they do so. Signed-off-by: David Brownell <dbr...@us...> diff --git a/src/openocd.c b/src/openocd.c index 629d50a..01e9e79 100644 --- a/src/openocd.c +++ b/src/openocd.c @@ -109,6 +109,8 @@ COMMAND_HANDLER(handle_init_command) atexit(exit_handler); + command_context_mode(CMD_CTX, COMMAND_EXEC); + if (target_init(CMD_CTX) != ERROR_OK) return ERROR_FAIL; LOG_DEBUG("target init complete"); @@ -267,7 +269,6 @@ int openocd_main(int argc, char *argv[]) if (ret != ERROR_COMMAND_CLOSE_CONNECTION) { - command_context_mode(cmd_ctx, COMMAND_EXEC); if (command_run_line(cmd_ctx, "init") != ERROR_OK) return EXIT_FAILURE; ----------------------------------------------------------------------- Summary of changes: src/openocd.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Zach W. <zw...@us...> - 2009-11-29 00:53: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 b0858e89c7a7cf761c2f67db835d17840fd830ee (commit) from a398c85de748effa1ac2ea7f75cee127e1ddcd5b (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 b0858e89c7a7cf761c2f67db835d17840fd830ee Author: lementec fabien <fab...@gm...> Date: Sat Nov 28 15:50:01 2009 -0800 fix s3c24xx device command helper Returns the common structure for the s3c24xx device, which was somehow nuked during past cleaning efforts. diff --git a/src/flash/s3c24xx_nand.c b/src/flash/s3c24xx_nand.c index e7afb48..1a2ece7 100644 --- a/src/flash/s3c24xx_nand.c +++ b/src/flash/s3c24xx_nand.c @@ -33,8 +33,9 @@ S3C24XX_DEVICE_COMMAND() { - struct s3c24xx_nand_controller *s3c24xx_info; + *info = NULL; + struct s3c24xx_nand_controller *s3c24xx_info; s3c24xx_info = malloc(sizeof(struct s3c24xx_nand_controller)); if (s3c24xx_info == NULL) { LOG_ERROR("no memory for nand controller\n"); @@ -49,6 +50,8 @@ S3C24XX_DEVICE_COMMAND() return ERROR_COMMAND_SYNTAX_ERROR; } + *info = s3c24xx_info; + return ERROR_OK; } ----------------------------------------------------------------------- Summary of changes: src/flash/s3c24xx_nand.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: David B. <dbr...@us...> - 2009-11-28 23:25:52
|
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 a398c85de748effa1ac2ea7f75cee127e1ddcd5b (commit) from 01f93137c4c9d2aedd57a715be46d2809c316811 (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 a398c85de748effa1ac2ea7f75cee127e1ddcd5b Author: David Brownell <dbr...@us...> Date: Sat Nov 28 14:19:45 2009 -0800 Cortex-M3: don't chain "struct arm" commands Those commands presume support for the "classic" set of CPU modes (FIQ, supervisor, IRQ, etc) ... which aren't supported by the ARMv7-M or ARMv6-M architectures. They also presume a "struct arm" base type, which this code doesn't use. We haven't cleaned up the register handling enough to be able to share any of those "base" methods. Signed-off-by: David Brownell <dbr...@us...> diff --git a/src/target/cortex_m3.c b/src/target/cortex_m3.c index ad59c78..195a3b9 100644 --- a/src/target/cortex_m3.c +++ b/src/target/cortex_m3.c @@ -1931,9 +1931,6 @@ static const struct command_registration cortex_m3_exec_command_handlers[] = { }; static const struct command_registration cortex_m3_command_handlers[] = { { - .chain = arm_command_handlers, - }, - { .chain = armv7m_command_handlers, }, { ----------------------------------------------------------------------- Summary of changes: src/target/cortex_m3.c | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Zach W. <zw...@us...> - 2009-11-28 22:05:01
|
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 01f93137c4c9d2aedd57a715be46d2809c316811 (commit) via cdfdcb28549174a2346fc91ec95a1c620c568cad (commit) from 070259cadbb0f142f6546c55f8044199c6aea9b9 (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 01f93137c4c9d2aedd57a715be46d2809c316811 Author: Zachary T Welch <zw...@su...> Date: Fri Nov 27 09:29:07 2009 -0800 add 'nonce' nand driver The nonce NAND driver provides a no-op implementation useful for testing the system independently of any driver side-effects. diff --git a/src/flash/Makefile.am b/src/flash/Makefile.am index 8403230..94cc86e 100644 --- a/src/flash/Makefile.am +++ b/src/flash/Makefile.am @@ -44,6 +44,7 @@ NAND_SRCS = \ nand.c NAND_DEVICES_SRCS = \ + nonce_nand.c \ davinci_nand.c \ lpc3180_nand_controller.c \ mx3_nand.c \ diff --git a/src/flash/nand.c b/src/flash/nand.c index 895abe3..94cec8d 100644 --- a/src/flash/nand.c +++ b/src/flash/nand.c @@ -36,6 +36,7 @@ static int nand_write_page(struct nand_device *nand, uint32_t page, uint8_t *dat /* NAND flash controller */ +extern struct nand_flash_controller nonce_nand_controller; extern struct nand_flash_controller davinci_nand_controller; extern struct nand_flash_controller lpc3180_nand_controller; extern struct nand_flash_controller orion_nand_controller; @@ -49,6 +50,7 @@ extern struct nand_flash_controller imx31_nand_flash_controller; static struct nand_flash_controller *nand_flash_controllers[] = { + &nonce_nand_controller, &davinci_nand_controller, &lpc3180_nand_controller, &orion_nand_controller, diff --git a/src/flash/nonce_nand.c b/src/flash/nonce_nand.c new file mode 100644 index 0000000..dae62a7 --- /dev/null +++ b/src/flash/nonce_nand.c @@ -0,0 +1,80 @@ +/*************************************************************************** + * 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 "nand.h" + + +static int nonce_nand_command(struct nand_device *nand, uint8_t command) +{ + return ERROR_OK; +} +static int nonce_nand_address(struct nand_device *nand, uint8_t address) +{ + return ERROR_OK; +} +static int nonce_nand_read(struct nand_device *nand, void *data) +{ + return ERROR_OK; +} +static int nonce_nand_write(struct nand_device *nand, uint16_t data) +{ + return ERROR_OK; +} +static int nonce_nand_fast_block_write(struct nand_device *nand, + uint8_t *data, int size) +{ + return ERROR_OK; +} + +static int nonce_nand_reset(struct nand_device *nand) +{ + return nonce_nand_command(nand, NAND_CMD_RESET); +} + +static int nonce_nand_controller_ready(struct nand_device *nand, int timeout) +{ + return true; +} + +NAND_DEVICE_COMMAND_HANDLER(nonce_nand_device_command) +{ + return ERROR_OK; +} + +static int nonce_nand_init(struct nand_device *nand) +{ + return ERROR_OK; +} + +struct nand_flash_controller nonce_nand_controller = +{ + .name = "nonce", + .nand_device_command = &nonce_nand_device_command, + .init = &nonce_nand_init, + .reset = &nonce_nand_reset, + .command = &nonce_nand_command, + .address = &nonce_nand_address, + .read_data = &nonce_nand_read, + .write_data = &nonce_nand_write, + .write_block_data = &nonce_nand_fast_block_write, + .controller_ready = &nonce_nand_controller_ready, +}; commit cdfdcb28549174a2346fc91ec95a1c620c568cad Author: Zachary T Welch <zw...@su...> Date: Wed Nov 25 16:57:12 2009 -0800 add more stub handlers to testee target Prevent everything from crashing when exercising various commands. diff --git a/src/target/testee.c b/src/target/testee.c index ca3d56e..f858232 100644 --- a/src/target/testee.c +++ b/src/target/testee.c @@ -40,9 +40,29 @@ static int testee_init(struct command_context *cmd_ctx, struct target *target) { return ERROR_OK; } - +static int testee_poll(struct target *target) +{ + return ERROR_OK; +} +static int testee_halt(struct target *target) +{ + return ERROR_OK; +} +static int testee_reset_assert(struct target *target) +{ + return ERROR_OK; +} +static int testee_reset_deassert(struct target *target) +{ + return ERROR_OK; +} struct target_type testee_target = { .name = "testee", - .init_target = &testee_init, .commands = testee_command_handlers, + + .init_target = &testee_init, + .poll = &testee_poll, + .halt = &testee_halt, + .assert_reset = &testee_reset_assert, + .deassert_reset = &testee_reset_deassert, }; ----------------------------------------------------------------------- Summary of changes: src/flash/Makefile.am | 1 + src/flash/nand.c | 2 + src/{target/testee.c => flash/nonce_nand.c} | 72 +++++++++++++++++++------- src/target/testee.c | 24 ++++++++- 4 files changed, 77 insertions(+), 22 deletions(-) copy src/{target/testee.c => flash/nonce_nand.c} (53%) hooks/post-receive -- Main OpenOCD repository |
From: Zach W. <zw...@us...> - 2009-11-28 22:04:38
|
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 070259cadbb0f142f6546c55f8044199c6aea9b9 (commit) via cb8d567b7524b96d034344a2027e33d7f44f48ec (commit) via f8a62fb9c62f165696cc34eeb23b2bc1f6a79000 (commit) via 7124be824792eee3f973eb2cf7e1c851cbd2a923 (commit) via 4ff5eda576d75ee57ba448d2136867c791d215a8 (commit) via 0377e5b54d6db196cfeeaaa70824c581317e2290 (commit) via c4992c6d863d0ead91d84d19bbfe1643d720b205 (commit) from 2da2864632c281a2523f924b406e532d610857a6 (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 070259cadbb0f142f6546c55f8044199c6aea9b9 Author: Zachary T Welch <zw...@su...> Date: Wed Nov 25 16:36:46 2009 -0800 explode tcl_target_func into many handlers Eliminate the monolithic tcl_target_func by registering each of its commands using the new chained command registration mechanism. Also chains the target's commands under the CPU command, though these may not work properly without some further modification. diff --git a/src/target/target.c b/src/target/target.c index d9552a5..3a84040 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -3366,7 +3366,7 @@ static int target_array2mem(Jim_Interp *interp, struct target *target, int argc, * argv[4] = count to write */ if (argc != 4) { - Jim_WrongNumArgs(interp, 1, argv, "varname width addr nelems"); + Jim_WrongNumArgs(interp, 0, argv, "varname width addr nelems"); return JIM_ERR; } varname = Jim_GetString(argv[0], &len); @@ -3849,422 +3849,537 @@ static int target_configure(Jim_GetOptInfo *goi, struct target *target) return JIM_OK; } -/** this is the 'tcl' handler for the target specific command */ -static int tcl_target_func(Jim_Interp *interp, int argc, Jim_Obj *const *argv) +static int jim_target_configure(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { Jim_GetOptInfo goi; - jim_wide a,b,c; - int x,y,z; - uint8_t target_buf[32]; - Jim_Nvp *n; - struct target *target; - struct command_context *cmd_ctx; - int e; + Jim_GetOpt_Setup(&goi, interp, argc - 1, argv + 1); + goi.isconfigure = strcmp(Jim_GetString(argv[0], NULL), "configure") == 0; + int need_args = 1 + goi.isconfigure; + if (goi.argc < need_args) + { + Jim_WrongNumArgs(goi.interp, goi.argc, goi.argv, + goi.isconfigure + ? "missing: -option VALUE ..." + : "missing: -option ..."); + return JIM_ERR; + } + struct target *target = Jim_CmdPrivData(goi.interp); + return target_configure(&goi, target); +} - enum { - TS_CMD_CONFIGURE, - TS_CMD_CGET, - - TS_CMD_MWW, TS_CMD_MWH, TS_CMD_MWB, - TS_CMD_MDW, TS_CMD_MDH, TS_CMD_MDB, - TS_CMD_MRW, TS_CMD_MRH, TS_CMD_MRB, - TS_CMD_MEM2ARRAY, TS_CMD_ARRAY2MEM, - TS_CMD_EXAMINE, - TS_CMD_POLL, - TS_CMD_RESET, - TS_CMD_HALT, - TS_CMD_WAITSTATE, - TS_CMD_EVENTLIST, - TS_CMD_CURSTATE, - TS_CMD_INVOKE_EVENT, - }; +static int jim_target_mw(Jim_Interp *interp, int argc, Jim_Obj *const *argv) +{ + const char *cmd_name = Jim_GetString(argv[0], NULL); - static const Jim_Nvp target_options[] = { - { .name = "configure", .value = TS_CMD_CONFIGURE }, - { .name = "cget", .value = TS_CMD_CGET }, - { .name = "mww", .value = TS_CMD_MWW }, - { .name = "mwh", .value = TS_CMD_MWH }, - { .name = "mwb", .value = TS_CMD_MWB }, - { .name = "mdw", .value = TS_CMD_MDW }, - { .name = "mdh", .value = TS_CMD_MDH }, - { .name = "mdb", .value = TS_CMD_MDB }, - { .name = "mem2array", .value = TS_CMD_MEM2ARRAY }, - { .name = "array2mem", .value = TS_CMD_ARRAY2MEM }, - { .name = "eventlist", .value = TS_CMD_EVENTLIST }, - { .name = "curstate", .value = TS_CMD_CURSTATE }, - - { .name = "arp_examine", .value = TS_CMD_EXAMINE }, - { .name = "arp_poll", .value = TS_CMD_POLL }, - { .name = "arp_reset", .value = TS_CMD_RESET }, - { .name = "arp_halt", .value = TS_CMD_HALT }, - { .name = "arp_waitstate", .value = TS_CMD_WAITSTATE }, - { .name = "invoke-event", .value = TS_CMD_INVOKE_EVENT }, - - { .name = NULL, .value = -1 }, - }; + Jim_GetOptInfo goi; + Jim_GetOpt_Setup(&goi, interp, argc - 1, argv + 1); - /* go past the "command" */ - Jim_GetOpt_Setup(&goi, interp, argc-1, argv + 1); + if (goi.argc != 2 && goi.argc != 3) + { + Jim_SetResult_sprintf(goi.interp, + "usage: %s <address> <data> [<count>]", cmd_name); + return JIM_ERR; + } - target = Jim_CmdPrivData(goi.interp); - cmd_ctx = Jim_GetAssocData(goi.interp, "context"); + jim_wide a; + int e = Jim_GetOpt_Wide(&goi, &a); + if (e != JIM_OK) + return e; - /* commands here are in an NVP table */ - e = Jim_GetOpt_Nvp(&goi, target_options, &n); - if (e != JIM_OK) { - Jim_GetOpt_NvpUnknown(&goi, target_options, 0); + jim_wide b; + e = Jim_GetOpt_Wide(&goi, &b); + if (e != JIM_OK) return e; + + jim_wide c = 1; + if (goi.argc == 3) + { + e = Jim_GetOpt_Wide(&goi, &c); + if (e != JIM_OK) + return e; } - /* Assume blank result */ - Jim_SetEmptyResult(goi.interp); - switch (n->value) { - case TS_CMD_CONFIGURE: - if (goi.argc < 2) { - Jim_WrongNumArgs(goi.interp, goi.argc, goi.argv, "missing: -option VALUE ..."); - return JIM_ERR; - } - goi.isconfigure = 1; - return target_configure(&goi, target); - case TS_CMD_CGET: - // some things take params - if (goi.argc < 1) { - Jim_WrongNumArgs(goi.interp, 0, goi.argv, "missing: ?-option?"); - return JIM_ERR; - } - goi.isconfigure = 0; - return target_configure(&goi, target); - break; - case TS_CMD_MWW: - case TS_CMD_MWH: - case TS_CMD_MWB: - /* argv[0] = cmd - * argv[1] = address - * argv[2] = data - * argv[3] = optional count. - */ + struct target *target = Jim_CmdPrivData(goi.interp); + uint8_t target_buf[32]; + if (strcasecmp(cmd_name, "mww") == 0) { + target_buffer_set_u32(target, target_buf, b); + b = 4; + } + else if (strcasecmp(cmd_name, "mwh") == 0) { + target_buffer_set_u16(target, target_buf, b); + b = 2; + } + else if (strcasecmp(cmd_name, "mwb") == 0) { + target_buffer_set_u8(target, target_buf, b); + b = 1; + } else { + LOG_ERROR("command '%s' unknown: ", cmd_name); + return JIM_ERR; + } - if ((goi.argc == 2) || (goi.argc == 3)) { - /* all is well */ - } else { - mwx_error: - Jim_SetResult_sprintf(goi.interp, "expected: %s ADDR DATA [COUNT]", n->name); + for (jim_wide x = 0; x < c; x++) + { + e = target_write_memory(target, a, b, 1, target_buf); + if (e != ERROR_OK) + { + Jim_SetResult_sprintf(interp, + "Error writing @ 0x%08x: %d\n", (int)(a), e); return JIM_ERR; } + /* b = width */ + a = a + b; + } + return JIM_OK; +} - e = Jim_GetOpt_Wide(&goi, &a); - if (e != JIM_OK) { - goto mwx_error; - } +static int jim_target_md(Jim_Interp *interp, int argc, Jim_Obj *const *argv) +{ + const char *cmd_name = Jim_GetString(argv[0], NULL); - e = Jim_GetOpt_Wide(&goi, &b); - if (e != JIM_OK) { - goto mwx_error; - } - if (goi.argc == 3) { - e = Jim_GetOpt_Wide(&goi, &c); - if (e != JIM_OK) { - goto mwx_error; - } - } else { - c = 1; - } + Jim_GetOptInfo goi; + Jim_GetOpt_Setup(&goi, interp, argc - 1, argv + 1); - switch (n->value) { - case TS_CMD_MWW: - target_buffer_set_u32(target, target_buf, b); - b = 4; - break; - case TS_CMD_MWH: - target_buffer_set_u16(target, target_buf, b); - b = 2; - break; - case TS_CMD_MWB: - target_buffer_set_u8(target, target_buf, b); - b = 1; - break; - } - for (x = 0 ; x < c ; x++) { - e = target_write_memory(target, a, b, 1, target_buf); - if (e != ERROR_OK) { - Jim_SetResult_sprintf(interp, "Error writing @ 0x%08x: %d\n", (int)(a), e); - return JIM_ERR; - } - /* b = width */ - a = a + b; - } - return JIM_OK; - break; + if ((goi.argc == 2) || (goi.argc == 3)) + { + Jim_SetResult_sprintf(goi.interp, + "usage: %s <address> [<count>]", cmd_name); + return JIM_ERR; + } - /* display */ - case TS_CMD_MDW: - case TS_CMD_MDH: - case TS_CMD_MDB: - /* argv[0] = command - * argv[1] = address - * argv[2] = optional count - */ - if ((goi.argc == 2) || (goi.argc == 3)) { - Jim_SetResult_sprintf(goi.interp, "expected: %s ADDR [COUNT]", n->name); - return JIM_ERR; - } - e = Jim_GetOpt_Wide(&goi, &a); + jim_wide a; + int e = Jim_GetOpt_Wide(&goi, &a); + if (e != JIM_OK) { + return JIM_ERR; + } + jim_wide c; + if (goi.argc) { + e = Jim_GetOpt_Wide(&goi, &c); if (e != JIM_OK) { return JIM_ERR; } - if (goi.argc) { - e = Jim_GetOpt_Wide(&goi, &c); - if (e != JIM_OK) { - return JIM_ERR; - } - } else { - c = 1; + } else { + c = 1; + } + jim_wide b = 1; /* shut up gcc */ + if (strcasecmp(cmd_name, "mdw") == 0) + b = 4; + else if (strcasecmp(cmd_name, "mdh") == 0) + b = 2; + else if (strcasecmp(cmd_name, "mdb") == 0) + b = 1; + else { + LOG_ERROR("command '%s' unknown: ", cmd_name); + return JIM_ERR; + } + + /* convert count to "bytes" */ + c = c * b; + + struct target *target = Jim_CmdPrivData(goi.interp); + uint8_t target_buf[32]; + jim_wide x, y, z; + while (c > 0) { + y = c; + if (y > 16) { + y = 16; } - b = 1; /* shut up gcc */ - switch (n->value) { - case TS_CMD_MDW: - b = 4; - break; - case TS_CMD_MDH: - b = 2; - break; - case TS_CMD_MDB: - b = 1; - break; + e = target_read_memory(target, a, b, y / b, target_buf); + if (e != ERROR_OK) { + Jim_SetResult_sprintf(interp, "error reading target @ 0x%08lx", (int)(a)); + return JIM_ERR; } - /* convert to "bytes" */ - c = c * b; - /* count is now in 'BYTES' */ - while (c > 0) { - y = c; - if (y > 16) { - y = 16; + Jim_fprintf(interp, interp->cookie_stdout, "0x%08x ", (int)(a)); + switch (b) { + case 4: + for (x = 0; x < 16 && x < y; x += 4) + { + z = target_buffer_get_u32(target, &(target_buf[ x * 4 ])); + Jim_fprintf(interp, interp->cookie_stdout, "%08x ", (int)(z)); } - e = target_read_memory(target, a, b, y / b, target_buf); - if (e != ERROR_OK) { - Jim_SetResult_sprintf(interp, "error reading target @ 0x%08lx", (int)(a)); - return JIM_ERR; + for (; (x < 16) ; x += 4) { + Jim_fprintf(interp, interp->cookie_stdout, " "); } - - Jim_fprintf(interp, interp->cookie_stdout, "0x%08x ", (int)(a)); - switch (b) { - case 4: - for (x = 0 ; (x < 16) && (x < y) ; x += 4) { - z = target_buffer_get_u32(target, &(target_buf[ x * 4 ])); - Jim_fprintf(interp, interp->cookie_stdout, "%08x ", (int)(z)); - } - for (; (x < 16) ; x += 4) { - Jim_fprintf(interp, interp->cookie_stdout, " "); - } - break; - case 2: - for (x = 0 ; (x < 16) && (x < y) ; x += 2) { - z = target_buffer_get_u16(target, &(target_buf[ x * 2 ])); - Jim_fprintf(interp, interp->cookie_stdout, "%04x ", (int)(z)); - } - for (; (x < 16) ; x += 2) { - Jim_fprintf(interp, interp->cookie_stdout, " "); - } - break; - case 1: - default: - for (x = 0 ; (x < 16) && (x < y) ; x += 1) { - z = target_buffer_get_u8(target, &(target_buf[ x * 4 ])); - Jim_fprintf(interp, interp->cookie_stdout, "%02x ", (int)(z)); - } - for (; (x < 16) ; x += 1) { - Jim_fprintf(interp, interp->cookie_stdout, " "); - } - break; + break; + case 2: + for (x = 0; x < 16 && x < y; x += 2) + { + z = target_buffer_get_u16(target, &(target_buf[ x * 2 ])); + Jim_fprintf(interp, interp->cookie_stdout, "%04x ", (int)(z)); } - /* ascii-ify the bytes */ - for (x = 0 ; x < y ; x++) { - if ((target_buf[x] >= 0x20) && - (target_buf[x] <= 0x7e)) { - /* good */ - } else { - /* smack it */ - target_buf[x] = '.'; - } + for (; (x < 16) ; x += 2) { + Jim_fprintf(interp, interp->cookie_stdout, " "); } - /* space pad */ - while (x < 16) { - target_buf[x] = ' '; - x++; + break; + case 1: + default: + for (x = 0 ; (x < 16) && (x < y) ; x += 1) { + z = target_buffer_get_u8(target, &(target_buf[ x * 4 ])); + Jim_fprintf(interp, interp->cookie_stdout, "%02x ", (int)(z)); } - /* terminate */ - target_buf[16] = 0; - /* print - with a newline */ - Jim_fprintf(interp, interp->cookie_stdout, "%s\n", target_buf); - /* NEXT... */ - c -= 16; - a += 16; - } - return JIM_OK; - case TS_CMD_MEM2ARRAY: - return target_mem2array(goi.interp, target, goi.argc, goi.argv); - break; - case TS_CMD_ARRAY2MEM: - return target_array2mem(goi.interp, target, goi.argc, goi.argv); - break; - case TS_CMD_EXAMINE: - if (goi.argc) { - Jim_WrongNumArgs(goi.interp, 2, argv, "[no parameters]"); - return JIM_ERR; - } - if (!target->tap->enabled) - goto err_tap_disabled; - e = target->type->examine(target); - if (e != ERROR_OK) { - Jim_SetResult_sprintf(interp, "examine-fails: %d", e); - return JIM_ERR; - } - return JIM_OK; - case TS_CMD_POLL: - if (goi.argc) { - Jim_WrongNumArgs(goi.interp, 2, argv, "[no parameters]"); - return JIM_ERR; - } - if (!target->tap->enabled) - goto err_tap_disabled; - if (!(target_was_examined(target))) { - e = ERROR_TARGET_NOT_EXAMINED; - } else { - e = target->type->poll(target); - } - if (e != ERROR_OK) { - Jim_SetResult_sprintf(interp, "poll-fails: %d", e); - return JIM_ERR; - } else { - return JIM_OK; - } - break; - case TS_CMD_RESET: - if (goi.argc != 2) { - Jim_WrongNumArgs(interp, 2, argv, - "([tT]|[fF]|assert|deassert) BOOL"); - return JIM_ERR; - } - e = Jim_GetOpt_Nvp(&goi, nvp_assert, &n); - if (e != JIM_OK) { - Jim_GetOpt_NvpUnknown(&goi, nvp_assert, 1); - return e; - } - /* the halt or not param */ - e = Jim_GetOpt_Wide(&goi, &a); - if (e != JIM_OK) { - return e; - } - if (!target->tap->enabled) - goto err_tap_disabled; - if (!target->type->assert_reset - || !target->type->deassert_reset) { - Jim_SetResult_sprintf(interp, - "No target-specific reset for %s", - target_name(target)); - return JIM_ERR; - } - /* determine if we should halt or not. */ - target->reset_halt = !!a; - /* When this happens - all workareas are invalid. */ - target_free_all_working_areas_restore(target, 0); - - /* do the assert */ - if (n->value == NVP_ASSERT) { - e = target->type->assert_reset(target); - } else { - e = target->type->deassert_reset(target); - } - return (e == ERROR_OK) ? JIM_OK : JIM_ERR; - case TS_CMD_HALT: - if (goi.argc) { - Jim_WrongNumArgs(goi.interp, 0, argv, "halt [no parameters]"); - return JIM_ERR; - } - if (!target->tap->enabled) - goto err_tap_disabled; - e = target->type->halt(target); - return (e == ERROR_OK) ? JIM_OK : JIM_ERR; - case TS_CMD_WAITSTATE: - /* params: <name> statename timeoutmsecs */ - if (goi.argc != 2) { - Jim_SetResult_sprintf(goi.interp, "%s STATENAME TIMEOUTMSECS", n->name); - return JIM_ERR; - } - e = Jim_GetOpt_Nvp(&goi, nvp_target_state, &n); - if (e != JIM_OK) { - Jim_GetOpt_NvpUnknown(&goi, nvp_target_state,1); - return e; - } - e = Jim_GetOpt_Wide(&goi, &a); - if (e != JIM_OK) { - return e; - } - if (!target->tap->enabled) - goto err_tap_disabled; - e = target_wait_state(target, n->value, a); - if (e != ERROR_OK) { - Jim_SetResult_sprintf(goi.interp, - "target: %s wait %s fails (%d) %s", - target_name(target), n->name, - e, target_strerror_safe(e)); - return JIM_ERR; - } else { - return JIM_OK; - } - case TS_CMD_EVENTLIST: - /* List for human, Events defined for this target. - * scripts/programs should use 'name cget -event NAME' - */ - { - struct target_event_action *teap; - teap = target->event_action; - command_print(cmd_ctx, - "Event actions for target (%d) %s\n", - target->target_number, - target_name(target)); - command_print(cmd_ctx, "%-25s | Body", "Event"); - command_print(cmd_ctx, "------------------------- | ----------------------------------------"); - while (teap) { - command_print(cmd_ctx, - "%-25s | %s", - Jim_Nvp_value2name_simple(nvp_target_event, teap->event)->name, - Jim_GetString(teap->body, NULL)); - teap = teap->next; + for (; (x < 16) ; x += 1) { + Jim_fprintf(interp, interp->cookie_stdout, " "); } - command_print(cmd_ctx, "***END***"); - return JIM_OK; - } - case TS_CMD_CURSTATE: - if (goi.argc != 0) { - Jim_WrongNumArgs(goi.interp, 0, argv, "[no parameters]"); - return JIM_ERR; + break; } - Jim_SetResultString(goi.interp, - target_state_name( target ), - -1); - return JIM_OK; - case TS_CMD_INVOKE_EVENT: - if (goi.argc != 1) { - Jim_SetResult_sprintf(goi.interp, "%s ?EVENTNAME?",n->name); - return JIM_ERR; + /* ascii-ify the bytes */ + for (x = 0 ; x < y ; x++) { + if ((target_buf[x] >= 0x20) && + (target_buf[x] <= 0x7e)) { + /* good */ + } else { + /* smack it */ + target_buf[x] = '.'; + } } - e = Jim_GetOpt_Nvp(&goi, nvp_target_event, &n); - if (e != JIM_OK) { - Jim_GetOpt_NvpUnknown(&goi, nvp_target_event, 1); - return e; + /* space pad */ + while (x < 16) { + target_buf[x] = ' '; + x++; } - target_handle_event(target, n->value); - return JIM_OK; + /* terminate */ + target_buf[16] = 0; + /* print - with a newline */ + Jim_fprintf(interp, interp->cookie_stdout, "%s\n", target_buf); + /* NEXT... */ + c -= 16; + a += 16; } - return JIM_ERR; + return JIM_OK; +} + +static int jim_target_mem2array(Jim_Interp *interp, int argc, Jim_Obj *const *argv) +{ + struct target *target = Jim_CmdPrivData(interp); + return target_mem2array(interp, target, argc - 1, argv + 1); +} + +static int jim_target_array2mem(Jim_Interp *interp, int argc, Jim_Obj *const *argv) +{ + struct target *target = Jim_CmdPrivData(interp); + return target_array2mem(interp, target, argc - 1, argv + 1); +} -err_tap_disabled: +static int jim_target_tap_disabled(Jim_Interp *interp) +{ Jim_SetResult_sprintf(interp, "[TAP is disabled]"); return JIM_ERR; } +static int jim_target_examine(Jim_Interp *interp, int argc, Jim_Obj *const *argv) +{ + if (argc != 1) + { + Jim_WrongNumArgs(interp, 1, argv, "[no parameters]"); + return JIM_ERR; + } + struct target *target = Jim_CmdPrivData(interp); + if (!target->tap->enabled) + return jim_target_tap_disabled(interp); + + int e = target->type->examine(target); + if (e != ERROR_OK) + { + Jim_SetResult_sprintf(interp, "examine-fails: %d", e); + return JIM_ERR; + } + return JIM_OK; +} + +static int jim_target_poll(Jim_Interp *interp, int argc, Jim_Obj *const *argv) +{ + if (argc != 1) + { + Jim_WrongNumArgs(interp, 1, argv, "[no parameters]"); + return JIM_ERR; + } + struct target *target = Jim_CmdPrivData(interp); + if (!target->tap->enabled) + return jim_target_tap_disabled(interp); + + int e; + if (!(target_was_examined(target))) { + e = ERROR_TARGET_NOT_EXAMINED; + } else { + e = target->type->poll(target); + } + if (e != ERROR_OK) + { + Jim_SetResult_sprintf(interp, "poll-fails: %d", e); + return JIM_ERR; + } + return JIM_OK; +} + +static int jim_target_reset(Jim_Interp *interp, int argc, Jim_Obj *const *argv) +{ + Jim_GetOptInfo goi; + Jim_GetOpt_Setup(&goi, interp, argc - 1, argv + 1); + + if (goi.argc != 2) + { + Jim_WrongNumArgs(interp, 0, argv, + "([tT]|[fF]|assert|deassert) BOOL"); + return JIM_ERR; + } + + Jim_Nvp *n; + int e = Jim_GetOpt_Nvp(&goi, nvp_assert, &n); + if (e != JIM_OK) + { + Jim_GetOpt_NvpUnknown(&goi, nvp_assert, 1); + return e; + } + /* the halt or not param */ + jim_wide a; + e = Jim_GetOpt_Wide(&goi, &a); + if (e != JIM_OK) + return e; + + struct target *target = Jim_CmdPrivData(goi.interp); + if (!target->tap->enabled) + return jim_target_tap_disabled(interp); + if (!target->type->assert_reset || !target->type->deassert_reset) + { + Jim_SetResult_sprintf(interp, + "No target-specific reset for %s", + target_name(target)); + return JIM_ERR; + } + /* determine if we should halt or not. */ + target->reset_halt = !!a; + /* When this happens - all workareas are invalid. */ + target_free_all_working_areas_restore(target, 0); + + /* do the assert */ + if (n->value == NVP_ASSERT) { + e = target->type->assert_reset(target); + } else { + e = target->type->deassert_reset(target); + } + return (e == ERROR_OK) ? JIM_OK : JIM_ERR; +} + +static int jim_target_halt(Jim_Interp *interp, int argc, Jim_Obj *const *argv) +{ + if (argc != 1) { + Jim_WrongNumArgs(interp, 1, argv, "[no parameters]"); + return JIM_ERR; + } + struct target *target = Jim_CmdPrivData(interp); + if (!target->tap->enabled) + return jim_target_tap_disabled(interp); + int e = target->type->halt(target); + return (e == ERROR_OK) ? JIM_OK : JIM_ERR; +} + +static int jim_target_wait_state(Jim_Interp *interp, int argc, Jim_Obj *const *argv) +{ + Jim_GetOptInfo goi; + Jim_GetOpt_Setup(&goi, interp, argc - 1, argv + 1); + + /* params: <name> statename timeoutmsecs */ + if (goi.argc != 2) + { + const char *cmd_name = Jim_GetString(argv[0], NULL); + Jim_SetResult_sprintf(goi.interp, + "%s <state_name> <timeout_in_msec>", cmd_name); + return JIM_ERR; + } + + Jim_Nvp *n; + int e = Jim_GetOpt_Nvp(&goi, nvp_target_state, &n); + if (e != JIM_OK) { + Jim_GetOpt_NvpUnknown(&goi, nvp_target_state,1); + return e; + } + jim_wide a; + e = Jim_GetOpt_Wide(&goi, &a); + if (e != JIM_OK) { + return e; + } + struct target *target = Jim_CmdPrivData(interp); + if (!target->tap->enabled) + return jim_target_tap_disabled(interp); + + e = target_wait_state(target, n->value, a); + if (e != ERROR_OK) + { + Jim_SetResult_sprintf(goi.interp, + "target: %s wait %s fails (%d) %s", + target_name(target), n->name, + e, target_strerror_safe(e)); + return JIM_ERR; + } + return JIM_OK; +} +/* List for human, Events defined for this target. + * scripts/programs should use 'name cget -event NAME' + */ +static int jim_target_event_list(Jim_Interp *interp, int argc, Jim_Obj *const *argv) +{ + struct command_context *cmd_ctx = Jim_GetAssocData(interp, "context"); + struct target *target = Jim_CmdPrivData(interp); + struct target_event_action *teap = target->event_action; + command_print(cmd_ctx, "Event actions for target (%d) %s\n", + target->target_number, + target_name(target)); + command_print(cmd_ctx, "%-25s | Body", "Event"); + command_print(cmd_ctx, "------------------------- | " + "----------------------------------------"); + while (teap) + { + Jim_Nvp *opt = Jim_Nvp_value2name_simple(nvp_target_event, teap->event); + command_print(cmd_ctx, "%-25s | %s", + opt->name, Jim_GetString(teap->body, NULL)); + teap = teap->next; + } + command_print(cmd_ctx, "***END***"); + return JIM_OK; +} +static int jim_target_current_state(Jim_Interp *interp, int argc, Jim_Obj *const *argv) +{ + if (argc != 1) + { + Jim_WrongNumArgs(interp, 1, argv, "[no parameters]"); + return JIM_ERR; + } + struct target *target = Jim_CmdPrivData(interp); + Jim_SetResultString(interp, target_state_name(target), -1); + return JIM_OK; +} +static int jim_target_invoke_event(Jim_Interp *interp, int argc, Jim_Obj *const *argv) +{ + Jim_GetOptInfo goi; + Jim_GetOpt_Setup(&goi, interp, argc - 1, argv + 1); + if (goi.argc != 1) + { + const char *cmd_name = Jim_GetString(argv[0], NULL); + Jim_SetResult_sprintf(goi.interp, "%s <eventname>", cmd_name); + return JIM_ERR; + } + Jim_Nvp *n; + int e = Jim_GetOpt_Nvp(&goi, nvp_target_event, &n); + if (e != JIM_OK) + { + Jim_GetOpt_NvpUnknown(&goi, nvp_target_event, 1); + return e; + } + struct target *target = Jim_CmdPrivData(interp); + target_handle_event(target, n->value); + return JIM_OK; +} + +static const struct command_registration target_instance_command_handlers[] = { + { + .name = "configure", + .mode = COMMAND_CONFIG, + .jim_handler = &jim_target_configure, + .usage = "[<target_options> ...]", + .help = "configure a new target for use", + }, + { + .name = "cget", + .mode = COMMAND_ANY, + .jim_handler = &jim_target_configure, + .usage = "<target_type> [<target_options> ...]", + .help = "configure a new target for use", + }, + { + .name = "mww", + .mode = COMMAND_EXEC, + .jim_handler = &jim_target_mw, + .usage = "<address> <data> [<count>]", + .help = "Write 32-bit word(s) to target memory", + }, + { + .name = "mwh", + .mode = COMMAND_EXEC, + .jim_handler = &jim_target_mw, + .usage = "<address> <data> [<count>]", + .help = "Write 16-bit half-word(s) to target memory", + }, + { + .name = "mwb", + .mode = COMMAND_EXEC, + .jim_handler = &jim_target_mw, + .usage = "<address> <data> [<count>]", + .help = "Write byte(s) to target memory", + }, + { + .name = "mdw", + .mode = COMMAND_EXEC, + .jim_handler = &jim_target_md, + .usage = "<address> [<count>]", + .help = "Display target memory as 32-bit words", + }, + { + .name = "mdh", + .mode = COMMAND_EXEC, + .jim_handler = &jim_target_md, + .usage = "<address> [<count>]", + .help = "Display target memory as 16-bit half-words", + }, + { + .name = "mdb", + .mode = COMMAND_EXEC, + .jim_handler = &jim_target_md, + .usage = "<address> [<count>]", + .help = "Display target memory as 8-bit bytes", + }, + { + .name = "array2mem", + .mode = COMMAND_EXEC, + .jim_handler = &jim_target_array2mem, + }, + { + .name = "mem2array", + .mode = COMMAND_EXEC, + .jim_handler = &jim_target_mem2array, + }, + { + .name = "eventlist", + .mode = COMMAND_EXEC, + .jim_handler = &jim_target_event_list, + }, + { + .name = "curstate", + .mode = COMMAND_EXEC, + .jim_handler = &jim_target_current_state, + }, + { + .name = "arp_examine", + .mode = COMMAND_EXEC, + .jim_handler = &jim_target_examine, + }, + { + .name = "arp_poll", + .mode = COMMAND_EXEC, + .jim_handler = &jim_target_poll, + }, + { + .name = "arp_reset", + .mode = COMMAND_EXEC, + .jim_handler = &jim_target_reset, + }, + { + .name = "arp_halt", + .mode = COMMAND_EXEC, + .jim_handler = &jim_target_halt, + }, + { + .name = "arp_waitstate", + .mode = COMMAND_EXEC, + .jim_handler = &jim_target_wait_state, + }, + { + .name = "invoke-event", + .mode = COMMAND_EXEC, + .jim_handler = &jim_target_invoke_event, + }, + COMMAND_REGISTRATION_DONE +}; + static int target_create(Jim_GetOptInfo *goi) { Jim_Obj *new_cmd; @@ -4412,16 +4527,35 @@ static int target_create(Jim_GetOptInfo *goi) } *tpp = target; } - + /* now - create the new target name command */ - const struct command_registration target_command = { - .name = cp, - .jim_handler = &tcl_target_func, - .jim_handler_data = target, - .help = "target command group", + const const struct command_registration target_subcommands[] = { + { + .chain = target_instance_command_handlers, + }, + { + .chain = target->type->commands, + }, + COMMAND_REGISTRATION_DONE }; - struct command *c = register_command(cmd_ctx, NULL, &target_command); - return (NULL != c) ? ERROR_OK : ERROR_FAIL; + const const struct command_registration target_commands[] = { + { + .name = cp, + .mode = COMMAND_ANY, + .help = "target command group", + .chain = target_subcommands, + }, + COMMAND_REGISTRATION_DONE + }; + e = register_commands(cmd_ctx, NULL, target_commands); + if (ERROR_OK != e) + return JIM_ERR; + + struct command *c = command_find_in_context(cmd_ctx, cp); + assert(c); + command_set_handler_data(c, target); + + return (ERROR_OK == e) ? JIM_OK : JIM_ERR; } static int jim_target_current(Jim_Interp *interp, int argc, Jim_Obj *const *argv) commit cb8d567b7524b96d034344a2027e33d7f44f48ec Author: Zachary T Welch <zw...@su...> Date: Wed Nov 25 12:57:28 2009 -0800 split jim_target into multiple handlers The 'target' command group was implemented using its own command dispatching, which can be eliminated by using the new chained command registration mechanism. This patch splits the jim_target() function into individual handlers, which makes them to be visible to the help and usage commands. These one-trick handlers are much easier to understand. diff --git a/src/target/target.c b/src/target/target.c index 28387f4..d9552a5 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -4424,129 +4424,156 @@ static int target_create(Jim_GetOptInfo *goi) return (NULL != c) ? ERROR_OK : ERROR_FAIL; } -static int jim_target(Jim_Interp *interp, int argc, Jim_Obj *const *argv) +static int jim_target_current(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { - int x,r,e; - jim_wide w; - struct command_context *cmd_ctx; - struct target *target; - Jim_GetOptInfo goi; - enum tcmd { - /* TG = target generic */ - TG_CMD_CREATE, - TG_CMD_TYPES, - TG_CMD_NAMES, - TG_CMD_CURRENT, - TG_CMD_NUMBER, - TG_CMD_COUNT, - }; - const char *target_cmds[] = { - "create", "types", "names", "current", "number", - "count", - NULL /* terminate */ - }; - - LOG_DEBUG("Target command params:"); - LOG_DEBUG("%s", Jim_Debug_ArgvString(interp, argc, argv)); - - cmd_ctx = Jim_GetAssocData(interp, "context"); + if (argc != 1) + { + Jim_WrongNumArgs(interp, 1, argv, "Too many parameters"); + return JIM_ERR; + } + struct command_context *cmd_ctx = Jim_GetAssocData(interp, "context"); + Jim_SetResultString(interp, get_current_target(cmd_ctx)->cmd_name, -1); + return JIM_OK; +} - Jim_GetOpt_Setup(&goi, interp, argc-1, argv + 1); +static int jim_target_types(Jim_Interp *interp, int argc, Jim_Obj *const *argv) +{ + if (argc != 1) + { + Jim_WrongNumArgs(interp, 1, argv, "Too many parameters"); + return JIM_ERR; + } + Jim_SetResult(interp, Jim_NewListObj(interp, NULL, 0)); + for (unsigned x = 0; NULL != target_types[x]; x++) + { + Jim_ListAppendElement(interp, Jim_GetResult(interp), + Jim_NewStringObj(interp, target_types[x]->name, -1)); + } + return JIM_OK; +} - if (goi.argc == 0) { - Jim_WrongNumArgs(interp, 1, argv, "missing: command ..."); +static int jim_target_names(Jim_Interp *interp, int argc, Jim_Obj *const *argv) +{ + if (argc != 1) + { + Jim_WrongNumArgs(interp, 1, argv, "Too many parameters"); return JIM_ERR; } + Jim_SetResult(interp, Jim_NewListObj(interp, NULL, 0)); + struct target *target = all_targets; + while (target) + { + Jim_ListAppendElement(interp, Jim_GetResult(interp), + Jim_NewStringObj(interp, target_name(target), -1)); + target = target->next; + } + return JIM_OK; +} - /* Jim_GetOpt_Debug(&goi); */ - r = Jim_GetOpt_Enum(&goi, target_cmds, &x); - if (r != JIM_OK) { - return r; +static int jim_target_create(Jim_Interp *interp, int argc, Jim_Obj *const *argv) +{ + Jim_GetOptInfo goi; + Jim_GetOpt_Setup(&goi, interp, argc - 1, argv + 1); + if (goi.argc < 3) + { + Jim_WrongNumArgs(goi.interp, goi.argc, goi.argv, + "<name> <target_type> [<target_options> ...]"); + return JIM_ERR; } + return target_create(&goi); +} - switch (x) { - default: - Jim_Panic(goi.interp,"Why am I here?"); +static int jim_target_number(Jim_Interp *interp, int argc, Jim_Obj *const *argv) +{ + Jim_GetOptInfo goi; + Jim_GetOpt_Setup(&goi, interp, argc - 1, argv + 1); + + /* It's OK to remove this mechanism sometime after August 2010 or so */ + LOG_WARNING("don't use numbers as target identifiers; use names"); + if (goi.argc != 1) + { + Jim_SetResult_sprintf(goi.interp, "usage: target number <number>"); return JIM_ERR; - case TG_CMD_CURRENT: - if (goi.argc != 0) { - Jim_WrongNumArgs(goi.interp, 1, goi.argv, "Too many parameters"); - return JIM_ERR; - } - Jim_SetResultString(goi.interp, - target_name(get_current_target(cmd_ctx)), - -1); - return JIM_OK; - case TG_CMD_TYPES: - if (goi.argc != 0) { - Jim_WrongNumArgs(goi.interp, 1, goi.argv, "Too many parameters"); - return JIM_ERR; - } - Jim_SetResult(goi.interp, Jim_NewListObj(goi.interp, NULL, 0)); - for (x = 0 ; target_types[x] ; x++) { - Jim_ListAppendElement(goi.interp, - Jim_GetResult(goi.interp), - Jim_NewStringObj(goi.interp, target_types[x]->name, -1)); - } - return JIM_OK; - case TG_CMD_NAMES: - if (goi.argc != 0) { - Jim_WrongNumArgs(goi.interp, 1, goi.argv, "Too many parameters"); - return JIM_ERR; - } - Jim_SetResult(goi.interp, Jim_NewListObj(goi.interp, NULL, 0)); - target = all_targets; - while (target) { - Jim_ListAppendElement(goi.interp, - Jim_GetResult(goi.interp), - Jim_NewStringObj(goi.interp, - target_name(target), -1)); - target = target->next; - } - return JIM_OK; - case TG_CMD_CREATE: - if (goi.argc < 3) { - Jim_WrongNumArgs(goi.interp, goi.argc, goi.argv, "?name ... config options ..."); - return JIM_ERR; - } - return target_create(&goi); - break; - case TG_CMD_NUMBER: - /* It's OK to remove this mechanism sometime after August 2010 or so */ - LOG_WARNING("don't use numbers as target identifiers; use names"); - if (goi.argc != 1) { - Jim_SetResult_sprintf(goi.interp, "expected: target number ?NUMBER?"); - return JIM_ERR; - } - e = Jim_GetOpt_Wide(&goi, &w); - if (e != JIM_OK) { - return JIM_ERR; - } - for (x = 0, target = all_targets; target; target = target->next, x++) { - if (target->target_number == w) - break; - } - if (target == NULL) { - Jim_SetResult_sprintf(goi.interp, - "Target: number %d does not exist", (int)(w)); - return JIM_ERR; - } - Jim_SetResultString(goi.interp, target_name(target), -1); - return JIM_OK; - case TG_CMD_COUNT: - if (goi.argc != 0) { - Jim_WrongNumArgs(goi.interp, 0, goi.argv, "<no parameters>"); - return JIM_ERR; - } - for (x = 0, target = all_targets; target; target = target->next, x++) + } + jim_wide w; + int e = Jim_GetOpt_Wide(&goi, &w); + if (e != JIM_OK) + return JIM_ERR; + + struct target *target; + for (target = all_targets; NULL != target; target = target->next) + { + if (target->target_number != w) continue; - Jim_SetResult(goi.interp, Jim_NewIntObj(goi.interp, x)); + + Jim_SetResultString(goi.interp, target_name(target), -1); return JIM_OK; } - + Jim_SetResult_sprintf(goi.interp, + "Target: number %d does not exist", (int)(w)); return JIM_ERR; } +static int jim_target_count(Jim_Interp *interp, int argc, Jim_Obj *const *argv) +{ + if (argc != 1) + { + Jim_WrongNumArgs(interp, 1, argv, "<no parameters>"); + return JIM_ERR; + } + unsigned count = 0; + struct target *target = all_targets; + while (NULL != target) + { + target = target->next; + count++; + } + Jim_SetResult(interp, Jim_NewIntObj(interp, count)); + return JIM_OK; +} + +static const struct command_registration target_subcommand_handlers[] = { + { + .name = "create", + .mode = COMMAND_ANY, + .jim_handler = &jim_target_create, + .usage = "<name> <type> ...", + .help = "Returns the currently selected target", + }, + { + .name = "current", + .mode = COMMAND_ANY, + .jim_handler = &jim_target_current, + .help = "Returns the currently selected target", + }, + { + .name = "types", + .mode = COMMAND_ANY, + .jim_handler = &jim_target_types, + .help = "Returns the available target types as a list of strings", + }, + { + .name = "names", + .mode = COMMAND_ANY, + .jim_handler = &jim_target_names, + .help = "Returns the names of all targets as a list of strings", + }, + { + .name = "number", + .mode = COMMAND_ANY, + .jim_handler = &jim_target_number, + .usage = "<number>", + .help = "Returns the name of target <n>", + }, + { + .name = "count", + .mode = COMMAND_ANY, + .jim_handler = &jim_target_count, + .help = "Returns the number of targets as an integer", + }, + COMMAND_REGISTRATION_DONE +}; + struct FastLoad { @@ -4816,8 +4843,9 @@ static const struct command_registration target_command_handlers[] = { { .name = "target", .mode = COMMAND_CONFIG, - .jim_handler = &jim_target, .help = "configure target", + + .chain = target_subcommand_handlers, }, COMMAND_REGISTRATION_DONE }; commit f8a62fb9c62f165696cc34eeb23b2bc1f6a79000 Author: Zachary T Welch <zw...@su...> Date: Thu Nov 26 14:04:02 2009 -0800 split jim_newtap_cmd into pieces Moves the ID and IR-related option parsing to static helpers, removing two levels of indent. diff --git a/src/jtag/tcl.c b/src/jtag/tcl.c index bb86a32..7ec7fa4 100644 --- a/src/jtag/tcl.c +++ b/src/jtag/tcl.c @@ -406,26 +406,106 @@ static int is_bad_irval(int ir_length, jim_wide w) return (w & v) != 0; } +static int jim_newtap_expected_id(Jim_Nvp *n, Jim_GetOptInfo *goi, + struct jtag_tap *pTap) +{ + jim_wide w; + int e = Jim_GetOpt_Wide(goi, &w); + if (e != JIM_OK) { + Jim_SetResult_sprintf(goi->interp, "option: %s bad parameter", n->name); + return e; + } + + unsigned expected_len = sizeof(uint32_t) * pTap->expected_ids_cnt; + uint32_t *new_expected_ids = malloc(expected_len + sizeof(uint32_t)); + if (new_expected_ids == NULL) + { + Jim_SetResult_sprintf(goi->interp, "no memory"); + return JIM_ERR; + } + + memcpy(new_expected_ids, pTap->expected_ids, expected_len); + + new_expected_ids[pTap->expected_ids_cnt] = w; + + free(pTap->expected_ids); + pTap->expected_ids = new_expected_ids; + pTap->expected_ids_cnt++; + + return JIM_OK; +} + +#define NTAP_OPT_IRLEN 0 +#define NTAP_OPT_IRMASK 1 +#define NTAP_OPT_IRCAPTURE 2 +#define NTAP_OPT_ENABLED 3 +#define NTAP_OPT_DISABLED 4 +#define NTAP_OPT_EXPECTED_ID 5 + +static int jim_newtap_ir_param(Jim_Nvp *n, Jim_GetOptInfo *goi, + struct jtag_tap *pTap) +{ + jim_wide w; + int e = Jim_GetOpt_Wide(goi, &w); + if (e != JIM_OK) + { + Jim_SetResult_sprintf(goi->interp, + "option: %s bad parameter", n->name); + free((void *)pTap->dotted_name); + return e; + } + switch (n->value) { + case NTAP_OPT_IRLEN: + if (w > (jim_wide) (8 * sizeof(pTap->ir_capture_value))) + { + LOG_WARNING("%s: huge IR length %d", + pTap->dotted_name, (int) w); + } + pTap->ir_length = w; + break; + case NTAP_OPT_IRMASK: + if (is_bad_irval(pTap->ir_length, w)) + { + LOG_ERROR("%s: IR mask %x too big", + pTap->dotted_name, + (int) w); + return JIM_ERR; + } + if ((w & 3) != 3) + LOG_WARNING("%s: nonstandard IR mask", pTap->dotted_name); + pTap->ir_capture_mask = w; + break; + case NTAP_OPT_IRCAPTURE: + if (is_bad_irval(pTap->ir_length, w)) + { + LOG_ERROR("%s: IR capture %x too big", + pTap->dotted_name, (int) w); + return JIM_ERR; + } + if ((w & 3) != 1) + LOG_WARNING("%s: nonstandard IR value", + pTap->dotted_name); + pTap->ir_capture_value = w; + break; + default: + return JIM_ERR; + } + return JIM_OK; +} + static int jim_newtap_cmd(Jim_GetOptInfo *goi) { struct jtag_tap *pTap; - jim_wide w; int x; int e; Jim_Nvp *n; char *cp; const Jim_Nvp opts[] = { -#define NTAP_OPT_IRLEN 0 { .name = "-irlen" , .value = NTAP_OPT_IRLEN }, -#define NTAP_OPT_IRMASK 1 { .name = "-irmask" , .value = NTAP_OPT_IRMASK }, -#define NTAP_OPT_IRCAPTURE 2 { .name = "-ircapture" , .value = NTAP_OPT_IRCAPTURE }, -#define NTAP_OPT_ENABLED 3 { .name = "-enable" , .value = NTAP_OPT_ENABLED }, -#define NTAP_OPT_DISABLED 4 { .name = "-disable" , .value = NTAP_OPT_DISABLED }, -#define NTAP_OPT_EXPECTED_ID 5 { .name = "-expected-id" , .value = NTAP_OPT_EXPECTED_ID }, { .name = NULL , .value = -1 }, }; @@ -483,81 +563,25 @@ static int jim_newtap_cmd(Jim_GetOptInfo *goi) pTap->disabled_after_reset = true; break; case NTAP_OPT_EXPECTED_ID: - { - uint32_t *new_expected_ids; - - e = Jim_GetOpt_Wide(goi, &w); - if (e != JIM_OK) { - Jim_SetResult_sprintf(goi->interp, "option: %s bad parameter", n->name); + e = jim_newtap_expected_id(n, goi, pTap); + if (JIM_OK != e) + { free((void *)pTap->dotted_name); free(pTap); return e; } - - new_expected_ids = malloc(sizeof(uint32_t) * (pTap->expected_ids_cnt + 1)); - if (new_expected_ids == NULL) { - Jim_SetResult_sprintf(goi->interp, "no memory"); - free((void *)pTap->dotted_name); - free(pTap); - return JIM_ERR; - } - - memcpy(new_expected_ids, pTap->expected_ids, sizeof(uint32_t) * pTap->expected_ids_cnt); - - new_expected_ids[pTap->expected_ids_cnt] = w; - - free(pTap->expected_ids); - pTap->expected_ids = new_expected_ids; - pTap->expected_ids_cnt++; break; - } case NTAP_OPT_IRLEN: case NTAP_OPT_IRMASK: case NTAP_OPT_IRCAPTURE: - e = Jim_GetOpt_Wide(goi, &w); - if (e != JIM_OK) { - Jim_SetResult_sprintf(goi->interp, "option: %s bad parameter", n->name); + e = jim_newtap_ir_param(n, goi, pTap); + if (JIM_OK != e) + { free((void *)pTap->dotted_name); free(pTap); return e; } - switch (n->value) { - case NTAP_OPT_IRLEN: - if (w > (jim_wide) (8 * sizeof(pTap->ir_capture_value))) - LOG_WARNING("%s: huge IR length %d", - pTap->dotted_name, - (int) w); - pTap->ir_length = w; - break; - case NTAP_OPT_IRMASK: - if (is_bad_irval(pTap->ir_length, w)) { - LOG_ERROR("%s: IR mask %x too big", - pTap->dotted_name, - (int) w); - free((void *)pTap->dotted_name); - free(pTap); - return ERROR_FAIL; - } - if ((w & 3) != 3) - LOG_WARNING("%s: nonstandard IR mask", - pTap->dotted_name); - pTap->ir_capture_mask = w; - break; - case NTAP_OPT_IRCAPTURE: - if (is_bad_irval(pTap->ir_length, w)) { - LOG_ERROR("%s: IR capture %x too big", - pTap->dotted_name, - (int) w); - free((void *)pTap->dotted_name); - free(pTap); - return ERROR_FAIL; - } - if ((w & 3) != 1) - LOG_WARNING("%s: nonstandard IR value", - pTap->dotted_name); - pTap->ir_capture_value = w; - break; - } + break; } /* switch (n->value) */ } /* while (goi->argc) */ commit 7124be824792eee3f973eb2cf7e1c851cbd2a923 Author: Zachary T Welch <zw...@su...> Date: Thu Nov 26 13:52:04 2009 -0800 improve jtag_tap_configure Splits bulk of the jtag_tap_configure into jtag_tap_configure_event, removing three or four levels of indentation in the process. The resulting code was stylistically improved in other ways, but it should be functionally identical. diff --git a/src/jtag/tcl.c b/src/jtag/tcl.c index 8371967..bb86a32 100644 --- a/src/jtag/tcl.c +++ b/src/jtag/tcl.c @@ -293,94 +293,105 @@ static Jim_Nvp nvp_config_opts[] = { { .name = NULL, .value = -1 } }; -static int jtag_tap_configure_cmd(Jim_GetOptInfo *goi, struct jtag_tap * tap) +static int jtag_tap_configure_event(Jim_GetOptInfo *goi, struct jtag_tap * tap) { + if (goi->argc == 0) + { + Jim_WrongNumArgs(goi->interp, goi->argc, goi->argv, "-event <event-name> ..."); + return JIM_ERR; + } + Jim_Nvp *n; - Jim_Obj *o; - int e; + int e = Jim_GetOpt_Nvp(goi, nvp_jtag_tap_event, &n); + if (e != JIM_OK) + { + Jim_GetOpt_NvpUnknown(goi, nvp_jtag_tap_event, 1); + return e; + } + + if (goi->isconfigure) { + if (goi->argc != 1) { + Jim_WrongNumArgs(goi->interp, goi->argc, goi->argv, "-event <event-name> <event-body>"); + return JIM_ERR; + } + } else { + if (goi->argc != 0) { + Jim_WrongNumArgs(goi->interp, goi->argc, goi->argv, "-event <event-name>"); + return JIM_ERR; + } + } + + struct jtag_tap_event_action *jteap = tap->event_action; + /* replace existing event body */ + bool found = false; + while (jteap) + { + if (jteap->event == (enum jtag_event)n->value) + { + found = true; + break; + } + jteap = jteap->next; + } + + Jim_SetEmptyResult(goi->interp); + + if (goi->isconfigure) + { + if (!found) + jteap = calloc(1, sizeof(*jteap)); + else if (NULL != jteap->body) + Jim_DecrRefCount(interp, jteap->body); + + jteap->event = n->value; + + Jim_Obj *o; + Jim_GetOpt_Obj(goi, &o); + jteap->body = Jim_DuplicateObj(goi->interp, o); + Jim_IncrRefCount(jteap->body); + + if (!found) + { + /* add to head of event list */ + jteap->next = tap->event_action; + tap->event_action = jteap; + } + } + else if (found) + { + Jim_SetResult(goi->interp, + Jim_DuplicateObj(goi->interp, jteap->body)); + } + return JIM_OK; +} +static int jtag_tap_configure_cmd(Jim_GetOptInfo *goi, struct jtag_tap * tap) +{ /* parse config or cget options */ - while (goi->argc > 0) { + while (goi->argc > 0) + { Jim_SetEmptyResult (goi->interp); - e = Jim_GetOpt_Nvp(goi, nvp_config_opts, &n); - if (e != JIM_OK) { + Jim_Nvp *n; + int e = Jim_GetOpt_Nvp(goi, nvp_config_opts, &n); + if (e != JIM_OK) + { Jim_GetOpt_NvpUnknown(goi, nvp_config_opts, 0); return e; } - switch (n->value) { - case JCFG_EVENT: - if (goi->argc == 0) { - Jim_WrongNumArgs(goi->interp, goi->argc, goi->argv, "-event ?event-name? ..."); - return JIM_ERR; - } - - e = Jim_GetOpt_Nvp(goi, nvp_jtag_tap_event, &n); - if (e != JIM_OK) { - Jim_GetOpt_NvpUnknown(goi, nvp_jtag_tap_event, 1); - return e; - } - - if (goi->isconfigure) { - if (goi->argc != 1) { - Jim_WrongNumArgs(goi->interp, goi->argc, goi->argv, "-event ?event-name? ?EVENT-BODY?"); - return JIM_ERR; - } - } else { - if (goi->argc != 0) { - Jim_WrongNumArgs(goi->interp, goi->argc, goi->argv, "-event ?event-name?"); - return JIM_ERR; - } - } - - { - struct jtag_tap_event_action *jteap; - - jteap = tap->event_action; - /* replace existing? */ - while (jteap) { - if (jteap->event == (enum jtag_event)n->value) { - break; - } - jteap = jteap->next; - } - - if (goi->isconfigure) { - bool replace = true; - if (jteap == NULL) { - /* create new */ - jteap = calloc(1, sizeof (*jteap)); - replace = false; - } - jteap->event = n->value; - Jim_GetOpt_Obj(goi, &o); - if (jteap->body) { - Jim_DecrRefCount(interp, jteap->body); - } - jteap->body = Jim_DuplicateObj(goi->interp, o); - Jim_IncrRefCount(jteap->body); - - if (!replace) - { - /* add to head of event list */ - jteap->next = tap->event_action; - tap->event_action = jteap; - } - Jim_SetEmptyResult(goi->interp); - } else { - /* get */ - if (jteap == NULL) { - Jim_SetEmptyResult(goi->interp); - } else { - Jim_SetResult(goi->interp, Jim_DuplicateObj(goi->interp, jteap->body)); - } - } - } - /* loop for more */ - break; + switch (n->value) + { + case JCFG_EVENT: + e = jtag_tap_configure_event(goi, tap); + if (e != JIM_OK) + return e; + break; + default: + Jim_SetResult_sprintf(goi->interp, "unknown event: %s", n->name); + return JIM_ERR; } - } /* while (goi->argc) */ + } return JIM_OK; } commit 4ff5eda576d75ee57ba448d2136867c791d215a8 Author: Zachary T Welch <zw...@su...> Date: Thu Nov 26 11:00:03 2009 -0800 improve jtag_tap_handle_event indentation Use 'continue' to reduce identation levels and superfluous logic. diff --git a/src/jtag/tcl.c b/src/jtag/tcl.c index 929c784..8371967 100644 --- a/src/jtag/tcl.c +++ b/src/jtag/tcl.c @@ -571,29 +571,36 @@ static void jtag_tap_handle_event(struct jtag_tap *tap, enum jtag_event e) { struct jtag_tap_event_action * jteap; - for (jteap = tap->event_action; jteap != NULL; jteap = jteap->next) { - if (jteap->event == e) { - LOG_DEBUG("JTAG tap: %s event: %d (%s)\n\taction: %s", - tap->dotted_name, - e, - Jim_Nvp_value2name_simple(nvp_jtag_tap_event, e)->name, - Jim_GetString(jteap->body, NULL)); - if (Jim_EvalObj(interp, jteap->body) != JIM_OK) { - Jim_PrintErrorMessage(interp); - } else switch (e) { - case JTAG_TAP_EVENT_ENABLE: - case JTAG_TAP_EVENT_DISABLE: - /* NOTE: we currently assume the handlers - * can't fail. Right here is where we should - * really be verifying the scan chains ... - */ - tap->enabled = (e == JTAG_TAP_EVENT_ENABLE); - LOG_INFO("JTAG tap: %s %s", tap->dotted_name, - tap->enabled ? "enabled" : "disabled"); - break; - default: - break; - } + for (jteap = tap->event_action; jteap != NULL; jteap = jteap->next) + { + if (jteap->event != e) + continue; + + Jim_Nvp *nvp = Jim_Nvp_value2name_simple(nvp_jtag_tap_event, e); + LOG_DEBUG("JTAG tap: %s event: %d (%s)\n\taction: %s", + tap->dotted_name, e, nvp->name, + Jim_GetString(jteap->body, NULL)); + + if (Jim_EvalObj(interp, jteap->body) != JIM_OK) + { + Jim_PrintErrorMessage(interp); + continue; + } + + switch (e) + { + case JTAG_TAP_EVENT_ENABLE: + case JTAG_TAP_EVENT_DISABLE: + /* NOTE: we currently assume the handlers + * can't fail. Right here is where we should + * really be verifying the scan chains ... + */ + tap->enabled = (e == JTAG_TAP_EVENT_ENABLE); + LOG_INFO("JTAG tap: %s %s", tap->dotted_name, + tap->enabled ? "enabled" : "disabled"); + break; + default: + break; } } } commit 0377e5b54d6db196cfeeaaa70824c581317e2290 Author: Zachary T Welch <zw...@su...> Date: Thu Nov 26 08:19:40 2009 -0800 begin moving JTAG jim handlers/helpers Moves the tertiary jim handlers and required static helpers to the top of tcl.c, defining them in a new registration array that is chained in both the top-level context and under the jtag command. The top-level commands can be removed at some point in the future to reduce clutter. diff --git a/src/jtag/tcl.c b/src/jtag/tcl.c index e7a0f67..929c784 100644 --- a/src/jtag/tcl.c +++ b/src/jtag/tcl.c @@ -51,6 +51,238 @@ static const Jim_Nvp nvp_jtag_tap_event[] = { extern struct jtag_interface *jtag_interface; +static bool scan_is_safe(tap_state_t state) +{ + switch (state) + { + case TAP_RESET: + case TAP_IDLE: + case TAP_DRPAUSE: + case TAP_IRPAUSE: + return true; + default: + return false; + } +} + +static int Jim_Command_drscan(Jim_Interp *interp, int argc, Jim_Obj *const *args) +{ + int retval; + struct scan_field *fields; + int num_fields; + int field_count = 0; + int i, e; + struct jtag_tap *tap; + tap_state_t endstate; + + /* args[1] = device + * args[2] = num_bits + * args[3] = hex string + * ... repeat num bits and hex string ... + * + * .. optionally: + * args[N-2] = "-endstate" + * args[N-1] = statename + */ + if ((argc < 4) || ((argc % 2) != 0)) + { + Jim_WrongNumArgs(interp, 1, args, "wrong arguments"); + return JIM_ERR; + } + + endstate = TAP_IDLE; + + script_debug(interp, "drscan", argc, args); + + /* validate arguments as numbers */ + e = JIM_OK; + for (i = 2; i < argc; i += 2) + { + long bits; + const char *cp; + + e = Jim_GetLong(interp, args[i], &bits); + /* If valid - try next arg */ + if (e == JIM_OK) { + continue; + } + + /* Not valid.. are we at the end? */ + if (((i + 2) != argc)) { + /* nope, then error */ + return e; + } + + /* it could be: "-endstate FOO" + * e.g. DRPAUSE so we can issue more instructions + * before entering RUN/IDLE and executing them. + */ + + /* get arg as a string. */ + cp = Jim_GetString(args[i], NULL); + /* is it the magic? */ + if (0 == strcmp("-endstate", cp)) { + /* is the statename valid? */ + cp = Jim_GetString(args[i + 1], NULL); + + /* see if it is a valid state name */ + endstate = tap_state_by_name(cp); + if (endstate < 0) { + /* update the error message */ + Jim_SetResult_sprintf(interp,"endstate: %s invalid", cp); + } else { + if (!scan_is_safe(endstate)) + LOG_WARNING("drscan with unsafe " + "endstate \"%s\"", cp); + + /* valid - so clear the error */ + e = JIM_OK; + /* and remove the last 2 args */ + argc -= 2; + } + } + + /* Still an error? */ + if (e != JIM_OK) { + return e; /* too bad */ + } + } /* validate args */ + + tap = jtag_tap_by_jim_obj(interp, args[1]); + if (tap == NULL) { + return JIM_ERR; + } + + num_fields = (argc-2)/2; + fields = malloc(sizeof(struct scan_field) * num_fields); + for (i = 2; i < argc; i += 2) + { + long bits; + int len; + const char *str; + + Jim_GetLong(interp, args[i], &bits); + str = Jim_GetString(args[i + 1], &len); + + fields[field_count].tap = tap; + fields[field_count].num_bits = bits; + fields[field_count].out_value = malloc(DIV_ROUND_UP(bits, 8)); + str_to_buf(str, len, fields[field_count].out_value, bits, 0); + fields[field_count].in_value = fields[field_count].out_value; + field_count++; + } + + jtag_add_dr_scan(num_fields, fields, endstate); + + retval = jtag_execute_queue(); + if (retval != ERROR_OK) + { + Jim_SetResultString(interp, "drscan: jtag execute failed",-1); + return JIM_ERR; + } + + field_count = 0; + Jim_Obj *list = Jim_NewListObj(interp, NULL, 0); + for (i = 2; i < argc; i += 2) + { + long bits; + char *str; + + Jim_GetLong(interp, args[i], &bits); + str = buf_to_str(fields[field_count].in_value, bits, 16); + free(fields[field_count].out_value); + + Jim_ListAppendElement(interp, list, Jim_NewStringObj(interp, str, strlen(str))); + free(str); + field_count++; + } + + Jim_SetResult(interp, list); + + free(fields); + + return JIM_OK; +} + + +static int Jim_Command_pathmove(Jim_Interp *interp, int argc, Jim_Obj *const *args) +{ + tap_state_t states[8]; + + if ((argc < 2) || ((size_t)argc > (ARRAY_SIZE(states) + 1))) + { + Jim_WrongNumArgs(interp, 1, args, "wrong arguments"); + return JIM_ERR; + } + + script_debug(interp, "pathmove", argc, args); + + int i; + for (i = 0; i < argc-1; i++) + { + const char *cp; + cp = Jim_GetString(args[i + 1], NULL); + states[i] = tap_state_by_name(cp); + if (states[i] < 0) + { + /* update the error message */ + Jim_SetResult_sprintf(interp,"endstate: %s invalid", cp); + return JIM_ERR; + } + } + + if ((jtag_add_statemove(states[0]) != ERROR_OK) || (jtag_execute_queue()!= ERROR_OK)) + { + Jim_SetResultString(interp, "pathmove: jtag execute failed",-1); + return JIM_ERR; + } + + jtag_add_pathmove(argc-2, states + 1); + + if (jtag_execute_queue()!= ERROR_OK) + { + Jim_SetResultString(interp, "pathmove: failed",-1); + return JIM_ERR; + } + + return JIM_OK; +} + + +static int Jim_Command_flush_count(Jim_Interp *interp, int argc, Jim_Obj *const *args) +{ + script_debug(interp, "flush_count", argc, args); + + Jim_SetResult(interp, Jim_NewIntObj(interp, jtag_get_flush_queue_count())); + + return JIM_OK; +} + +static const struct command_registration jtag_command_handlers_to_move[] = { + { + .name = "drscan", + .mode = COMMAND_EXEC, + .jim_handler = &Jim_Command_drscan, + .help = "execute DR scan <device> " + "<num_bits> <value> <num_bits1> <value2> ...", + }, + { + .name = "flush_count", + .mode = COMMAND_EXEC, + .jim_handler = &Jim_Command_flush_count, + .help = "returns number of times the JTAG queue has been flushed", + }, + { + .name = "pathmove", + .mode = COMMAND_EXEC, + .jim_handler = &Jim_Command_pathmove, + .usage = "<state1>,<state2>,<state3>... ", + .help = "move JTAG to state1 then to state2, state3, etc.", + }, + COMMAND_REGISTRATION_DONE +}; + + enum jtag_tap_cfg_param { JCFG_EVENT }; @@ -598,6 +830,9 @@ static const struct command_registration jtag_subcommand_handlers[] = { .jim_handler = &jim_jtag_names, .help = "Returns list of all JTAG tap names", }, + { + .chain = jtag_command_handlers_to_move, + }, COMMAND_REGISTRATION_DONE }; @@ -1095,20 +1330,6 @@ COMMAND_HANDLER(handle_runtest_command) * Not surprisingly, this is the same constraint as SVF; the "irscan" * and "drscan" commands are a write-only subset of what SVF provides. */ -static bool scan_is_safe(tap_state_t state) -{ - switch (state) - { - case TAP_RESET: - case TAP_IDLE: - case TAP_DRPAUSE: - case TAP_IRPAUSE: - return true; - default: - return false; - } -} - COMMAND_HANDLER(handle_irscan_command) { @@ -1191,199 +1412,6 @@ error_return: return retval; } -static int Jim_Command_drscan(Jim_Interp *interp, int argc, Jim_Obj *const *args) -{ - int retval; - struct scan_field *fields; - int num_fields; - int field_count = 0; - int i, e; - struct jtag_tap *tap; - tap_state_t endstate; - - /* args[1] = device - * args[2] = num_bits - * args[3] = hex string - * ... repeat num bits and hex string ... - * - * .. optionally: - * args[N-2] = "-endstate" - * args[N-1] = statename - */ - if ((argc < 4) || ((argc % 2) != 0)) - { - Jim_WrongNumArgs(interp, 1, args, "wrong arguments"); - return JIM_ERR; - } - - endstate = TAP_IDLE; - - script_debug(interp, "drscan", argc, args); - - /* validate arguments as numbers */ - e = JIM_OK; - for (i = 2; i < argc; i += 2) - { - long bits; - const char *cp; - - e = Jim_GetLong(interp, args[i], &bits); - /* If valid - try next arg */ - if (e == JIM_OK) { - continue; - } - - /* Not valid.. are we at the end? */ - if (((i + 2) != argc)) { - /* nope, then error */ - return e; - } - - /* it could be: "-endstate FOO" - * e.g. DRPAUSE so we can issue more instructions - * before entering RUN/IDLE and executing them. - */ - - /* get arg as a string. */ - cp = Jim_GetString(args[i], NULL); - /* is it the magic? */ - if (0 == strcmp("-endstate", cp)) { - /* is the statename valid? */ - cp = Jim_GetString(args[i + 1], NULL); - - /* see if it is a valid state name */ - endstate = tap_state_by_name(cp); - if (endstate < 0) { - /* update the error message */ - Jim_SetResult_sprintf(interp,"endstate: %s invalid", cp); - } else { - if (!scan_is_safe(endstate)) - LOG_WARNING("drscan with unsafe " - "endstate \"%s\"", cp); - - /* valid - so clear the error */ - e = JIM_OK; - /* and remove the last 2 args */ - argc -= 2; - } - } - - /* Still an error? */ - if (e != JIM_OK) { - return e; /* too bad */ - } - } /* validate args */ - - tap = jtag_tap_by_jim_obj(interp, args[1]); - if (tap == NULL) { - return JIM_ERR; - } - - num_fields = (argc-2)/2; - fields = malloc(sizeof(struct scan_field) * num_fields); - for (i = 2; i < argc; i += 2) - { - long bits; - int len; - const char *str; - - Jim_GetLong(interp, args[i], &bits); - str = Jim_GetString(args[i + 1], &len); - - fields[field_count].tap = tap; - fields[field_count].num_bits = bits; - fields[field_count].out_value = malloc(DIV_ROUND_UP(bits, 8)); - str_to_buf(str, len, fields[field_count].out_value, bits, 0); - fields[field_count].in_value = fields[field_count].out_value; - field_count++; - } - - jtag_add_dr_scan(num_fields, fields, endstate); - - retval = jtag_execute_queue(); - if (retval != ERROR_OK) - { - Jim_SetResultString(interp, "drscan: jtag execute failed",-1); - return JIM_ERR; - } - - field_count = 0; - Jim_Obj *list = Jim_NewListObj(interp, NULL, 0); - for (i = 2; i < argc; i += 2) - { - long bits; - char *str; - - Jim_GetLong(interp, args[i], &bits); - str = buf_to_str(fields[field_count].in_value, bits, 16); - free(fields[field_count].out_value); - - Jim_ListAppendElement(interp, list, Jim_NewStringObj(interp, str, strlen(str))); - free(str); - field_count++; - } - - Jim_SetResult(interp, list); - - free(fields); - - return JIM_OK; -} - - -static int Jim_Command_pathmove(Jim_Interp *interp, int argc, Jim_Obj *const *args) -{ - tap_state_t states[8]; - - if ((argc < 2) || ((size_t)argc > (ARRAY_SIZE(states) + 1))) - { - Jim_WrongNumArgs(interp, 1, args, "wrong arguments"); - return JIM_ERR; - } - - script_debug(interp, "pathmove", argc, args); - - int i; - for (i = 0; i < argc-1; i++) - { - const char *cp; - cp = Jim_GetString(args[i + 1], NULL); - states[i] = tap_state_by_name(cp); - if (states[i] < 0) - { - /* update the error message */ - Jim_SetResult_sprintf(interp,"endstate: %s invalid", cp); - return JIM_ERR; - } - } - - if ((jtag_add_statemove(states[0]) != ERROR_OK) || (jtag_execute_queue()!= ERROR_OK)) - { - Jim_SetResultString(interp, "pathmove: jtag execute failed",-1); - return JIM_ERR; - } - - jtag_add_pathmove(argc-2, states + 1); - - if (jtag_execute_queue()!= ERROR_OK) - { - Jim_SetResultString(interp, "pathmove: failed",-1); - return JIM_ERR; - } - - return JIM_OK; -} - - -static int Jim_Command_flush_count(Jim_Interp *interp, int argc, Jim_Obj *const *args) -{ - script_debug(interp, "flush_count", argc, args); - - Jim_SetResult(interp, Jim_NewIntObj(interp, jtag_get_flush_queue_count())); - - return JIM_OK; -} - COMMAND_HANDLER(handle_verify_ircapture_command) { @@ -1560,7 +1588,6 @@ static const struct command_registration jtag_command_handlers[] = { .help = "choose short(default) or long tms_sequence", .usage = "<short | long>", }, - // jim commands { .name = "jtag", .mode = COMMAND_ANY, @@ -1569,28 +1596,10 @@ static const struct command_registration jtag_command_handlers[] = { .chain = jtag_subcommand_handlers, }, { - .name = "drscan", - .mode = COMMAND_EXEC, - .jim_handler = &Jim_Command_drscan, - .help = "execute DR scan <device> " - "<num_bits> <value> <num_bits... [truncated message content] |
From: Zach W. <zw...@us...> - 2009-11-28 22:04:17
|
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 2da2864632c281a2523f924b406e532d610857a6 (commit) via 8795b8f9df5ba1fd8466a04b515aa5f56c0c4015 (commit) via 42e00bb379fe7591b6d74768a45855ed5cd0c24f (commit) via fd343bea7f11796a9fba77158fe84b0ccaac1a4b (commit) via 933b4579f06d25e349e6648ec4aff114e634164d (commit) via 3b5751a4d4aa4eb980aee6931b7d100a6d37224a (commit) from 89fa493a3bc34d22eeca06fa4e78523ac3b766a8 (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 2da2864632c281a2523f924b406e532d610857a6 Author: Zachary T Welch <zw...@su...> Date: Sat Nov 28 10:46:53 2009 -0800 remove redundant 'rm' command handler Two 'rm' commands were implemented and registered. This removes the version that would have never been called prior to refactoring the command registration. diff --git a/src/helper/ioutil.c b/src/helper/ioutil.c index e13f590..ed82ba1 100644 --- a/src/helper/ioutil.c +++ b/src/helper/ioutil.c @@ -38,9 +38,6 @@ #ifdef HAVE_NET_IF_H #include <net/if.h> #endif -//#ifdef HAVE_NETINET_TCP_H -//#include <netinet/tcp.h> -//#endif #ifdef HAVE_SYS_IOCTL_H #include <sys/ioctl.h> #endif @@ -57,23 +54,6 @@ #endif -COMMAND_HANDLER(handle_rm_command) -{ - if (CMD_ARGC != 1) - { - command_print(CMD_CTX, "rm <filename>"); - return ERROR_INVALID_ARGUMENTS; - } - - if (unlink(CMD_ARGV[0]) != 0) - { - command_print(CMD_CTX, "failed: %d", errno); - } - - return ERROR_OK; -} - - /* loads a file and returns a pointer to it in memory. The file contains * a 0 byte(sentinel) after len bytes - the length of the file. */ int loadFile(const char *fileName, void **data, size_t *len) @@ -645,13 +625,6 @@ static int zylinjtag_Jim_Command_mac(Jim_Interp *interp, int argc, static const struct command_registration ioutil_command_handlers[] = { { - .name = "rm", - .handler = &handle_rm_command, - .mode = COMMAND_ANY, - .help = "remove file", - .usage= "<file_name>", - }, - { .name = "cat", .handler = &handle_cat_command, .mode = COMMAND_ANY, commit 8795b8f9df5ba1fd8466a04b515aa5f56c0c4015 Author: Zachary T Welch <zw...@su...> Date: Sat Nov 28 10:42:51 2009 -0800 add error checking in command_new Adds checks for memory allocation failures. Started to use calloc() instead of malloc()/memset(), but I got carried away. This kind of work should be done throughout the tree, but it's almost hopeless at present. diff --git a/src/helper/command.c b/src/helper/command.c index 4b7d8cb..ce857dd 100644 --- a/src/helper/command.c +++ b/src/helper/command.c @@ -253,19 +253,44 @@ static struct command **command_list_for_parent( return parent ? &parent->children : &cmd_ctx->commands; } +static void command_free(struct command *c) +{ + /// @todo if command has a handler, unregister its jim command! + + while (NULL != c->children) + { + struct command *tmp = c->children; + c->children = tmp->next; + command_free(tmp); + } + + if (c->name) + free(c->name); + if (c->help) + free((void*)c->help); + if (c->usage) + free((void*)c->usage); + free(c); +} + static struct command *command_new(struct command_context *cmd_ctx, struct command *parent, const struct command_registration *cr) { assert(cr->name); - struct command *c = malloc(sizeof(struct command)); - memset(c, 0, sizeof(struct command)); + struct command *c = calloc(1, sizeof(struct command)); + if (NULL == c) + return NULL; c->name = strdup(cr->name); if (cr->help) c->help = strdup(cr->help); if (cr->usage) c->usage = strdup(cr->usage); + + if (!c->name || (cr->help && !c->help) || (cr->usage && !c->usage)) + goto command_new_error; + c->parent = parent; c->handler = cr->handler; c->jim_handler = cr->jim_handler; @@ -275,25 +300,10 @@ static struct command *command_new(struct command_context *cmd_ctx, command_add_child(command_list_for_parent(cmd_ctx, parent), c); return c; -} -static void command_free(struct command *c) -{ - /// @todo if command has a handler, unregister its jim command! - while (NULL != c->children) - { - struct command *tmp = c->children; - c->children = tmp->next; - command_free(tmp); - } - - if (c->name) - free(c->name); - if (c->help) - free((void*)c->help); - if (c->usage) - free((void*)c->usage); - free(c); +command_new_error: + command_free(c); + return NULL; } static int command_unknown(Jim_Interp *interp, int argc, Jim_Obj *const *argv); commit 42e00bb379fe7591b6d74768a45855ed5cd0c24f Author: Zachary T Welch <zw...@su...> Date: Sat Nov 28 12:42:06 2009 -0800 include mode information in help text. Extends the help output to list the valid modes for each commands. Fixes a memory leak of the returned command_name() string. diff --git a/src/helper/command.c b/src/helper/command.c index 3f43942..4b7d8cb 100644 --- a/src/helper/command.c +++ b/src/helper/command.c @@ -862,16 +862,40 @@ static void command_help_show_wrap(const char *str, unsigned n, unsigned n2) static COMMAND_HELPER(command_help_show, struct command *c, unsigned n, bool show_help) { + char *cmd_name = command_name(c, ' '); + if (NULL == cmd_name) + return -ENOMEM; + command_help_show_indent(n); - LOG_USER_N("%s", command_name(c, ' ')); + LOG_USER_N("%s", cmd_name); + free(cmd_name); + if (c->usage) { LOG_USER_N(" "); command_help_show_wrap(c->usage, 0, n + 5); } else LOG_USER_N("\n"); - if (show_help && c->help) - command_help_show_wrap(c->help, n + 3, n + 3); + + if (show_help) + { + const char *stage_msg; + switch (c->mode) { + case COMMAND_CONFIG: stage_msg = "CONFIG"; break; + case COMMAND_EXEC: stage_msg = "EXEC"; break; + case COMMAND_ANY: stage_msg = "CONFIG or EXEC"; break; + default: stage_msg = "***UNKNOWN***"; break; + } + char *msg = alloc_printf("%s%sValid Modes: %s", + c->help ? : "", c->help ? " " : "", stage_msg); + if (NULL != msg) + { + command_help_show_wrap(msg, n + 3, n + 3); + free(msg); + } else + return -ENOMEM; + } + if (++n >= 2) return ERROR_OK; commit fd343bea7f11796a9fba77158fe84b0ccaac1a4b Author: Zachary T Welch <zw...@su...> Date: Fri Nov 27 10:16:42 2009 -0800 refactor command mode detection Splits the check for a command's ability to run into a helper. This also fixes a bug whereby commands that specified COMMAND_EXEC were allowed to run during the configuration stage. This allowed problematic commands to be called before 'init', defeating the intention of specifying that command mode. With this change, the run_command() helper denies access to handlers that should run only after 'init' during the configuration stage. diff --git a/src/helper/command.c b/src/helper/command.c index b2aa76b..3f43942 100644 --- a/src/helper/command.c +++ b/src/helper/command.c @@ -525,13 +525,18 @@ char *command_name(struct command *c, char delim) return __command_name(c, delim, 0); } +static bool command_can_run(struct command_context *cmd_ctx, struct command *c) +{ + return c->mode == COMMAND_ANY || c->mode == cmd_ctx->mode; +} + static int run_command(struct command_context *context, struct command *c, const char *words[], unsigned num_words) { - if (!((context->mode == COMMAND_CONFIG) || (c->mode == COMMAND_ANY) || (c->mode == context->mode))) + if (!command_can_run(context, c)) { /* Config commands can not run after the config stage */ - LOG_ERROR("Command '%s' only runs during configuration stage", c->name); + LOG_ERROR("The '%s' command must be used before 'init'.", c->name); return ERROR_FAIL; } commit 933b4579f06d25e349e6648ec4aff114e634164d Author: Zachary T Welch <zw...@su...> Date: Fri Nov 27 16:30:28 2009 -0800 add command private data setter/accessor Presently, commands registration taks a static handler data pointer. This patch adds support for commands that require a dynamic pointer, such as those registered in a dynamic context (e.g. subcommands for a user-created 'foo.cpu' command). The command_set_handler_data will update a command (group) to use a new context pointer, while the CMD_DATA macro allows command handlers to access the value. Jim handlers should find this value in interp->cmdPrivData. diff --git a/src/helper/command.c b/src/helper/command.c index 61a791d..b2aa76b 100644 --- a/src/helper/command.c +++ b/src/helper/command.c @@ -439,6 +439,14 @@ int unregister_command(struct command_context *context, return ERROR_OK; } +void command_set_handler_data(struct command *c, void *p) +{ + if (NULL != c->handler || NULL != c->jim_handler) + c->jim_handler_data = p; + for (struct command *cc = c->children; NULL != cc; cc = cc->next) + command_set_handler_data(cc, p); +} + void command_output_text(struct command_context *context, const char *data) { if (context && context->output_handler && data) { diff --git a/src/helper/command.h b/src/helper/command.h index 84bdb71..2d33484 100644 --- a/src/helper/command.h +++ b/src/helper/command.h @@ -80,6 +80,8 @@ struct command_context void *output_handler_priv; }; +struct command; + /** * When run_command is called, a new instance will be created on the * stack, filled with the proper values, and passed by reference to the @@ -87,6 +89,7 @@ struct command_context */ struct command_invocation { struct command_context *ctx; + struct command *current; const char *name; unsigned argc; const char **argv; @@ -151,6 +154,16 @@ struct command_invocation { * rather than accessing the variable directly. It may be moved. */ #define CMD_NAME cmd->name +/** + * Use this macro to access the current command being handled, + * rather than accessing the variable directly. It may be moved. + */ +#define CMD_CURRENT cmd->current +/** + * Use this macro to access the invoked command handler's data pointer, + * rather than accessing the variable directly. It may be moved. + */ +#define CMD_DATA CMD_CURRENT->jim_handler_data /// The type signature for commands' handler functions. @@ -290,6 +303,16 @@ struct command *command_find_in_context(struct command_context *cmd_ctx, struct command *command_find_in_parent(struct command *parent, const char *name); +/** + * Update the private command data field for a command and all descendents. + * This is used when creating a new heirarchy of commands that depends + * on obtaining a dynamically created context. The value will be available + * in command handlers by using the CMD_DATA macro. + * @param c The command (group) whose data pointer(s) will be updated. + * @param p The new data pointer to use for the command or its descendents. + */ +void command_set_handler_data(struct command *c, void *p); + void command_set_output_handler(struct command_context* context, command_output_handler_t output_handler, void *priv); commit 3b5751a4d4aa4eb980aee6931b7d100a6d37224a Author: Zachary T Welch <zw...@su...> Date: Sat Nov 28 12:29:42 2009 -0800 add 'command mode' introspective handler Allows scripts to behave different depending on the current mode. Also allows introspection of the mode required for commands. diff --git a/src/helper/command.c b/src/helper/command.c index 2b29956..61a791d 100644 --- a/src/helper/command.c +++ b/src/helper/command.c @@ -950,6 +950,36 @@ static int command_unknown(Jim_Interp *interp, int argc, Jim_Obj *const *argv) return script_command_run(interp, count, start, c, found); } +static int jim_command_mode(Jim_Interp *interp, int argc, Jim_Obj *const *argv) +{ + struct command_context *cmd_ctx = current_command_context(); + enum command_mode mode; + if (argc > 1) + { + struct command *c = cmd_ctx->commands; + int remaining = command_unknown_find(argc - 1, argv + 1, c, &c, true); + // if nothing could be consumed, then it's an unknown command + if (remaining == argc - 1) + { + Jim_SetResultString(interp, "unknown", -1); + return JIM_OK; + } + mode = c->mode; + } + else + mode = cmd_ctx->mode; + + const char *mode_str; + switch (mode) { + case COMMAND_ANY: mode_str = "any"; break; + case COMMAND_CONFIG: mode_str = "config"; break; + case COMMAND_EXEC: mode_str = "exec"; break; + default: mode_str = "unknown"; break; + } + Jim_SetResultString(interp, mode_str, -1); + return JIM_OK; +} + static int jim_command_type(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { if (1 == argc) @@ -1098,6 +1128,15 @@ COMMAND_HANDLER(handle_sleep_command) static const struct command_registration command_subcommand_handlers[] = { { + .name = "mode", + .mode = COMMAND_ANY, + .jim_handler = &jim_command_mode, + .usage = "[<name> ...]", + .help = "Returns the command modes allowed by a command:" + "'any', 'config', or 'exec'. If no command is" + "specified, returns the current command mode.", + }, + { .name = "type", .mode = COMMAND_ANY, .jim_handler = &jim_command_type, ----------------------------------------------------------------------- Summary of changes: src/helper/command.c | 136 ++++++++++++++++++++++++++++++++++++++++--------- src/helper/command.h | 23 ++++++++ src/helper/ioutil.c | 27 ---------- 3 files changed, 134 insertions(+), 52 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Zach W. <zw...@us...> - 2009-11-28 22:03:51
|
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 89fa493a3bc34d22eeca06fa4e78523ac3b766a8 (commit) via df22f0f9ca4ebf881adf8d20cb63e64139f18613 (commit) via 37dd5a685a67f9069ac0c1d98d47077a67fb897a (commit) from 5f0223423d6c9a41bf0a9ac45772d1b01469bf0a (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 89fa493a3bc34d22eeca06fa4e78523ac3b766a8 Author: Zachary T Welch <zw...@su...> Date: Fri Nov 27 21:47:54 2009 -0800 remove unknown handler Updates command registration to provide top-level handlers for all commands, rather than falling back onto the 'unknown' command. Instead, that same handler is registered for placeholders, providing the same functionality under the root verb command name instead. This permits users to implement their own 'unknown' function, and it resolves some mind-bending breakage related to function object lookup while recursing. Changes 'ocd_bounce' to call 'ocd_command' and 'ocd_help' from the wrapper directly, rather than bouncing through their wrappers. This prevents endless recursion caused by the above changes, whereby the 'command' wrapper's type check would blow the stack to hell and gone. diff --git a/src/helper/command.c b/src/helper/command.c index ba04157..2b29956 100644 --- a/src/helper/command.c +++ b/src/helper/command.c @@ -296,37 +296,32 @@ static void command_free(struct command *c) free(c); } +static int command_unknown(Jim_Interp *interp, int argc, Jim_Obj *const *argv); + static int register_command_handler(struct command *c) { - int retval = -ENOMEM; - const char *full_name = command_name(c, '_'); - if (NULL == full_name) - return retval; + const char *ocd_name = alloc_printf("ocd_%s", c->name); + if (NULL == ocd_name) + return JIM_ERR; - if (NULL != c->handler) - { - const char *ocd_name = alloc_printf("ocd_%s", full_name); - if (NULL == full_name) - goto free_full_name; + LOG_DEBUG("registering '%s'...", ocd_name); - Jim_CreateCommand(interp, ocd_name, script_command, c, NULL); - free((void *)ocd_name); - } + Jim_CmdProc func = c->handler ? &script_command : &command_unknown; + int retval = Jim_CreateCommand(interp, ocd_name, func, c, NULL); + free((void *)ocd_name); + if (JIM_OK != retval) + return retval; /* we now need to add an overrideable proc */ const char *override_name = alloc_printf( "proc %s {args} {eval ocd_bouncer %s $args}", - full_name, full_name); + c->name, c->name); if (NULL == override_name) - goto free_full_name; + return JIM_ERR; - Jim_Eval_Named(interp, override_name, __THIS__FILE__, __LINE__); + retval = Jim_Eval_Named(interp, override_name, __FILE__, __LINE__); free((void *)override_name); - retval = ERROR_OK; - -free_full_name: - free((void *)full_name); return retval; } @@ -350,19 +345,20 @@ struct command* register_command(struct command_context *context, if (NULL == c) return NULL; - if (NULL != c->handler) + int retval = ERROR_OK; + if (NULL != cr->jim_handler && NULL == parent) { - int retval = register_command_handler(command_root(c)); - if (ERROR_OK != retval) - { - unregister_command(context, parent, name); - return NULL; - } + retval = Jim_CreateCommand(interp, cr->name, + cr->jim_handler, cr->jim_handler_data, NULL); } + else if (NULL != cr->handler || NULL != parent) + retval = register_command_handler(command_root(c)); - if (NULL != cr->jim_handler && NULL == parent) - Jim_CreateCommand(interp, cr->name, cr->jim_handler, cr->jim_handler_data, NULL); - + if (ERROR_OK != retval) + { + unregister_command(context, parent, name); + c = NULL; + } return c; } @@ -903,15 +899,22 @@ static int command_unknown_find(unsigned argc, Jim_Obj *const *argv, static int command_unknown(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { const char *cmd_name = Jim_GetString(argv[0], NULL); - script_debug(interp, cmd_name, argc - 1, argv + 1); + if (strcmp(cmd_name, "unknown") == 0) + { + if (argc == 1) + return JIM_OK; + argc--; + argv++; + } + script_debug(interp, cmd_name, argc, argv); struct command_context *cmd_ctx = current_command_context(); struct command *c = cmd_ctx->commands; - int remaining = command_unknown_find(argc - 1, argv + 1, c, &c, true); + int remaining = command_unknown_find(argc, argv, c, &c, true); // if nothing could be consumed, then it's really an unknown command - if (remaining == argc - 1) + if (remaining == argc) { - const char *cmd = Jim_GetString(argv[1], NULL); + const char *cmd = Jim_GetString(argv[0], NULL); LOG_ERROR("Unknown command:\n %s", cmd); return JIM_OK; } @@ -1196,7 +1199,6 @@ struct command_context* command_init(const char *startup_tcl) Jim_SetGlobalVariableStr(interp, "ocd_HOSTOS", Jim_NewStringObj(interp, HostOs , strlen(HostOs))); - Jim_CreateCommand(interp, "unknown", &command_unknown, NULL, NULL); Jim_CreateCommand(interp, "ocd_find", jim_find, NULL, NULL); Jim_CreateCommand(interp, "echo", jim_echo, NULL, NULL); Jim_CreateCommand(interp, "capture", jim_capture, NULL, NULL); diff --git a/src/helper/startup.tcl b/src/helper/startup.tcl index cb5fb02..dda89c8 100644 --- a/src/helper/startup.tcl +++ b/src/helper/startup.tcl @@ -15,7 +15,7 @@ proc exit {} { # to discard 'handler' command output, proc ocd_bouncer {name args} { set cmd [format "ocd_%s" $name] - set type [eval command type $cmd $args] + set type [eval ocd_command type $cmd $args] if {$type == "native"} { return [eval $cmd $args] } else {if {$type == "simple"} { @@ -25,7 +25,7 @@ proc ocd_bouncer {name args} { set errmsg "Command handler execution failed" } } else {if {$type == "group"} { - catch {eval help $name $args} + catch {eval ocd_help $name $args} set errmsg [format "%s: command requires more arguments" \ [concat $name " " $args]] } else { commit df22f0f9ca4ebf881adf8d20cb63e64139f18613 Author: Zachary T Welch <zw...@su...> Date: Fri Nov 27 19:14:30 2009 -0800 improve command handler wrapper script Adds 'ocd_bouncer' in startup.tcl that is called as a helper for all command handlers, shrinking the embedded C wrapper to a mere stub. Jim handlers are called directly, simple handlers get called with the wrapper to capture and discard their output on error, and placeholders call help directly (though the unknown handler still does this too). It attempts to improve the quality of the error messages as well. diff --git a/src/helper/command.c b/src/helper/command.c index 23175ba..ba04157 100644 --- a/src/helper/command.c +++ b/src/helper/command.c @@ -314,9 +314,8 @@ static int register_command_handler(struct command *c) } /* we now need to add an overrideable proc */ - const char *override_name = alloc_printf("proc %s {args} {" - "if {[catch {eval ocd_%s $args}] == 0} " - "{return \"\"} else {return -code error}}", + const char *override_name = alloc_printf( + "proc %s {args} {eval ocd_bouncer %s $args}", full_name, full_name); if (NULL == override_name) goto free_full_name; diff --git a/src/helper/startup.tcl b/src/helper/startup.tcl index f11d5b6..cb5fb02 100644 --- a/src/helper/startup.tcl +++ b/src/helper/startup.tcl @@ -10,6 +10,30 @@ proc exit {} { ocd_throw exit } +# All commands are registered with an 'ocd_' prefix, while the "real" +# command is a wrapper that calls this function. Its primary purpose is +# to discard 'handler' command output, +proc ocd_bouncer {name args} { + set cmd [format "ocd_%s" $name] + set type [eval command type $cmd $args] + if {$type == "native"} { + return [eval $cmd $args] + } else {if {$type == "simple"} { + if {[catch {eval $cmd $args}] == 0} { + return "" + } else { + set errmsg "Command handler execution failed" + } + } else {if {$type == "group"} { + catch {eval help $name $args} + set errmsg [format "%s: command requires more arguments" \ + [concat $name " " $args]] + } else { + set errmsg [format "Unknown command type: %s" $type] + }}} + return -code error $errmsg +} + # Try flipping / and \ to find file if the filename does not # match the precise spelling proc find {filename} { commit 37dd5a685a67f9069ac0c1d98d47077a67fb897a Author: Zachary T Welch <zw...@su...> Date: Fri Nov 27 18:59:14 2009 -0800 add 'command type' introspective handler Adds the 'command' group handler, with the 'type' command producing a string that tells whether the given command is 'native' (for Jim-based command handlers), 'simple' (for simple built-in commands), 'group' for command group placeholders, and 'unknown' if not found in the command registration tables (e.g. core built-ins functions). diff --git a/src/helper/command.c b/src/helper/command.c index 65421f5..23175ba 100644 --- a/src/helper/command.c +++ b/src/helper/command.c @@ -948,6 +948,31 @@ static int command_unknown(Jim_Interp *interp, int argc, Jim_Obj *const *argv) return script_command_run(interp, count, start, c, found); } +static int jim_command_type(Jim_Interp *interp, int argc, Jim_Obj *const *argv) +{ + if (1 == argc) + return JIM_ERR; + + struct command_context *cmd_ctx = current_command_context(); + struct command *c = cmd_ctx->commands; + int remaining = command_unknown_find(argc - 1, argv + 1, c, &c, true); + // if nothing could be consumed, then it's an unknown command + if (remaining == argc - 1) + { + Jim_SetResultString(interp, "unknown", -1); + return JIM_OK; + } + + if (c->jim_handler) + Jim_SetResultString(interp, "native", -1); + else if (c->handler) + Jim_SetResultString(interp, "simple", -1); + else + Jim_SetResultString(interp, "group", -1); + + return JIM_OK; +} + int help_add_command(struct command_context *cmd_ctx, struct command *parent, const char *cmd_name, const char *help_text, const char *usage) { @@ -1069,6 +1094,18 @@ COMMAND_HANDLER(handle_sleep_command) return ERROR_OK; } +static const struct command_registration command_subcommand_handlers[] = { + { + .name = "type", + .mode = COMMAND_ANY, + .jim_handler = &jim_command_type, + .usage = "<name> ...", + .help = "Returns the type of built-in command:" + "'native', 'simple', 'group', or 'unknown'", + }, + COMMAND_REGISTRATION_DONE +}; + static const struct command_registration command_builtin_handlers[] = { { .name = "add_help_text", @@ -1106,6 +1143,12 @@ static const struct command_registration command_builtin_handlers[] = { .help = "show basic command usage", .usage = "[<command> ...]", }, + { + .name = "command", + .mode= COMMAND_ANY, + .help = "core command group (introspection)", + .chain = command_subcommand_handlers, + }, COMMAND_REGISTRATION_DONE }; ----------------------------------------------------------------------- Summary of changes: src/helper/command.c | 118 +++++++++++++++++++++++++++++++++--------------- src/helper/startup.tcl | 24 ++++++++++ 2 files changed, 105 insertions(+), 37 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: David B. <dbr...@us...> - 2009-11-28 20:57:01
|
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 5f0223423d6c9a41bf0a9ac45772d1b01469bf0a (commit) from 30f6142fc8570549ff42676ffe16425c6a6ef264 (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 5f0223423d6c9a41bf0a9ac45772d1b01469bf0a Author: David Brownell <dbr...@us...> Date: Sat Nov 28 11:55:00 2009 -0800 ARM11: fix warning on amd64 Previous version of JTAG_DEBUG() macro hid this bug. Signed-off-by: David Brownell <dbr...@us...> diff --git a/src/target/arm11_dbgtap.c b/src/target/arm11_dbgtap.c index 9e43895..ed57d20 100644 --- a/src/target/arm11_dbgtap.c +++ b/src/target/arm11_dbgtap.c @@ -871,7 +871,10 @@ int arm11_sc7_run(struct arm11_common * arm11, struct arm11_sc7_action * actions for (size_t i = 0; i < count; i++) { - JTAG_DEBUG("SC7 %02d: %02x %s %08x", i, actions[i].address, actions[i].write ? "<=" : "=>", actions[i].value); + JTAG_DEBUG("SC7 %02d: %02x %s %08x", + (unsigned) i, actions[i].address, + actions[i].write ? "<=" : "=>", + actions[i].value); } return ERROR_OK; ----------------------------------------------------------------------- Summary of changes: src/target/arm11_dbgtap.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: David B. <dbr...@us...> - 2009-11-28 20:30: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 30f6142fc8570549ff42676ffe16425c6a6ef264 (commit) via acbe054a38a45432f5948026e1e9258b4e2910c2 (commit) via 68889ea02f28bfd61f0b4b85aad4b0bf8826a947 (commit) from 5782999f6030acb560a3b02da10354eb099c45a4 (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 30f6142fc8570549ff42676ffe16425c6a6ef264 Author: David Brownell <dbr...@us...> Date: Sat Nov 28 11:28:17 2009 -0800 ARM11: fix dbgtap JTAG_DEBUG There is no DEBUG() macro; don't call one! Always at least *parse* debug code, to help prevent such errors. Signed-off-by: David Brownell <dbr...@us...> diff --git a/src/target/arm11_dbgtap.c b/src/target/arm11_dbgtap.c index b5b02ef..9e43895 100644 --- a/src/target/arm11_dbgtap.c +++ b/src/target/arm11_dbgtap.c @@ -30,9 +30,9 @@ #include "time_support.h" #if 0 -#define JTAG_DEBUG(expr ...) DEBUG(expr) +#define JTAG_DEBUG(expr ...) do { if (1) LOG_DEBUG(expr); } while (0) #else -#define JTAG_DEBUG(expr ...) do {} while (0) +#define JTAG_DEBUG(expr ...) do { if (0) LOG_DEBUG(expr); } while (0) #endif /* commit acbe054a38a45432f5948026e1e9258b4e2910c2 Author: David Brownell <dbr...@us...> Date: Sat Nov 28 10:40:26 2009 -0800 target: uplevel add_{break,watch}point() error checks In target_type.h it's documented that the target must be halted for add_breakpoint() ... and with slight ambiguity, also for its add_watchpoint() sibling. So rather than verifying that constraint in the CPU drivers, do it in the target_add_{break,watch}point() routines. Add minor paranoia on the remove_*point() paths too: save the return value, and print it out in in the LOG_DEBUG message in case it's nonzero. Note that with some current cores, like all ARMv7 ones I've looked at, there's no technical issue preventing watchpoint or breakpoint add/remove operations on active cores. This model seems deeply wired into OpenOCD though. ALSO: the ARM targets were fairly "good" about enforcing that constraint themselves. The MIPS ones were relied on other code to catch such stuff, but it's not clear such code existed ... keep an eye out for new issues on MIPS. Signed-off-by: David Brownell <dbr...@us...> diff --git a/src/target/arm7_9_common.c b/src/target/arm7_9_common.c index f7b8669..b5553cd 100644 --- a/src/target/arm7_9_common.c +++ b/src/target/arm7_9_common.c @@ -426,12 +426,6 @@ int arm7_9_add_breakpoint(struct target *target, struct breakpoint *breakpoint) { struct arm7_9_common *arm7_9 = target_to_arm7_9(target); - if (target->state != TARGET_HALTED) - { - LOG_WARNING("target not halted"); - return ERROR_TARGET_NOT_HALTED; - } - if (arm7_9->breakpoint_count == 0) { /* make sure we don't have any dangling breakpoints. This is vital upon @@ -631,12 +625,6 @@ int arm7_9_add_watchpoint(struct target *target, struct watchpoint *watchpoint) { struct arm7_9_common *arm7_9 = target_to_arm7_9(target); - if (target->state != TARGET_HALTED) - { - LOG_WARNING("target not halted"); - return ERROR_TARGET_NOT_HALTED; - } - if (arm7_9->wp_available < 1) { return ERROR_TARGET_RESOURCE_NOT_AVAILABLE; diff --git a/src/target/breakpoints.c b/src/target/breakpoints.c index 16ab7e0..2542c41 100644 --- a/src/target/breakpoints.c +++ b/src/target/breakpoints.c @@ -109,6 +109,7 @@ static void breakpoint_free(struct target *target, struct breakpoint *breakpoint { struct breakpoint *breakpoint = target->breakpoints; struct breakpoint **breakpoint_p = &target->breakpoints; + int retval; while (breakpoint) { @@ -121,9 +122,9 @@ static void breakpoint_free(struct target *target, struct breakpoint *breakpoint if (breakpoint == NULL) return; - target_remove_breakpoint(target, breakpoint); + retval = target_remove_breakpoint(target, breakpoint); - LOG_DEBUG("BPID: %d", breakpoint->unique_id ); + LOG_DEBUG("free BPID: %d --> %d", breakpoint->unique_id, retval); (*breakpoint_p) = breakpoint->next; free(breakpoint->orig_instr); free(breakpoint); @@ -249,6 +250,7 @@ static void watchpoint_free(struct target *target, struct watchpoint *watchpoint { struct watchpoint *watchpoint = target->watchpoints; struct watchpoint **watchpoint_p = &target->watchpoints; + int retval; while (watchpoint) { @@ -260,8 +262,8 @@ static void watchpoint_free(struct target *target, struct watchpoint *watchpoint if (watchpoint == NULL) return; - target_remove_watchpoint(target, watchpoint); - LOG_DEBUG("WPID: %d", watchpoint->unique_id ); + retval = target_remove_watchpoint(target, watchpoint); + LOG_DEBUG("free WPID: %d --> %d", watchpoint->unique_id, retval); (*watchpoint_p) = watchpoint->next; free(watchpoint); } diff --git a/src/target/cortex_m3.c b/src/target/cortex_m3.c index 7cfe540..ad59c78 100644 --- a/src/target/cortex_m3.c +++ b/src/target/cortex_m3.c @@ -1141,13 +1141,6 @@ cortex_m3_add_watchpoint(struct target *target, struct watchpoint *watchpoint) { struct cortex_m3_common *cortex_m3 = target_to_cm3(target); - /* REVISIT why check? DWT can be updated with core running ... */ - if (target->state != TARGET_HALTED) - { - LOG_WARNING("target not halted"); - return ERROR_TARGET_NOT_HALTED; - } - if (cortex_m3->dwt_comp_available < 1) { LOG_DEBUG("no comparators?"); diff --git a/src/target/target.c b/src/target/target.c index a2bd886..28387f4 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -606,6 +606,10 @@ int target_bulk_write_memory(struct target *target, int target_add_breakpoint(struct target *target, struct breakpoint *breakpoint) { + if (target->state != TARGET_HALTED) { + LOG_WARNING("target %s is not halted", target->cmd_name); + return ERROR_TARGET_NOT_HALTED; + } return target->type->add_breakpoint(target, breakpoint); } int target_remove_breakpoint(struct target *target, @@ -617,6 +621,10 @@ int target_remove_breakpoint(struct target *target, int target_add_watchpoint(struct target *target, struct watchpoint *watchpoint) { + if (target->state != TARGET_HALTED) { + LOG_WARNING("target %s is not halted", target->cmd_name); + return ERROR_TARGET_NOT_HALTED; + } return target->type->add_watchpoint(target, watchpoint); } int target_remove_watchpoint(struct target *target, diff --git a/src/target/target_type.h b/src/target/target_type.h index 333b58b..d141608 100644 --- a/src/target/target_type.h +++ b/src/target/target_type.h @@ -124,18 +124,24 @@ struct target_type * Target must be halted while this is invoked as this * will actually set up breakpoints on target. * - * The breakpoint hardware will be set up upon adding the first breakpoint. + * The breakpoint hardware will be set up upon adding the + * first breakpoint. * * Upon GDB connection all breakpoints/watchpoints are cleared. */ int (*add_breakpoint)(struct target *target, struct breakpoint *breakpoint); - /* remove breakpoint. hw will only be updated if the target is currently halted. + /* remove breakpoint. hw will only be updated if the target + * is currently halted. * However, this method can be invoked on unresponsive targets. */ int (*remove_breakpoint)(struct target *target, struct breakpoint *breakpoint); + + /* add watchpoint ... see add_breakpoint() comment above. */ int (*add_watchpoint)(struct target *target, struct watchpoint *watchpoint); - /* remove watchpoint. hw will only be updated if the target is currently halted. + + /* remove watchpoint. hw will only be updated if the target + * is currently halted. * However, this method can be invoked on unresponsive targets. */ int (*remove_watchpoint)(struct target *target, struct watchpoint *watchpoint); diff --git a/src/target/xscale.c b/src/target/xscale.c index 1a18ab8..49653a9 100644 --- a/src/target/xscale.c +++ b/src/target/xscale.c @@ -2137,12 +2137,6 @@ static int xscale_add_breakpoint(struct target *target, { struct xscale_common *xscale = target_to_xscale(target); - if (target->state != TARGET_HALTED) - { - LOG_WARNING("target not halted"); - return ERROR_TARGET_NOT_HALTED; - } - if ((breakpoint->type == BKPT_HARD) && (xscale->ibcr_available < 1)) { LOG_INFO("no breakpoint unit available for hardware breakpoint"); @@ -2300,12 +2294,6 @@ static int xscale_add_watchpoint(struct target *target, { struct xscale_common *xscale = target_to_xscale(target); - if (target->state != TARGET_HALTED) - { - LOG_WARNING("target not halted"); - return ERROR_TARGET_NOT_HALTED; - } - if (xscale->dbr_available < 1) { return ERROR_TARGET_RESOURCE_NOT_AVAILABLE; commit 68889ea02f28bfd61f0b4b85aad4b0bf8826a947 Author: David Brownell <dbr...@us...> Date: Sat Nov 28 10:36:32 2009 -0800 target: remove unused TARGET_EVENT_OLD_* symbols Just two *_OLD_* symbols left... Signed-off-by: David Brownell <dbr...@us...> diff --git a/src/target/target.h b/src/target/target.h index 55e9088..009ec17 100644 --- a/src/target/target.h +++ b/src/target/target.h @@ -172,8 +172,6 @@ enum target_event * - June/July/Aug 2008 * - Duane Ellis */ TARGET_EVENT_OLD_gdb_program_config, - TARGET_EVENT_OLD_pre_reset, - TARGET_EVENT_OLD_post_reset, TARGET_EVENT_OLD_pre_resume, /* allow GDB to do stuff before others handle the halted event, ----------------------------------------------------------------------- Summary of changes: src/target/arm11_dbgtap.c | 4 ++-- src/target/arm7_9_common.c | 12 ------------ src/target/breakpoints.c | 10 ++++++---- src/target/cortex_m3.c | 7 ------- src/target/target.c | 8 ++++++++ src/target/target.h | 2 -- src/target/target_type.h | 12 +++++++++--- src/target/xscale.c | 12 ------------ 8 files changed, 25 insertions(+), 42 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: David B. <dbr...@us...> - 2009-11-28 03:54: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 5782999f6030acb560a3b02da10354eb099c45a4 (commit) via ddce517e3a2144e27a26090aef7ef1a7f2270af1 (commit) via e0cb27df6bc595650ca6ce205803d3aa3218e262 (commit) via 4e56a2303b3f68bb647d8bb640a830f7f21ea231 (commit) via 4d2750e571b6a3f700cd95542a4bb5c7949e476c (commit) from 77aa7ca8d65ac5dc7b46ad9ef79e3f6aed9b4d0e (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 5782999f6030acb560a3b02da10354eb099c45a4 Author: David Brownell <dbr...@us...> Date: Fri Nov 27 18:53:43 2009 -0800 NEWS: mention new reset-assert event Signed-off-by: David Brownell <dbr...@us...> diff --git a/NEWS b/NEWS index c5811bc..b7eb0f0 100644 --- a/NEWS +++ b/NEWS @@ -8,6 +8,8 @@ JTAG Layer: Boundary Scan: Target Layer: + General + - new "reset-assert" event, for systems without SRST ARM - renamed "armv4_5" command prefix as "arm" - recognize TrustZone "Secure Monitor" mode @@ -22,6 +24,7 @@ Target Layer: Cortex-A8 - support "arm regs" command - can access all core modes and registers + - supports "reset-assert" event (used on OMAP3530) Cortex-M3 - Exposed DWT registers like cycle counter commit ddce517e3a2144e27a26090aef7ef1a7f2270af1 Author: David Brownell <dbr...@us...> Date: Fri Nov 27 18:50:31 2009 -0800 omap3530.cfg: use new "reset-assert" event Replaces previous "reset-assert-pre" workaround. Signed-off-by: David Brownell <dbr...@us...> diff --git a/tcl/target/omap3530.cfg b/tcl/target/omap3530.cfg index 0a83423..74edd72 100644 --- a/tcl/target/omap3530.cfg +++ b/tcl/target/omap3530.cfg @@ -65,10 +65,10 @@ proc omap3_dbginit {target} { jtag_rclk 1000 $_TARGETNAME configure -event "reset-start" { jtag_rclk 1000 } -# REVISIT This assumes that SRST is unavailable, so we must assert reset +# Assume SRST is unavailable (e.g. TI-14 JTAG), so we must assert reset # ourselves using PRM_RSTCTRL. RST_GS (2) is a warm reset, like ICEpick # would issue. RST_DPLL3 (4) is a cold reset. set PRM_RSTCTRL 0x48307250 -$_TARGETNAME configure -event reset-assert-pre "$_TARGETNAME mww $PRM_RSTCTRL 2" +$_TARGETNAME configure -event reset-assert "$_TARGETNAME mww $PRM_RSTCTRL 2" $_TARGETNAME configure -event reset-assert-post "omap3_dbginit $_TARGETNAME" commit e0cb27df6bc595650ca6ce205803d3aa3218e262 Author: David Brownell <dbr...@us...> Date: Fri Nov 27 18:50:26 2009 -0800 Cortex-A8: support "reset-assert" event Use the new "reset-assert" event; else SRST; else fail. Tested on an OMAP3, using the event. NOTE: still doesn't handle "reset halt". For some reason neither VCR nor PRCR seemed effective; they held the value that was written, but VCR didn't trigger debug entry when the reset vector fired (maybe the vector needs configuring?) and PRCR refused to hold the chip in reset until deassert() could force the core into debug state. Signed-off-by: David Brownell <dbr...@us...> diff --git a/src/target/cortex_a8.c b/src/target/cortex_a8.c index b85481a..8402081 100644 --- a/src/target/cortex_a8.c +++ b/src/target/cortex_a8.c @@ -1246,6 +1246,21 @@ static int cortex_a8_assert_reset(struct target *target) LOG_DEBUG(" "); + /* FIXME when halt is requested, make it work somehow... */ + + /* Issue some kind of warm reset. */ + if (target_has_event_action(target, TARGET_EVENT_RESET_ASSERT)) { + target_handle_event(target, TARGET_EVENT_RESET_ASSERT); + } else if (jtag_get_reset_config() & RESET_HAS_SRST) { + /* REVISIT handle "pulls" cases, if there's + * hardware that needs them to work. + */ + jtag_add_reset(0, 1); + } else { + LOG_ERROR("%s: how to reset?", target_name(target)); + return ERROR_FAIL; + } + /* registers are now invalid */ register_cache_invalidate(armv7a->armv4_5_common.core_cache); @@ -1256,14 +1271,22 @@ static int cortex_a8_assert_reset(struct target *target) static int cortex_a8_deassert_reset(struct target *target) { + int retval; LOG_DEBUG(" "); - if (target->reset_halt) - { - int retval; - if ((retval = target_halt(target)) != ERROR_OK) - return retval; + /* be certain SRST is off */ + jtag_add_reset(0, 0); + + retval = cortex_a8_poll(target); + + if (target->reset_halt) { + if (target->state != TARGET_HALTED) { + LOG_WARNING("%s: ran after reset and before halt ...", + target_name(target)); + if ((retval = target_halt(target)) != ERROR_OK) + return retval; + } } return ERROR_OK; commit 4e56a2303b3f68bb647d8bb640a830f7f21ea231 Author: David Brownell <dbr...@us...> Date: Fri Nov 27 18:50:20 2009 -0800 target: groundwork for "reset-assert" event This defines a "reset-assert" event and a supporting utility routine, and documents both how targets should implement it and how config scripts should use it. Core-specific updates are needed to make this work. Signed-off-by: David Brownell <dbr...@us...> diff --git a/doc/openocd.texi b/doc/openocd.texi index e94c9d0..b32ed21 100644 --- a/doc/openocd.texi +++ b/doc/openocd.texi @@ -1411,6 +1411,20 @@ chip can be tweaked by the board. Some chips have specific ways the TRST and SRST signals are managed. In the unusual case that these are @emph{chip specific} and can never be changed by board wiring, they could go here. +For example, some chips can't support JTAG debugging without +both signals. + +Provide a @code{reset-assert} event handler if you can. +Such a handler uses JTAG operations to reset the target, +letting this target config be used in systems which don't +provide the optional SRST signal, or on systems where you +don't want to reset all targets at once. +Such a handler might write to chip registers to force a reset, +use a JRC to do that (preferable -- the target may be wedged!), +or force a watchdog timer to trigger. +(For Cortex-M3 targets, this is not necessary. The target +driver knows how to use trigger an NVIC reset when SRST is +not available.) Some chips need special attention during reset handling if they're going to be used with JTAG. @@ -1418,6 +1432,8 @@ An example might be needing to send some commands right after the target's TAP has been reset, providing a @code{reset-deassert-post} event handler that writes a chip register to report that JTAG debugging is being done. +Another would be reconfiguring the watchdog so that it stops +counting while the core is halted in the debugger. JTAG clocking constraints often change during reset, and in some cases target config files (rather than board config files) @@ -2401,6 +2417,12 @@ There are also @emph{event handlers} associated with TAPs or Targets. Those handlers are Tcl procedures you can provide, which are invoked at particular points in the reset sequence. +@emph{When SRST is not an option} you must set +up a @code{reset-assert} event handler for your target. +For example, some JTAG adapters don't include the SRST signal; +and some boards have multiple targets, and you won't always +want to reset everything at once. + After configuring those mechanisms, you might still find your board doesn't start up or reset correctly. For example, maybe it needs a slightly different sequence @@ -3390,9 +3412,14 @@ For example: @itemize @bullet @item What should happen when GDB connects? Should your target reset? @item When GDB tries to flash the target, do you need to enable the flash via a special command? +@item Is using SRST appropriate (and possible) on your system? +Or instead of that, do you need to issue JTAG commands to trigger reset? +SRST usually resets everything on the scan chain, which can be inappropriate. @item During reset, do you need to write to certain memory locations to set up system clocks or to reconfigure the SDRAM? +How about configuring the watchdog timer, or other peripherals, +to stop running while you hold the core stopped for debugging? @end itemize All of the above items can be addressed by target event handlers. @@ -3457,16 +3484,28 @@ The following target events are defined: @item @b{reset-assert-pre} @* Issued as part of @command{reset} processing after @command{reset_init} was triggered -but before SRST alone is re-asserted on the tap. +but before either SRST alone is re-asserted on the scan chain, +or @code{reset-assert} is triggered. +@item @b{reset-assert} +@* Issued as part of @command{reset} processing +after @command{reset-assert-pre} was triggered. +When such a handler is present, cores which support this event will use +it instead of asserting SRST. +This support is essential for debugging with JTAG interfaces which +don't include an SRST line (JTAG doesn't require SRST), and for +selective reset on scan chains that have multiple targets. @item @b{reset-assert-post} @* Issued as part of @command{reset} processing -when SRST is asserted on the tap. +after @code{reset-assert} has been triggered. +or the target asserted SRST on the entire scan chain. @item @b{reset-deassert-pre} @* Issued as part of @command{reset} processing -when SRST is about to be released on the tap. +after @code{reset-assert-post} has been triggered. @item @b{reset-deassert-post} @* Issued as part of @command{reset} processing -when SRST has been released on the tap. +after @code{reset-deassert-pre} has been triggered +and (if the target is using it) after SRST has been +released on the scan chain. @item @b{reset-end} @* Issued as the final step in @command{reset} processing. @ignore diff --git a/src/target/target.c b/src/target/target.c index 3de9f2c..a2bd886 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -147,6 +147,7 @@ static const Jim_Nvp nvp_target_event[] = { { .value = TARGET_EVENT_RESET_START, .name = "reset-start" }, { .value = TARGET_EVENT_RESET_ASSERT_PRE, .name = "reset-assert-pre" }, + { .value = TARGET_EVENT_RESET_ASSERT, .name = "reset-assert" }, { .value = TARGET_EVENT_RESET_ASSERT_POST, .name = "reset-assert-post" }, { .value = TARGET_EVENT_RESET_DEASSERT_PRE, .name = "reset-deassert-pre" }, { .value = TARGET_EVENT_RESET_DEASSERT_POST, .name = "reset-deassert-post" }, @@ -154,8 +155,8 @@ static const Jim_Nvp nvp_target_event[] = { { .value = TARGET_EVENT_RESET_HALT_POST, .name = "reset-halt-post" }, { .value = TARGET_EVENT_RESET_WAIT_PRE, .name = "reset-wait-pre" }, { .value = TARGET_EVENT_RESET_WAIT_POST, .name = "reset-wait-post" }, - { .value = TARGET_EVENT_RESET_INIT , .name = "reset-init" }, - { .value = TARGET_EVENT_RESET_END, .name = "reset-end" }, + { .value = TARGET_EVENT_RESET_INIT, .name = "reset-init" }, + { .value = TARGET_EVENT_RESET_END, .name = "reset-end" }, { .value = TARGET_EVENT_EXAMINE_START, .name = "examine-start" }, { .value = TARGET_EVENT_EXAMINE_END, .name = "examine-end" }, @@ -3523,6 +3524,20 @@ void target_handle_event(struct target *target, enum target_event e) } } +/** + * Returns true only if the target has a handler for the specified event. + */ +bool target_has_event_action(struct target *target, enum target_event event) +{ + struct target_event_action *teap; + + for (teap = target->event_action; teap != NULL; teap = teap->next) { + if (teap->event == event) + return true; + } + return false; +} + enum target_cfg_param { TCFG_TYPE, TCFG_EVENT, diff --git a/src/target/target.h b/src/target/target.h index 15003c6..55e9088 100644 --- a/src/target/target.h +++ b/src/target/target.h @@ -196,6 +196,7 @@ enum target_event TARGET_EVENT_RESET_START, TARGET_EVENT_RESET_ASSERT_PRE, + TARGET_EVENT_RESET_ASSERT, /* C code uses this instead of SRST */ TARGET_EVENT_RESET_ASSERT_POST, TARGET_EVENT_RESET_DEASSERT_PRE, TARGET_EVENT_RESET_DEASSERT_POST, @@ -226,7 +227,9 @@ struct target_event_action { struct Jim_Obj *body; int has_percent; struct target_event_action *next; - }; +}; + +bool target_has_event_action(struct target *target, enum target_event event); struct target_event_callback { commit 4d2750e571b6a3f700cd95542a4bb5c7949e476c Author: David Brownell <dbr...@us...> Date: Fri Nov 27 18:40:37 2009 -0800 ARM11: write_memory() avoids increment check When writing to a chip's "reset yourself" register, the ARM11 code was reporting a spurious failure. Just don't bother checking for correctly incremented pointers given single-unit writes ... it's a bit faster that way too. (Reads should likely do the same thing. For that matter, such checks are usually just a waste...) Shrink an overlong parameter name, and associated lines'o'code. Signed-off-by: David Brownell <dbr...@us...> diff --git a/src/target/arm11.c b/src/target/arm11.c index 7c6d39c..daba3b8 100644 --- a/src/target/arm11.c +++ b/src/target/arm11.c @@ -989,13 +989,14 @@ static int arm11_read_memory(struct target *target, uint32_t address, uint32_t s } /* -* arm11_config_memrw_no_increment - in the future we may want to be able +* no_increment - in the future we may want to be able * to read/write a range of data to a "port". a "port" is an action on * read memory address for some peripheral. */ static int arm11_write_memory_inner(struct target *target, - uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer, - bool arm11_config_memrw_no_increment) + uint32_t address, uint32_t size, + uint32_t count, uint8_t *buffer, + bool no_increment) { int retval; @@ -1043,7 +1044,9 @@ static int arm11_write_memory_inner(struct target *target, /* strb r1, [r0], #1 */ /* strb r1, [r0] */ retval = arm11_run_instr_no_data1(arm11, - !arm11_config_memrw_no_increment ? 0xe4c01001 : 0xe5c01000); + !no_increment + ? 0xe4c01001 + : 0xe5c01000); if (retval != ERROR_OK) return retval; } @@ -1068,7 +1071,9 @@ static int arm11_write_memory_inner(struct target *target, /* strh r1, [r0], #2 */ /* strh r1, [r0] */ retval = arm11_run_instr_no_data1(arm11, - !arm11_config_memrw_no_increment ? 0xe0c010b2 : 0xe1c010b0); + !no_increment + ? 0xe0c010b2 + : 0xe1c010b0); if (retval != ERROR_OK) return retval; } @@ -1077,7 +1082,7 @@ static int arm11_write_memory_inner(struct target *target, } case 4: { - uint32_t instr = !arm11_config_memrw_no_increment ? 0xeca05e01 : 0xed805e00; + uint32_t instr = !no_increment ? 0xeca05e01 : 0xed805e00; /** \todo TODO: buffer cast to uint32_t* causes alignment warnings */ uint32_t *words = (uint32_t*)buffer; @@ -1104,7 +1109,7 @@ static int arm11_write_memory_inner(struct target *target, } /* r0 verification */ - if (!arm11_config_memrw_no_increment) + if (!no_increment) { uint32_t r0; @@ -1132,9 +1137,14 @@ static int arm11_write_memory_inner(struct target *target, } static int arm11_write_memory(struct target *target, - uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer) + uint32_t address, uint32_t size, + uint32_t count, uint8_t *buffer) { - return arm11_write_memory_inner(target, address, size, count, buffer, false); + /* pointer increment matters only for multi-unit writes ... + * not e.g. to a "reset the chip" controller. + */ + return arm11_write_memory_inner(target, address, size, + count, buffer, count == 1); } /* write target memory in multiples of 4 byte, optimized for writing large quantities of data */ ----------------------------------------------------------------------- Summary of changes: NEWS | 3 +++ doc/openocd.texi | 47 +++++++++++++++++++++++++++++++++++++++++++---- src/target/arm11.c | 28 +++++++++++++++++++--------- src/target/cortex_a8.c | 33 ++++++++++++++++++++++++++++----- src/target/target.c | 19 +++++++++++++++++-- src/target/target.h | 5 ++++- tcl/target/omap3530.cfg | 4 ++-- 7 files changed, 116 insertions(+), 23 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Zach W. <zw...@us...> - 2009-11-27 23:50: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 77aa7ca8d65ac5dc7b46ad9ef79e3f6aed9b4d0e (commit) from a0d983ab0616581559634c7217a8eecf61f4d65b (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 77aa7ca8d65ac5dc7b46ad9ef79e3f6aed9b4d0e Author: Zachary T Welch <zw...@su...> Date: Fri Nov 27 13:51:17 2009 -0800 fix regression causing duplicated output The command refactoring caused subcommand handlers to produce duplicate output when run. The problem was introduced by failing to ensure all such invocations went through a top-level "catcher" script, prefixing the command name with the 'ocd_' prefix and consuming its results. The fix is to ensure such a top-level "catcher" script gets created for each top-level command, regardless of whether it has a handler. Indeed, this patch removes all command registrations for sub-commands, which would not have worked in the new registration scheme anyway. For now, dispatch of subcommands continues to be handled by the new 'unknown' command handler, which gets fixed here to strip the 'ocd_' prefix if searching for the top-level command name fails initially. Some Jim commands may be registered with this prefix, and that situation seems to require the current fallback approach. Otherwise, that prefix could be stripped unconditionally and the logic made a little simpler. The same problem must be handled by the 'help' command handler too, so its lookup process works as intended. Overall, the command dispatching remains more complicated than desired, but this patch fixes the immediate regressions. diff --git a/src/helper/command.c b/src/helper/command.c index 62fb487..65421f5 100644 --- a/src/helper/command.c +++ b/src/helper/command.c @@ -44,6 +44,9 @@ #include "jim-eventloop.h" +/* nice short description of source file */ +#define __THIS__FILE__ "command.c" + Jim_Interp *interp = NULL; static int run_command(struct command_context *context, @@ -185,8 +188,12 @@ static int script_command(Jim_Interp *interp, int argc, Jim_Obj *const *argv) return script_command_run(interp, argc, argv, c, true); } -/* nice short description of source file */ -#define __THIS__FILE__ "command.c" +static struct command *command_root(struct command *c) +{ + while (NULL != c->parent) + c = c->parent; + return c; +} /** * Find a command by name from a list of commands. @@ -296,19 +303,22 @@ static int register_command_handler(struct command *c) if (NULL == full_name) return retval; - const char *ocd_name = alloc_printf("ocd_%s", full_name); - if (NULL == full_name) - goto free_full_name; + if (NULL != c->handler) + { + const char *ocd_name = alloc_printf("ocd_%s", full_name); + if (NULL == full_name) + goto free_full_name; - Jim_CreateCommand(interp, ocd_name, script_command, c, NULL); - free((void *)ocd_name); + Jim_CreateCommand(interp, ocd_name, script_command, c, NULL); + free((void *)ocd_name); + } /* we now need to add an overrideable proc */ const char *override_name = alloc_printf("proc %s {args} {" "if {[catch {eval ocd_%s $args}] == 0} " "{return \"\"} else {return -code error}}", full_name, full_name); - if (NULL == full_name) + if (NULL == override_name) goto free_full_name; Jim_Eval_Named(interp, override_name, __THIS__FILE__, __LINE__); @@ -343,7 +353,7 @@ struct command* register_command(struct command_context *context, if (NULL != c->handler) { - int retval = register_command_handler(c); + int retval = register_command_handler(command_root(c)); if (ERROR_OK != retval) { unregister_command(context, parent, name); @@ -792,6 +802,8 @@ static COMMAND_HELPER(command_help_find, struct command *head, if (0 == CMD_ARGC) return ERROR_INVALID_ARGUMENTS; *out = command_find(head, CMD_ARGV[0]); + if (NULL == *out && strncmp(CMD_ARGV[0], "ocd_", 4) == 0) + *out = command_find(head, CMD_ARGV[0] + 4); if (NULL == *out) return ERROR_INVALID_ARGUMENTS; if (--CMD_ARGC == 0) @@ -875,15 +887,18 @@ COMMAND_HANDLER(handle_help_command) } static int command_unknown_find(unsigned argc, Jim_Obj *const *argv, - struct command *head, struct command **out) + struct command *head, struct command **out, bool top_level) { if (0 == argc) return argc; - struct command *c = command_find(head, Jim_GetString(argv[0], NULL)); + const char *cmd_name = Jim_GetString(argv[0], NULL); + struct command *c = command_find(head, cmd_name); + if (NULL == c && top_level && strncmp(cmd_name, "ocd_", 4) == 0) + c = command_find(head, cmd_name + 4); if (NULL == c) return argc; *out = c; - return command_unknown_find(--argc, ++argv, (*out)->children, out); + return command_unknown_find(--argc, ++argv, (*out)->children, out, false); } static int command_unknown(Jim_Interp *interp, int argc, Jim_Obj *const *argv) @@ -893,7 +908,7 @@ static int command_unknown(Jim_Interp *interp, int argc, Jim_Obj *const *argv) struct command_context *cmd_ctx = current_command_context(); struct command *c = cmd_ctx->commands; - int remaining = command_unknown_find(argc - 1, argv + 1, c, &c); + int remaining = command_unknown_find(argc - 1, argv + 1, c, &c, true); // if nothing could be consumed, then it's really an unknown command if (remaining == argc - 1) { ----------------------------------------------------------------------- Summary of changes: src/helper/command.c | 41 ++++++++++++++++++++++++++++------------- 1 files changed, 28 insertions(+), 13 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2009-11-27 20:43:01
|
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 a0d983ab0616581559634c7217a8eecf61f4d65b (commit) from 6ce3a299f395ef7f778661ae3f79d63659d133f7 (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 a0d983ab0616581559634c7217a8eecf61f4d65b Author: Ãyvind Harboe <oyv...@zy...> Date: Fri Nov 27 20:41:06 2009 +0100 zy1000: keep up with new command registration stuff jim and classic style commands are both supported. Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/jtag/zy1000/zy1000.c b/src/jtag/zy1000/zy1000.c index 5ea72a7..aeaa914 100644 --- a/src/jtag/zy1000/zy1000.c +++ b/src/jtag/zy1000/zy1000.c @@ -36,15 +36,6 @@ #define ZYLIN_OPENOCD GIT_OPENOCD_VERSION #define ZYLIN_OPENOCD_VERSION "ZY1000 " ZYLIN_VERSION " " ZYLIN_DATE -/* low level command set - */ -void zy1000_reset(int trst, int srst); - - -int zy1000_speed(int speed); -int zy1000_register_commands(struct command_context *cmd_ctx); -int zy1000_init(void); -int zy1000_quit(void); static int zy1000_khz(int khz, int *jtag_speed) { @@ -108,21 +99,6 @@ static int zy1000_power_dropout(int *dropout) return ERROR_OK; } - -struct jtag_interface zy1000_interface = -{ - .name = "ZY1000", - .execute_queue = NULL, - .speed = zy1000_speed, - .register_commands = zy1000_register_commands, - .init = zy1000_init, - .quit = zy1000_quit, - .khz = zy1000_khz, - .speed_div = zy1000_speed_div, - .power_dropout = zy1000_power_dropout, - .srst_asserted = zy1000_srst_asserted, -}; - void zy1000_reset(int trst, int srst) { LOG_DEBUG("zy1000 trst=%d, srst=%d", trst, srst); @@ -370,24 +346,6 @@ zylinjtag_Jim_Command_powerstatus(Jim_Interp *interp, return JIM_OK; } -int zy1000_register_commands(struct command_context *cmd_ctx) -{ - COMMAND_REGISTER(cmd_ctx, NULL, "power", handle_power_command, COMMAND_ANY, - "power <on/off> - turn power switch to target on/off. No arguments - print status."); - - Jim_CreateCommand(interp, "zy1000_version", jim_zy1000_version, NULL, NULL); - - - Jim_CreateCommand(interp, "powerstatus", zylinjtag_Jim_Command_powerstatus, NULL, NULL); - -#ifdef CYGPKG_HAL_NIOS2 - Jim_CreateCommand(interp, "updatezy1000firmware", jim_zy1000_writefirmware, NULL, NULL); -#endif - - - return ERROR_OK; -} - @@ -817,3 +775,49 @@ void embeddedice_write_dcc(struct jtag_tap *tap, int reg_addr, uint8_t *buffer, } +static const struct command_registration zy1000_commands[] = { + { + .name = "power", + .handler = &handle_power_command, + .mode = COMMAND_ANY, + .help = "turn power switch to target on/off. No arguments - print status.", + .usage = "power <on/off>", + }, + { + .name = "zy1000_version", + .mode = COMMAND_ANY, + .jim_handler = &jim_zy1000_version, + .help = "print version info for zy1000", + }, + { + .name = "powerstatus", + .mode = COMMAND_ANY, + .jim_handler = & zylinjtag_Jim_Command_powerstatus, + .help = "print power status of target", + }, +#ifdef CYGPKG_HAL_NIOS2 + { + .name = "updatezy1000firmware", + .mode = COMMAND_ANY, + .jim_handler = &jim_zy1000_writefirmware, + .help = "writes firmware to flash", + }, +#endif +}; + + + +struct jtag_interface zy1000_interface = +{ + .name = "ZY1000", + .execute_queue = NULL, + .speed = zy1000_speed, + .commands = zy1000_commands, + .init = zy1000_init, + .quit = zy1000_quit, + .khz = zy1000_khz, + .speed_div = zy1000_speed_div, + .power_dropout = zy1000_power_dropout, + .srst_asserted = zy1000_srst_asserted, +}; + ----------------------------------------------------------------------- Summary of changes: src/jtag/zy1000/zy1000.c | 88 ++++++++++++++++++++++++---------------------- 1 files changed, 46 insertions(+), 42 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Zach W. <zw...@us...> - 2009-11-27 20:12: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 6ce3a299f395ef7f778661ae3f79d63659d133f7 (commit) via f31dfffdef16e640fa0bb881db1ac65ffcd42bf0 (commit) from 46ed068bacec3c40aa543e78e99b51e30aacf15b (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 6ce3a299f395ef7f778661ae3f79d63659d133f7 Author: Zachary T Welch <zw...@su...> Date: Fri Nov 27 11:02:54 2009 -0800 update minidummy interface driver command handling Changes the interface definition field reference from register_commands to commands, which allows the module to compile. diff --git a/src/jtag/minidummy/minidummy.c b/src/jtag/minidummy/minidummy.c index 1bee74e..986a8be 100644 --- a/src/jtag/minidummy/minidummy.c +++ b/src/jtag/minidummy/minidummy.c @@ -29,7 +29,7 @@ struct jtag_interface minidummy_interface = .name = "minidummy", .execute_queue = NULL, .speed = NULL, - .register_commands = NULL, + .commands = NULL, .init = NULL, .quit = NULL, .khz = NULL, commit f31dfffdef16e640fa0bb881db1ac65ffcd42bf0 Author: Zachary T Welch <zw...@su...> Date: Fri Nov 27 09:57:25 2009 -0800 fix 'nand info' command Move device argument parsing after check for number of arguments; otherwise, calling this command without any arguments would access argv[0] before checking whether it even existed. diff --git a/src/flash/nand.c b/src/flash/nand.c index 1e28ba2..895abe3 100644 --- a/src/flash/nand.c +++ b/src/flash/nand.c @@ -1121,11 +1121,6 @@ COMMAND_HANDLER(handle_nand_info_command) int first = -1; int last = -1; - struct nand_device *p; - int retval = CALL_COMMAND_HANDLER(nand_command_get_device, 0, &p); - if (ERROR_OK != retval) - return retval; - switch (CMD_ARGC) { default: return ERROR_COMMAND_SYNTAX_ERROR; @@ -1144,6 +1139,11 @@ COMMAND_HANDLER(handle_nand_info_command) break; } + struct nand_device *p; + int retval = CALL_COMMAND_HANDLER(nand_command_get_device, 0, &p); + if (ERROR_OK != retval) + return retval; + if (NULL == p->device) { command_print(CMD_CTX, "#%s: not probed", CMD_ARGV[0]); ----------------------------------------------------------------------- Summary of changes: src/flash/nand.c | 10 +++++----- src/jtag/minidummy/minidummy.c | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2009-11-27 19:44:06
|
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 46ed068bacec3c40aa543e78e99b51e30aacf15b (commit) from bd3ef5ca3d11c228aece1a1a654a8c89bd6d0e05 (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 46ed068bacec3c40aa543e78e99b51e30aacf15b Author: Ãyvind Harboe <oyv...@zy...> Date: Fri Nov 27 19:41:22 2009 +0100 zy1000: keep up with changes to log_init() fn's and return value for log_init() changed to void. Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/ecosboard.c b/src/ecosboard.c index 2789464..5588934 100644 --- a/src/ecosboard.c +++ b/src/ecosboard.c @@ -1098,13 +1098,7 @@ int main(int argc, char *argv[]) Jim_CreateCommand(interp, "uart", zylinjtag_Jim_Command_uart, NULL, NULL); - int errVal; - errVal = log_init(cmd_ctx); - if (errVal != ERROR_OK) - { - diag_printf("log_init() failed %d\n", errVal); - exit(-1); - } + log_init(); set_log_output(cmd_ctx, log); ----------------------------------------------------------------------- Summary of changes: src/ecosboard.c | 8 +------- 1 files changed, 1 insertions(+), 7 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2009-11-27 09:12:34
|
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 bd3ef5ca3d11c228aece1a1a654a8c89bd6d0e05 (commit) from 2221a037447b61b8a9db500ba997e61dbe874d61 (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 bd3ef5ca3d11c228aece1a1a654a8c89bd6d0e05 Author: Ãyvind Harboe <oyv...@zy...> Date: Fri Nov 27 09:10:37 2009 +0100 minidummy: fix compilation error during refactoring a search and replace error crept in Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/src/jtag/minidummy/jtag_minidriver.h b/src/jtag/minidummy/jtag_minidriver.h index baf4ada..d50a800 100644 --- a/src/jtag/minidummy/jtag_minidriver.h +++ b/src/jtag/minidummy/jtag_minidriver.h @@ -20,7 +20,7 @@ -static __inline__ void interface_jtag_add_dr_out_core(struct jtag_tap *struct targetap, +static __inline__ void interface_jtag_add_dr_out_core(struct jtag_tap *targettap, int num_fields, const int *num_bits, const uint32_t *value, @@ -29,7 +29,7 @@ static __inline__ void interface_jtag_add_dr_out_core(struct jtag_tap *struct ta /* synchronously do the operation here */ } -static __inline__ void interface_jtag_add_dr_out(struct jtag_tap *struct targetap, +static __inline__ void interface_jtag_add_dr_out(struct jtag_tap *targettap, int num_fields, const int *num_bits, const uint32_t *value, ----------------------------------------------------------------------- Summary of changes: src/jtag/minidummy/jtag_minidriver.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: David B. <dbr...@us...> - 2009-11-27 09:00: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 2221a037447b61b8a9db500ba997e61dbe874d61 (commit) via 8f3c728273e9b89070259d6120117f6a190dd773 (commit) via 05a5f682c6cff5bba3b54ec7d8bd0ad6b7a72054 (commit) via ffc704fdeb406abff1a61f4f6a0423535db939fd (commit) via 7c9cd4789316a1933f5c1e217d1e01e6d417decb (commit) from fd5f53f035ed7af472b3edfa0afaba9c9af667a0 (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 2221a037447b61b8a9db500ba997e61dbe874d61 Author: Dean Glazeski <dn...@gm...> Date: Mon Nov 16 12:47:45 2009 -0600 ARM NAND I/O header documentation update. Fixed the header file to properly specify the doxygen documentation for the items defined in it. Signed-off-by: David Brownell <dbr...@us...> diff --git a/src/flash/arm_nandio.h b/src/flash/arm_nandio.h index fbe1f88..115a13a 100644 --- a/src/flash/arm_nandio.h +++ b/src/flash/arm_nandio.h @@ -1,20 +1,24 @@ #ifndef __ARM_NANDIO_H -#define __ARM_NANDIO_H +#define __ARM_NANDIO_H #include "nand.h" #include "binarybuffer.h" +/** + * The arm_nand_data struct is used for defining NAND I/O operations on an ARM + * core. + */ struct arm_nand_data { - /* target is proxy for some ARM core */ + /** target is proxy for some ARM core */ struct target *target; - /* copy_area holds write-to-NAND loop and data to write */ + /** copy_area holds write-to-NAND loop and data to write */ struct working_area *copy_area; - /* chunk_size == page or ECC unit */ + /** chunk_size == page or ECC unit */ unsigned chunk_size; - /* data == where to write the data */ + /** data == where to write the data */ uint32_t data; /* currently implicit: data width == 8 bits (not 16) */ @@ -23,4 +27,4 @@ struct arm_nand_data { int arm_nandwrite(struct arm_nand_data *nand, uint8_t *data, int size); int arm_nandread(struct arm_nand_data *nand, uint8_t *data, uint32_t size); -#endif /* __ARM_NANDIO_H */ +#endif /* __ARM_NANDIO_H */ commit 8f3c728273e9b89070259d6120117f6a190dd773 Author: Dean Glazeski <dn...@gm...> Date: Mon Nov 16 12:43:39 2009 -0600 ARM NAND I/O documentation update. This updates the functions in the file to all have doxygen comments describing what they do. Signed-off-by: David Brownell <dbr...@us...> diff --git a/src/flash/arm_nandio.c b/src/flash/arm_nandio.c index 990d3a0..f774b61 100644 --- a/src/flash/arm_nandio.c +++ b/src/flash/arm_nandio.c @@ -68,7 +68,7 @@ int arm_code_to_working_area(struct target *target, const uint32_t *code, unsign return retval; } -/* +/** * ARM-specific bulk write from buffer to address of 8-bit wide NAND. * For now this only supports ARMv4 and ARMv5 cores. * @@ -78,6 +78,11 @@ int arm_code_to_working_area(struct target *target, const uint32_t *code, unsign * Different code fragments could handle: * - Thumb2 cores like Cortex-M (needs different byteswapping) * - 16-bit wide data (needs different setup too) + * + * @param nand Pointer to the arm_nand_data struct that defines the I/O + * @param data Pointer to the data to be copied to flash + * @param size Size of the data being copied + * @return Success or failure of the operation */ int arm_nandwrite(struct arm_nand_data *nand, uint8_t *data, int size) { @@ -159,6 +164,7 @@ int arm_nandwrite(struct arm_nand_data *nand, uint8_t *data, int size) * @param nand Pointer to the arm_nand_data struct that defines the I/O * @param data Pointer to the data buffer to store the read data * @param size Amount of data to be stored to the buffer. + * @return Success or failure of the operation */ int arm_nandread(struct arm_nand_data *nand, uint8_t *data, uint32_t size) { commit 05a5f682c6cff5bba3b54ec7d8bd0ad6b7a72054 Author: Dean Glazeski <dn...@gm...> Date: Mon Nov 16 12:26:21 2009 -0600 ARM NAND I/O refactor code copying. Created a function for copying code to the working area on a target. The NAND write and read functions are updated to include use of this function. Signed-off-by: David Brownell <dbr...@us...> diff --git a/src/flash/arm_nandio.c b/src/flash/arm_nandio.c index 20a76f4..990d3a0 100644 --- a/src/flash/arm_nandio.c +++ b/src/flash/arm_nandio.c @@ -28,6 +28,45 @@ #include "armv4_5.h" #include "algorithm.h" +/** + * Copies code to a working area. This will allocate room for the code plus the + * additional amount requested if the working area pointer is null. + * + * @param target Pointer to the target to copy code to + * @param code Pointer to the code area to be copied + * @param code_size Size of the code being copied + * @param additional Size of the additional area to be allocated in addition to + * code + * @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, const uint32_t *code, unsigned code_size, + unsigned additional, struct working_area **area) +{ + uint8_t code_buf[code_size]; + unsigned i; + int retval; + unsigned size = code_size + additional; + + /* make sure we have a working area */ + if (NULL == *area) { + retval = target_alloc_working_area(target, size, area); + if (retval != ERROR_OK) { + LOG_DEBUG("%s: no %d byte buffer", __FUNCTION__, (int) size); + return ERROR_NAND_NO_BUFFER; + } + } + + /* buffer code in target endianness */ + for (i = 0; i < code_size / 4; i++) + target_buffer_set_u32(target, code_buf + i * 4, code[i]); + + /* copy code to work area */ + retval = target_write_memory(target, (*area)->address, + 4, code_size / 4, code_buf); + + return retval; +} /* * ARM-specific bulk write from buffer to address of 8-bit wide NAND. @@ -66,29 +105,11 @@ int arm_nandwrite(struct arm_nand_data *nand, uint8_t *data, int size) }; if (!nand->copy_area) { - uint8_t code_buf[sizeof(code)]; - unsigned i; - - /* make sure we have a working area */ - if (target_alloc_working_area(target, - sizeof(code) + nand->chunk_size, - &nand->copy_area) != ERROR_OK) { - LOG_DEBUG("%s: no %d byte buffer", - __FUNCTION__, - (int) sizeof(code) + nand->chunk_size); - return ERROR_NAND_NO_BUFFER; - } - - /* buffer code in target endianness */ - for (i = 0; i < sizeof(code) / 4; i++) - target_buffer_set_u32(target, code_buf + i * 4, code[i]); - - /* copy code to work area */ - retval = target_write_memory(target, - nand->copy_area->address, - 4, sizeof(code) / 4, code_buf); - if (retval != ERROR_OK) + retval = arm_code_to_working_area(target, code, sizeof(code), + nand->chunk_size, &nand->copy_area); + if (retval != ERROR_OK) { return retval; + } } /* copy data to work area */ @@ -139,7 +160,8 @@ int arm_nandwrite(struct arm_nand_data *nand, uint8_t *data, int size) * @param data Pointer to the data buffer to store the read data * @param size Amount of data to be stored to the buffer. */ -int arm_nandread(struct arm_nand_data *nand, uint8_t *data, uint32_t size) { +int arm_nandread(struct arm_nand_data *nand, uint8_t *data, uint32_t size) +{ struct target *target = nand->target; struct armv4_5_algorithm algo; struct arm *armv4_5 = target->arch_info; @@ -165,23 +187,8 @@ int arm_nandread(struct arm_nand_data *nand, uint8_t *data, uint32_t size) { /* create the copy area if not yet available */ if (!nand->copy_area) { - uint8_t code_buf[sizeof(code)]; - unsigned i; - - /* make sure we have a working area */ - retval = target_alloc_working_area(target, sizeof(code) + nand->chunk_size, &nand->copy_area); - if (retval != ERROR_OK) { - LOG_DEBUG("%s: no %d byte buffer", __FUNCTION__, (int) sizeof(code) + nand->chunk_size); - return ERROR_NAND_NO_BUFFER; - } - - /* buffer code in target endianness */ - for (i = 0; i < sizeof(code) / 4; i++) { - target_buffer_set_u32(target, code_buf + i * 4, code[i]); - } - - /* copy code to work area */ - retval = target_write_memory(target, nand->copy_area->address, 4, sizeof(code) / 4, code_buf); + retval = arm_code_to_working_area(target, code, sizeof(code), + nand->chunk_size, &nand->copy_area); if (retval != ERROR_OK) { return retval; } commit ffc704fdeb406abff1a61f4f6a0423535db939fd Author: Dean Glazeski <dn...@gm...> Date: Sun Nov 15 02:32:38 2009 -0600 ARM NAND I/O read function. Implementation of the NAND read function for ARM NAND I/O that includes running a local algorithm on a device to increase the performance of block reads. Signed-off-by: David Brownell <dbr...@us...> diff --git a/src/flash/arm_nandio.c b/src/flash/arm_nandio.c index 81697fa..20a76f4 100644 --- a/src/flash/arm_nandio.c +++ b/src/flash/arm_nandio.c @@ -131,5 +131,94 @@ int arm_nandwrite(struct arm_nand_data *nand, uint8_t *data, int size) return retval; } -/* REVISIT do the same for bulk *read* too ... */ +/** + * Uses an on-chip algorithm for an ARM device to read from a NAND device and + * store the data into the host machine's memory. + * + * @param nand Pointer to the arm_nand_data struct that defines the I/O + * @param data Pointer to the data buffer to store the read data + * @param size Amount of data to be stored to the buffer. + */ +int arm_nandread(struct arm_nand_data *nand, uint8_t *data, uint32_t size) { + struct target *target = nand->target; + struct armv4_5_algorithm algo; + struct arm *armv4_5 = target->arch_info; + struct reg_param reg_params[3]; + uint32_t target_buf; + uint32_t exit = 0; + int retval; + + /* Inputs: + * r0 buffer address + * r1 NAND data address (byte wide) + * r2 buffer length + */ + static const uint32_t code[] = { + 0xe5d13000, /* s: ldrb r3, [r1] */ + 0xe4c03001, /* strb r3, [r0], #1 */ + 0xe2522001, /* subs r2, r2, #1 */ + 0x1afffffb, /* bne s */ + + /* exit: ARMv4 needs hardware breakpoint */ + 0xe1200070, /* e: bkpt #0 */ + }; + + /* create the copy area if not yet available */ + if (!nand->copy_area) { + uint8_t code_buf[sizeof(code)]; + unsigned i; + + /* make sure we have a working area */ + retval = target_alloc_working_area(target, sizeof(code) + nand->chunk_size, &nand->copy_area); + if (retval != ERROR_OK) { + LOG_DEBUG("%s: no %d byte buffer", __FUNCTION__, (int) sizeof(code) + nand->chunk_size); + return ERROR_NAND_NO_BUFFER; + } + + /* buffer code in target endianness */ + for (i = 0; i < sizeof(code) / 4; i++) { + target_buffer_set_u32(target, code_buf + i * 4, code[i]); + } + + /* copy code to work area */ + retval = target_write_memory(target, nand->copy_area->address, 4, sizeof(code) / 4, code_buf); + if (retval != ERROR_OK) { + return retval; + } + } + + target_buf = nand->copy_area->address + sizeof(code); + + /* set up algorithm and parameters */ + algo.common_magic = ARMV4_5_COMMON_MAGIC; + algo.core_mode = ARMV4_5_MODE_SVC; + algo.core_state = ARMV4_5_STATE_ARM; + + init_reg_param(®_params[0], "r0", 32, PARAM_IN); + init_reg_param(®_params[1], "r1", 32, PARAM_IN); + init_reg_param(®_params[2], "r2", 32, PARAM_IN); + + buf_set_u32(reg_params[0].value, 0, 32, target_buf); + buf_set_u32(reg_params[1].value, 0, 32, nand->data); + buf_set_u32(reg_params[2].value, 0, 32, size); + + /* armv4 must exit using a hardware breakpoint */ + if (armv4_5->is_armv4) + exit = nand->copy_area->address + sizeof(code) - 4; + + /* use alg to write data from NAND chip to work area */ + retval = target_run_algorithm(target, 0, NULL, 3, reg_params, + nand->copy_area->address, exit, 1000, &algo); + if (retval != ERROR_OK) + LOG_ERROR("error executing hosted NAND write"); + + destroy_reg_param(®_params[0]); + destroy_reg_param(®_params[1]); + destroy_reg_param(®_params[2]); + + /* read from work area to the host's memory */ + retval = target_read_buffer(target, target_buf, size, data); + + return retval; +} diff --git a/src/flash/arm_nandio.h b/src/flash/arm_nandio.h index a1bed32..fbe1f88 100644 --- a/src/flash/arm_nandio.h +++ b/src/flash/arm_nandio.h @@ -21,5 +21,6 @@ struct arm_nand_data { }; int arm_nandwrite(struct arm_nand_data *nand, uint8_t *data, int size); +int arm_nandread(struct arm_nand_data *nand, uint8_t *data, uint32_t size); #endif /* __ARM_NANDIO_H */ commit 7c9cd4789316a1933f5c1e217d1e01e6d417decb Author: Dean Glazeski <dn...@gm...> Date: Tue Nov 17 14:16:23 2009 -0600 NAND Flash documentation update. Updated doxygen comments for different interface structures for the NAND interface. Signed-off-by: David Brownell <dbr...@us...> diff --git a/src/flash/nand.h b/src/flash/nand.h index b780f28..a30a654 100644 --- a/src/flash/nand.h +++ b/src/flash/nand.h @@ -32,32 +32,78 @@ struct nand_device; #define __NAND_DEVICE_COMMAND(name) \ COMMAND_HELPER(name, struct nand_device *nand) +/** + * Interface for NAND flash controllers. Not all of these functions are + * required for full functionality of the NAND driver, but better performance + * can be achieved by implementing each function. + */ struct nand_flash_controller { + /** Driver name that is used to select it from configuration files. */ char *name; - const struct command_registration *commands; + + const struct command_registration *commands; + + /** NAND device command called when driver is instantiated during configuration. */ __NAND_DEVICE_COMMAND((*nand_device_command)); + + /** Register controller specific commands as a TCL interface to the driver. */ + int (*register_commands)(struct command_context *cmd_ctx); + + /** Initialize the NAND device. */ int (*init)(struct nand_device *nand); + + /** Reset the NAND device. */ int (*reset)(struct nand_device *nand); + + /** Issue a command to the NAND device. */ int (*command)(struct nand_device *nand, uint8_t command); + + /** Write an address to the NAND device. */ int (*address)(struct nand_device *nand, uint8_t address); + + /** Write word of data to the NAND device. */ int (*write_data)(struct nand_device *nand, uint16_t data); + + /** Read word of data from the NAND device. */ int (*read_data)(struct nand_device *nand, void *data); + + /** Write a block of data to the NAND device. */ int (*write_block_data)(struct nand_device *nand, uint8_t *data, int size); + + /** Read a block of data from the NAND device. */ int (*read_block_data)(struct nand_device *nand, uint8_t *data, int size); + + /** Write a page to the NAND device. */ int (*write_page)(struct nand_device *nand, uint32_t page, uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size); + + /** Read a page from the NAND device. */ int (*read_page)(struct nand_device *nand, uint32_t page, uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size); + + /** Check if the controller is ready for more instructions with timeout. */ int (*controller_ready)(struct nand_device *nand, int timeout); + + /** Check if the NAND device is ready for more instructions with timeout. */ int (*nand_ready)(struct nand_device *nand, int timeout); }; #define NAND_DEVICE_COMMAND_HANDLER(name) static __NAND_DEVICE_COMMAND(name) +/** + * Representation of a single NAND block in a NAND device. + */ struct nand_block { + /** Offset to the block. */ uint32_t offset; + + /** Size of the block. */ uint32_t size; + + /** True if the block has been erased. */ int is_erased; + + /** True if the block is bad. */ int is_bad; }; ----------------------------------------------------------------------- Summary of changes: src/flash/arm_nandio.c | 150 ++++++++++++++++++++++++++++++++++++++++-------- src/flash/arm_nandio.h | 17 ++++-- src/flash/nand.h | 48 +++++++++++++++- 3 files changed, 184 insertions(+), 31 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: David B. <dbr...@us...> - 2009-11-26 21:02:46
|
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 fd5f53f035ed7af472b3edfa0afaba9c9af667a0 (commit) from e07ad3057771eb51b6cda86c9bd9e4a92f35a129 (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 fd5f53f035ed7af472b3edfa0afaba9c9af667a0 Author: David Brownell <dbr...@us...> Date: Thu Nov 26 12:00:56 2009 -0800 XScale: add stub {read,write}_phys routines Just make these fail, instead of letting them write over potentially random memory. Users should be able to work around the lack of real implementations by disbling the MMU by hand ... until someone provides a Real Fix. Signed-off-by: David Brownell <dbr...@us...> diff --git a/src/target/xscale.c b/src/target/xscale.c index 07fcc4c..1a18ab8 100644 --- a/src/target/xscale.c +++ b/src/target/xscale.c @@ -1881,6 +1881,15 @@ static int xscale_read_memory(struct target *target, uint32_t address, return ERROR_OK; } +static int xscale_read_phys_memory(struct target *target, uint32_t address, + uint32_t size, uint32_t count, uint8_t *buffer) +{ + /** \todo: provide a non-stub implementtion of this routine. */ + LOG_ERROR("%s: %s is not implemented. Disable MMU?", + target_name(target), __func__); + return ERROR_FAIL; +} + static int xscale_write_memory(struct target *target, uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer) { @@ -1959,6 +1968,15 @@ static int xscale_write_memory(struct target *target, uint32_t address, return ERROR_OK; } +static int xscale_write_phys_memory(struct target *target, uint32_t address, + uint32_t size, uint32_t count, uint8_t *buffer) +{ + /** \todo: provide a non-stub implementtion of this routine. */ + LOG_ERROR("%s: %s is not implemented. Disable MMU?", + target_name(target), __func__); + return ERROR_FAIL; +} + static int xscale_bulk_write_memory(struct target *target, uint32_t address, uint32_t count, uint8_t *buffer) { @@ -3684,7 +3702,9 @@ struct target_type xscale_target = .get_gdb_reg_list = armv4_5_get_gdb_reg_list, .read_memory = xscale_read_memory, + .read_phys_memory = xscale_read_phys_memory, .write_memory = xscale_write_memory, + .write_phys_memory = xscale_write_phys_memory, .bulk_write_memory = xscale_bulk_write_memory, .checksum_memory = arm_checksum_memory, ----------------------------------------------------------------------- Summary of changes: src/target/xscale.c | 20 ++++++++++++++++++++ 1 files changed, 20 insertions(+), 0 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Zach W. <zw...@us...> - 2009-11-26 19:17:39
|
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 e07ad3057771eb51b6cda86c9bd9e4a92f35a129 (commit) via cfc02ccca25b7883ad761123faf207df0df4ad06 (commit) via 1240ae459f170db8a641b4bcd5635ba9f9199aec (commit) from 060980357df2f71b8d18eb6a86a8c9878a8b417e (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 e07ad3057771eb51b6cda86c9bd9e4a92f35a129 Author: Uwe Hermann <uw...@he...> Date: Tue Nov 24 20:42:42 2009 +0100 update bug reporting information The Berlios bug-tracker is disabled, bug reports go to the list. Signed-off-by: Zachary T Welch <zw...@su...> diff --git a/doc/openocd.1 b/doc/openocd.1 index 77abcf9..d9f8a7c 100644 --- a/doc/openocd.1 +++ b/doc/openocd.1 @@ -1,4 +1,4 @@ -.TH "OPENOCD" "1" "January 08, 2009" +.TH "OPENOCD" "1" "November 24, 2009" .SH "NAME" openocd \- A free and open on\-chip debugging, in\-system programming and boundary\-scan testing tool for ARM and MIPS systems @@ -69,9 +69,7 @@ Show a help text and exit. .B "\-v, \-\-version" Show version information and exit. .SH "BUGS" -Please report any bugs at -.B http://developer.berlios.de/bugs/?group_id=4148 -or on the mailing list +Please report any bugs on the mailing list at .BR openocd\-de...@li... . .SH "LICENCE" .B OpenOCD commit cfc02ccca25b7883ad761123faf207df0df4ad06 Author: Uwe Hermann <uw...@he...> Date: Tue Nov 24 20:28:21 2009 +0100 fix typos in documentation Fixes some minor typos in the top-level documentation files. Signed-off-by: Zachary T Welch <zw...@su...> diff --git a/BUGS b/BUGS index 0cb99ae..6967525 100644 --- a/BUGS +++ b/BUGS @@ -1,4 +1,4 @@ -// This file is part of the Doyxgen Developer Manual +// This file is part of the Doxygen Developer Manual /** @page bugs Bug Reporting Please report bugs by subscribing to the OpenOCD mailing list and diff --git a/ChangeLog b/ChangeLog index d80c896..a8df5d0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1 +1 @@ -Retired in favour of SVN log. +Retired in favor of git log. diff --git a/PATCHES b/PATCHES index 32f1bda..74a76fd 100644 --- a/PATCHES +++ b/PATCHES @@ -1,4 +1,4 @@ -// This file is part of the Doyxgen Developer Manual +// This file is part of the Doxygen Developer Manual /** @page patchguide Patch Guidelines Please mail patches to: @par diff --git a/README b/README index 0ba6f76..35118da 100644 --- a/README +++ b/README @@ -338,7 +338,7 @@ all operating systems used with OpenOCD. You may, however, build such copies for personal use. The FTDICHIP drivers come as either a (win32) ZIP file, or a (Linux) -TAR.GZ file. You must unpack them ``some where'' convient. As of this +TAR.GZ file. You must unpack them ``some where'' convenient. As of this writing FTDICHIP does not supply means to install these files "in an appropriate place." @@ -404,7 +404,7 @@ Then you can update that at your convenience using git pull There is also a gitweb interface, which you can use either to browse -the repository or to downlad arbitrary snapshots using HTTP: +the repository or to download arbitrary snapshots using HTTP: http://openocd.git.sourceforge.net/git/gitweb.cgi?p=openocd/openocd http://repo.or.cz/w/openocd.git diff --git a/TODO b/TODO index da5cf52..a9e95f6 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,4 @@ -// This file is part of the Doyxgen Developer Manual +// This file is part of the Doxygen Developer Manual /** @page tasks Pending and Open Tasks This page lists pending and open tasks being considered or worked upon @@ -46,7 +46,7 @@ This section list issues that need to be resolved in the JTAG layer. The following tasks have been suggested for cleaning up the JTAG layer: - use tap_set_state everywhere to allow logging TAP state transitions -- Encapsulate cmd_queue_cur_state and related varaible handling. +- Encapsulate cmd_queue_cur_state and related variable handling. - add slick 32 bit versions of jtag_add_xxx_scan() that avoids buf_set_u32() calls and other evidence of poor impedance match between API and calling code. New API should cut down # of lines in calling @@ -85,7 +85,7 @@ There are some known bugs to fix in JTAG adapter drivers: Workaround: use "tms_sequence long" @par https://lists.berlios.de/pipermail/openocd-development/2009-July/009426.html -The following tasks have been suggeted for improving OpenOCD's JTAG +The following tasks have been suggested for improving OpenOCD's JTAG interface support: - rework USB communication to be more robust. Two possible options are: @@ -290,11 +290,11 @@ These ideas were first introduced here: @par - automatically detect the features that are available, unless options were specifically provided to configure - provide a report of the drivers that will be build at the end of - running configure, so the users can verify which driverswill be + running configure, so the users can verify which drivers will be built during 'make' (and their options) . - eliminate sources of confusion in @c bootstrap script: -# Make @c bootstrap call 'configure --enable-maintainer-mode \<opts\>'? - -# Add @c buildstrap script to assist with boostrap and configure steps. + -# Add @c buildstrap script to assist with bootstrap and configure steps. - automatically build tool-chains required for cross-compiling - produce mingw32, arm-elf, others using in-tree scripts - build all required target code from sources @@ -348,7 +348,7 @@ to complete: - reviewing patches - committing to Subversion - Review The Guide for OpenOCD Users for documentation errors or omissions -- Update The Manual for OpenOCD Developerrs: +- Update The Manual for OpenOCD Developers: - Add documentation describing the architecture of each module - Provide more Technical Primers to bootstrap contributor knowledge commit 1240ae459f170db8a641b4bcd5635ba9f9199aec Author: Uwe Hermann <uw...@he...> Date: Tue Nov 24 20:01:15 2009 +0100 fix typos in source files Correct some spelling errors in source comments and printed output. Signed-off-by: Zachary T Welch <zw...@su...> diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c index bd1d047..3c099fa 100644 --- a/src/server/gdb_server.c +++ b/src/server/gdb_server.c @@ -53,7 +53,7 @@ static const char *DIGITS = "0123456789abcdef"; static void gdb_log_callback(void *priv, const char *file, unsigned line, const char *function, const char *string); -/* number of gdb connections, mainly to supress gdb related debugging spam +/* number of gdb connections, mainly to suppress gdb related debugging spam * in helper/log.c when no gdb connections are actually active */ int gdb_actual_connections; @@ -568,7 +568,7 @@ int gdb_get_packet_inner(struct connection *connection, char *buffer, int *len) break; case '+': /* gdb sends a dummy ack '+' at every remote connect - see remote_start_remote (remote.c) - * incase anyone tries to debug why they receive this warning every time */ + * in case anyone tries to debug why they receive this warning every time */ LOG_WARNING("acknowledgment received, but no packet pending"); break; case '-': @@ -859,7 +859,7 @@ static int gdb_reg_pos(struct target *target, int pos, int len) * register might be non-divisible by 8(a byte), in which * case an entire byte is shown. * - * NB! the format on the wire is the target endianess + * NB! the format on the wire is the target endianness * * The format of reg->value is little endian * @@ -2141,7 +2141,7 @@ int gdb_input_inner(struct connection *connection) target_name(target)); break; default: - /* ignore unkown packets */ + /* ignore unknown packets */ LOG_DEBUG("ignoring 0x%2.2x packet", packet[0]); gdb_put_packet(connection, NULL, 0); break; @@ -2320,7 +2320,7 @@ COMMAND_HANDLER(handle_gdb_breakpoint_override_command) LOG_USER("force %s breakpoints", (gdb_breakpoint_override_type == BKPT_HARD)?"hard":"soft"); } else { - LOG_USER("breakpoint type is not overriden"); + LOG_USER("breakpoint type is not overridden"); } return ERROR_OK; diff --git a/src/server/httpd.c b/src/server/httpd.c index 8c1d3db..9fa5879 100644 --- a/src/server/httpd.c +++ b/src/server/httpd.c @@ -207,7 +207,7 @@ static void request_completed(void *cls, struct MHD_Connection *connection, *con_cls = NULL; } -/* append to said key in dictonary */ +/* append to said key in dictionary */ static void append_key(struct httpd_request *r, const char *key, const char *data, size_t off, size_t size) { @@ -388,7 +388,7 @@ static int ahc_echo_inner(void * cls, struct MHD_Connection * connection, r->post = post; Jim_SetVariableStr(interp, "httppostdata", Jim_NewDictObj(interp, NULL, 0)); - /* fill in url query strings in dictonary */ + /* fill in url query strings in dictionary */ MHD_get_connection_values(connection, MHD_GET_ARGUMENT_KIND, record_arg, r); diff --git a/src/server/server.c b/src/server/server.c index 50bc00e..3ba433e 100644 --- a/src/server/server.c +++ b/src/server/server.c @@ -309,7 +309,7 @@ int server_loop(struct command_context *command_context) while (!shutdown_openocd) { - /* monitor sockets for acitvity */ + /* monitor sockets for activity */ fd_max = 0; FD_ZERO(&read_fds); ----------------------------------------------------------------------- Summary of changes: BUGS | 2 +- ChangeLog | 2 +- PATCHES | 2 +- README | 4 ++-- TODO | 12 ++++++------ doc/openocd.1 | 6 ++---- src/server/gdb_server.c | 10 +++++----- src/server/httpd.c | 4 ++-- src/server/server.c | 2 +- 9 files changed, 21 insertions(+), 23 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Øyvind H. <go...@us...> - 2009-11-26 17:36: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 060980357df2f71b8d18eb6a86a8c9878a8b417e (commit) from 3f8aa3cb035a97988fd38dfb08db5a4224f4b591 (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 060980357df2f71b8d18eb6a86a8c9878a8b417e Author: Ãyvind Harboe <oyv...@zy...> Date: Tue Nov 24 20:26:40 2009 +0100 styleguide: add some embedded style rules. Embedded and pthreads rely on modest and predictable stack usage. Signed-off-by: Ãyvind Harboe <oyv...@zy...> diff --git a/doc/manual/style.txt b/doc/manual/style.txt index b4d0216..71bb5f6 100644 --- a/doc/manual/style.txt +++ b/doc/manual/style.txt @@ -80,6 +80,9 @@ Finally, try to avoid lines of code that are longer than than 72-80 columns: - designated initializers (@{ .field = value @}) - variables declarations should occur at the point of first use - new block scopes for selection and iteration statements +- use malloc() to create dynamic arrays. Do @b not use @c alloca +or variable length arrays on the stack. non-MMU hosts(uClinux) and +pthreads require modest and predictable stack usage. @section styletypes Type Guidelines - use native types (@c int or @c unsigned) if the type is not important ----------------------------------------------------------------------- Summary of changes: doc/manual/style.txt | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: Zach W. <zw...@us...> - 2009-11-26 16:59:23
|
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 3f8aa3cb035a97988fd38dfb08db5a4224f4b591 (commit) from 2653b8030722c85393974cd6c0ebcdbd1ae27c72 (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 3f8aa3cb035a97988fd38dfb08db5a4224f4b591 Author: Eric Wetzel <the...@gm...> Date: Thu Nov 26 07:54:45 2009 -0800 fix 'flash protect' and 'flash erase_sector' Command upgrading introduced two off-by-one bugs in the flash commands. This patch fixes the 'flash {protect,erase_sector}' commands to check that they have been passed the correct number of arguments. Ammended during commit to fix help text for 'erase_address' too. diff --git a/src/flash/flash.c b/src/flash/flash.c index bbdbaa8..7023ef9 100644 --- a/src/flash/flash.c +++ b/src/flash/flash.c @@ -559,7 +559,7 @@ static int flash_check_sector_parameters(struct command_context *cmd_ctx, COMMAND_HANDLER(handle_flash_erase_command) { - if (CMD_ARGC != 2) + if (CMD_ARGC != 3) return ERROR_COMMAND_SYNTAX_ERROR; uint32_t bank_nr; @@ -599,7 +599,7 @@ COMMAND_HANDLER(handle_flash_erase_command) COMMAND_HANDLER(handle_flash_protect_command) { - if (CMD_ARGC != 3) + if (CMD_ARGC != 4) return ERROR_COMMAND_SYNTAX_ERROR; uint32_t bank_nr; @@ -1316,7 +1316,7 @@ static const struct command_registration flash_exec_command_handlers[] = { .name = "erase_address", .handler = &handle_flash_erase_address_command, .mode = COMMAND_EXEC, - .usage = "<bank> <address> <length>", + .usage = "<address> <length>", .help = "erase address range", }, ----------------------------------------------------------------------- Summary of changes: src/flash/flash.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: David B. <dbr...@us...> - 2009-11-26 01:38:43
|
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 2653b8030722c85393974cd6c0ebcdbd1ae27c72 (commit) via b715a81f5b95144118d8f946d4191f1dc844783a (commit) via ac06d41fc723c264e989673be16f9f21a1896518 (commit) via cc53ad81d3f7598eb06c216218734342d2d8e7e9 (commit) via 21378f58b604453262ac6f3cbf3d6b94b50251cf (commit) via 5d244b85e25e97768e66ec86f23ca58f6ab6c08b (commit) via 83568b6b62b3508f10aa3a51fe4ae86421ec5d27 (commit) from 49036463dbebcd4c5722f89b86dc6cec777bab0f (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 2653b8030722c85393974cd6c0ebcdbd1ae27c72 Author: David Brownell <dbr...@us...> Date: Wed Nov 25 16:38:08 2009 -0800 target: create and use target_name() Several of the sites now using target_type_name() really ought to be using an instance-specific name. Create a function called target_name(), accessing the instance's own (command) name. Use it in several places that really should be displaying instance-specific names. Also in several places which were already doing so, but which had no wrapper to call. Signed-off-by: David Brownell <dbr...@us...> diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c index f733e7b..bd1d047 100644 --- a/src/server/gdb_server.c +++ b/src/server/gdb_server.c @@ -774,7 +774,7 @@ int gdb_new_connection(struct connection *connection) gdb_actual_connections++; LOG_DEBUG("New GDB Connection: %d, Target %s, state: %s", gdb_actual_connections, - gdb_service->target->cmd_name, + target_name(gdb_service->target), target_state_name(gdb_service->target)); return ERROR_OK; @@ -792,7 +792,7 @@ int gdb_connection_closed(struct connection *connection) gdb_actual_connections--; LOG_DEBUG("GDB Close, Target: %s, state: %s, gdb_actual_connections=%d", - gdb_service->target->cmd_name, + target_name(gdb_service->target), target_state_name(gdb_service->target), gdb_actual_connections); @@ -2138,7 +2138,7 @@ int gdb_input_inner(struct connection *connection) watchpoint_clear_target(gdb_service->target); command_run_linef(connection->cmd_ctx, "ocd_gdb_restart %s", - target->cmd_name); + target_name(target)); break; default: /* ignore unkown packets */ @@ -2216,7 +2216,7 @@ int gdb_init(void) add_service("gdb", CONNECTION_PIPE, 0, 1, gdb_new_connection, gdb_input, gdb_connection_closed, gdb_service); LOG_DEBUG("gdb service for target %s using pipes", - target_type_name(target)); + target_name(target)); } else { @@ -2233,7 +2233,7 @@ int gdb_init(void) gdb_connection_closed, gdb_service); LOG_DEBUG("gdb service for target %s at TCP port %i", - target_type_name(target), + target_name(target), port); target = target->next; port++; diff --git a/src/target/breakpoints.c b/src/target/breakpoints.c index df797e3..16ab7e0 100644 --- a/src/target/breakpoints.c +++ b/src/target/breakpoints.c @@ -157,7 +157,7 @@ void breakpoint_clear_target(struct target *target) struct breakpoint *breakpoint; LOG_DEBUG("Delete all breakpoints for target: %s", - target_type_name(target)); + target_name(target)); while ((breakpoint = target->breakpoints) != NULL) { breakpoint_free(target, breakpoint); @@ -294,7 +294,7 @@ void watchpoint_clear_target(struct target *target) struct watchpoint *watchpoint; LOG_DEBUG("Delete all watchpoints for target: %s", - target_type_name(target)); + target_name(target)); while ((watchpoint = target->watchpoints) != NULL) { watchpoint_free(target, watchpoint); diff --git a/src/target/etm.c b/src/target/etm.c index 2ea7345..520e22f 100644 --- a/src/target/etm.c +++ b/src/target/etm.c @@ -1374,7 +1374,8 @@ COMMAND_HANDLER(handle_etm_config_command) arm = target_to_arm(target); if (!is_arm(arm)) { command_print(CMD_CTX, "target '%s' is '%s'; not an ARM", - target->cmd_name, target_type_name(target)); + target_name(target), + target_type_name(target)); return ERROR_FAIL; } diff --git a/src/target/target.c b/src/target/target.c index f46fc67..3de9f2c 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -556,7 +556,7 @@ static int target_soft_reset_halt_imp(struct target *target) } if (!target->type->soft_reset_halt_imp) { LOG_ERROR("Target %s does not support soft_reset_halt", - target->cmd_name); + target_name(target)); return ERROR_FAIL; } return target->type->soft_reset_halt_imp(target); @@ -766,7 +766,7 @@ int target_init(struct command_context *cmd_ctx) if ((retval = target->type->init_target(cmd_ctx, target)) != ERROR_OK) { - LOG_ERROR("target '%s' init failed", target_type_name(target)); + LOG_ERROR("target '%s' init failed", target_name(target)); return retval; } @@ -1697,7 +1697,7 @@ DumpTargets: command_print(CMD_CTX, "%2d%c %-18s %-10s %-6s %-18s %s", target->target_number, marker, - target->cmd_name, + target_name(target), target_type_name(target), Jim_Nvp_value2name_simple(nvp_target_endian, target->endianness)->name, @@ -3510,7 +3510,7 @@ void target_handle_event(struct target *target, enum target_event e) if (teap->event == e) { LOG_DEBUG("target: (%d) %s (%s) event: %d (%s) action: %s", target->target_number, - target->cmd_name, + target_name(target), target_type_name(target), e, Jim_Nvp_value2name_simple(nvp_target_event, e)->name, @@ -4139,7 +4139,7 @@ static int tcl_target_func(Jim_Interp *interp, int argc, Jim_Obj *const *argv) || !target->type->deassert_reset) { Jim_SetResult_sprintf(interp, "No target-specific reset for %s", - target->cmd_name); + target_name(target)); return JIM_ERR; } /* determine if we should halt or not. */ @@ -4183,10 +4183,9 @@ static int tcl_target_func(Jim_Interp *interp, int argc, Jim_Obj *const *argv) e = target_wait_state(target, n->value, a); if (e != ERROR_OK) { Jim_SetResult_sprintf(goi.interp, - "target: %s wait %s fails (%d) %s", - target->cmd_name, - n->name, - e, target_strerror_safe(e)); + "target: %s wait %s fails (%d) %s", + target_name(target), n->name, + e, target_strerror_safe(e)); return JIM_ERR; } else { return JIM_OK; @@ -4198,9 +4197,10 @@ static int tcl_target_func(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { struct target_event_action *teap; teap = target->event_action; - command_print(cmd_ctx, "Event actions for target (%d) %s\n", - target->target_number, - target->cmd_name); + command_print(cmd_ctx, + "Event actions for target (%d) %s\n", + target->target_number, + target_name(target)); command_print(cmd_ctx, "%-25s | Body", "Event"); command_print(cmd_ctx, "------------------------- | ----------------------------------------"); while (teap) { @@ -4450,7 +4450,9 @@ static int jim_target(Jim_Interp *interp, int argc, Jim_Obj *const *argv) Jim_WrongNumArgs(goi.interp, 1, goi.argv, "Too many parameters"); return JIM_ERR; } - Jim_SetResultString(goi.interp, get_current_target(cmd_ctx)->cmd_name, -1); + Jim_SetResultString(goi.interp, + target_name(get_current_target(cmd_ctx)), + -1); return JIM_OK; case TG_CMD_TYPES: if (goi.argc != 0) { @@ -4473,8 +4475,9 @@ static int jim_target(Jim_Interp *interp, int argc, Jim_Obj *const *argv) target = all_targets; while (target) { Jim_ListAppendElement(goi.interp, - Jim_GetResult(goi.interp), - Jim_NewStringObj(goi.interp, target->cmd_name, -1)); + Jim_GetResult(goi.interp), + Jim_NewStringObj(goi.interp, + target_name(target), -1)); target = target->next; } return JIM_OK; @@ -4505,7 +4508,7 @@ static int jim_target(Jim_Interp *interp, int argc, Jim_Obj *const *argv) "Target: number %d does not exist", (int)(w)); return JIM_ERR; } - Jim_SetResultString(goi.interp, target->cmd_name, -1); + Jim_SetResultString(goi.interp, target_name(target), -1); return JIM_OK; case TG_CMD_COUNT: if (goi.argc != 0) { diff --git a/src/target/target.h b/src/target/target.h index 61bc68a..15003c6 100644 --- a/src/target/target.h +++ b/src/target/target.h @@ -159,6 +159,12 @@ struct target long long halt_issued_time; /* Note time when halt was issued */ }; +/** Returns the instance-specific name of the specified target. */ +static inline const char *target_name(struct target *target) +{ + return target->cmd_name; +} + enum target_event { /* LD historical names commit b715a81f5b95144118d8f946d4191f1dc844783a Author: David Brownell <dbr...@us...> Date: Wed Nov 25 16:38:08 2009 -0800 target: target_get_name() --> target_type_name() There are two names that may matter on a per-target basis. One is a per-instance name (for example, "at91sam7s.cpu"). The other is the name of its type (for example, "arm7tdmi"), which is shared among multiple targets. Currently target_get_name() returns the type name, which is misleading and is rarely appropriate for target diagnostics. Rename that as target_type_name(). Signed-off-by: David Brownell <dbr...@us...> diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c index cb14cc3..f733e7b 100644 --- a/src/server/gdb_server.c +++ b/src/server/gdb_server.c @@ -2216,7 +2216,7 @@ int gdb_init(void) add_service("gdb", CONNECTION_PIPE, 0, 1, gdb_new_connection, gdb_input, gdb_connection_closed, gdb_service); LOG_DEBUG("gdb service for target %s using pipes", - target_get_name(target)); + target_type_name(target)); } else { @@ -2233,7 +2233,7 @@ int gdb_init(void) gdb_connection_closed, gdb_service); LOG_DEBUG("gdb service for target %s at TCP port %i", - target_get_name(target), + target_type_name(target), port); target = target->next; port++; diff --git a/src/target/breakpoints.c b/src/target/breakpoints.c index 3ab1464..df797e3 100644 --- a/src/target/breakpoints.c +++ b/src/target/breakpoints.c @@ -155,7 +155,9 @@ void breakpoint_remove(struct target *target, uint32_t address) void breakpoint_clear_target(struct target *target) { struct breakpoint *breakpoint; - LOG_DEBUG("Delete all breakpoints for target: %s", target_get_name( target )); + + LOG_DEBUG("Delete all breakpoints for target: %s", + target_type_name(target)); while ((breakpoint = target->breakpoints) != NULL) { breakpoint_free(target, breakpoint); @@ -290,7 +292,9 @@ void watchpoint_remove(struct target *target, uint32_t address) void watchpoint_clear_target(struct target *target) { struct watchpoint *watchpoint; - LOG_DEBUG("Delete all watchpoints for target: %s", target_get_name( target )); + + LOG_DEBUG("Delete all watchpoints for target: %s", + target_type_name(target)); while ((watchpoint = target->watchpoints) != NULL) { watchpoint_free(target, watchpoint); diff --git a/src/target/embeddedice.c b/src/target/embeddedice.c index 3947e26..cca9cc0 100644 --- a/src/target/embeddedice.c +++ b/src/target/embeddedice.c @@ -281,8 +281,8 @@ embeddedice_build_reg_cache(struct target *target, struct arm7_9_common *arm7_9) * in some unusual bits. Let feroceon.c validate it * and do the appropriate setup itself. */ - if (strcmp(target_get_name(target), "feroceon") == 0 || - strcmp(target_get_name(target), "dragonite") == 0) + if (strcmp(target_type_name(target), "feroceon") == 0 || + strcmp(target_type_name(target), "dragonite") == 0) break; LOG_ERROR("unknown EmbeddedICE version " "(comms ctrl: 0x%8.8" PRIx32 ")", diff --git a/src/target/etm.c b/src/target/etm.c index 4e7f917..2ea7345 100644 --- a/src/target/etm.c +++ b/src/target/etm.c @@ -1374,7 +1374,7 @@ COMMAND_HANDLER(handle_etm_config_command) arm = target_to_arm(target); if (!is_arm(arm)) { command_print(CMD_CTX, "target '%s' is '%s'; not an ARM", - target->cmd_name, target_get_name(target)); + target->cmd_name, target_type_name(target)); return ERROR_FAIL; } diff --git a/src/target/target.c b/src/target/target.c index 97a93c0..f46fc67 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -522,7 +522,7 @@ int target_examine(void) } return retval; } -const char *target_get_name(struct target *target) +const char *target_type_name(struct target *target) { return target->type->name; } @@ -766,7 +766,7 @@ int target_init(struct command_context *cmd_ctx) if ((retval = target->type->init_target(cmd_ctx, target)) != ERROR_OK) { - LOG_ERROR("target '%s' init failed", target_get_name(target)); + LOG_ERROR("target '%s' init failed", target_type_name(target)); return retval; } @@ -1698,7 +1698,7 @@ DumpTargets: target->target_number, marker, target->cmd_name, - target_get_name(target), + target_type_name(target), Jim_Nvp_value2name_simple(nvp_target_endian, target->endianness)->name, target->tap->dotted_name, @@ -3511,7 +3511,7 @@ void target_handle_event(struct target *target, enum target_event e) LOG_DEBUG("target: (%d) %s (%s) event: %d (%s) action: %s", target->target_number, target->cmd_name, - target_get_name(target), + target_type_name(target), e, Jim_Nvp_value2name_simple(nvp_target_event, e)->name, Jim_GetString(teap->body, NULL)); @@ -3585,16 +3585,20 @@ static int target_configure(Jim_GetOptInfo *goi, struct target *target) case TCFG_TYPE: /* not setable */ if (goi->isconfigure) { - Jim_SetResult_sprintf(goi->interp, "not setable: %s", n->name); + Jim_SetResult_sprintf(goi->interp, + "not settable: %s", n->name); return JIM_ERR; } else { no_params: if (goi->argc != 0) { - Jim_WrongNumArgs(goi->interp, goi->argc, goi->argv, "NO PARAMS"); + Jim_WrongNumArgs(goi->interp, + goi->argc, goi->argv, + "NO PARAMS"); return JIM_ERR; } } - Jim_SetResultString(goi->interp, target_get_name(target), -1); + Jim_SetResultString(goi->interp, + target_type_name(target), -1); /* loop for more */ break; case TCFG_EVENT: diff --git a/src/target/target.h b/src/target/target.h index ee40209..61bc68a 100644 --- a/src/target/target.h +++ b/src/target/target.h @@ -280,11 +280,12 @@ struct target* get_current_target(struct command_context *cmd_ctx); struct target *get_target(const char *id); /** - * Get the target name. + * Get the target type name. * * This routine is a wrapper for the target->type->name field. + * Note that this is not an instance-specific name for his target. */ -const char *target_get_name(struct target *target); +const char *target_type_name(struct target *target); /** * Examine the specified @a target, letting it perform any diff --git a/src/target/target_type.h b/src/target/target_type.h index 9a0709d..333b58b 100644 --- a/src/target/target_type.h +++ b/src/target/target_type.h @@ -39,7 +39,7 @@ struct target_type { /** * Name of this type of target. Do @b not access this - * field directly, use target_get_name() instead. + * field directly, use target_type_name() instead. */ char *name; commit ac06d41fc723c264e989673be16f9f21a1896518 Author: David Brownell <dbr...@us...> Date: Wed Nov 25 16:19:53 2009 -0800 omap3530.cfg: yes we have SRAM! Signed-off-by: David Brownell <dbr...@us...> diff --git a/tcl/target/omap3530.cfg b/tcl/target/omap3530.cfg index 45f3c01..0a83423 100644 --- a/tcl/target/omap3530.cfg +++ b/tcl/target/omap3530.cfg @@ -38,6 +38,9 @@ jtag newtap $_CHIPNAME jrc -irlen 6 -ircapture 0x1 -irmask 0x3f \ set _TARGETNAME $_CHIPNAME.cpu target create $_TARGETNAME cortex_a8 -chain-position $_CHIPNAME.dap +# SRAM: 64K at 0x4020.0000; use the first 16K +$_TARGETNAME configure -work-area-phys 0x40200000 -work-area-size 0x4000 + ################### # the reset sequence is event-driven commit cc53ad81d3f7598eb06c216218734342d2d8e7e9 Author: David Brownell <dbr...@us...> Date: Wed Nov 25 16:18:22 2009 -0800 ARM: minor armv4/armv5 cleanup Lines of 300+ characters are still bad; debug tweaks. Signed-off-by: David Brownell <dbr...@us...> diff --git a/src/target/armv4_5.c b/src/target/armv4_5.c index 7e5bb0a..b5e33ff 100644 --- a/src/target/armv4_5.c +++ b/src/target/armv4_5.c @@ -390,6 +390,10 @@ void arm_set_cpsr(struct arm *arm, uint32_t cpsr) state = ARMV4_5_STATE_ARM; } arm->core_state = state; + + LOG_DEBUG("set CPSR %#8.8x: %s mode, %s state", (unsigned) cpsr, + arm_mode_name(mode), + armv4_5_state_strings[arm->core_state]); } /** @@ -875,7 +879,13 @@ static int armv4_5_run_algorithm_completion(struct target *target, uint32_t exit return ERROR_OK; } -int armv4_5_run_algorithm_inner(struct target *target, int num_mem_params, struct mem_param *mem_params, int num_reg_params, struct reg_param *reg_params, uint32_t entry_point, uint32_t exit_point, int timeout_ms, void *arch_info, int (*run_it)(struct target *target, uint32_t exit_point, int timeout_ms, void *arch_info)) +int armv4_5_run_algorithm_inner(struct target *target, + int num_mem_params, struct mem_param *mem_params, + int num_reg_params, struct reg_param *reg_params, + uint32_t entry_point, uint32_t exit_point, + int timeout_ms, void *arch_info, + int (*run_it)(struct target *target, uint32_t exit_point, + int timeout_ms, void *arch_info)) { struct arm *armv4_5 = target_to_armv4_5(target); struct armv4_5_algorithm *armv4_5_algorithm_info = arch_info; @@ -885,6 +895,7 @@ int armv4_5_run_algorithm_inner(struct target *target, int num_mem_params, struc int exit_breakpoint_size = 0; int i; int retval = ERROR_OK; + LOG_DEBUG("Running algorithm"); if (armv4_5_algorithm_info->common_magic != ARMV4_5_COMMON_MAGIC) commit 21378f58b604453262ac6f3cbf3d6b94b50251cf Author: David Brownell <dbr...@us...> Date: Wed Nov 25 16:14:45 2009 -0800 ARM: comment tweaks in ADIv5 "OptimoDE DESS" is ARM's semicustom DSPish stuff. Signed-off-by: David Brownell <dbr...@us...> diff --git a/src/target/arm_adi_v5.c b/src/target/arm_adi_v5.c index 3d0b8f8..72408e1 100644 --- a/src/target/arm_adi_v5.c +++ b/src/target/arm_adi_v5.c @@ -1007,12 +1007,15 @@ int ahbap_debugport_init(struct swjdp_common *swjdp) return ERROR_OK; } -/* CID interpretation -- see ARM IHI 0029B section 3 */ +/* CID interpretation -- see ARM IHI 0029B section 3 + * and ARM IHI 0031A table 13-3. + */ static const char *class_description[16] ={ "Reserved", "ROM table", "Reserved", "Reserved", "Reserved", "Reserved", "Reserved", "Reserved", "Reserved", "CoreSight component", "Reserved", "Peripheral Test Block", - "Reserved", "DESS", "Generic IP component", "PrimeCell or System component" + "Reserved", "OptimoDE DESS", + "Generic IP component", "PrimeCell or System component" }; static bool commit 5d244b85e25e97768e66ec86f23ca58f6ab6c08b Author: David Brownell <dbr...@us...> Date: Wed Nov 25 16:11:26 2009 -0800 ARM7/9: shrink run_algorithm_inner() lines 300+ characters is unreasonable. So is half that. Signed-off-by: David Brownell <dbr...@us...> diff --git a/src/target/arm7_9_common.c b/src/target/arm7_9_common.c index c4775e8..f7b8669 100644 --- a/src/target/arm7_9_common.c +++ b/src/target/arm7_9_common.c @@ -2659,7 +2659,13 @@ static const uint32_t dcc_code[] = 0xeafffff9 /* b w */ }; -int armv4_5_run_algorithm_inner(struct target *target, int num_mem_params, struct mem_param *mem_params, int num_reg_params, struct reg_param *reg_params, uint32_t entry_point, uint32_t exit_point, int timeout_ms, void *arch_info, int (*run_it)(struct target *target, uint32_t exit_point, int timeout_ms, void *arch_info)); +extern int armv4_5_run_algorithm_inner(struct target *target, + int num_mem_params, struct mem_param *mem_params, + int num_reg_params, struct reg_param *reg_params, + uint32_t entry_point, uint32_t exit_point, + int timeout_ms, void *arch_info, + int (*run_it)(struct target *target, uint32_t exit_point, + int timeout_ms, void *arch_info)); int arm7_9_bulk_write_memory(struct target *target, uint32_t address, uint32_t count, uint8_t *buffer) { @@ -2709,7 +2715,9 @@ int arm7_9_bulk_write_memory(struct target *target, uint32_t address, uint32_t c dcc_count = count; dcc_buffer = buffer; retval = armv4_5_run_algorithm_inner(target, 0, NULL, 1, reg_params, - arm7_9->dcc_working_area->address, arm7_9->dcc_working_area->address + 6*4, 20*1000, &armv4_5_info, arm7_9_dcc_completion); + arm7_9->dcc_working_area->address, + arm7_9->dcc_working_area->address + 6*4, + 20*1000, &armv4_5_info, arm7_9_dcc_completion); if (retval == ERROR_OK) { commit 83568b6b62b3508f10aa3a51fe4ae86421ec5d27 Author: David Brownell <dbr...@us...> Date: Wed Nov 25 16:05:35 2009 -0800 NEWS updates Signed-off-by: David Brownell <dbr...@us...> diff --git a/NEWS b/NEWS index a0bf43c..c5811bc 100644 --- a/NEWS +++ b/NEWS @@ -10,10 +10,20 @@ Boundary Scan: Target Layer: ARM - renamed "armv4_5" command prefix as "arm" + - recognize TrustZone "Secure Monitor" mode + - "arm regs" command output changed + - register names use "sp" not "r13" ARM11 - Preliminary ETM and ETB hookup - accelerated "flash erase_check" - accelerated GDB memory checksum + - support "arm regs" command + - can access all core modes and registers + Cortex-A8 + - support "arm regs" command + - can access all core modes and registers + Cortex-M3 + - Exposed DWT registers like cycle counter Flash Layer: 'flash bank' and 'nand device' take <bank_name> as first argument. ----------------------------------------------------------------------- Summary of changes: NEWS | 10 ++++++++ src/server/gdb_server.c | 10 ++++---- src/target/arm7_9_common.c | 12 ++++++++- src/target/arm_adi_v5.c | 7 ++++- src/target/armv4_5.c | 13 ++++++++++- src/target/breakpoints.c | 8 +++++- src/target/embeddedice.c | 4 +- src/target/etm.c | 3 +- src/target/target.c | 51 +++++++++++++++++++++++++------------------- src/target/target.h | 11 +++++++- src/target/target_type.h | 2 +- tcl/target/omap3530.cfg | 3 ++ 12 files changed, 94 insertions(+), 40 deletions(-) hooks/post-receive -- Main OpenOCD repository |