From: OpenOCD-Gerrit <ope...@us...> - 2020-12-26 15:49: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 c69b4deae36a7bcbab5df80ec2a5dbfd652e25ac (commit) via 7f74906c2d18a2347ec392f9a457963bff3f25b8 (commit) via 433e37f02f6a38a3905b84f2aac12fdd66045137 (commit) via 6090390a23158b1463be3ffc8ac5731843b73586 (commit) via ed73398eb0b4ce6db63e5cec447ab052d084261a (commit) from 722f5797069bc233c8e1b71bdab283766d6be9b3 (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 c69b4deae36a7bcbab5df80ec2a5dbfd652e25ac Author: Antonio Borneo <bor...@gm...> Date: Sat Dec 19 22:31:29 2020 +0100 gdb_server: fix HW thread status at gdb attach At gdb attach, the event TARGET_EVENT_GDB_ATTACH is in charge of halting the target. For HW thread, rtos_update_threads() should be called after the event to detect and record the new 'halted' status. Instead it is called immediately before the event, thus reading the status before the halt. Move after the event the call to rtos_update_threads(). Change-Id: Iab3480ea0f5283ed6580f0f6c11200083197d1e9 Signed-off-by: Antonio Borneo <bor...@gm...> Reviewed-on: http://openocd.zylin.com/5983 Tested-by: jenkins diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c index c1e90a04a..9e44287fd 100644 --- a/src/server/gdb_server.c +++ b/src/server/gdb_server.c @@ -969,15 +969,6 @@ static int gdb_new_connection(struct connection *connection) breakpoint_clear_target(target); watchpoint_clear_target(target); - if (target->rtos) { - /* clean previous rtos session if supported*/ - if (target->rtos->type->clean) - target->rtos->type->clean(target); - - /* update threads */ - rtos_update_threads(target); - } - /* remove the initial ACK from the incoming buffer */ retval = gdb_get_char(connection, &initial_ack); if (retval != ERROR_OK) @@ -990,6 +981,15 @@ static int gdb_new_connection(struct connection *connection) gdb_putback_char(connection, initial_ack); target_call_event_callbacks(target, TARGET_EVENT_GDB_ATTACH); + if (target->rtos) { + /* clean previous rtos session if supported*/ + if (target->rtos->type->clean) + target->rtos->type->clean(target); + + /* update threads */ + rtos_update_threads(target); + } + if (gdb_use_memory_map) { /* Connect must fail if the memory map can't be set up correctly. * commit 7f74906c2d18a2347ec392f9a457963bff3f25b8 Author: Antonio Borneo <bor...@gm...> Date: Sat Dec 19 16:15:54 2020 +0100 gdb_server: minor fix for indentation Use a TAB in place of 4 spaces Change-Id: Ic34b7c3ef24078d2c36a193d4dd079bca5a7ef2e Signed-off-by: Antonio Borneo <bor...@gm...> Fixes: a4cdce0129a6 ("gdb_server: prevent false positive valgrind report") Reviewed-on: http://openocd.zylin.com/5982 Tested-by: jenkins Reviewed-by: Jonathan McDowell <noo...@ea...> diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c index 792bbdcea..c1e90a04a 100644 --- a/src/server/gdb_server.c +++ b/src/server/gdb_server.c @@ -2516,7 +2516,7 @@ static int gdb_get_thread_list_chunk(struct target *target, char **thread_list, transfer_type = 'l'; *chunk = malloc(length + 2 + 3); - /* Allocating extra 3 bytes prevents false positive valgrind report + /* Allocating extra 3 bytes prevents false positive valgrind report * of strlen(chunk) word access: * Invalid read of size 4 * Address 0x4479934 is 44 bytes inside a block of size 45 alloc'd */ commit 433e37f02f6a38a3905b84f2aac12fdd66045137 Author: Antonio Borneo <bor...@gm...> Date: Sat Dec 19 15:44:41 2020 +0100 rtos/hwthread: fix register list for armv7a The targets armv7a in file cortex_a.c inherit the register list from file armv4_5.c thus, depending on the core status, some register get marked as not existing. For HW threads other than current target, the registers in the list are not checked for existence and are all forwarded to GDB that in turns complains for too many data: Remote 'g' packet reply is too long (expected 68 bytes, got 104 bytes) Check all the attributes of the registers and pass to GDB only the valid registers. To test it, use a SMP cortex-a target (2 cores are enough) and add -rtos hwthread to all the cores. Connect GDB to OpenOCD and issue the GDB command info threads Change-Id: Ie66119fe83a3c8d53e9d18dda39e60fd97769669 Signed-off-by: Antonio Borneo <bor...@gm...> Reviewed-on: http://openocd.zylin.com/5981 Tested-by: jenkins diff --git a/src/rtos/hwthread.c b/src/rtos/hwthread.c index 850b93223..e2d1ccf13 100644 --- a/src/rtos/hwthread.c +++ b/src/rtos/hwthread.c @@ -237,23 +237,35 @@ static int hwthread_get_thread_reg_list(struct rtos *rtos, int64_t thread_id, if (!target_was_examined(curr)) return ERROR_FAIL; + int reg_list_size; struct reg **reg_list; - int retval = target_get_gdb_reg_list(curr, ®_list, rtos_reg_list_size, + int retval = target_get_gdb_reg_list(curr, ®_list, ®_list_size, REG_CLASS_GENERAL); if (retval != ERROR_OK) return retval; + int j = 0; + for (int i = 0; i < reg_list_size; i++) { + if (reg_list[i] == NULL || reg_list[i]->exist == false || reg_list[i]->hidden) + continue; + j++; + } + *rtos_reg_list_size = j; *rtos_reg_list = calloc(*rtos_reg_list_size, sizeof(struct rtos_reg)); if (*rtos_reg_list == NULL) { free(reg_list); return ERROR_FAIL; } - for (int i = 0; i < *rtos_reg_list_size; i++) { - (*rtos_reg_list)[i].number = (*reg_list)[i].number; - (*rtos_reg_list)[i].size = (*reg_list)[i].size; - memcpy((*rtos_reg_list)[i].value, (*reg_list)[i].value, + j = 0; + for (int i = 0; i < reg_list_size; i++) { + if (reg_list[i] == NULL || reg_list[i]->exist == false || reg_list[i]->hidden) + continue; + (*rtos_reg_list)[j].number = (*reg_list)[i].number; + (*rtos_reg_list)[j].size = (*reg_list)[i].size; + memcpy((*rtos_reg_list)[j].value, (*reg_list)[i].value, ((*reg_list)[i].size + 7) / 8); + j++; } free(reg_list); commit 6090390a23158b1463be3ffc8ac5731843b73586 Author: Jiri Kastner <cz1...@gm...> Date: Wed Dec 16 20:51:06 2020 +0100 tcl/target/rk3308.cfg: add defer-examine only core0 is brought up by bootloader Change-Id: I1d6b5e6ba7498beadbf3805f4271f0197e411bd5 Signed-off-by: Jiri Kastner <cz1...@gm...> Reviewed-on: http://openocd.zylin.com/5980 Reviewed-by: Antonio Borneo <bor...@gm...> Tested-by: jenkins Reviewed-by: Jonathan McDowell <noo...@ea...> diff --git a/tcl/target/rk3308.cfg b/tcl/target/rk3308.cfg index b55109312..7f957da06 100644 --- a/tcl/target/rk3308.cfg +++ b/tcl/target/rk3308.cfg @@ -28,7 +28,7 @@ swd newdap $_CHIPNAME cpu -expected-id $_DAP_TAPID -ignore-version dap create $_CHIPNAME.dap -chain-position $_CHIPNAME.cpu target create $_CHIPNAME.ahb mem_ap -dap $_CHIPNAME.dap -ap-num 0 -# declare the 8 main application cores +# declare the 4 main application cores set _TARGETNAME $_CHIPNAME.core set _smp_command "" @@ -53,6 +53,7 @@ for { set _core 0 } { $_core < $_cores } { incr _core 1 } { if { $_core != 0 } { set _smp_command "$_smp_command ${_TARGETNAME}$_core" + set _command "$_command -defer-examine" } else { # uncomment to use hardware threads pseudo rtos # set _command "$_command -rtos hwthread" commit ed73398eb0b4ce6db63e5cec447ab052d084261a Author: Antonio Borneo <bor...@gm...> Date: Wed Dec 2 22:04:12 2020 +0100 cortex-a: fix reset on dapdirect transports The target code for assert reset on cortex_a has been patched on commit b0698501b0e7 ("cortex_a: fix cortex_a_assert_reset() if srst_gates_jtag") then in cdba6ba0ad63 ("cortex_a: fix reset for SWD transport") to workaround the mismatch between jtag and swd implementations. See discussion for the second patch at http://openocd.zylin.com/3641/ While all of these mismatches should hopefully be cleaned by the reset framework rework, an extension of the workaround of the second patch is required for dapdirect transports, either dapdirect_swd and dapdirect_jtag. Extend the existing workaround to all non-jtag transports. Change-Id: Ia6a9d43bab524cbb3de4c37ce24c45f25187353d Signed-off-by: Antonio Borneo <bor...@gm...> Reviewed-on: http://openocd.zylin.com/5979 Tested-by: jenkins diff --git a/src/target/cortex_a.c b/src/target/cortex_a.c index f39fd9b2b..d27c298b6 100644 --- a/src/target/cortex_a.c +++ b/src/target/cortex_a.c @@ -1681,10 +1681,10 @@ static int cortex_a_assert_reset(struct target *target) */ /* - * FIXME: fix reset when transport is SWD. This is a temporary + * FIXME: fix reset when transport is not JTAG. This is a temporary * work-around for release v0.10 that is not intended to stay! */ - if (transport_is_swd() || + if (!transport_is_jtag() || (target->reset_halt && (jtag_get_reset_config() & RESET_SRST_NO_GATING))) adapter_assert_reset(); ----------------------------------------------------------------------- Summary of changes: src/rtos/hwthread.c | 22 +++++++++++++++++----- src/server/gdb_server.c | 20 ++++++++++---------- src/target/cortex_a.c | 4 ++-- tcl/target/rk3308.cfg | 3 ++- 4 files changed, 31 insertions(+), 18 deletions(-) hooks/post-receive -- Main OpenOCD repository |