From: OpenOCD-Gerrit <ope...@us...> - 2021-06-04 16:42:53
|
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 e74eaaacbcae8e8ec4063e0d058e2851d35a2af6 (commit) via b9f4532eb76a987310bbc039230259ed175b8797 (commit) via 6b94d2983171b8421f841ecd0a4fd2d2aa98262e (commit) from 968f5082dd7304ba3d8f72f481f4f76886779ea9 (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 e74eaaacbcae8e8ec4063e0d058e2851d35a2af6 Author: Tarek BOCHKATI <tar...@gm...> Date: Wed May 26 16:10:39 2021 +0100 tcl/target/stm32f4x: fix hardcoded chip name Fixes: c945d6e61605 ("tcl/target: start using the new TPIU/SWO support") Change-Id: I4543c9a204f7b4b3b14e6eabc5042653106aff0e Signed-off-by: Tarek BOCHKATI <tar...@gm...> Reviewed-on: http://openocd.zylin.com/6277 Reviewed-by: Antonio Borneo <bor...@gm...> Tested-by: jenkins diff --git a/tcl/target/stm32f4x.cfg b/tcl/target/stm32f4x.cfg index e94837f83..2228de72f 100644 --- a/tcl/target/stm32f4x.cfg +++ b/tcl/target/stm32f4x.cfg @@ -38,7 +38,7 @@ if { [info exists CPUTAPID] } { swj_newdap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID dap create $_CHIPNAME.dap -chain-position $_CHIPNAME.cpu -tpiu create $_CHIPNAME.tpiu -dap stm32f4x.dap -ap-num 0 -baseaddr 0xE0040000 +tpiu create $_CHIPNAME.tpiu -dap $_CHIPNAME.dap -ap-num 0 -baseaddr 0xE0040000 if {[using_jtag]} { jtag newtap $_CHIPNAME bs -irlen 5 commit b9f4532eb76a987310bbc039230259ed175b8797 Author: Antonio Borneo <bor...@gm...> Date: Thu May 27 14:21:13 2021 +0200 helper/list.h: add mention to the example in contrib Without such reference, it could be difficult to find the example. Change-Id: Ia9ffb06bc1a45446c2c7b53197ab3400e1d8a9e9 Signed-off-by: Antonio Borneo <bor...@gm...> Reviewed-on: http://openocd.zylin.com/6281 Tested-by: jenkins Reviewed-by: Tim Newsome <ti...@si...> diff --git a/src/helper/list.h b/src/helper/list.h index 0949636b9..a7cd4ad37 100644 --- a/src/helper/list.h +++ b/src/helper/list.h @@ -10,6 +10,8 @@ * list_prepare_entry; * - expand READ_ONCE, WRITE_ONCE, smp_load_acquire, smp_store_release; * - make comments compatible with doxygen. + * + * There is an example of using this file in contrib/list_example.c. */ #ifndef OPENOCD_HELPER_LIST_H commit 6b94d2983171b8421f841ecd0a4fd2d2aa98262e Author: Andreas Fritiofson <and...@gm...> Date: Thu May 27 09:45:28 2021 +0200 contrib: add an example of using list.h Change-Id: Ic3d399d7ad2e4d10677cf78d64968040941b74e5 Signed-off-by: Andreas Fritiofson <and...@gm...> Signed-off-by: Antonio Borneo <bor...@gm...> Reviewed-on: http://openocd.zylin.com/6280 Tested-by: jenkins Reviewed-by: Tim Newsome <ti...@si...> diff --git a/contrib/list_example.c b/contrib/list_example.c new file mode 100644 index 000000000..0f62b864b --- /dev/null +++ b/contrib/list_example.c @@ -0,0 +1,74 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* Copyright (C) 2021 by Andreas Fritiofson <and...@gm...> */ + +/* + * Simple example of using a circular doubly linked list through list.h + * + * gcc -I ../src/ list_example.c -o list_example + */ + +#include <stdint.h> +#include <stdbool.h> +#include <assert.h> +#include <helper/list.h> + +static LIST_HEAD(threads); + +struct thread { + int id; + uint64_t tcb_address; + struct list_head lh; +}; + +void insert(struct thread *t) +{ + list_add_tail(&t->lh, &threads); +} + +void remove(struct thread *t) +{ + list_del(&t->lh); +} + +struct thread *lookup_id(int id) +{ + struct thread *t; + list_for_each_entry(t, &threads, lh) { + if (t->id == id) + return t; + } + return NULL; +} + +struct thread *lookup_tcb(uint64_t addr) +{ + struct thread *t; + list_for_each_entry(t, &threads, lh) { + if (t->tcb_address == addr) + return t; + } + return NULL; +} + +int main(void) +{ + struct thread t1 = { .id = 1, .tcb_address = 111111111 }; + struct thread t2 = { .id = 2, .tcb_address = 222222222 }; + struct thread t3 = { .id = 3, .tcb_address = 333333333 }; + + insert(&t1); + insert(&t2); + assert(lookup_id(1) == &t1); + assert(lookup_tcb(111111111) == &t1); + assert(lookup_id(2) == &t2); + assert(lookup_id(42) == NULL); + remove(&t1); + assert(lookup_id(1) == NULL); + insert(&t3); + remove(&t2); + assert(lookup_id(3) == &t3); + assert(lookup_tcb(333333333) == &t3); + assert(lookup_id(2) == NULL); + remove(&t3); + assert(list_empty(&threads)); +} ----------------------------------------------------------------------- Summary of changes: contrib/list_example.c | 74 +++++++++++++++++++++++++++++++++++++++++++++++++ src/helper/list.h | 2 ++ tcl/target/stm32f4x.cfg | 2 +- 3 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 contrib/list_example.c hooks/post-receive -- Main OpenOCD repository |