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: OpenOCD-Gerrit <ope...@us...> - 2020-06-14 13:25:42
|
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 b7d41ef96aaf371e71cb58f5fa7104f4a201ea27 (commit) from bd6072072eabf3b0ad61ee63c78ccf53f49ab957 (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 b7d41ef96aaf371e71cb58f5fa7104f4a201ea27 Author: Marc Schink <de...@za...> Date: Fri May 15 10:06:07 2020 +0200 flash/nor/stm32l4x: Fix check for number of arguments The current version erroneously allows any number of arguments >= 1. Change-Id: I64156c11b48d411c72bebbf866954818cd036ff2 Signed-off-by: Marc Schink <de...@za...> Reviewed-on: http://openocd.zylin.com/5716 Tested-by: jenkins Reviewed-by: Tarek BOCHKATI <tar...@gm...> Reviewed-by: Antonio Borneo <bor...@gm...> diff --git a/src/flash/nor/stm32l4x.c b/src/flash/nor/stm32l4x.c index 38f8b3b99..94fcd3226 100644 --- a/src/flash/nor/stm32l4x.c +++ b/src/flash/nor/stm32l4x.c @@ -1238,7 +1238,7 @@ COMMAND_HANDLER(stm32l4_handle_option_write_command) COMMAND_HANDLER(stm32l4_handle_option_load_command) { - if (CMD_ARGC < 1) + if (CMD_ARGC != 1) return ERROR_COMMAND_SYNTAX_ERROR; struct flash_bank *bank; ----------------------------------------------------------------------- Summary of changes: src/flash/nor/stm32l4x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- Main OpenOCD repository |
From: OpenOCD-Gerrit <ope...@us...> - 2020-06-14 13:25:03
|
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 bd6072072eabf3b0ad61ee63c78ccf53f49ab957 (commit) via 9a690c6bdb18d722a99d5752ac9c3ae1733cf22e (commit) from 7e78c04f1c275176bdee8f9d2553300218164577 (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 bd6072072eabf3b0ad61ee63c78ccf53f49ab957 Author: Tarek BOCHKATI <tar...@gm...> Date: Mon Apr 27 13:09:27 2020 +0100 stlink: code factorization by introducing stlink_usb_exit_mode Change-Id: I4abd6432c4ef969e382bfed96cd19a49d9610000 Signed-off-by: Antonio Borneo <bor...@gm...> Signed-off-by: Tarek BOCHKATI <tar...@gm...> Reviewed-on: http://openocd.zylin.com/5612 Tested-by: jenkins diff --git a/src/jtag/drivers/stlink_usb.c b/src/jtag/drivers/stlink_usb.c index 3fdb126cf..72975d5ac 100644 --- a/src/jtag/drivers/stlink_usb.c +++ b/src/jtag/drivers/stlink_usb.c @@ -1303,12 +1303,11 @@ static enum stlink_mode stlink_get_mode(enum hl_transports t) } /** */ -static int stlink_usb_init_mode(void *handle, bool connect_under_reset, int initial_interface_speed) +static int stlink_usb_exit_mode(void *handle) { int res; uint8_t mode; enum stlink_mode emode; - struct stlink_usb_handle_s *h = handle; assert(handle != NULL); @@ -1337,12 +1336,25 @@ static int stlink_usb_init_mode(void *handle, bool connect_under_reset, int init break; } - if (emode != STLINK_MODE_UNKNOWN) { - res = stlink_usb_mode_leave(handle, emode); + if (emode != STLINK_MODE_UNKNOWN) + return stlink_usb_mode_leave(handle, emode); - if (res != ERROR_OK) - return res; - } + return ERROR_OK; +} + +/** */ +static int stlink_usb_init_mode(void *handle, bool connect_under_reset, int initial_interface_speed) +{ + int res; + uint8_t mode; + enum stlink_mode emode; + struct stlink_usb_handle_s *h = handle; + + assert(handle != NULL); + + res = stlink_usb_exit_mode(handle); + if (res != ERROR_OK) + return res; res = stlink_usb_current_mode(handle, &mode); @@ -2683,45 +2695,14 @@ static int stlink_speed(void *handle, int khz, bool query) /** */ static int stlink_usb_close(void *handle) { - int res; - uint8_t mode; - enum stlink_mode emode; struct stlink_usb_handle_s *h = handle; - if (h && h->fd) - res = stlink_usb_current_mode(handle, &mode); - else - res = ERROR_FAIL; - /* do not exit if return code != ERROR_OK, - it prevents us from closing jtag_libusb */ - - if (res == ERROR_OK) { - /* try to exit current mode */ - switch (mode) { - case STLINK_DEV_DFU_MODE: - emode = STLINK_MODE_DFU; - break; - case STLINK_DEV_DEBUG_MODE: - emode = STLINK_MODE_DEBUG_SWD; - break; - case STLINK_DEV_SWIM_MODE: - emode = STLINK_MODE_DEBUG_SWIM; - break; - case STLINK_DEV_BOOTLOADER_MODE: - case STLINK_DEV_MASS_MODE: - default: - emode = STLINK_MODE_UNKNOWN; - break; - } - - if (emode != STLINK_MODE_UNKNOWN) - stlink_usb_mode_leave(handle, emode); - /* do not check return code, it prevent - us from closing jtag_libusb */ - } - - if (h && h->fd) + if (h && h->fd) { + stlink_usb_exit_mode(h); + /* do not check return code, it prevent + us from closing jtag_libusb */ jtag_libusb_close(h->fd); + } free(h); commit 9a690c6bdb18d722a99d5752ac9c3ae1733cf22e Author: Tarek BOCHKATI <tar...@gm...> Date: Thu Apr 23 11:00:31 2020 +0100 openocd: fix issue in WIN32 with TCP adapters Issue: server_quit is called before adapter_quit: In WIN32 only in server_quit we do an WSACleanup, which terminates/closes all active sockets. So if the adapter is TCP based, the adapter.quit handler will fail if it will need to send some commands through TCP. Example: close_socket in jtag_vpi_quit will fail in WIN32 because the socket is already closed and the errno is set as "Bad File Descriptor" To fix that we introduced new functions called server_host_os_entry/quit to manage specific OS setup (hence WSA for sockets in WINDOWS) in order to delay WSACleanup after adapter_quit(). Change-Id: Ie4afacafe123857f6ae300e376bdfcf0d8c027ac Signed-off-by: Tarek BOCHKATI <tar...@gm...> Reviewed-on: http://openocd.zylin.com/5456 Tested-by: jenkins Reviewed-by: Antonio Borneo <bor...@gm...> diff --git a/src/openocd.c b/src/openocd.c index 2a9a0b3d4..886228425 100644 --- a/src/openocd.c +++ b/src/openocd.c @@ -345,6 +345,8 @@ int openocd_main(int argc, char *argv[]) command_context_mode(cmd_ctx, COMMAND_CONFIG); command_set_output_handler(cmd_ctx, configuration_output_handler, NULL); + server_host_os_entry(); + /* Start the executable meat that can evolve into thread in future. */ ret = openocd_thread(argc, argv, cmd_ctx); @@ -360,6 +362,8 @@ int openocd_main(int argc, char *argv[]) adapter_quit(); + server_host_os_close(); + /* Shutdown commandline interface */ command_exit(cmd_ctx); diff --git a/src/server/server.c b/src/server/server.c index 07b7ae487..23a15ef9a 100644 --- a/src/server/server.c +++ b/src/server/server.c @@ -631,7 +631,7 @@ static void sigkey_handler(int sig) #endif -int server_preinit(void) +int server_host_os_entry(void) { /* this currently only calls WSAStartup on native win32 systems * before any socket operations are performed. @@ -647,7 +647,21 @@ int server_preinit(void) LOG_ERROR("Failed to Open Winsock"); return ERROR_FAIL; } +#endif + return ERROR_OK; +} +int server_host_os_close(void) +{ +#ifdef _WIN32 + WSACleanup(); +#endif + return ERROR_OK; +} + +int server_preinit(void) +{ +#ifdef _WIN32 /* register ctrl-c handler */ SetConsoleCtrlHandler(ControlHandler, TRUE); @@ -688,7 +702,6 @@ int server_quit(void) target_quit(); #ifdef _WIN32 - WSACleanup(); SetConsoleCtrlHandler(ControlHandler, FALSE); return ERROR_OK; diff --git a/src/server/server.h b/src/server/server.h index ab9b72f90..f4cc39d3a 100644 --- a/src/server/server.h +++ b/src/server/server.h @@ -80,6 +80,9 @@ int add_service(char *name, const char *port, void *priv); int remove_service(const char *name, const char *port); +int server_host_os_entry(void); +int server_host_os_close(void); + int server_preinit(void); int server_init(struct command_context *cmd_ctx); int server_quit(void); ----------------------------------------------------------------------- Summary of changes: src/jtag/drivers/stlink_usb.c | 67 ++++++++++++++++--------------------------- src/openocd.c | 4 +++ src/server/server.c | 17 +++++++++-- src/server/server.h | 3 ++ 4 files changed, 46 insertions(+), 45 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: OpenOCD-Gerrit <ope...@us...> - 2020-06-14 13:24:15
|
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 7e78c04f1c275176bdee8f9d2553300218164577 (commit) via 4a5de86f5871a07c05d4d13f18a75ab4554d07cb (commit) from f0909fe9e5f819d83c90c2622e27d98fa1b59046 (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 7e78c04f1c275176bdee8f9d2553300218164577 Author: Alistair Francis <ali...@wd...> Date: Wed May 13 15:04:16 2020 -0700 board: Add the HiFive1 revB board configuration Change-Id: If186afcfd2c87414b9323569a16aed9a6054c883 Signed-off-by: Alistair Francis <ali...@wd...> Reviewed-on: http://openocd.zylin.com/5680 Tested-by: jenkins Reviewed-by: Antonio Borneo <bor...@gm...> Reviewed-by: Tim Newsome <ti...@si...> diff --git a/tcl/board/sifive-hifive1-revb.cfg b/tcl/board/sifive-hifive1-revb.cfg new file mode 100644 index 000000000..292f1027a --- /dev/null +++ b/tcl/board/sifive-hifive1-revb.cfg @@ -0,0 +1,21 @@ +adapter speed 4000 + +adapter driver jlink +transport select jtag + +set _CHIPNAME riscv +jtag newtap $_CHIPNAME cpu -irlen 5 -expected-id 0x20000913 + +set _TARGETNAME $_CHIPNAME.cpu +target create $_TARGETNAME.0 riscv -chain-position $_TARGETNAME +$_TARGETNAME.0 configure -work-area-phys 0x80000000 -work-area-size 0x4000 -work-area-backup 0 + +flash bank onboard_spi_flash fespi 0x20000000 0 0 0 $_TARGETNAME.0 + +init + +jlink jtag 3 + +halt +flash protect 0 1 last off +echo "Ready for Remote Connections" commit 4a5de86f5871a07c05d4d13f18a75ab4554d07cb Author: Alistair Francis <ali...@wd...> Date: Wed May 13 15:03:44 2020 -0700 flash: Add the Freedom E310-G002 SPI Flash Change-Id: Id9f4a209a6eacf186931b142e70a5b0458517be0 Signed-off-by: Alistair Francis <ali...@wd...> Reviewed-on: http://openocd.zylin.com/5679 Tested-by: jenkins Reviewed-by: Antonio Borneo <bor...@gm...> Reviewed-by: Tim Newsome <ti...@si...> diff --git a/src/flash/nor/fespi.c b/src/flash/nor/fespi.c index 90242b1ad..05489fdfb 100644 --- a/src/flash/nor/fespi.c +++ b/src/flash/nor/fespi.c @@ -136,7 +136,8 @@ struct fespi_target { /* TODO !!! What is the right naming convention here? */ static const struct fespi_target target_devices[] = { /* name, tap_idcode, ctrl_base */ - { "Freedom E300 SPI Flash", 0x10e31913 , 0x10014000 }, + { "Freedom E310-G000 SPI Flash", 0x10e31913 , 0x10014000 }, + { "Freedom E310-G002 SPI Flash", 0x20000913 , 0x10014000 }, { NULL, 0, 0 } }; ----------------------------------------------------------------------- Summary of changes: src/flash/nor/fespi.c | 3 ++- tcl/board/sifive-hifive1-revb.cfg | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 tcl/board/sifive-hifive1-revb.cfg hooks/post-receive -- Main OpenOCD repository |
From: OpenOCD-Gerrit <ope...@us...> - 2020-06-06 17:07:15
|
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 f0909fe9e5f819d83c90c2622e27d98fa1b59046 (commit) from bd425de3fbb9ba73d4e24573e2b2262ba1b8a3f5 (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 f0909fe9e5f819d83c90c2622e27d98fa1b59046 Author: Antonio Borneo <bor...@gm...> Date: Mon May 6 19:31:00 2019 +0200 coding style: fix multi-line dereferencing Issue identified by checkpatch script from Linux kernel v5.1 using the command find src/ -type f -exec ./tools/scripts/checkpatch.pl \ -q --types MULTILINE_DEREFERENCE -f {} \; Change-Id: Icba05613e22a72ecc3e6a0aad7cb6b479496146f Signed-off-by: Antonio Borneo <bor...@gm...> Reviewed-on: http://openocd.zylin.com/5629 Tested-by: jenkins Reviewed-by: Marc Schink <de...@za...> diff --git a/src/rtos/linux.c b/src/rtos/linux.c index e85a3bdf8..63659bb05 100644 --- a/src/rtos/linux.c +++ b/src/rtos/linux.c @@ -995,10 +995,8 @@ static int linux_task_update(struct target *target, int context) if (context) thread_list->context = cpu_context_read(target, - thread_list-> - base_addr, - &thread_list-> - thread_info_addr); + thread_list->base_addr, + &thread_list->thread_info_addr); } else { /* it is a current thread no need to read context */ } @@ -1190,9 +1188,8 @@ int linux_gdb_T_packet(struct connection *connection, } else { /* delete item in the list */ linux_os->thread_list = - liste_del_task(linux_os-> - thread_list, &temp, - prev); + liste_del_task(linux_os->thread_list, + &temp, prev); linux_os->thread_count--; gdb_put_packet(connection, "E01", 3); return ERROR_OK; @@ -1323,9 +1320,7 @@ static int linux_thread_packet(struct connection *connection, char const *packet if (strncmp(packet, "qSymbol", 7) == 0) { if (rtos_qsymbol(connection, packet, packet_size) == 1) { linux_compute_virt2phys(target, - target->rtos-> - symbols[INIT_TASK]. - address); + target->rtos->symbols[INIT_TASK].address); } break; @@ -1376,8 +1371,7 @@ static int linux_thread_packet(struct connection *connection, char const *packet } if ((ct != NULL) && (ct->threadid != - target->rtos-> - current_threadid) + target->rtos->current_threadid) && (target->rtos->current_threadid != -1)) LOG_WARNING("WARNING! current GDB thread do not match " "current thread running. " @@ -1410,8 +1404,7 @@ static int linux_os_smp_init(struct target *target) while (head != (struct target_list *)NULL) { if (head->target->rtos != rtos) { struct linux_os *smp_os_linux = - (struct linux_os *)head->target->rtos-> - rtos_specific_params; + (struct linux_os *)head->target->rtos->rtos_specific_params; /* remap smp target on rtos */ free(head->target->rtos); head->target->rtos = rtos; diff --git a/src/target/etm.c b/src/target/etm.c index 5218a9e48..5d079ffa8 100644 --- a/src/target/etm.c +++ b/src/target/etm.c @@ -1074,8 +1074,8 @@ static int etmv1_analyze_trace(struct etm_context *ctx, struct command_invocatio (instruction.type == ARM_STM)) { int i; for (i = 0; i < 16; i++) { - if (instruction.info.load_store_multiple. - register_list & (1 << i)) { + if (instruction.info.load_store_multiple.register_list + & (1 << i)) { uint32_t data; if (etmv1_data(ctx, 4, &data) != 0) return ERROR_ETM_ANALYSIS_FAILED; ----------------------------------------------------------------------- Summary of changes: src/rtos/linux.c | 21 +++++++-------------- src/target/etm.c | 4 ++-- 2 files changed, 9 insertions(+), 16 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: OpenOCD-Gerrit <ope...@us...> - 2020-06-06 17:06: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 bd425de3fbb9ba73d4e24573e2b2262ba1b8a3f5 (commit) via 6f88aa0fb3bb7a91b5327b75e8fb772ed6d3be2d (commit) from 061cae171c9d2b6015a565dcc748dd04319e08cf (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 bd425de3fbb9ba73d4e24573e2b2262ba1b8a3f5 Author: Antonio Borneo <bor...@gm...> Date: Thu May 21 16:03:17 2020 +0200 jtag/tcl: fix memory leak in command 'irscan' If the function parse_u64() fails, we jump to return, thus leaking the memory just allocated in 'v'. Issue identified by clang. Move earlier the call to parse_u64() and the associated test, before memory allocation. While there, fix a possible NULL pointer dereferencing in case the calloc() fails, by testing for allocation failure. Change-Id: I6a77ee17aceb282bbdfefe7cdafeba2e0e7012f1 Signed-off-by: Antonio Borneo <bor...@gm...> Reviewed-on: http://openocd.zylin.com/5692 Tested-by: jenkins Reviewed-by: Tarek BOCHKATI <tar...@gm...> diff --git a/src/jtag/tcl.c b/src/jtag/tcl.c index 01210bd69..d2f1f0db5 100644 --- a/src/jtag/tcl.c +++ b/src/jtag/tcl.c @@ -1129,14 +1129,19 @@ COMMAND_HANDLER(handle_irscan_command) return ERROR_FAIL; } - int field_size = tap->ir_length; - fields[i].num_bits = field_size; - uint8_t *v = calloc(1, DIV_ROUND_UP(field_size, 8)); - uint64_t value; retval = parse_u64(CMD_ARGV[i * 2 + 1], &value); if (ERROR_OK != retval) goto error_return; + + int field_size = tap->ir_length; + fields[i].num_bits = field_size; + uint8_t *v = calloc(1, DIV_ROUND_UP(field_size, 8)); + if (!v) { + LOG_ERROR("Out of memory"); + goto error_return; + } + buf_set_u64(v, 0, field_size, value); fields[i].out_value = v; fields[i].in_value = NULL; commit 6f88aa0fb3bb7a91b5327b75e8fb772ed6d3be2d Author: Antonio Borneo <bor...@gm...> Date: Fri May 22 18:55:34 2020 +0200 target/cortex_a: fix memory leak of register cache There is no method to free the register cache, allocated in armv4_5, so we get a memory leak. Issue identified by valgrind. Implement the method arm_free_reg_cache() and call it in cortex_a deinit and to exit for error during arm_dpm_setup(). Tested on dual cortex-A stm32mp15x. This change is inspired from similar fix in commit b01b5fe13a67 ("armv7m: Fix memory leak in register caching."). The same allocation is also used by target types "arm7tdmi", "arm9tdmi", "arm11" and "xscale" but they all lack the deinit method and I do not have relevant HW to test the fix. For such reasons they are not addressed in this patch. Change-Id: I4da1e1f12e36ec245d1f3b11a4eafcbd9a1d2e25 Signed-off-by: Antonio Borneo <bor...@gm...> Reviewed-on: http://openocd.zylin.com/5693 Tested-by: jenkins diff --git a/src/target/arm.h b/src/target/arm.h index b39957495..3450260f0 100644 --- a/src/target/arm.h +++ b/src/target/arm.h @@ -272,6 +272,8 @@ struct arm_reg { }; struct reg_cache *arm_build_reg_cache(struct target *target, struct arm *arm); +void arm_free_reg_cache(struct arm *arm); + struct reg_cache *armv8_build_reg_cache(struct target *target); extern const struct command_registration arm_command_handlers[]; diff --git a/src/target/arm_dpm.c b/src/target/arm_dpm.c index 495d63ec2..72215f90b 100644 --- a/src/target/arm_dpm.c +++ b/src/target/arm_dpm.c @@ -1100,6 +1100,7 @@ int arm_dpm_setup(struct arm_dpm *dpm) dpm->dwp = calloc(dpm->nwp, sizeof(*dpm->dwp)); if (!dpm->dbp || !dpm->dwp) { + arm_free_reg_cache(arm); free(dpm->dbp); free(dpm->dwp); return ERROR_FAIL; diff --git a/src/target/armv4_5.c b/src/target/armv4_5.c index b4581d5f1..58bc3390a 100644 --- a/src/target/armv4_5.c +++ b/src/target/armv4_5.c @@ -769,6 +769,27 @@ struct reg_cache *arm_build_reg_cache(struct target *target, struct arm *arm) return cache; } +void arm_free_reg_cache(struct arm *arm) +{ + if (!arm || !arm->core_cache) + return; + + struct reg_cache *cache = arm->core_cache; + + for (unsigned int i = 0; i < cache->num_regs; i++) { + struct reg *reg = &cache->reg_list[i]; + + free(reg->feature); + free(reg->reg_data_type); + } + + free(cache->reg_list[0].arch_info); + free(cache->reg_list); + free(cache); + + arm->core_cache = NULL; +} + int arm_arch_state(struct target *target) { struct arm *arm = target_to_arm(target); diff --git a/src/target/cortex_a.c b/src/target/cortex_a.c index f71b15524..f562a7614 100644 --- a/src/target/cortex_a.c +++ b/src/target/cortex_a.c @@ -2959,6 +2959,7 @@ static void cortex_a_deinit_target(struct target *target) } free(cortex_a->brp_list); + arm_free_reg_cache(dpm->arm); free(dpm->dbp); free(dpm->dwp); free(target->private_config); ----------------------------------------------------------------------- Summary of changes: src/jtag/tcl.c | 13 +++++++++---- src/target/arm.h | 2 ++ src/target/arm_dpm.c | 1 + src/target/armv4_5.c | 21 +++++++++++++++++++++ src/target/cortex_a.c | 1 + 5 files changed, 34 insertions(+), 4 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: OpenOCD-Gerrit <ope...@us...> - 2020-06-06 17:06: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 061cae171c9d2b6015a565dcc748dd04319e08cf (commit) via f6b4079ce5793f86b2c26c6bfcc8c717e2c8a3c3 (commit) from 37330f89d789e5b0a74aa14f7a7bfcfb4260abff (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 061cae171c9d2b6015a565dcc748dd04319e08cf Author: Antonio Borneo <bor...@gm...> Date: Fri May 22 18:08:55 2020 +0200 target/mem_ap: fix two memory leaks The target mem_ap misses the method 'deinit_target' and does not free the memory allocated during 'target create' and 'configure'. Add the missing method and free the allocated memory. Issue identified with valgrind. Change-Id: If0d0114a75dd76a8b65c2d46d96c6085fd31a09d Signed-off-by: Antonio Borneo <bor...@gm...> Reviewed-on: http://openocd.zylin.com/5700 Tested-by: jenkins diff --git a/src/target/mem_ap.c b/src/target/mem_ap.c index 29cd37a90..ade48b6d7 100644 --- a/src/target/mem_ap.c +++ b/src/target/mem_ap.c @@ -65,6 +65,15 @@ static int mem_ap_init_target(struct command_context *cmd_ctx, struct target *ta return ERROR_OK; } +static void mem_ap_deinit_target(struct target *target) +{ + LOG_DEBUG("%s", __func__); + + free(target->private_config); + free(target->arch_info); + return; +} + static int mem_ap_arch_state(struct target *target) { LOG_DEBUG("%s", __func__); @@ -169,6 +178,7 @@ struct target_type mem_ap_target = { .target_create = mem_ap_target_create, .init_target = mem_ap_init_target, + .deinit_target = mem_ap_deinit_target, .examine = mem_ap_examine, .target_jim_configure = adiv5_jim_configure, commit f6b4079ce5793f86b2c26c6bfcc8c717e2c8a3c3 Author: Antonio Borneo <bor...@gm...> Date: Mon May 25 21:37:12 2020 +0200 libusb_helper: fix memory leak when no adapter is found When jtag_libusb_open() fails to find the adapter, it returns error but left libusb initialized causing memory leak of libusb internal data. Issue found with valgrind when no adapter or board is connected to the host, e.g. valgrind openocd -f board/st_nucleo_f4.cfg Close the libusb operations if jtag_libusb_open() has to return error. Change-Id: Ieb2f110be15705dafe80c099e7d83c07056c2a41 Signed-off-by: Antonio Borneo <bor...@gm...> Reviewed-on: http://openocd.zylin.com/5701 Tested-by: jenkins diff --git a/src/jtag/drivers/libusb_helper.c b/src/jtag/drivers/libusb_helper.c index fbbfb4114..184882abc 100644 --- a/src/jtag/drivers/libusb_helper.c +++ b/src/jtag/drivers/libusb_helper.c @@ -208,6 +208,9 @@ int jtag_libusb_open(const uint16_t vids[], const uint16_t pids[], if (serial_mismatch) LOG_INFO("No device matches the serial string"); + if (retval != ERROR_OK) + libusb_exit(jtag_libusb_context); + return retval; } ----------------------------------------------------------------------- Summary of changes: src/jtag/drivers/libusb_helper.c | 3 +++ src/target/mem_ap.c | 10 ++++++++++ 2 files changed, 13 insertions(+) hooks/post-receive -- Main OpenOCD repository |
From: OpenOCD-Gerrit <ope...@us...> - 2020-06-06 17:05:26
|
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 37330f89d789e5b0a74aa14f7a7bfcfb4260abff (commit) via 1fa66d3633862d824420fb90b5b63e41e415d70e (commit) from ffc1ca4b91757911c53d5dc86cae55eb00d858d5 (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 37330f89d789e5b0a74aa14f7a7bfcfb4260abff Author: Antonio Borneo <bor...@gm...> Date: Wed May 27 00:03:45 2020 +0200 target/cortex-m: enable C_DEBUGEN during examine Current code for Cortex M does not set C_DEBUGEN as soon as possible, (which means during target examine), but later-on either: 1) at command 'halt' (e.g. for 'gdb-attach' event); 2) at command 'soft_reset_halt'; 3) at commands 'reset', 'reset halt' or 'reset init'; 4) during polling, but only if the target: = enter in 'double fault', or = exit from a reset, or = halts (not possible if C_DEBUGEN is not set) Plus, if commands in 1) or 2) are executed before the very first poll of the target, the value of 'cortex_m->dcb_dhcsr' is used not initialized while writing it back in DCB_DHCSR. Another side effect of this situation is that it's possible to set a HW breakpoint with the target running, while C_DEBUGEN is not set. Accordingly to [1], C1.3.1 "Debug authentication": When DGBEN is LOW and DHCSR.S_HALT == 0: ... FPB breakpoints do not generate an entry to Debug state and, if no DebugMonitor exception is generated, will escalate to HardFault, Lockup, or be ignored. On STM32MP15x I get HW breakpoint ignored, while on STM32F411 I get HardFault. E.g. following these steps: - power-on a pre-flashed board that starts running the firmware; - connect openocd, without halting or resetting the board; - set a HW breakpoint to some address often executed; - wait, but the board doesn't halt ...; - type the command 'halt'; - if the Cortex-M has HardFault it would be visible and the fault is at the breakpoint address; - if no HardFault then type the command 'resume'; - wait and the board will finally halt at the HW breakpoint. A similar issue has been detected on Cortex-A code and fixed by commit bff87a7f28fb ("target/cortex_a: enable DSCR_HALT_DBG_MODE during examine"). Follow the same approach and set C_DEBUGEN during examine. Also, initialize 'cortex_m->dcb_dhcsr' during examine. [1] ARM DDI 0403E "ARM v7-M Architecture Reference Manual" Change-Id: I5b0b23403634f7dfce38f104bba9f59c33eb3e99 Signed-off-by: Antonio Borneo <bor...@gm...> Reviewed-on: http://openocd.zylin.com/5702 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <and...@gm...> Reviewed-by: Tarek BOCHKATI <tar...@gm...> Reviewed-by: Moritz Fischer <mo...@go...> diff --git a/src/target/cortex_m.c b/src/target/cortex_m.c index e540f8507..d9bee0e53 100644 --- a/src/target/cortex_m.c +++ b/src/target/cortex_m.c @@ -2230,6 +2230,19 @@ int cortex_m_examine(struct target *target) armv7m->debug_ap->tar_autoincr_block = (1 << 10); } + /* Enable debug requests */ + retval = target_read_u32(target, DCB_DHCSR, &cortex_m->dcb_dhcsr); + if (retval != ERROR_OK) + return retval; + if (!(cortex_m->dcb_dhcsr & C_DEBUGEN)) { + uint32_t dhcsr = (cortex_m->dcb_dhcsr | C_DEBUGEN) & ~(C_HALT | C_STEP | C_MASKINTS); + + retval = target_write_u32(target, DCB_DHCSR, DBGKEY | (dhcsr & 0x0000FFFFUL)); + if (retval != ERROR_OK) + return retval; + cortex_m->dcb_dhcsr = dhcsr; + } + /* Configure trace modules */ retval = target_write_u32(target, DCB_DEMCR, TRCENA | armv7m->demcr); if (retval != ERROR_OK) commit 1fa66d3633862d824420fb90b5b63e41e415d70e Author: Antonio Borneo <bor...@gm...> Date: Fri May 29 12:00:35 2020 +0200 log: fix kept_alive() and report expired timeout The kept_alive() function is called to inform the keep-alive code that a keep-alive as been just kicked through some other path. But kept_alive() erroneously resets the timeout counter without checking if it has already expired, thus masking a potential timeout. Check if timeout counter has expired during kept_alive(). While there, put the timeout values in macros and explicit the units in the timeout messages. Change-Id: Iaf6368b44e5b5352b1cc4e7efbb2368575dcfa08 Signed-off-by: Antonio Borneo <bor...@gm...> Reviewed-on: http://openocd.zylin.com/5705 Reviewed-by: <jon...@gm...> Tested-by: jenkins diff --git a/src/helper/log.c b/src/helper/log.c index 380f548f4..31122554e 100644 --- a/src/helper/log.c +++ b/src/helper/log.c @@ -401,25 +401,43 @@ char *alloc_printf(const char *format, ...) * fast when invoked more often than every 500ms. * */ +#define KEEP_ALIVE_KICK_TIME_MS 500 +#define KEEP_ALIVE_TIMEOUT_MS 1000 + +static void gdb_timeout_warning(int64_t delta_time) +{ + extern int gdb_actual_connections; + + if (gdb_actual_connections) + LOG_WARNING("keep_alive() was not invoked in the " + "%d ms timelimit. GDB alive packet not " + "sent! (%" PRId64 " ms). Workaround: increase " + "\"set remotetimeout\" in GDB", + KEEP_ALIVE_TIMEOUT_MS, + delta_time); + else + LOG_DEBUG("keep_alive() was not invoked in the " + "%d ms timelimit (%" PRId64 " ms). This may cause " + "trouble with GDB connections.", + KEEP_ALIVE_TIMEOUT_MS, + delta_time); +} + void keep_alive(void) { current_time = timeval_ms(); - if (current_time-last_time > 1000) { - extern int gdb_actual_connections; - - if (gdb_actual_connections) - LOG_WARNING("keep_alive() was not invoked in the " - "1000ms timelimit. GDB alive packet not " - "sent! (%" PRId64 "). Workaround: increase " - "\"set remotetimeout\" in GDB", - current_time-last_time); - else - LOG_DEBUG("keep_alive() was not invoked in the " - "1000ms timelimit (%" PRId64 "). This may cause " - "trouble with GDB connections.", - current_time-last_time); + + int64_t delta_time = current_time - last_time; + + if (delta_time > KEEP_ALIVE_TIMEOUT_MS) { + last_time = current_time; + + gdb_timeout_warning(delta_time); } - if (current_time-last_time > 500) { + + if (delta_time > KEEP_ALIVE_KICK_TIME_MS) { + last_time = current_time; + /* this will keep the GDB connection alive */ LOG_USER_N("%s", ""); @@ -430,8 +448,6 @@ void keep_alive(void) * * These functions should be invoked at a well defined spot in server.c */ - - last_time = current_time; } } @@ -439,7 +455,13 @@ void keep_alive(void) void kept_alive(void) { current_time = timeval_ms(); + + int64_t delta_time = current_time - last_time; + last_time = current_time; + + if (delta_time > KEEP_ALIVE_TIMEOUT_MS) + gdb_timeout_warning(delta_time); } /* if we sleep for extended periods of time, we must invoke keep_alive() intermittantly */ ----------------------------------------------------------------------- Summary of changes: src/helper/log.c | 56 +++++++++++++++++++++++++++++++++++---------------- src/target/cortex_m.c | 13 ++++++++++++ 2 files changed, 52 insertions(+), 17 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: OpenOCD-Gerrit <ope...@us...> - 2020-06-06 17:04:50
|
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 ffc1ca4b91757911c53d5dc86cae55eb00d858d5 (commit) from 2d3bbcd56656b5f2a708541d42c6c85371323730 (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 ffc1ca4b91757911c53d5dc86cae55eb00d858d5 Author: Antonio Borneo <bor...@gm...> Date: Fri May 29 10:42:43 2020 +0200 nor/kinetis: add keep-alive during flash write Flashing Kinetis MCU MK22FX512VLH12 takes longer than one second, thus gdb connection can timeout. Before commit 7f260f5009a7 ("helper/command: Handle Tcl return values consistently") the openocd timeout warning was masked by a bug in gdb_put_packet() that resets the timeout counter if any message is logged out. The commit above removes one log message and the timeout warning is now triggered. While the bug in gdb_put_packet() is still to be fixed, the reason of the timeout is the lack of keep_alive() calls in kinetis flash driver. Add keep_alive() call at every iteration in function kinetis_write_sections(), that is reported as core write function in chunks of 1024 bytes in the log from the reporter. Add also a keep_alive() call at every iteration in function kinetis_write_inner(). This part is not present in the log but, by code analysis, it represents another critical loop. Change-Id: I38e631b36c7eb2f1e21cef68710ce47c03d3edda Signed-off-by: Antonio Borneo <bor...@gm...> Reported-by: Jonatan Hatakeyama Zeidler <jon...@me...> Reviewed-on: http://openocd.zylin.com/5703 Tested-by: jenkins Reviewed-by: <jon...@gm...> diff --git a/src/flash/nor/kinetis.c b/src/flash/nor/kinetis.c index bceaf8474..084e009ee 100644 --- a/src/flash/nor/kinetis.c +++ b/src/flash/nor/kinetis.c @@ -1793,6 +1793,8 @@ static int kinetis_write_sections(struct flash_bank *bank, const uint8_t *buffer buffer += size; offset += size; count -= size; + + keep_alive(); } free(buffer_aligned); @@ -1885,6 +1887,8 @@ static int kinetis_write_inner(struct flash_bank *bank, const uint8_t *buffer, buffer += 4; offset += 4; words_remaining--; + + keep_alive(); } } free(new_buffer); ----------------------------------------------------------------------- Summary of changes: src/flash/nor/kinetis.c | 4 ++++ 1 file changed, 4 insertions(+) hooks/post-receive -- Main OpenOCD repository |
From: OpenOCD-Gerrit <ope...@us...> - 2020-06-06 17:03:58
|
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 2d3bbcd56656b5f2a708541d42c6c85371323730 (commit) from cdb6918c87569e055e56db88b2726538c4617ad6 (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 2d3bbcd56656b5f2a708541d42c6c85371323730 Author: Tarek BOCHKATI <tar...@gm...> Date: Sun May 31 11:46:56 2020 +0100 arm_adi_v5: dap_ti_be_32_quirks_command minor simplification use handle_command_parse_bool within dap_ti_be_32_quirks_command to make it shorter and simpler. Change-Id: Ice179cc477933b27e27235dc2ade23fe655e233d Signed-off-by: Tarek BOCHKATI <tar...@gm...> Reviewed-on: http://openocd.zylin.com/5708 Tested-by: jenkins Reviewed-by: Marc Schink <de...@za...> Reviewed-by: Antonio Borneo <bor...@gm...> diff --git a/src/target/arm_adi_v5.c b/src/target/arm_adi_v5.c index 5f6f1ff38..f19514c85 100644 --- a/src/target/arm_adi_v5.c +++ b/src/target/arm_adi_v5.c @@ -1878,24 +1878,8 @@ COMMAND_HANDLER(dap_dpreg_command) COMMAND_HANDLER(dap_ti_be_32_quirks_command) { struct adiv5_dap *dap = adiv5_get_dap(CMD_DATA); - uint32_t enable = dap->ti_be_32_quirks; - - switch (CMD_ARGC) { - case 0: - break; - case 1: - COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], enable); - if (enable > 1) - return ERROR_COMMAND_ARGUMENT_INVALID; - break; - default: - return ERROR_COMMAND_SYNTAX_ERROR; - } - dap->ti_be_32_quirks = enable; - command_print(CMD, "TI BE-32 quirks mode %s", - enable ? "enabled" : "disabled"); - - return 0; + return CALL_COMMAND_HANDLER(handle_command_parse_bool, &dap->ti_be_32_quirks, + "TI BE-32 quirks mode"); } const struct command_registration dap_instance_commands[] = { ----------------------------------------------------------------------- Summary of changes: src/target/arm_adi_v5.c | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: OpenOCD-Gerrit <ope...@us...> - 2020-06-06 17:03:28
|
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 cdb6918c87569e055e56db88b2726538c4617ad6 (commit) from 93e4bed0566fa783fc5f2524920f11ba250ea7dd (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 cdb6918c87569e055e56db88b2726538c4617ad6 Author: Tarek BOCHKATI <tar...@gm...> Date: Sun May 31 11:12:05 2020 +0100 arm_adi_v5: enhance command error reporting avoid the usage of ERROR_COMMAND_SYNTAX_ERROR when ERROR_COMMAND_ARGUMENT_INVALID is more adequate. Change-Id: Ic9aaedb93fedd45efee1b39f8ea20185f01af2da Signed-off-by: Tarek BOCHKATI <tar...@gm...> Reviewed-on: http://openocd.zylin.com/5654 Tested-by: jenkins Reviewed-by: Antonio Borneo <bor...@gm...> diff --git a/src/target/arm_adi_v5.c b/src/target/arm_adi_v5.c index 2d47da3ea..5f6f1ff38 100644 --- a/src/target/arm_adi_v5.c +++ b/src/target/arm_adi_v5.c @@ -1610,8 +1610,10 @@ COMMAND_HANDLER(handle_dap_info_command) break; case 1: COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], apsel); - if (apsel > DP_APSEL_MAX) - return ERROR_COMMAND_SYNTAX_ERROR; + if (apsel > DP_APSEL_MAX) { + command_print(CMD, "Invalid AP number"); + return ERROR_COMMAND_ARGUMENT_INVALID; + } break; default: return ERROR_COMMAND_SYNTAX_ERROR; @@ -1633,8 +1635,10 @@ COMMAND_HANDLER(dap_baseaddr_command) case 1: COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], apsel); /* AP address is in bits 31:24 of DP_SELECT */ - if (apsel > DP_APSEL_MAX) - return ERROR_COMMAND_SYNTAX_ERROR; + if (apsel > DP_APSEL_MAX) { + command_print(CMD, "Invalid AP number"); + return ERROR_COMMAND_ARGUMENT_INVALID; + } break; default: return ERROR_COMMAND_SYNTAX_ERROR; @@ -1692,8 +1696,10 @@ COMMAND_HANDLER(dap_apsel_command) case 1: COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], apsel); /* AP address is in bits 31:24 of DP_SELECT */ - if (apsel > DP_APSEL_MAX) - return ERROR_COMMAND_SYNTAX_ERROR; + if (apsel > DP_APSEL_MAX) { + command_print(CMD, "Invalid AP number"); + return ERROR_COMMAND_ARGUMENT_INVALID; + } break; default: return ERROR_COMMAND_SYNTAX_ERROR; @@ -1722,7 +1728,7 @@ COMMAND_HANDLER(dap_apcsw_command) if (csw_val & (CSW_SIZE_MASK | CSW_ADDRINC_MASK)) { LOG_ERROR("CSW value cannot include 'Size' and 'AddrInc' bit-fields"); - return ERROR_COMMAND_SYNTAX_ERROR; + return ERROR_COMMAND_ARGUMENT_INVALID; } apcsw = csw_val; break; @@ -1731,7 +1737,7 @@ COMMAND_HANDLER(dap_apcsw_command) COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], csw_mask); if (csw_mask & (CSW_SIZE_MASK | CSW_ADDRINC_MASK)) { LOG_ERROR("CSW mask cannot include 'Size' and 'AddrInc' bit-fields"); - return ERROR_COMMAND_SYNTAX_ERROR; + return ERROR_COMMAND_ARGUMENT_INVALID; } apcsw = (apcsw & ~csw_mask) | (csw_val & csw_mask); break; @@ -1758,8 +1764,10 @@ COMMAND_HANDLER(dap_apid_command) case 1: COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], apsel); /* AP address is in bits 31:24 of DP_SELECT */ - if (apsel > DP_APSEL_MAX) - return ERROR_COMMAND_SYNTAX_ERROR; + if (apsel > DP_APSEL_MAX) { + command_print(CMD, "Invalid AP number"); + return ERROR_COMMAND_ARGUMENT_INVALID; + } break; default: return ERROR_COMMAND_SYNTAX_ERROR; @@ -1789,13 +1797,18 @@ COMMAND_HANDLER(dap_apreg_command) COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], apsel); /* AP address is in bits 31:24 of DP_SELECT */ - if (apsel > DP_APSEL_MAX) - return ERROR_COMMAND_SYNTAX_ERROR; + if (apsel > DP_APSEL_MAX) { + command_print(CMD, "Invalid AP number"); + return ERROR_COMMAND_ARGUMENT_INVALID; + } + ap = dap_ap(dap, apsel); COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], reg); - if (reg >= 256 || (reg & 3)) - return ERROR_COMMAND_SYNTAX_ERROR; + if (reg >= 256 || (reg & 3)) { + command_print(CMD, "Invalid reg value (should be less than 256 and 4 bytes aligned)"); + return ERROR_COMMAND_ARGUMENT_INVALID; + } if (CMD_ARGC == 3) { COMMAND_PARSE_NUMBER(u32, CMD_ARGV[2], value); @@ -1839,8 +1852,10 @@ COMMAND_HANDLER(dap_dpreg_command) return ERROR_COMMAND_SYNTAX_ERROR; COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], reg); - if (reg >= 256 || (reg & 3)) - return ERROR_COMMAND_SYNTAX_ERROR; + if (reg >= 256 || (reg & 3)) { + command_print(CMD, "Invalid reg value (should be less than 256 and 4 bytes aligned)"); + return ERROR_COMMAND_ARGUMENT_INVALID; + } if (CMD_ARGC == 2) { COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], value); @@ -1871,7 +1886,7 @@ COMMAND_HANDLER(dap_ti_be_32_quirks_command) case 1: COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], enable); if (enable > 1) - return ERROR_COMMAND_SYNTAX_ERROR; + return ERROR_COMMAND_ARGUMENT_INVALID; break; default: return ERROR_COMMAND_SYNTAX_ERROR; ----------------------------------------------------------------------- Summary of changes: src/target/arm_adi_v5.c | 49 ++++++++++++++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 17 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: OpenOCD-Gerrit <ope...@us...> - 2020-06-06 17:02:56
|
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 93e4bed0566fa783fc5f2524920f11ba250ea7dd (commit) via ae4113d877c8f2a0518fb3246610b1518ce7c03f (commit) from fe13f61539b5ee27e14e8675c9ebe36a6ca034d4 (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 93e4bed0566fa783fc5f2524920f11ba250ea7dd Author: tscn92 <ts...@ka...> Date: Mon Apr 6 16:05:08 2020 +0200 jtag/drivers/bcm2835gpio: bcm2835gpio_init has been updated For jtag/drivers/bcm2835gpio dev_mem_fd has been updated within bcm2835gpio_init with the add on of gpio to mem. This permits the access to memory of GPIO without the need for root access. For failed attempt, a fallback to original memory follows. It should be noted that any printed error is relative to original memory ("dev/mem"). Tested on EFM32GG12B390F board Change-Id: I4540bdf62fb3b91a51221e277881adfae138dcc5 Signed-off-by: tscn92 <ts...@ka...> Reviewed-on: http://openocd.zylin.com/5568 Tested-by: jenkins Reviewed-by: Antonio Borneo <bor...@gm...> diff --git a/src/jtag/drivers/bcm2835gpio.c b/src/jtag/drivers/bcm2835gpio.c index bbc87d3dd..df557c5c6 100644 --- a/src/jtag/drivers/bcm2835gpio.c +++ b/src/jtag/drivers/bcm2835gpio.c @@ -466,7 +466,11 @@ static int bcm2835gpio_init(void) return ERROR_JTAG_INIT_FAILED; } - dev_mem_fd = open("/dev/mem", O_RDWR | O_SYNC); + dev_mem_fd = open("/dev/gpiomem", O_RDWR | O_SYNC); + if (dev_mem_fd < 0) { + LOG_DEBUG("Cannot open /dev/gpiomem, fallback to /dev/mem"); + dev_mem_fd = open("/dev/mem", O_RDWR | O_SYNC); + } if (dev_mem_fd < 0) { perror("open"); return ERROR_JTAG_INIT_FAILED; commit ae4113d877c8f2a0518fb3246610b1518ce7c03f Author: Marc Schink <de...@za...> Date: Wed Feb 26 12:58:27 2020 +0100 tcl/boards: Rename 'ek-tm4c1294xl.cfg' to 'ti_ek-tm4c1294xl.cfg' The new filename has a proper vendor prefix. Keep the old configuration file for now but show a "deprecated" warning at runtime. Change-Id: If7465a752f47f3292e430c8b311148badfd384cd Signed-off-by: Marc Schink <de...@za...> Reviewed-on: http://openocd.zylin.com/5478 Tested-by: jenkins Reviewed-by: Karl Palsson <ka...@tw...> Reviewed-by: Antonio Borneo <bor...@gm...> diff --git a/tcl/board/ek-tm4c1294xl.cfg b/tcl/board/ek-tm4c1294xl.cfg index b3f384c0e..676386680 100644 --- a/tcl/board/ek-tm4c1294xl.cfg +++ b/tcl/board/ek-tm4c1294xl.cfg @@ -1,14 +1,3 @@ -# -# TI Tiva C Series ek-tm4c1294xl Launchpad Evaluation Kit -# -# http://www.ti.com/tool/ek-tm4c1294xl -# +echo "WARNING: board/ek-tm4c1294xl.cfg is deprecated, please switch to board/ti_ek-tm4c1294xl.cfg" -source [find interface/ti-icdi.cfg] - -transport select hla_jtag - -set WORKAREASIZE 0x8000 -set CHIPNAME tm4c1294ncpdt - -source [find target/stellaris.cfg] +source [find board/ti_ek-tm4c1294xl.cfg] diff --git a/tcl/board/ek-tm4c1294xl.cfg b/tcl/board/ti_ek-tm4c1294xl.cfg similarity index 100% copy from tcl/board/ek-tm4c1294xl.cfg copy to tcl/board/ti_ek-tm4c1294xl.cfg ----------------------------------------------------------------------- Summary of changes: src/jtag/drivers/bcm2835gpio.c | 6 +++++- tcl/board/ek-tm4c1294xl.cfg | 15 ++------------- tcl/board/{ek-tm4c1294xl.cfg => ti_ek-tm4c1294xl.cfg} | 0 3 files changed, 7 insertions(+), 14 deletions(-) copy tcl/board/{ek-tm4c1294xl.cfg => ti_ek-tm4c1294xl.cfg} (100%) hooks/post-receive -- Main OpenOCD repository |
From: OpenOCD-Gerrit <ope...@us...> - 2020-06-06 17:02:16
|
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 fe13f61539b5ee27e14e8675c9ebe36a6ca034d4 (commit) via 3076fc601d9b4f8adf8aa080f550cb96290af60f (commit) from 4c364b453488fb5d30c32dfb4f294c30d255d7bf (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 fe13f61539b5ee27e14e8675c9ebe36a6ca034d4 Author: Marc Schink <de...@za...> Date: Wed Feb 26 12:56:33 2020 +0100 tcl/boards: Rename 'ek-tm4c123gxl.cfg' to 'ti_ek-tm4c123gxl.cfg' The new filename has a proper vendor prefix. Keep the old configuration file for now but show a "deprecated" warning at runtime. Change-Id: I13871ec13709055843e23b1b6da90694fd60505e Signed-off-by: Marc Schink <de...@za...> Reviewed-on: http://openocd.zylin.com/5477 Tested-by: jenkins Reviewed-by: Karl Palsson <ka...@tw...> Reviewed-by: Antonio Borneo <bor...@gm...> diff --git a/tcl/board/ek-tm4c123gxl.cfg b/tcl/board/ek-tm4c123gxl.cfg index 4fc1050c7..3e497ba19 100644 --- a/tcl/board/ek-tm4c123gxl.cfg +++ b/tcl/board/ek-tm4c123gxl.cfg @@ -1,13 +1,3 @@ -# -# TI Tiva C Series ek-tm4c123gxl Launchpad Evaluation Kit -# -# http://www.ti.com/tool/ek-tm4c123gxl -# +echo "WARNING: board/ek-tm4c123gxl.cfg is deprecated, please switch to board/ti_ek-tm4c123gxl.cfg" -source [find interface/ti-icdi.cfg] - -transport select hla_jtag - -set WORKAREASIZE 0x8000 -set CHIPNAME tm4c123gh6pm -source [find target/stellaris.cfg] +source [find board/ti_ek-tm4c123gxl.cfg] diff --git a/tcl/board/ek-tm4c123gxl.cfg b/tcl/board/ti_ek-tm4c123gxl.cfg similarity index 100% copy from tcl/board/ek-tm4c123gxl.cfg copy to tcl/board/ti_ek-tm4c123gxl.cfg commit 3076fc601d9b4f8adf8aa080f550cb96290af60f Author: Marc Schink <de...@za...> Date: Wed Feb 26 12:51:35 2020 +0100 tcl/boards: Rename 'dk-tm4c129.cfg' to 'ti_dk-tm4c129.cfg' The new filename has a proper vendor prefix. Keep the old configuration file for now but show a "deprecated" warning at runtime. Change-Id: I30fcb8f291d401acaa1fe665db0eeabc250d24b6 Signed-off-by: Marc Schink <de...@za...> Reviewed-on: http://openocd.zylin.com/5476 Tested-by: jenkins Reviewed-by: Tarek BOCHKATI <tar...@gm...> Reviewed-by: Antonio Borneo <bor...@gm...> diff --git a/tcl/board/dk-tm4c129.cfg b/tcl/board/dk-tm4c129.cfg index f1171af12..2c7de290d 100644 --- a/tcl/board/dk-tm4c129.cfg +++ b/tcl/board/dk-tm4c129.cfg @@ -1,14 +1,3 @@ -# -# TI Tiva C DK-TM4C129X Connected Development Kit -# -# http://www.ti.com/tool/dk-tm4c129x -# +echo "WARNING: board/dk-tm4c129.cfg is deprecated, please switch to board/ti_dk-tm4c129.cfg" -source [find interface/ti-icdi.cfg] - -transport select hla_jtag - -set WORKAREASIZE 0x8000 -set CHIPNAME tm4c129xnczad - -source [find target/stellaris.cfg] +source [find board/ti_dk-tm4c129.cfg] diff --git a/tcl/board/dk-tm4c129.cfg b/tcl/board/ti_dk-tm4c129.cfg similarity index 100% copy from tcl/board/dk-tm4c129.cfg copy to tcl/board/ti_dk-tm4c129.cfg ----------------------------------------------------------------------- Summary of changes: tcl/board/dk-tm4c129.cfg | 15 ++------------- tcl/board/ek-tm4c123gxl.cfg | 14 ++------------ tcl/board/{dk-tm4c129.cfg => ti_dk-tm4c129.cfg} | 0 tcl/board/{ek-tm4c123gxl.cfg => ti_ek-tm4c123gxl.cfg} | 0 4 files changed, 4 insertions(+), 25 deletions(-) copy tcl/board/{dk-tm4c129.cfg => ti_dk-tm4c129.cfg} (100%) copy tcl/board/{ek-tm4c123gxl.cfg => ti_ek-tm4c123gxl.cfg} (100%) hooks/post-receive -- Main OpenOCD repository |
From: OpenOCD-Gerrit <ope...@us...> - 2020-06-02 17:41:58
|
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 4c364b453488fb5d30c32dfb4f294c30d255d7bf (commit) from d8ac0086f957fabf63d596a3b8d396b110bc696d (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 4c364b453488fb5d30c32dfb4f294c30d255d7bf Author: Diego Elio Pettenò <fla...@fl...> Date: Tue Jun 2 11:52:01 2020 +0100 Update Autotools Mythbuster link to avoid multiple redirects. While I'm hoping to maintain the chain of redirects for the foreseeable future, it makes sense to point at the final URL now that Autotools Mythuster has had its domain for a long while. Change-Id: I6d912e3be0f81b25bec14746ebfee58f29f144b6 Signed-off-by: Diego Elio Pettenò <fla...@fl...> Reviewed-on: http://openocd.zylin.com/5709 Reviewed-by: Antonio Borneo <bor...@gm...> Tested-by: jenkins Reviewed-by: Tarek BOCHKATI <tar...@gm...> Reviewed-by: Andreas Fritiofson <and...@gm...> diff --git a/README b/README index 00e83bbf4..2ff0329ed 100644 --- a/README +++ b/README @@ -277,7 +277,7 @@ e.g. for cross-building for Windows 32-bit with MinGW on Debian: To make pkg-config work nicely for cross-compiling, you might need an additional wrapper script as described at - http://www.flameeyes.eu/autotools-mythbuster/pkgconfig/cross-compiling.html + https://autotools.io/pkgconfig/cross-compiling.html This is needed to tell pkg-config where to look for the target libraries that OpenOCD depends on. Alternatively, you can specify ----------------------------------------------------------------------- Summary of changes: README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- Main OpenOCD repository |
From: OpenOCD-Gerrit <ope...@us...> - 2020-05-24 20:37:48
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via d8ac0086f957fabf63d596a3b8d396b110bc696d (commit) from 3b5a24c13b320fc0fd09e0dfacb5854b378eec34 (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 d8ac0086f957fabf63d596a3b8d396b110bc696d Author: Antonio Borneo <bor...@gm...> Date: Sun May 10 10:57:59 2020 +0200 helper/command: remove unused functions and make static local ones The function command_find_in_parent() is never used in OpenOCD, so remove it. The functions command_name() and [un]register_command() are only used internally in command.c, so make them static. Change-Id: Ide9842659796f4884fb6c1fcf5979b3b71b67abb Signed-off-by: Antonio Borneo <bor...@gm...> Reviewed-on: http://openocd.zylin.com/5663 Reviewed-by: Andreas Fritiofson <and...@gm...> Tested-by: jenkins diff --git a/src/helper/command.c b/src/helper/command.c index 193867fe8..271e7b993 100644 --- a/src/helper/command.c +++ b/src/helper/command.c @@ -52,6 +52,10 @@ struct log_capture_state { Jim_Obj *output; }; +static int unregister_command(struct command_context *context, + struct command *parent, const char *name); +static char *command_name(struct command *c, char delim); + static void tcl_output(void *privData, const char *file, unsigned line, const char *function, const char *string) { @@ -242,11 +246,6 @@ struct command *command_find_in_context(struct command_context *cmd_ctx, { return command_find(cmd_ctx->commands, name); } -struct command *command_find_in_parent(struct command *parent, - const char *name) -{ - return command_find(parent->children, name); -} /** * Add the command into the linked list, sorted by name. @@ -358,7 +357,7 @@ static int register_command_handler(struct command_context *cmd_ctx, return retval; } -struct command *register_command(struct command_context *context, +static struct command *register_command(struct command_context *context, struct command *parent, const struct command_registration *cr) { if (!context || !cr->name) @@ -440,7 +439,7 @@ int unregister_all_commands(struct command_context *context, return ERROR_OK; } -int unregister_command(struct command_context *context, +static int unregister_command(struct command_context *context, struct command *parent, const char *name) { if ((!context) || (!name)) @@ -548,7 +547,7 @@ static char *__command_name(struct command *c, char delim, unsigned extra) return name; } -char *command_name(struct command *c, char delim) +static char *command_name(struct command *c, char delim) { return __command_name(c, delim, 0); } diff --git a/src/helper/command.h b/src/helper/command.h index a20c4620d..886bde86b 100644 --- a/src/helper/command.h +++ b/src/helper/command.h @@ -195,19 +195,9 @@ struct command { struct command *next; }; -/** - * @param c The command to be named. - * @param delim The character to place between command names. - * @returns A malloc'd string containing the full command name, - * which may include one or more ancestor components. Multiple names - * are separated by single spaces. The caller must free() the string - * when done with it. - */ -char *command_name(struct command *c, char delim); - /* * Commands should be registered by filling in one or more of these - * structures and passing them to register_command(). + * structures and passing them to [un]register_commands(). * * A conventioal format should be used for help strings, to provide both * usage and basic information: @@ -243,24 +233,6 @@ struct command_registration { /** Use this as the last entry in an array of command_registration records. */ #define COMMAND_REGISTRATION_DONE { .name = NULL, .chain = NULL } -/** - * Register a command @c handler that can be called from scripts during - * the execution @c mode specified. - * - * If @c parent is non-NULL, the new command will be registered as a - * sub-command under it; otherwise, it will be available as a top-level - * command. - * - * @param cmd_ctx The command_context in which to register the command. - * @param parent Register this command as a child of this, or NULL to - * register a top-level command. - * @param rec A command_registration record that contains the desired - * command parameters. - * @returns The new command, if successful; otherwise, NULL. - */ -struct command *register_command(struct command_context *cmd_ctx, - struct command *parent, const struct command_registration *rec); - /** * Register one or more commands in the specified context, as children * of @c parent (or top-level commends, if NULL). In a registration's @@ -279,16 +251,6 @@ struct command *register_command(struct command_context *cmd_ctx, int register_commands(struct command_context *cmd_ctx, struct command *parent, const struct command_registration *cmds); - -/** - * Unregisters command @c name from the given context, @c cmd_ctx. - * @param cmd_ctx The context of the registered command. - * @param parent The parent of the given command, or NULL. - * @param name The name of the command to unregister. - * @returns ERROR_OK on success, or an error code. - */ -int unregister_command(struct command_context *cmd_ctx, - struct command *parent, const char *name); /** * Unregisters all commands from the specfied context. * @param cmd_ctx The context that will be cleared of registered commands. @@ -300,8 +262,6 @@ int unregister_all_commands(struct command_context *cmd_ctx, struct command *command_find_in_context(struct command_context *cmd_ctx, const char *name); -struct command *command_find_in_parent(struct command *parent, - const char *name); /** * Update the private command data field for a command and all descendents. ----------------------------------------------------------------------- Summary of changes: src/helper/command.c | 15 +++++++-------- src/helper/command.h | 42 +----------------------------------------- 2 files changed, 8 insertions(+), 49 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: OpenOCD-Gerrit <ope...@us...> - 2020-05-24 20:37:19
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 3b5a24c13b320fc0fd09e0dfacb5854b378eec34 (commit) via 80e8b019b0757ae895783dc7b8eaf424a6f6428c (commit) via 3008756604b8b7a3811948cf66ed7e587efac349 (commit) from 7456e6bac5a3f13818d16660f3cd049a73a6e3fb (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 3b5a24c13b320fc0fd09e0dfacb5854b378eec34 Author: Antonio Borneo <bor...@gm...> Date: Tue May 12 02:52:30 2020 +0200 openocd: properly use jim data types The jim library exports all the data types through typedef, so there is no need to use the internal struct types. Fix the few remaining inconsistencies in the code. Change-Id: Id4ae0083563ea7a371833374e7b39f17158f66a4 Signed-off-by: Antonio Borneo <bor...@gm...> Reviewed-on: http://openocd.zylin.com/5662 Reviewed-by: Andreas Fritiofson <and...@gm...> Tested-by: jenkins diff --git a/src/rtos/rtos.c b/src/rtos/rtos.c index 221234828..ff0fb9286 100644 --- a/src/rtos/rtos.c +++ b/src/rtos/rtos.c @@ -121,7 +121,7 @@ int rtos_create(Jim_GetOptInfo *goi, struct target *target) { int x; const char *cp; - struct Jim_Obj *res; + Jim_Obj *res; int e; if (!goi->isconfigure && goi->argc != 0) { diff --git a/src/target/target.c b/src/target/target.c index b0deadb0b..c0953a3f1 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -5011,7 +5011,7 @@ static int jim_target_examine(Jim_Interp *interp, int argc, Jim_Obj *const *argv if (goi.argc > 0 && strcmp(Jim_GetString(argv[1], NULL), "allow-defer") == 0) { /* consume it */ - struct Jim_Obj *obj; + Jim_Obj *obj; int e = Jim_GetOpt_Obj(&goi, &obj); if (e != JIM_OK) return e; diff --git a/src/target/target.h b/src/target/target.h index fc150442d..c69aa934a 100644 --- a/src/target/target.h +++ b/src/target/target.h @@ -32,6 +32,7 @@ #define OPENOCD_TARGET_TARGET_H #include <helper/list.h> +#include <jim.h> struct reg; struct trace; @@ -293,8 +294,8 @@ enum target_event { struct target_event_action { enum target_event event; - struct Jim_Interp *interp; - struct Jim_Obj *body; + Jim_Interp *interp; + Jim_Obj *body; struct target_event_action *next; }; commit 80e8b019b0757ae895783dc7b8eaf424a6f6428c Author: Antonio Borneo <bor...@gm...> Date: Wed May 13 00:47:17 2020 +0200 helper/command: fix check on value returned by jim API Either Jim_CreateCommand() and register_command_handler() return the jim error code JIM_OK/JIM_ERR. Fix the check and the initialization of retval. Change-Id: I3073c66764670128706ad979a43bb3edbbeb0ab0 Signed-off-by: Antonio Borneo <bor...@gm...> Reviewed-on: http://openocd.zylin.com/5661 Reviewed-by: Andreas Fritiofson <and...@gm...> Tested-by: jenkins diff --git a/src/helper/command.c b/src/helper/command.c index 14746a095..193867fe8 100644 --- a/src/helper/command.c +++ b/src/helper/command.c @@ -380,14 +380,14 @@ struct command *register_command(struct command_context *context, if (NULL == c) return NULL; - int retval = ERROR_OK; + int retval = JIM_OK; if (NULL != cr->jim_handler && NULL == parent) { retval = Jim_CreateCommand(context->interp, cr->name, cr->jim_handler, NULL, NULL); } else if (NULL != cr->handler || NULL != parent) retval = register_command_handler(context, command_root(c)); - if (ERROR_OK != retval) { + if (retval != JIM_OK) { unregister_command(context, parent, name); c = NULL; } commit 3008756604b8b7a3811948cf66ed7e587efac349 Author: Antonio Borneo <bor...@gm...> Date: Sun Oct 20 19:40:28 2019 +0200 helper/command: strip replicated command name in log After commit 0840414f0e57 ("helper/command: do not replace new commands with ocd_ prefix"), the command name is present in argv[0], so there is no need to pass it directly. The current code causes the command name to be logged twice, once explicitly and then from the content of argv[0]: openocd -c 'debug_level 3; echo hello; shutdown' <snip> Debug: 13 3 command.c:142 script_debug(): command - echo echo hello <snip> Debug: 16 4 command.c:142 script_debug(): command - shutdown shutdown Remove the command name from the arguments of the function script_debug(). Change-Id: I57860774f450ff717ee71ef9dc07590549a84319 Signed-off-by: Antonio Borneo <bor...@gm...> Reviewed-on: http://openocd.zylin.com/5660 Reviewed-by: Andreas Fritiofson <and...@gm...> Tested-by: jenkins diff --git a/src/helper/command.c b/src/helper/command.c index 4422b4abe..14746a095 100644 --- a/src/helper/command.c +++ b/src/helper/command.c @@ -126,13 +126,12 @@ extern struct command_context *global_cmd_ctx; /* dump a single line to the log for the command. * Do nothing in case we are not at debug level 3 */ -void script_debug(Jim_Interp *interp, const char *name, - unsigned argc, Jim_Obj * const *argv) +void script_debug(Jim_Interp *interp, unsigned int argc, Jim_Obj * const *argv) { if (debug_level < LOG_LVL_DEBUG) return; - char *dbg = alloc_printf("command - %s", name); + char *dbg = alloc_printf("command -"); for (unsigned i = 0; i < argc; i++) { int len; const char *w = Jim_GetString(argv[i], &len); @@ -213,7 +212,7 @@ static int script_command(Jim_Interp *interp, int argc, Jim_Obj *const *argv) struct command *c = interp->cmdPrivData; assert(c); - script_debug(interp, c->name, argc, argv); + script_debug(interp, argc, argv); return script_command_run(interp, argc, argv, c); } @@ -1032,8 +1031,7 @@ static int run_usage(Jim_Interp *interp, int argc_valid, int argc, Jim_Obj * con 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, argv); + script_debug(interp, argc, argv); struct command_context *cmd_ctx = current_command_context(interp); struct command *c = cmd_ctx->commands; diff --git a/src/helper/command.h b/src/helper/command.h index 672ccd02b..a20c4620d 100644 --- a/src/helper/command.h +++ b/src/helper/command.h @@ -448,7 +448,6 @@ COMMAND_HELPER(handle_command_parse_bool, bool *out, const char *label); #define COMMAND_PARSE_ENABLE(in, out) \ COMMAND_PARSE_BOOL(in, out, "enable", "disable") -void script_debug(Jim_Interp *interp, const char *cmd, - unsigned argc, Jim_Obj * const *argv); +void script_debug(Jim_Interp *interp, unsigned int argc, Jim_Obj * const *argv); #endif /* OPENOCD_HELPER_COMMAND_H */ diff --git a/src/jtag/tcl.c b/src/jtag/tcl.c index f52cbd606..01210bd69 100644 --- a/src/jtag/tcl.c +++ b/src/jtag/tcl.c @@ -108,7 +108,7 @@ static int Jim_Command_drscan(Jim_Interp *interp, int argc, Jim_Obj *const *args endstate = TAP_IDLE; - script_debug(interp, "drscan", argc, args); + script_debug(interp, argc, args); /* validate arguments as numbers */ e = JIM_OK; @@ -229,7 +229,7 @@ static int Jim_Command_pathmove(Jim_Interp *interp, int argc, Jim_Obj *const *ar return JIM_ERR; } - script_debug(interp, "pathmove", argc, args); + script_debug(interp, argc, args); int i; for (i = 0; i < argc-1; i++) { @@ -261,7 +261,7 @@ static int Jim_Command_pathmove(Jim_Interp *interp, int argc, Jim_Obj *const *ar static int Jim_Command_flush_count(Jim_Interp *interp, int argc, Jim_Obj *const *args) { - script_debug(interp, "flush_count", argc, args); + script_debug(interp, argc, args); Jim_SetResult(interp, Jim_NewIntObj(interp, jtag_get_flush_queue_count())); ----------------------------------------------------------------------- Summary of changes: src/helper/command.c | 14 ++++++-------- src/helper/command.h | 3 +-- src/jtag/tcl.c | 6 +++--- src/rtos/rtos.c | 2 +- src/target/target.c | 2 +- src/target/target.h | 5 +++-- 6 files changed, 15 insertions(+), 17 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: OpenOCD-Gerrit <ope...@us...> - 2020-05-24 20:36:31
|
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 7456e6bac5a3f13818d16660f3cd049a73a6e3fb (commit) via b342c67f7786fd17734763902dcb0c39286834a0 (commit) from af0db36f92827d24f16c321db4c9636ac37a5f91 (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 7456e6bac5a3f13818d16660f3cd049a73a6e3fb Author: Antonio Borneo <bor...@gm...> Date: Thu May 21 13:24:32 2020 +0200 stlink: fix open AP for v2j37 and v3j7 The new stlink firmware requires opening the AP before issuing any operation. In the current code we have a 'questionable' check about the core model to set the TAR autoincrement, that is issued without opening the AP, thus causing a STLINK_BAD_AP_ERROR. Modify the AP open API to handle this case and open AP#0 before the memory access to check the core model. Change-Id: I576955b5094bd41d63ff1fbad7b4fd9433253321 Signed-off-by: Antonio Borneo <bor...@gm...> Reported-by: Andreas Bolsch <hyp...@gm...> Reviewed-on: http://openocd.zylin.com/5691 Tested-by: jenkins Reviewed-by: Andreas Bolsch <hyp...@gm...> diff --git a/src/jtag/drivers/stlink_usb.c b/src/jtag/drivers/stlink_usb.c index 116d71c6c..3fdb126cf 100644 --- a/src/jtag/drivers/stlink_usb.c +++ b/src/jtag/drivers/stlink_usb.c @@ -361,6 +361,7 @@ static int stlink_swim_status(void *handle); void stlink_dump_speed_map(const struct speed_map *map, unsigned int map_size); static int stlink_get_com_freq(void *handle, bool is_jtag, struct speed_map *map); static int stlink_speed(void *handle, int khz, bool query); +static int stlink_usb_open_ap(void *handle, unsigned short apsel); /** */ static unsigned int stlink_usb_block(void *handle) @@ -2972,6 +2973,7 @@ static int stlink_usb_open(struct hl_interface_param_s *param, enum stlink_mode h->max_mem_packet = (1 << 10); uint8_t buffer[4]; + stlink_usb_open_ap(h, 0); err = stlink_usb_read_mem32(h, CPUID, 4, buffer); if (err == ERROR_OK) { uint32_t cpuid = le_to_h_u32(buffer); @@ -3204,13 +3206,13 @@ static int stlink_dap_get_and_clear_error(void) return retval; } -/** */ -static int stlink_dap_open_ap(unsigned short apsel) +static int stlink_usb_open_ap(void *handle, unsigned short apsel) { + struct stlink_usb_handle_s *h = handle; int retval; /* nothing to do on old versions */ - if (!(stlink_dap_handle->version.flags & STLINK_F_HAS_AP_INIT)) + if (!(h->version.flags & STLINK_F_HAS_AP_INIT)) return ERROR_OK; if (apsel > DP_APSEL_MAX) @@ -3219,7 +3221,7 @@ static int stlink_dap_open_ap(unsigned short apsel) if (test_bit(apsel, opened_ap)) return ERROR_OK; - retval = stlink_usb_init_access_port(stlink_dap_handle, apsel); + retval = stlink_usb_init_access_port(h, apsel); if (retval != ERROR_OK) return retval; @@ -3228,6 +3230,11 @@ static int stlink_dap_open_ap(unsigned short apsel) return ERROR_OK; } +static int stlink_dap_open_ap(unsigned short apsel) +{ + return stlink_usb_open_ap(stlink_dap_handle, apsel); +} + /** */ static int stlink_dap_closeall_ap(void) { commit b342c67f7786fd17734763902dcb0c39286834a0 Author: Antonio Borneo <bor...@gm...> Date: Fri May 15 14:55:42 2020 +0200 stlink: fix incorrectly returned error on v2j28 Firmware v2j28 introduces the API to open and close the AP, but closing AP always returns error 0x1d (STLINK_BAD_AP_ERROR). Ignore the error returned by the bogus firmware on closing AP. Change-Id: I992ddbf7acb10f1d376ed8f781eeb3344605b85d Signed-off-by: Antonio Borneo <bor...@gm...> Reviewed-on: http://openocd.zylin.com/5683 Tested-by: jenkins diff --git a/src/jtag/drivers/stlink_usb.c b/src/jtag/drivers/stlink_usb.c index 79f2f7ee2..116d71c6c 100644 --- a/src/jtag/drivers/stlink_usb.c +++ b/src/jtag/drivers/stlink_usb.c @@ -319,6 +319,7 @@ struct stlink_usb_handle_s { #define STLINK_F_HAS_AP_INIT BIT(7) #define STLINK_F_HAS_DPBANKSEL BIT(8) #define STLINK_F_HAS_RW8_512BYTES BIT(9) +#define STLINK_F_FIX_CLOSE_AP BIT(10) /* aliases */ #define STLINK_F_HAS_TARGET_VOLT STLINK_F_HAS_TRACE @@ -1030,6 +1031,10 @@ static int stlink_usb_version(void *handle) if (h->version.jtag >= 28) flags |= STLINK_F_HAS_AP_INIT; + /* API required to return proper error code on close AP from J29 */ + if (h->version.jtag >= 29) + flags |= STLINK_F_FIX_CLOSE_AP; + /* Banked regs (DPv1 & DPv2) support from V2J32 */ if (h->version.jtag >= 32) flags |= STLINK_F_HAS_DPBANKSEL; @@ -1057,6 +1062,9 @@ static int stlink_usb_version(void *handle) /* API required to init AP before any AP access */ flags |= STLINK_F_HAS_AP_INIT; + /* API required to return proper error code on close AP */ + flags |= STLINK_F_FIX_CLOSE_AP; + /* Banked regs (DPv1 & DPv2) support from V3J2 */ if (h->version.jtag >= 2) flags |= STLINK_F_HAS_DPBANKSEL; @@ -3073,7 +3081,12 @@ static int stlink_usb_close_access_port(void *handle, unsigned char ap_num) h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_APIV2_CLOSE_AP_DBG; h->cmdbuf[h->cmdidx++] = ap_num; - return stlink_usb_xfer_errcheck(handle, h->databuf, 2); + /* ignore incorrectly returned error on bogus FW */ + if (h->version.flags & STLINK_F_FIX_CLOSE_AP) + return stlink_usb_xfer_errcheck(handle, h->databuf, 2); + else + return stlink_usb_xfer_noerrcheck(handle, h->databuf, 2); + } /** */ ----------------------------------------------------------------------- Summary of changes: src/jtag/drivers/stlink_usb.c | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: OpenOCD-Gerrit <ope...@us...> - 2020-05-24 20:36:03
|
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 af0db36f92827d24f16c321db4c9636ac37a5f91 (commit) from 2bc24c06d3ae11d3ec5b128cb1af556669e6c708 (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 af0db36f92827d24f16c321db4c9636ac37a5f91 Author: Antonio Borneo <bor...@gm...> Date: Mon Mar 23 15:58:01 2020 +0100 stlink: default dapdirect to SWD instead of JTAG When the transport is not specified, OpenOCD uses the first listed by the selected adapter driver. The old HLA driver for stlink lists SWD as first. The new driver dapdirect instead lists JTAG, making more difficult a fallback to HLA when dapdirect is not available due to old stlink FW. Plus, in case of JTAG wiring, SWD is still possible, while the opposite is not. Reorder the list of transports to grant the default to SWD. Change-Id: Id9c529e921b148d5b352d4603a9028c2a5f15d83 Signed-off-by: Antonio Borneo <bor...@gm...> Suggested-by: Tarek BOCHKATI <tar...@gm...> Reviewed-on: http://openocd.zylin.com/5538 Tested-by: jenkins Reviewed-by: Tarek BOCHKATI <tar...@gm...> diff --git a/src/jtag/drivers/stlink_usb.c b/src/jtag/drivers/stlink_usb.c index 7281e5843..79f2f7ee2 100644 --- a/src/jtag/drivers/stlink_usb.c +++ b/src/jtag/drivers/stlink_usb.c @@ -3782,7 +3782,7 @@ static const struct swim_driver stlink_swim_ops = { .reconnect = stlink_swim_op_reconnect, }; -static const char *const stlink_dap_transport[] = { "dapdirect_jtag", "dapdirect_swd", "swim", NULL }; +static const char *const stlink_dap_transport[] = { "dapdirect_swd", "dapdirect_jtag", "swim", NULL }; struct adapter_driver stlink_dap_adapter_driver = { .name = "st-link", ----------------------------------------------------------------------- Summary of changes: src/jtag/drivers/stlink_usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- Main OpenOCD repository |
From: OpenOCD-Gerrit <ope...@us...> - 2020-05-24 20:35: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 2bc24c06d3ae11d3ec5b128cb1af556669e6c708 (commit) from 1156fcd79e2700c7094b0a5ab435a4b7f31a8f41 (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 2bc24c06d3ae11d3ec5b128cb1af556669e6c708 Author: Ake Rehnman <ake...@gm...> Date: Sun Mar 29 21:57:53 2020 +0200 stm8 target: make adapter speed settings work Previously the adapter speed settings were hard-coded to connect with low speed then switch over to high speed regardless what was mentioned in the cfg files. Now the stm8 target intercept adapter speed settings and configure the stm8 control registers accordingly. Change-Id: I7419514e5214e4b43b9d51253cf5b7f04a233533 Signed-off-by: Ake Rehnman <ake...@gm...> Reviewed-on: http://openocd.zylin.com/5548 Tested-by: jenkins Reviewed-by: Antonio Borneo <bor...@gm...> diff --git a/src/target/stm8.c b/src/target/stm8.c index c06e0fae7..ce8cfaa51 100644 --- a/src/target/stm8.c +++ b/src/target/stm8.c @@ -45,6 +45,8 @@ static int stm8_set_breakpoint(struct target *target, static void stm8_enable_watchpoints(struct target *target); static int stm8_unset_watchpoint(struct target *target, struct watchpoint *watchpoint); +static int (*adapter_speed)(int speed); +extern struct adapter_driver *adapter_driver; static const struct { unsigned id; @@ -797,8 +799,35 @@ static int stm8_read_memory(struct target *target, target_addr_t address, return retval; } +static int stm8_speed(int speed) +{ + int retval; + uint8_t csr; + + LOG_DEBUG("stm8_speed: %d", speed); + + csr = SAFE_MASK | SWIM_DM; + if (speed >= SWIM_FREQ_HIGH) + csr |= HS; + + LOG_DEBUG("writing B0 to SWIM_CSR (SAFE_MASK + SWIM_DM + HS:%d)", csr & HS ? 1 : 0); + retval = stm8_write_u8(NULL, SWIM_CSR, csr); + if (retval != ERROR_OK) + return retval; + return adapter_speed(speed); +} + static int stm8_init(struct command_context *cmd_ctx, struct target *target) { + /* + * FIXME: this is a temporarily hack that needs better implementation. + * Being the only overwrite of adapter_driver, it prevents declaring const + * the struct adapter_driver. + * intercept adapter_driver->speed() calls + */ + adapter_speed = adapter_driver->speed; + adapter_driver->speed = stm8_speed; + stm8_build_reg_cache(target); return ERROR_OK; @@ -1660,17 +1689,6 @@ static int stm8_examine(struct target *target) if (!target_was_examined(target)) { if (!stm8->swim_configured) { - /* set SWIM_CSR = 0xa0 (enable mem access & mask reset) */ - LOG_DEBUG("writing A0 to SWIM_CSR (SAFE_MASK + SWIM_DM)"); - retval = stm8_write_u8(target, SWIM_CSR, SAFE_MASK + SWIM_DM); - if (retval != ERROR_OK) - return retval; - /* set high speed */ - LOG_DEBUG("writing B0 to SWIM_CSR (SAFE_MASK + SWIM_DM + HS)"); - retval = stm8_write_u8(target, SWIM_CSR, SAFE_MASK + SWIM_DM + HS); - if (retval != ERROR_OK) - return retval; - jtag_config_khz(SWIM_FREQ_HIGH); stm8->swim_configured = true; /* Now is the time to deassert reset if connect_under_reset. diff --git a/tcl/target/stm8l.cfg b/tcl/target/stm8l.cfg index 782350f78..a06c4cb60 100644 --- a/tcl/target/stm8l.cfg +++ b/tcl/target/stm8l.cfg @@ -78,8 +78,10 @@ $_TARGETNAME configure -optionstart $_OPTIONSTART -optionend $_OPTIONEND -blocks # Set stm8l type $_TARGETNAME configure -enable_stm8l -# Set low speed at debug entry -adapter speed 363 +# Set high speed +adapter speed 800 +# Set low speed +#adapter speed 363 reset_config srst_only diff --git a/tcl/target/stm8s.cfg b/tcl/target/stm8s.cfg index 277cdc9fb..2dae65515 100644 --- a/tcl/target/stm8s.cfg +++ b/tcl/target/stm8s.cfg @@ -75,8 +75,10 @@ $_TARGETNAME configure -optionstart $_OPTIONSTART -optionend $_OPTIONEND -blocks # Uncomment this line to enable interrupts while instruction step #$_TARGETNAME configure -enable_step_irq -# Set low speed at debug entry -adapter speed 363 +# Set high speed +adapter speed 800 +# Set low speed +#adapter speed 363 reset_config srst_only ----------------------------------------------------------------------- Summary of changes: src/target/stm8.c | 40 +++++++++++++++++++++++++++++----------- tcl/target/stm8l.cfg | 6 ++++-- tcl/target/stm8s.cfg | 6 ++++-- 3 files changed, 37 insertions(+), 15 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: OpenOCD-Gerrit <ope...@us...> - 2020-05-24 20:34:48
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 1156fcd79e2700c7094b0a5ab435a4b7f31a8f41 (commit) via cc5889883f0b4660d5173f89543da02014f54b9c (commit) from ce9e21b769358b6408aada59810c33544bd8df4d (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 1156fcd79e2700c7094b0a5ab435a4b7f31a8f41 Author: Antonio Borneo <bor...@gm...> Date: Thu Mar 26 10:49:04 2020 +0100 tcl/board: add board ST nucleo-8l152r8 The transport SWIM is selected twice, in board and in target, thus a warning is generated at run-time. It should be fixed by remove a line in the target file, but does not harm so let's keep it there for the time being. Change-Id: I479004dc16005a330d552c8dbd5def61690f9b9f Signed-off-by: Antonio Borneo <bor...@gm...> Reviewed-on: http://openocd.zylin.com/5543 Tested-by: jenkins diff --git a/tcl/board/st_nucleo_8l152r8.cfg b/tcl/board/st_nucleo_8l152r8.cfg new file mode 100644 index 000000000..d3372693d --- /dev/null +++ b/tcl/board/st_nucleo_8l152r8.cfg @@ -0,0 +1,10 @@ +# This is a ST NUCLEO 8L152R8 board with a single STM8L152R8T6 chip. +# http://www.st.com/en/evaluation-tools/nucleo-8l152r8.html + +source [find interface/stlink-dap.cfg] + +transport select swim + +source [find target/stm8l152.cfg] + +reset_config srst_only commit cc5889883f0b4660d5173f89543da02014f54b9c Author: Antonio Borneo <bor...@gm...> Date: Thu Mar 19 12:12:20 2020 +0100 Revert "adapter: expose HLA interface in struct adapter_driver" No reason to keep longer this temporary hack. Remove it by reverting the original commit. Change-Id: I5c6dcdb1f4755b7dba4c03a5033913ef8db35e18 Signed-off-by: Antonio Borneo <bor...@gm...> Reviewed-on: http://openocd.zylin.com/5533 Tested-by: jenkins diff --git a/src/jtag/hla/hla_interface.c b/src/jtag/hla/hla_interface.c index 064c268e4..6d5cdc5e7 100644 --- a/src/jtag/hla/hla_interface.c +++ b/src/jtag/hla/hla_interface.c @@ -361,7 +361,4 @@ struct adapter_driver hl_adapter_driver = { .poll_trace = &hl_interface_poll_trace, /* no ops for HLA, targets hla_target and stm8 intercept them all */ - - /* FIXME: helper to simplify transition of HLA drivers. To be removed */ - .hla_if = &hl_if, }; diff --git a/src/jtag/interface.h b/src/jtag/interface.h index a471aa96d..42598c1ae 100644 --- a/src/jtag/interface.h +++ b/src/jtag/interface.h @@ -38,9 +38,6 @@ */ -/* FIXME: prototype to simplify transition of HLA drivers. To be removed */ -struct hl_interface_s; - /** implementation of wrapper function tap_set_state() */ void tap_set_state_impl(tap_state_t new_state); @@ -366,9 +363,6 @@ struct adapter_driver { /* SWIM APIs */ const struct swim_driver *swim_ops; - - /* FIXME: helper to simplify transition of HLA drivers. To be removed */ - struct hl_interface_s *hla_if; }; extern const char * const jtag_only[]; ----------------------------------------------------------------------- Summary of changes: src/jtag/hla/hla_interface.c | 3 --- src/jtag/interface.h | 6 ------ tcl/board/st_nucleo_8l152r8.cfg | 10 ++++++++++ 3 files changed, 10 insertions(+), 9 deletions(-) create mode 100644 tcl/board/st_nucleo_8l152r8.cfg hooks/post-receive -- Main OpenOCD repository |
From: OpenOCD-Gerrit <ope...@us...> - 2020-05-24 20:34:14
|
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 ce9e21b769358b6408aada59810c33544bd8df4d (commit) from 72f67790cf21b6328c9e599fb549b81f805694fc (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 ce9e21b769358b6408aada59810c33544bd8df4d Author: Antonio Borneo <bor...@gm...> Date: Tue Jan 28 15:53:06 2020 +0100 stlink: simplify handling of SWIM Now that SWIM is not accessed through HLA anymore, decouple the SWIM code and remove the conditional execution. Fix the inconsistency of the return type for stlink_usb_state() in case of SWIM (returns ERROR_OK while type is enum target_state) introduced by commit 3de6b5f6e52f ("jtag/drivers/stlink_usb : implemented and repaired SWIM support"). The code added by commit above in stlink_usb_state() is an hack to reuse existing HLA API to perform a reconnect. Move the SWIM specific code from stlink_usb_state() to a dedicated stlink_swim_op_reconnect() that provides consistent data type. Change-Id: I3fe175fef00b0735bea6139b057f217a080c9d38 Signed-off-by: Antonio Borneo <bor...@gm...> Fixes: 3de6b5f6e52f ("jtag/drivers/stlink_usb : implemented and repaired SWIM support") Reviewed-on: http://openocd.zylin.com/5532 Tested-by: jenkins diff --git a/src/jtag/drivers/stlink_usb.c b/src/jtag/drivers/stlink_usb.c index c866dc54d..7281e5843 100644 --- a/src/jtag/drivers/stlink_usb.c +++ b/src/jtag/drivers/stlink_usb.c @@ -1761,18 +1761,6 @@ static enum target_state stlink_usb_state(void *handle) assert(handle != NULL); - if (h->st_mode == STLINK_MODE_DEBUG_SWIM) { - res = stlink_usb_mode_enter(handle, h->st_mode); - if (res != ERROR_OK) - return TARGET_UNKNOWN; - - res = stlink_swim_resync(handle); - if (res != ERROR_OK) - return TARGET_UNKNOWN; - - return ERROR_OK; - } - if (h->reconnect_pending) { LOG_INFO("Previous state query failed, trying to reconnect"); res = stlink_usb_mode_enter(handle, h->st_mode); @@ -1892,9 +1880,6 @@ static int stlink_usb_reset(void *handle) assert(handle != NULL); - if (h->st_mode == STLINK_MODE_DEBUG_SWIM) - return stlink_swim_generate_rst(handle); - stlink_usb_init_buffer(handle, h->rx_ep, 2); h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_COMMAND; @@ -3536,7 +3521,7 @@ static void stlink_dap_op_quit(struct adiv5_dap *dap) static int stlink_swim_op_srst(void) { - return stlink_usb_reset(stlink_dap_handle); + return stlink_swim_generate_rst(stlink_dap_handle); } static int stlink_swim_op_read_mem(uint32_t addr, uint32_t size, @@ -3587,7 +3572,13 @@ static int stlink_swim_op_write_mem(uint32_t addr, uint32_t size, static int stlink_swim_op_reconnect(void) { - return stlink_usb_state(stlink_dap_handle); + int retval; + + retval = stlink_usb_mode_enter(stlink_dap_handle, STLINK_MODE_DEBUG_SWIM); + if (retval != ERROR_OK) + return retval; + + return stlink_swim_resync(stlink_dap_handle); } static int stlink_dap_config_trace(bool enabled, ----------------------------------------------------------------------- Summary of changes: src/jtag/drivers/stlink_usb.c | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: OpenOCD-Gerrit <ope...@us...> - 2020-05-24 20:33:31
|
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 72f67790cf21b6328c9e599fb549b81f805694fc (commit) from ffe6bc82201ff3dceea193af530738d868258b0b (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 72f67790cf21b6328c9e599fb549b81f805694fc Author: Antonio Borneo <bor...@gm...> Date: Tue Feb 4 12:53:54 2020 +0100 stlink: simplify mem R/W with SWIM Thanks to API separation between SWIM and the other transports, we can easily split the memory read/write for SWIM from the rest of the code. While there, use the macro STLINK_DATA_SIZE as size of data chunks that can be read/write in SWIM. This was not implemented before. Change-Id: I7d913c92539007e4d914480bacc0126a8f0e9705 Signed-off-by: Antonio Borneo <bor...@gm...> Reviewed-on: http://openocd.zylin.com/5531 Tested-by: jenkins diff --git a/src/jtag/drivers/stlink_usb.c b/src/jtag/drivers/stlink_usb.c index 4c5081c9e..c866dc54d 100644 --- a/src/jtag/drivers/stlink_usb.c +++ b/src/jtag/drivers/stlink_usb.c @@ -2322,11 +2322,6 @@ static int stlink_usb_read_mem(void *handle, uint32_t addr, uint32_t size, if (count < bytes_remaining) bytes_remaining = count; - if (h->st_mode == STLINK_MODE_DEBUG_SWIM) { - retval = stlink_swim_readbytes(handle, addr, bytes_remaining, buffer); - if (retval != ERROR_OK) - return retval; - } else /* * all stlink support 8/32bit memory read/writes and only from * stlink V2J26 there is support for 16 bit memory read/write. @@ -2407,11 +2402,6 @@ static int stlink_usb_write_mem(void *handle, uint32_t addr, uint32_t size, if (count < bytes_remaining) bytes_remaining = count; - if (h->st_mode == STLINK_MODE_DEBUG_SWIM) { - retval = stlink_swim_writebytes(handle, addr, bytes_remaining, buffer); - if (retval != ERROR_OK) - return retval; - } else /* * all stlink support 8/32bit memory read/writes and only from * stlink V2J26 there is support for 16 bit memory read/write. @@ -3552,13 +3542,47 @@ static int stlink_swim_op_srst(void) static int stlink_swim_op_read_mem(uint32_t addr, uint32_t size, uint32_t count, uint8_t *buffer) { - return stlink_usb_read_mem(stlink_dap_handle, addr, size, count, buffer); + int retval; + uint32_t bytes_remaining; + + LOG_DEBUG_IO("read at 0x%08x len %d*0x%08x", addr, size, count); + count *= size; + + while (count) { + bytes_remaining = (count > STLINK_DATA_SIZE) ? STLINK_DATA_SIZE : count; + retval = stlink_swim_readbytes(stlink_dap_handle, addr, bytes_remaining, buffer); + if (retval != ERROR_OK) + return retval; + + buffer += bytes_remaining; + addr += bytes_remaining; + count -= bytes_remaining; + } + + return ERROR_OK; } static int stlink_swim_op_write_mem(uint32_t addr, uint32_t size, uint32_t count, const uint8_t *buffer) { - return stlink_usb_write_mem(stlink_dap_handle, addr, size, count, buffer); + int retval; + uint32_t bytes_remaining; + + LOG_DEBUG_IO("write at 0x%08x len %d*0x%08x", addr, size, count); + count *= size; + + while (count) { + bytes_remaining = (count > STLINK_DATA_SIZE) ? STLINK_DATA_SIZE : count; + retval = stlink_swim_writebytes(stlink_dap_handle, addr, bytes_remaining, buffer); + if (retval != ERROR_OK) + return retval; + + buffer += bytes_remaining; + addr += bytes_remaining; + count -= bytes_remaining; + } + + return ERROR_OK; } static int stlink_swim_op_reconnect(void) ----------------------------------------------------------------------- Summary of changes: src/jtag/drivers/stlink_usb.c | 48 ++++++++++++++++++++++++++++++++----------- 1 file changed, 36 insertions(+), 12 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: OpenOCD-Gerrit <ope...@us...> - 2020-05-24 20:32:49
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via ffe6bc82201ff3dceea193af530738d868258b0b (commit) from ac05f929edffd6f1a4491d0b1e6cc95122ec6eb1 (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 ffe6bc82201ff3dceea193af530738d868258b0b Author: Antonio Borneo <bor...@gm...> Date: Mon Jan 27 18:45:10 2020 +0100 swim: add new transport Add SWIM and STM8 to documentation and update TODO file. Introduce transport "swim" and command "swim newtap". Switch in swim.c from HLA API to the new SWIM API. Implement in stlink driver the SWIM APIs as wrappers of existing HLA functions. Remove any SWIM related reference from HLA files. Update stm8 config files and stlink-dap interface config file. Change-Id: I2bb9f58d52900f6eb4df05f979f7ef11fd439c24 Signed-off-by: Antonio Borneo <bor...@gm...> Reviewed-on: http://openocd.zylin.com/5530 Tested-by: jenkins diff --git a/TODO b/TODO index c73d772e2..ebb6c9980 100644 --- a/TODO +++ b/TODO @@ -59,8 +59,7 @@ changes pending in gerrit. - tap_set_state(TAP_RESET) is already done in src/jtag/core.c. No need to replicate it in the drivers, apart in case the driver sets TRST independently -- separate SWIM from HLA and make it independent -- add .hla_ops and .swim_ops to "adapter" +- add .hla_ops to "adapter" - HLA is a API level (.hla_ops). Transport should simply be {jtag,swd}, not {hla_jtag,hla_swd}. diff --git a/doc/openocd.texi b/doc/openocd.texi index ef77993ec..1ddf09ffa 100644 --- a/doc/openocd.texi +++ b/doc/openocd.texi @@ -3304,6 +3304,24 @@ The Serial Peripheral Interface (SPI) is a general purpose transport which uses four wire signaling. Some processors use it as part of a solution for flash programming. +@anchor{swimtransport} +@subsection SWIM Transport +@cindex SWIM +@cindex Single Wire Interface Module +The Single Wire Interface Module (SWIM) is a low-pin-count debug protocol used +by the STMicroelectronics MCU family STM8 and documented in the +@uref{https://www.st.com/resource/en/user_manual/cd00173911.pdf, User Manual UM470}. + +SWIM does not support boundary scan testing nor multiple cores. + +The SWIM transport is selected with the command @command{transport select swim}. + +The concept of TAPs does not fit in the protocol since SWIM does not implement +a scan chain. Nevertheless, the current SW model of OpenOCD requires defining a +virtual SWIM TAP through the command @command{swim newtap basename tap_type}. +The TAP definition must precede the target definition command +@command{target create target_name stm8 -chain-position basename.tap_type}. + @anchor{jtagspeed} @section JTAG Speed JTAG clock setup is part of system setup. @@ -9831,6 +9849,12 @@ This command is similar to @command{arc jtag get-aux-reg} but is for core registers. @end deffn +@section STM8 Architecture +@uref{http://st.com/stm8/, STM8} is a 8-bit microcontroller platform from +STMicroelectronics, based on a proprietary 8-bit core architecture. + +OpenOCD supports debugging STM8 through the STMicroelectronics debug +protocol SWIM, @pxref{swimtransport,,SWIM}. @anchor{softwaredebugmessagesandtracing} @section Software Debug Messages and Tracing diff --git a/src/jtag/core.c b/src/jtag/core.c index d83f19503..1d424b2e4 100644 --- a/src/jtag/core.c +++ b/src/jtag/core.c @@ -2027,7 +2027,8 @@ int adapter_resets(int trst, int srst) jtag_execute_queue(); return ERROR_OK; } else if (transport_is_swd() || transport_is_hla() || - transport_is_dapdirect_swd() || transport_is_dapdirect_jtag()) { + transport_is_dapdirect_swd() || transport_is_dapdirect_jtag() || + transport_is_swim()) { if (trst == TRST_ASSERT) { LOG_ERROR("transport %s has no trst signal", get_current_transport()->name); @@ -2060,7 +2061,8 @@ int adapter_assert_reset(void) jtag_add_reset(0, 1); return ERROR_OK; } else if (transport_is_swd() || transport_is_hla() || - transport_is_dapdirect_jtag() || transport_is_dapdirect_swd()) + transport_is_dapdirect_jtag() || transport_is_dapdirect_swd() || + transport_is_swim()) return adapter_system_reset(1); else if (get_current_transport() != NULL) LOG_ERROR("reset is not supported on %s", @@ -2076,7 +2078,8 @@ int adapter_deassert_reset(void) jtag_add_reset(0, 0); return ERROR_OK; } else if (transport_is_swd() || transport_is_hla() || - transport_is_dapdirect_jtag() || transport_is_dapdirect_swd()) + transport_is_dapdirect_jtag() || transport_is_dapdirect_swd() || + transport_is_swim()) return adapter_system_reset(0); else if (get_current_transport() != NULL) LOG_ERROR("reset is not supported on %s", diff --git a/src/jtag/drivers/stlink_usb.c b/src/jtag/drivers/stlink_usb.c index 485a95c6b..4c5081c9e 100644 --- a/src/jtag/drivers/stlink_usb.c +++ b/src/jtag/drivers/stlink_usb.c @@ -1288,8 +1288,6 @@ static enum stlink_mode stlink_get_mode(enum hl_transports t) return STLINK_MODE_DEBUG_SWD; case HL_TRANSPORT_JTAG: return STLINK_MODE_DEBUG_JTAG; - case HL_TRANSPORT_SWIM: - return STLINK_MODE_DEBUG_SWIM; default: return STLINK_MODE_UNKNOWN; } @@ -3546,6 +3544,28 @@ static void stlink_dap_op_quit(struct adiv5_dap *dap) LOG_ERROR("Error closing APs"); } +static int stlink_swim_op_srst(void) +{ + return stlink_usb_reset(stlink_dap_handle); +} + +static int stlink_swim_op_read_mem(uint32_t addr, uint32_t size, + uint32_t count, uint8_t *buffer) +{ + return stlink_usb_read_mem(stlink_dap_handle, addr, size, count, buffer); +} + +static int stlink_swim_op_write_mem(uint32_t addr, uint32_t size, + uint32_t count, const uint8_t *buffer) +{ + return stlink_usb_write_mem(stlink_dap_handle, addr, size, count, buffer); +} + +static int stlink_swim_op_reconnect(void) +{ + return stlink_usb_state(stlink_dap_handle); +} + static int stlink_dap_config_trace(bool enabled, enum tpiu_pin_protocol pin_protocol, uint32_t port_size, unsigned int *trace_freq, unsigned int traceclkin_freq, @@ -3656,6 +3676,8 @@ static int stlink_dap_init(void) mode = STLINK_MODE_DEBUG_SWD; else if (transport_is_dapdirect_jtag()) mode = STLINK_MODE_DEBUG_JTAG; + else if (transport_is_swim()) + mode = STLINK_MODE_DEBUG_SWIM; else { LOG_ERROR("Unsupported transport"); return ERROR_FAIL; @@ -3665,7 +3687,8 @@ static int stlink_dap_init(void) if (retval != ERROR_OK) return retval; - if (!(stlink_dap_handle->version.flags & STLINK_F_HAS_DAP_REG)) { + if ((mode != STLINK_MODE_DEBUG_SWIM) && + !(stlink_dap_handle->version.flags & STLINK_F_HAS_DAP_REG)) { LOG_ERROR("ST-Link version does not support DAP direct transport"); return ERROR_FAIL; } @@ -3737,7 +3760,14 @@ static const struct dap_ops stlink_dap_ops = { .quit = stlink_dap_op_quit, /* optional */ }; -static const char *const stlink_dap_transport[] = { "dapdirect_jtag", "dapdirect_swd", NULL }; +static const struct swim_driver stlink_swim_ops = { + .srst = stlink_swim_op_srst, + .read_mem = stlink_swim_op_read_mem, + .write_mem = stlink_swim_op_write_mem, + .reconnect = stlink_swim_op_reconnect, +}; + +static const char *const stlink_dap_transport[] = { "dapdirect_jtag", "dapdirect_swd", "swim", NULL }; struct adapter_driver stlink_dap_adapter_driver = { .name = "st-link", @@ -3755,4 +3785,5 @@ struct adapter_driver stlink_dap_adapter_driver = { .dap_jtag_ops = &stlink_dap_ops, .dap_swd_ops = &stlink_dap_ops, + .swim_ops = &stlink_swim_ops, }; diff --git a/src/jtag/hla/hla_transport.c b/src/jtag/hla/hla_transport.c index ddacea36a..fbdddfd65 100644 --- a/src/jtag/hla/hla_transport.c +++ b/src/jtag/hla/hla_transport.c @@ -175,8 +175,6 @@ static int hl_transport_init(struct command_context *cmd_ctx) tr = HL_TRANSPORT_SWD; else if (strcmp(transport->name, "hla_jtag") == 0) tr = HL_TRANSPORT_JTAG; - else if (strcmp(transport->name, "stlink_swim") == 0) - tr = HL_TRANSPORT_SWIM; int retval = hl_interface_open(tr); @@ -218,26 +216,18 @@ static struct transport hl_jtag_transport = { .override_target = hl_interface_override_target, }; -static struct transport stlink_swim_transport = { - .name = "stlink_swim", - .select = hl_transport_select, - .init = hl_transport_init, -}; - -const char *hl_transports[] = { "hla_swd", "hla_jtag", "stlink_swim", NULL }; +const char *hl_transports[] = { "hla_swd", "hla_jtag", NULL }; static void hl_constructor(void) __attribute__ ((constructor)); static void hl_constructor(void) { transport_register(&hl_swd_transport); transport_register(&hl_jtag_transport); - transport_register(&stlink_swim_transport); } bool transport_is_hla(void) { struct transport *t; t = get_current_transport(); - return t == &hl_swd_transport || t == &hl_jtag_transport - || t == &stlink_swim_transport; + return t == &hl_swd_transport || t == &hl_jtag_transport; } diff --git a/src/jtag/hla/hla_transport.h b/src/jtag/hla/hla_transport.h index 07eb751e2..0e0bea25f 100644 --- a/src/jtag/hla/hla_transport.h +++ b/src/jtag/hla/hla_transport.h @@ -26,7 +26,6 @@ enum hl_transports { HL_TRANSPORT_UNKNOWN = 0, HL_TRANSPORT_SWD, HL_TRANSPORT_JTAG, - HL_TRANSPORT_SWIM }; #endif /* OPENOCD_JTAG_HLA_HLA_TRANSPORT_H */ diff --git a/src/jtag/interface.h b/src/jtag/interface.h index 91291dbd1..a471aa96d 100644 --- a/src/jtag/interface.h +++ b/src/jtag/interface.h @@ -26,6 +26,7 @@ #define OPENOCD_JTAG_INTERFACE_H #include <jtag/jtag.h> +#include <jtag/swim.h> #include <target/armv7m_trace.h> /* @file @@ -363,6 +364,9 @@ struct adapter_driver { /* DAP APIs over SWD transport */ const struct dap_ops *dap_swd_ops; + /* SWIM APIs */ + const struct swim_driver *swim_ops; + /* FIXME: helper to simplify transition of HLA drivers. To be removed */ struct hl_interface_s *hla_if; }; diff --git a/src/jtag/swim.c b/src/jtag/swim.c index 965018c27..936268b25 100644 --- a/src/jtag/swim.c +++ b/src/jtag/swim.c @@ -14,38 +14,140 @@ #include "interface.h" #include "swim.h" -#include "jtag/hla/hla_transport.h" -#include "jtag/hla/hla_interface.h" -#include "jtag/hla/hla_layout.h" +#include <helper/command.h> +#include <transport/transport.h> extern struct adapter_driver *adapter_driver; int swim_system_reset(void) { - assert(adapter_driver->hla_if); + assert(adapter_driver->swim_ops); - return adapter_driver->hla_if->layout->api->reset(adapter_driver->hla_if->handle); + return adapter_driver->swim_ops->srst(); } int swim_read_mem(uint32_t addr, uint32_t size, uint32_t count, uint8_t *buffer) { - assert(adapter_driver->hla_if); + assert(adapter_driver->swim_ops); - return adapter_driver->hla_if->layout->api->read_mem(adapter_driver->hla_if->handle, addr, size, count, buffer); + return adapter_driver->swim_ops->read_mem(addr, size, count, buffer); } int swim_write_mem(uint32_t addr, uint32_t size, uint32_t count, const uint8_t *buffer) { - assert(adapter_driver->hla_if); + assert(adapter_driver->swim_ops); - return adapter_driver->hla_if->layout->api->write_mem(adapter_driver->hla_if->handle, addr, size, count, buffer); + return adapter_driver->swim_ops->write_mem(addr, size, count, buffer); } int swim_reconnect(void) { - assert(adapter_driver->hla_if); + assert(adapter_driver->swim_ops); - return adapter_driver->hla_if->layout->api->state(adapter_driver->hla_if->handle); + return adapter_driver->swim_ops->reconnect(); +} + +COMMAND_HANDLER(handle_swim_newtap_command) +{ + struct jtag_tap *tap; + + /* + * only need "basename" and "tap_type", but for backward compatibility + * ignore extra parameters + */ + if (CMD_ARGC < 2) + return ERROR_COMMAND_SYNTAX_ERROR; + + tap = calloc(1, sizeof(*tap)); + if (!tap) { + LOG_ERROR("Out of memory"); + return ERROR_FAIL; + } + + tap->chip = strdup(CMD_ARGV[0]); + tap->tapname = strdup(CMD_ARGV[1]); + tap->dotted_name = alloc_printf("%s.%s", CMD_ARGV[0], CMD_ARGV[1]); + if (!tap->chip || !tap->tapname || !tap->dotted_name) { + LOG_ERROR("Out of memory"); + free(tap->dotted_name); + free(tap->tapname); + free(tap->chip); + free(tap); + return ERROR_FAIL; + } + + LOG_DEBUG("Creating new SWIM \"tap\", Chip: %s, Tap: %s, Dotted: %s", + tap->chip, tap->tapname, tap->dotted_name); + + /* default is enabled-after-reset */ + tap->enabled = true; + + jtag_tap_init(tap); + return ERROR_OK; +} + +static const struct command_registration swim_transport_subcommand_handlers[] = { + { + .name = "newtap", + .handler = handle_swim_newtap_command, + .mode = COMMAND_CONFIG, + .help = "Create a new TAP instance named basename.tap_type, " + "and appends it to the scan chain.", + .usage = "basename tap_type", + }, + COMMAND_REGISTRATION_DONE +}; + +static const struct command_registration swim_transport_command_handlers[] = { + { + .name = "swim", + .mode = COMMAND_ANY, + .help = "perform swim adapter actions", + .usage = "", + .chain = swim_transport_subcommand_handlers, + }, + COMMAND_REGISTRATION_DONE +}; + +static int swim_transport_select(struct command_context *cmd_ctx) +{ + LOG_DEBUG(__func__); + + return register_commands(cmd_ctx, NULL, swim_transport_command_handlers); +} + +static int swim_transport_init(struct command_context *cmd_ctx) +{ + enum reset_types jtag_reset_config = jtag_get_reset_config(); + + LOG_DEBUG(__func__); + + if (jtag_reset_config & RESET_CNCT_UNDER_SRST) { + if (jtag_reset_config & RESET_SRST_NO_GATING) + adapter_assert_reset(); + else + LOG_WARNING("\'srst_nogate\' reset_config option is required"); + } else + adapter_deassert_reset(); + + return ERROR_OK; +} + +static struct transport swim_transport = { + .name = "swim", + .select = swim_transport_select, + .init = swim_transport_init, +}; + +static void swim_constructor(void) __attribute__ ((constructor)); +static void swim_constructor(void) +{ + transport_register(&swim_transport); +} + +bool transport_is_swim(void) +{ + return get_current_transport() == &swim_transport; } diff --git a/src/transport/transport.h b/src/transport/transport.h index 4effca5d5..809564e78 100644 --- a/src/transport/transport.h +++ b/src/transport/transport.h @@ -98,6 +98,7 @@ bool transport_is_jtag(void); bool transport_is_swd(void); bool transport_is_dapdirect_jtag(void); bool transport_is_dapdirect_swd(void); +bool transport_is_swim(void); #if BUILD_HLADAPTER bool transport_is_hla(void); diff --git a/tcl/interface/stlink-dap.cfg b/tcl/interface/stlink-dap.cfg index 4576ad388..ac4de18f9 100644 --- a/tcl/interface/stlink-dap.cfg +++ b/tcl/interface/stlink-dap.cfg @@ -1,16 +1,19 @@ # -# STMicroelectronics ST-LINK/V2, ST-LINK/V2-1, STLINK-V3 in-circuit +# STMicroelectronics ST-LINK/V1, ST-LINK/V2, ST-LINK/V2-1, STLINK-V3 in-circuit # debugger/programmer # -# This new interface driver creates a ST-Link wrapper for ARM-DAP -# Old ST-LINK/V1 and ST-LINK/V2 pre version V2J24 don't support this method +# This new interface driver creates a ST-Link wrapper for ARM-DAP named "dapdirect" +# Old ST-LINK/V1 and ST-LINK/V2 pre version V2J24 don't support "dapdirect" +# +# SWIM transport is natively supported # adapter driver st-link -st-link vid_pid 0x0483 0x3748 0x0483 0x374b 0x0483 0x374d 0x0483 0x374e 0x0483 0x374f 0x0483 0x3752 0x0483 0x3753 +st-link vid_pid 0x0483 0x3744 0x0483 0x3748 0x0483 0x374b 0x0483 0x374d 0x0483 0x374e 0x0483 0x374f 0x0483 0x3752 0x0483 0x3753 # transport select dapdirect_jtag # transport select dapdirect_swd +# transport select swim # Optionally specify the serial number of usb device # e.g. diff --git a/tcl/target/stm8l.cfg b/tcl/target/stm8l.cfg index f3c94280a..782350f78 100644 --- a/tcl/target/stm8l.cfg +++ b/tcl/target/stm8l.cfg @@ -4,7 +4,7 @@ # stm8 devices support SWIM transports only. # -transport select stlink_swim +transport select swim if { [info exists CHIPNAME] } { set _CHIPNAME $CHIPNAME @@ -62,7 +62,7 @@ if { [info exists BLOCKSIZE] } { set _BLOCKSIZE 0x80 } -hla newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id 0 +swim newtap $_CHIPNAME cpu set _TARGETNAME $_CHIPNAME.cpu diff --git a/tcl/target/stm8s.cfg b/tcl/target/stm8s.cfg index 5d52aea12..277cdc9fb 100644 --- a/tcl/target/stm8s.cfg +++ b/tcl/target/stm8s.cfg @@ -4,7 +4,7 @@ # stm8 devices support SWIM transports only. # -transport select stlink_swim +transport select swim if { [info exists CHIPNAME] } { set _CHIPNAME $CHIPNAME @@ -62,7 +62,7 @@ if { [info exists BLOCKSIZE] } { set _BLOCKSIZE 0x80 } -hla newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id 0 +swim newtap $_CHIPNAME cpu set _TARGETNAME $_CHIPNAME.cpu ----------------------------------------------------------------------- Summary of changes: TODO | 3 +- doc/openocd.texi | 24 ++++++++ src/jtag/core.c | 9 ++- src/jtag/drivers/stlink_usb.c | 39 +++++++++++-- src/jtag/hla/hla_transport.c | 14 +---- src/jtag/hla/hla_transport.h | 1 - src/jtag/interface.h | 4 ++ src/jtag/swim.c | 124 ++++++++++++++++++++++++++++++++++++++---- src/transport/transport.h | 1 + tcl/interface/stlink-dap.cfg | 11 ++-- tcl/target/stm8l.cfg | 4 +- tcl/target/stm8s.cfg | 4 +- 12 files changed, 197 insertions(+), 41 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: OpenOCD-Gerrit <ope...@us...> - 2020-05-24 20:32:16
|
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 ac05f929edffd6f1a4491d0b1e6cc95122ec6eb1 (commit) from ac18e960ce79f06b22e71a17415be0feb741a482 (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 ac05f929edffd6f1a4491d0b1e6cc95122ec6eb1 Author: Antonio Borneo <bor...@gm...> Date: Tue Feb 4 11:07:01 2020 +0100 swim: fix adapter speed handling SWIM transport only supports two adapter speeds: - "low speed" equal to 363 kHz (8 MHz / 22) - "high speed" equal to 800 kHz (8 MHz / 10) Replace the previous convention that use "0" or "1" for "low" or "high" speed with the effective speed in kHz. Rework the implementation of stlink_speed_swim(). Set low speed in the stm8 config files, because only low speed is permitted at debug connection; the previous code ignores the initial value. Change-Id: I2484c9419a2c554c59eb6b9216339393ab0b54f3 Signed-off-by: Antonio Borneo <bor...@gm...> Reviewed-on: http://openocd.zylin.com/5529 Tested-by: jenkins diff --git a/src/jtag/drivers/stlink_usb.c b/src/jtag/drivers/stlink_usb.c index aef02c563..485a95c6b 100644 --- a/src/jtag/drivers/stlink_usb.c +++ b/src/jtag/drivers/stlink_usb.c @@ -36,6 +36,7 @@ #include <jtag/hla/hla_layout.h> #include <jtag/hla/hla_transport.h> #include <jtag/hla/hla_interface.h> +#include <jtag/swim.h> #include <target/target.h> #include <transport/transport.h> @@ -2478,17 +2479,20 @@ static int stlink_usb_override_target(const char *targetname) static int stlink_speed_swim(void *handle, int khz, bool query) { + int retval; + /* - we dont care what the khz rate is we only have low and high speed... before changing speed the SWIM_CSR HS bit must be updated */ - if (khz == 0) - stlink_swim_speed(handle, 0); - else - stlink_swim_speed(handle, 1); - return khz; + if (!query) { + retval = stlink_swim_speed(handle, (khz < SWIM_FREQ_HIGH) ? 0 : 1); + if (retval != ERROR_OK) + LOG_ERROR("Unable to set adapter speed"); + } + + return (khz < SWIM_FREQ_HIGH) ? SWIM_FREQ_LOW : SWIM_FREQ_HIGH; } static int stlink_match_speed_map(const struct speed_map *map, unsigned int map_size, int khz, bool query) diff --git a/src/jtag/swim.h b/src/jtag/swim.h index d0ae18eab..186e0cc71 100644 --- a/src/jtag/swim.h +++ b/src/jtag/swim.h @@ -13,6 +13,9 @@ #ifndef OPENOCD_JTAG_SWIM_H #define OPENOCD_JTAG_SWIM_H +#define SWIM_FREQ_LOW 363 +#define SWIM_FREQ_HIGH 800 + struct swim_driver { /** * Send SRST (system reset) command to target. diff --git a/src/target/stm8.c b/src/target/stm8.c index ad05b54f9..c06e0fae7 100644 --- a/src/target/stm8.c +++ b/src/target/stm8.c @@ -1670,7 +1670,7 @@ static int stm8_examine(struct target *target) retval = stm8_write_u8(target, SWIM_CSR, SAFE_MASK + SWIM_DM + HS); if (retval != ERROR_OK) return retval; - jtag_config_khz(1); + jtag_config_khz(SWIM_FREQ_HIGH); stm8->swim_configured = true; /* Now is the time to deassert reset if connect_under_reset. diff --git a/tcl/target/stm8l.cfg b/tcl/target/stm8l.cfg index 386f371ea..f3c94280a 100644 --- a/tcl/target/stm8l.cfg +++ b/tcl/target/stm8l.cfg @@ -78,8 +78,8 @@ $_TARGETNAME configure -optionstart $_OPTIONSTART -optionend $_OPTIONEND -blocks # Set stm8l type $_TARGETNAME configure -enable_stm8l -# The khz rate does not apply here, only slow <0> and fast <1> -adapter speed 1 +# Set low speed at debug entry +adapter speed 363 reset_config srst_only diff --git a/tcl/target/stm8s.cfg b/tcl/target/stm8s.cfg index 4768068e8..5d52aea12 100644 --- a/tcl/target/stm8s.cfg +++ b/tcl/target/stm8s.cfg @@ -75,8 +75,8 @@ $_TARGETNAME configure -optionstart $_OPTIONSTART -optionend $_OPTIONEND -blocks # Uncomment this line to enable interrupts while instruction step #$_TARGETNAME configure -enable_step_irq -# The khz rate does not apply here, only slow <0> and fast <1> -adapter speed 1 +# Set low speed at debug entry +adapter speed 363 reset_config srst_only ----------------------------------------------------------------------- Summary of changes: src/jtag/drivers/stlink_usb.c | 16 ++++++++++------ src/jtag/swim.h | 3 +++ src/target/stm8.c | 2 +- tcl/target/stm8l.cfg | 4 ++-- tcl/target/stm8s.cfg | 4 ++-- 5 files changed, 18 insertions(+), 11 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: OpenOCD-Gerrit <ope...@us...> - 2020-05-24 20:30:27
|
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 ac18e960ce79f06b22e71a17415be0feb741a482 (commit) from 93c4c0fcbec1ebcb2ce19b37c39b63f10a91b9e8 (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 ac18e960ce79f06b22e71a17415be0feb741a482 Author: Antonio Borneo <bor...@gm...> Date: Sun Jan 26 17:00:55 2020 +0100 swim: abstract the transport in stm8 target SWIM is implemented by (ab)using the HLA API. This was acceptable when OpenOCD code did not provided a clear separation between transports and related APIs. Still today SWIM in OpenOCD is only supported by STLink, so the decision to re-use the HLA API was the simpler way to implement it. After commit efd1d642220a ("adapter: switch from struct jtag_interface to adapter_driver") the transports API are better split and SWIM can be implemented as a separate set of API. This would open the possibility to extend OpenOCD for other adapters that provide SWIM, e.g. versaloon, or through SPI emulation [1]. Introduce a new set of files swim.[ch] to handle the SWIM API. Beside the API that almost match the transport low-level data communication (system_reset, read_mem, write_mem), add a further API reconnect. Today, inside HLA STLink code, the reconnect is implemented by hacking the HLA API state(). Please notice that due to this hack the return type is incorrect; stlink_usb_state() returns ERROR_OK in SWIM mode, while its return type is enum target_state. Ignore the type mismatch and still call the HLA API state in the new SWIM API reconnect. Further commit will fix it. [1] http://kuku.eu.org/?projects/stm8spi/stm8spi Change-Id: I52018e1e2200cbd41af8e5031f7b35dc761b61d6 Signed-off-by: Antonio Borneo <bor...@gm...> Reviewed-on: http://openocd.zylin.com/5528 Tested-by: jenkins diff --git a/src/jtag/Makefile.am b/src/jtag/Makefile.am index a76486399..b82914bcb 100644 --- a/src/jtag/Makefile.am +++ b/src/jtag/Makefile.am @@ -56,6 +56,7 @@ endif %D%/interface.c \ %D%/interfaces.c \ %D%/tcl.c \ + %D%/swim.c \ %D%/commands.h \ %D%/driver.h \ %D%/interface.h \ @@ -65,6 +66,7 @@ endif %D%/minidriver/minidriver_imp.h \ %D%/minidummy/jtag_minidriver.h \ %D%/swd.h \ + %D%/swim.h \ %D%/tcl.h \ $(JTAG_SRCS) diff --git a/src/jtag/swim.c b/src/jtag/swim.c new file mode 100644 index 000000000..965018c27 --- /dev/null +++ b/src/jtag/swim.c @@ -0,0 +1,51 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +/* + * Copyright (C) 2020 by Antonio Borneo <bor...@gm... + * + * SWIM (Single Wire Interface Module) is a low-pin-count debug protocol + * used by STMicroelectronics MCU family STM8 and documented in UM470 + * https://www.st.com/resource/en/user_manual/cd00173911.pdf + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "interface.h" +#include "swim.h" +#include "jtag/hla/hla_transport.h" +#include "jtag/hla/hla_interface.h" +#include "jtag/hla/hla_layout.h" + +extern struct adapter_driver *adapter_driver; + +int swim_system_reset(void) +{ + assert(adapter_driver->hla_if); + + return adapter_driver->hla_if->layout->api->reset(adapter_driver->hla_if->handle); +} + +int swim_read_mem(uint32_t addr, uint32_t size, uint32_t count, + uint8_t *buffer) +{ + assert(adapter_driver->hla_if); + + return adapter_driver->hla_if->layout->api->read_mem(adapter_driver->hla_if->handle, addr, size, count, buffer); +} + +int swim_write_mem(uint32_t addr, uint32_t size, uint32_t count, + const uint8_t *buffer) +{ + assert(adapter_driver->hla_if); + + return adapter_driver->hla_if->layout->api->write_mem(adapter_driver->hla_if->handle, addr, size, count, buffer); +} + +int swim_reconnect(void) +{ + assert(adapter_driver->hla_if); + + return adapter_driver->hla_if->layout->api->state(adapter_driver->hla_if->handle); +} diff --git a/src/jtag/swim.h b/src/jtag/swim.h new file mode 100644 index 000000000..d0ae18eab --- /dev/null +++ b/src/jtag/swim.h @@ -0,0 +1,65 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +/* + * Copyright (C) 2020 by Antonio Borneo <bor...@gm... + */ + +/** + * @file + * This file implements support for STMicroelectronics debug protocol SWIM + * (Single Wire Interface Module). + */ + +#ifndef OPENOCD_JTAG_SWIM_H +#define OPENOCD_JTAG_SWIM_H + +struct swim_driver { + /** + * Send SRST (system reset) command to target. + * + * @return ERROR_OK on success, else a fault code. + */ + int (*srst)(void); + + /** + * Read target memory through ROTF (read on-the-fly) command. + * + * @param addr Start address to read data from target memory. + * @param size Size in bytes of data units, 1, 2 or 4. + * @param count Number of units (size units, not bytes) to read. + * @param buffer Data buffer to receive data. + * @return ERROR_OK on success, else a fault code. + */ + int (*read_mem)(uint32_t addr, uint32_t size, uint32_t count, + uint8_t *buffer); + + /** + * Write target memory through WOTF (write on-the-fly) command. + * + * @param addr Start address to write data to target memory. + * @param size Size in bytes of data units, 1, 2 or 4. + * @param count Number of units (size units, not bytes) to write. + * @param buffer Data buffer to write. + * @return ERROR_OK on success, else a fault code. + */ + int (*write_mem)(uint32_t addr, uint32_t size, uint32_t count, + const uint8_t *buffer); + + /** + * Reconnect to the target. + * Should be reworked to be more generic and not linked to current + * implementation in stlink driver. + * + * @return ERROR_OK on success, else a fault code. + */ + int (*reconnect)(void); +}; + +int swim_system_reset(void); +int swim_read_mem(uint32_t addr, uint32_t size, uint32_t count, + uint8_t *buffer); +int swim_write_mem(uint32_t addr, uint32_t size, uint32_t count, + const uint8_t *buffer); +int swim_reconnect(void); + +#endif /* OPENOCD_JTAG_SWIM_H */ diff --git a/src/target/stm8.c b/src/target/stm8.c index 6b03bb5a4..ad05b54f9 100644 --- a/src/target/stm8.c +++ b/src/target/stm8.c @@ -27,9 +27,7 @@ #include "hello.h" #include "jtag/interface.h" #include "jtag/jtag.h" -#include "jtag/hla/hla_transport.h" -#include "jtag/hla/hla_interface.h" -#include "jtag/hla/hla_layout.h" +#include "jtag/swim.h" #include "register.h" #include "breakpoints.h" #include "algorithm.h" @@ -180,68 +178,31 @@ struct stm8_comparator { enum hw_break_type type; }; -static inline struct hl_interface_s *target_to_adapter(struct target *target) -{ - return target->tap->priv; -} - static int stm8_adapter_read_memory(struct target *target, uint32_t addr, int size, int count, void *buf) { - int ret; - struct hl_interface_s *adapter = target_to_adapter(target); - - ret = adapter->layout->api->read_mem(adapter->handle, - addr, size, count, buf); - if (ret != ERROR_OK) - return ret; - return ERROR_OK; + return swim_read_mem(addr, size, count, buf); } static int stm8_adapter_write_memory(struct target *target, uint32_t addr, int size, int count, const void *buf) { - int ret; - struct hl_interface_s *adapter = target_to_adapter(target); - - ret = adapter->layout->api->write_mem(adapter->handle, - addr, size, count, buf); - if (ret != ERROR_OK) - return ret; - return ERROR_OK; + return swim_write_mem(addr, size, count, buf); } static int stm8_write_u8(struct target *target, uint32_t addr, uint8_t val) { - int ret; uint8_t buf[1]; - struct hl_interface_s *adapter = target_to_adapter(target); buf[0] = val; - ret = adapter->layout->api->write_mem(adapter->handle, addr, 1, 1, buf); - if (ret != ERROR_OK) - return ret; - return ERROR_OK; + return swim_write_mem(addr, 1, 1, buf); } static int stm8_read_u8(struct target *target, uint32_t addr, uint8_t *val) { - int ret; - struct hl_interface_s *adapter = target_to_adapter(target); - - ret = adapter->layout->api->read_mem(adapter->handle, addr, 1, 1, val); - if (ret != ERROR_OK) - return ret; - return ERROR_OK; -} - -static int stm8_set_speed(struct target *target, int speed) -{ - struct hl_interface_s *adapter = target_to_adapter(target); - adapter->layout->api->speed(adapter->handle, speed, 0); - return ERROR_OK; + return swim_read_mem(addr, 1, 1, val); } /* @@ -924,7 +885,6 @@ static int stm8_halt(struct target *target) static int stm8_reset_assert(struct target *target) { int res = ERROR_OK; - struct hl_interface_s *adapter = target_to_adapter(target); struct stm8_common *stm8 = target_to_stm8(target); bool use_srst_fallback = true; @@ -942,7 +902,7 @@ static int stm8_reset_assert(struct target *target) if (use_srst_fallback) { LOG_DEBUG("Hardware srst not supported, falling back to swim reset"); - res = adapter->layout->api->reset(adapter->handle); + res = swim_system_reset(); if (res != ERROR_OK) return res; } @@ -1696,7 +1656,7 @@ static int stm8_examine(struct target *target) uint8_t csr1, csr2; /* get pointers to arch-specific information */ struct stm8_common *stm8 = target_to_stm8(target); - struct hl_interface_s *adapter = target_to_adapter(target); + enum reset_types jtag_reset_config = jtag_get_reset_config(); if (!target_was_examined(target)) { if (!stm8->swim_configured) { @@ -1710,20 +1670,23 @@ static int stm8_examine(struct target *target) retval = stm8_write_u8(target, SWIM_CSR, SAFE_MASK + SWIM_DM + HS); if (retval != ERROR_OK) return retval; - retval = stm8_set_speed(target, 1); - if (retval == ERROR_OK) - stm8->swim_configured = true; + jtag_config_khz(1); + stm8->swim_configured = true; /* Now is the time to deassert reset if connect_under_reset. Releasing reset line will cause the option bytes to load. The core will still be stalled. */ - if (adapter->param.connect_under_reset) - stm8_reset_deassert(target); + if (jtag_reset_config & RESET_CNCT_UNDER_SRST) { + if (jtag_reset_config & RESET_SRST_NO_GATING) + stm8_reset_deassert(target); + else + LOG_WARNING("\'srst_nogate\' reset_config option is required"); + } } else { LOG_INFO("trying to reconnect"); - retval = adapter->layout->api->state(adapter->handle); + retval = swim_reconnect(); if (retval != ERROR_OK) { LOG_ERROR("reconnect failed"); return ERROR_FAIL; ----------------------------------------------------------------------- Summary of changes: src/jtag/Makefile.am | 2 ++ src/jtag/swim.c | 51 ++++++++++++++++++++++++++++++++++++++ src/jtag/swim.h | 65 +++++++++++++++++++++++++++++++++++++++++++++++++ src/target/stm8.c | 69 ++++++++++++---------------------------------------- 4 files changed, 134 insertions(+), 53 deletions(-) create mode 100644 src/jtag/swim.c create mode 100644 src/jtag/swim.h hooks/post-receive -- Main OpenOCD repository |
From: OpenOCD-Gerrit <ope...@us...> - 2020-05-24 20:29:56
|
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 93c4c0fcbec1ebcb2ce19b37c39b63f10a91b9e8 (commit) from 94dfa68647062ce71322f293a468bf5cdccf82be (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 93c4c0fcbec1ebcb2ce19b37c39b63f10a91b9e8 Author: Antonio Borneo <bor...@gm...> Date: Sun Jan 26 16:30:14 2020 +0100 adapter: expose HLA interface in struct adapter_driver The transition of STM8/SWIM out of HLA will require a new struct swim_ops in struct adapter_driver. To simplify the development, make the HLA interface temporarily accessible through the struct adapter_driver. This commit will be reverted after the swim rework. Change-Id: I1e4f370cf64641164d7bcaa22f75ac58c9240052 Signed-off-by: Antonio Borneo <bor...@gm...> Reviewed-on: http://openocd.zylin.com/5527 Tested-by: jenkins diff --git a/src/jtag/hla/hla_interface.c b/src/jtag/hla/hla_interface.c index 6d5cdc5e7..064c268e4 100644 --- a/src/jtag/hla/hla_interface.c +++ b/src/jtag/hla/hla_interface.c @@ -361,4 +361,7 @@ struct adapter_driver hl_adapter_driver = { .poll_trace = &hl_interface_poll_trace, /* no ops for HLA, targets hla_target and stm8 intercept them all */ + + /* FIXME: helper to simplify transition of HLA drivers. To be removed */ + .hla_if = &hl_if, }; diff --git a/src/jtag/interface.h b/src/jtag/interface.h index 39d2d9d88..91291dbd1 100644 --- a/src/jtag/interface.h +++ b/src/jtag/interface.h @@ -37,6 +37,9 @@ */ +/* FIXME: prototype to simplify transition of HLA drivers. To be removed */ +struct hl_interface_s; + /** implementation of wrapper function tap_set_state() */ void tap_set_state_impl(tap_state_t new_state); @@ -359,6 +362,9 @@ struct adapter_driver { /* DAP APIs over SWD transport */ const struct dap_ops *dap_swd_ops; + + /* FIXME: helper to simplify transition of HLA drivers. To be removed */ + struct hl_interface_s *hla_if; }; extern const char * const jtag_only[]; ----------------------------------------------------------------------- Summary of changes: src/jtag/hla/hla_interface.c | 3 +++ src/jtag/interface.h | 6 ++++++ 2 files changed, 9 insertions(+) hooks/post-receive -- Main OpenOCD repository |