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
(54) |
Sep
(47) |
Oct
(15) |
Nov
(58) |
Dec
|
|
From: openocd-gerrit <ope...@us...> - 2023-04-07 21:45:44
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Main OpenOCD repository".
The branch, master has been updated
via 18aacc8bf3ff7c7481673cbbfe82f0104e4dccf9 (commit)
from 41037eb26585114209c3c8f1d63f7788a421df07 (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 18aacc8bf3ff7c7481673cbbfe82f0104e4dccf9
Author: François LEGAL <de...@th...>
Date: Wed Mar 29 14:19:48 2023 +0200
src/target/mips_m4k : fix condition on overlapping workspace data area
The condition to check if the workspace area (used by actual MIPS code
executed on target) and data area (sandbox to put data to be read/written
to/from flash) is wrong, thus preventing the use of FAST_* commands to
program/verify FLASH.
Signed-off-by: François LEGAL <de...@th...>
Change-Id: Ic68424b7f42d44e550433a120093db5e7980fd56
Reviewed-on: https://review.openocd.org/c/openocd/+/7563
Tested-by: jenkins
Reviewed-by: Tomas Vanek <va...@fb...>
diff --git a/src/target/mips_m4k.c b/src/target/mips_m4k.c
index 491b247b1..d3b07585d 100644
--- a/src/target/mips_m4k.c
+++ b/src/target/mips_m4k.c
@@ -1218,8 +1218,8 @@ static int mips_m4k_bulk_write_memory(struct target *target, target_addr_t addre
fast_data_area = mips32->fast_data_area;
- if (address <= fast_data_area->address + fast_data_area->size &&
- fast_data_area->address <= address + count) {
+ if (address < (fast_data_area->address + fast_data_area->size) &&
+ fast_data_area->address < (address + count)) {
LOG_ERROR("fast_data (" TARGET_ADDR_FMT ") is within write area "
"(" TARGET_ADDR_FMT "-" TARGET_ADDR_FMT ").",
fast_data_area->address, address, address + count);
-----------------------------------------------------------------------
Summary of changes:
src/target/mips_m4k.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2023-04-07 21:45: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 41037eb26585114209c3c8f1d63f7788a421df07 (commit)
from 99ec5760961d264599a9c9fb1a4d5d6042bc3ba8 (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 41037eb26585114209c3c8f1d63f7788a421df07
Author: Chao Du <du...@es...>
Date: Wed Mar 22 06:51:51 2023 +0000
rtos/FreeRTOS: some optimization of freertos_update_threads()
1.
update the rtos->thread_count in time, to make sure the allocated
thread_name_str and extra_info_str could be freed by
rtos_free_threadlist(). Otherwise the abnormal return may cause a
memory leak.
2.
remove a redundant assignment to threadid.
Signed-off-by: Chao Du <du...@es...>
Change-Id: Ifabc59d501c925b3d6aec8b04b2856d2c31cc4e2
Reviewed-on: https://review.openocd.org/c/openocd/+/7549
Tested-by: jenkins
Reviewed-by: Tomas Vanek <va...@fb...>
Reviewed-by: Antonio Borneo <bor...@gm...>
diff --git a/src/rtos/FreeRTOS.c b/src/rtos/FreeRTOS.c
index 070275f2c..e8df030aa 100644
--- a/src/rtos/FreeRTOS.c
+++ b/src/rtos/FreeRTOS.c
@@ -312,7 +312,6 @@ static int freertos_update_threads(struct rtos *rtos)
(list_elem_ptr != prev_list_elem_ptr) &&
(tasks_found < thread_list_size)) {
/* Get the location of the thread structure. */
- rtos->thread_details[tasks_found].threadid = 0;
retval = target_read_u32(rtos->target,
list_elem_ptr + param->list_elem_content_offset,
&pointer_casts_are_bad);
@@ -365,6 +364,7 @@ static int freertos_update_threads(struct rtos *rtos)
tasks_found++;
list_thread_count--;
+ rtos->thread_count = tasks_found;
prev_list_elem_ptr = list_elem_ptr;
list_elem_ptr = 0;
@@ -383,7 +383,6 @@ static int freertos_update_threads(struct rtos *rtos)
}
free(list_of_lists);
- rtos->thread_count = tasks_found;
return 0;
}
-----------------------------------------------------------------------
Summary of changes:
src/rtos/FreeRTOS.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2023-04-01 16:11:57
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Main OpenOCD repository".
The branch, master has been updated
via 99ec5760961d264599a9c9fb1a4d5d6042bc3ba8 (commit)
from 4b9b55a832e43815a1dd1b219107a01a1beadc1e (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 99ec5760961d264599a9c9fb1a4d5d6042bc3ba8
Author: Erhan Kurubas <erh...@es...>
Date: Sat Mar 25 03:00:51 2023 +0300
github/workflow: build libjaylink from source
Libjaylink submodule disabled by default at
https://review.openocd.org/c/openocd/+/7129
--enable-internal-libjaylink config option will be deprecated soon.
So, building the source is a permanent solution.
Signed-off-by: Erhan Kurubas <erh...@es...>
Change-Id: Id06654d806a3a49f35e3ba41e9e4cc58c1a0d388
Reviewed-on: https://review.openocd.org/c/openocd/+/7552
Tested-by: jenkins
Reviewed-by: zapb <de...@za...>
Reviewed-by: Antonio Borneo <bor...@gm...>
diff --git a/.github/workflows/snapshot.yml b/.github/workflows/snapshot.yml
index b48388ef7..f5cf56459 100644
--- a/.github/workflows/snapshot.yml
+++ b/.github/workflows/snapshot.yml
@@ -56,6 +56,16 @@ jobs:
wget "https://github.com/aquynh/capstone/archive/${CAPSTONE_VER}.tar.gz"
tar -xzf ${CAPSTONE_VER}.tar.gz
echo "CAPSTONE_SRC=$PWD/capstone-${CAPSTONE_VER}" >> $GITHUB_ENV
+ - name: Prepare libjaylink
+ env:
+ LIBJAYLINK_VER: 0.3.1
+ run: |
+ mkdir -p $DL_DIR && cd $DL_DIR
+ wget https://gitlab.zapb.de/libjaylink/libjaylink/-/archive/${LIBJAYLINK_VER}/libjaylink-${LIBJAYLINK_VER}.tar.gz
+ tar -xzf libjaylink-${LIBJAYLINK_VER}.tar.gz
+ cd libjaylink-${LIBJAYLINK_VER}
+ ./autogen.sh
+ echo "LIBJAYLINK_SRC=$PWD" >> $GITHUB_ENV
- name: Package OpenOCD for windows
env:
MAKE_JOBS: 2
@@ -64,6 +74,7 @@ jobs:
HIDAPI_CONFIG: --enable-shared --disable-static --disable-testgui
LIBFTDI_CONFIG: -DSTATICLIBS=OFF -DEXAMPLES=OFF -DFTDI_EEPROM=OFF
CAPSTONE_CONFIG: "CAPSTONE_BUILD_CORE_ONLY=yes CAPSTONE_STATIC=yes CAPSTONE_SHARED=no"
+ LIBJAYLINK_CONFIG: --enable-shared --disable-static
run: |
# check if there is tag pointing at HEAD, otherwise take the HEAD SHA-1 as OPENOCD_TAG
OPENOCD_TAG="`git tag --points-at HEAD`"
diff --git a/contrib/cross-build.sh b/contrib/cross-build.sh
index b199bf715..bb8c8c47d 100755
--- a/contrib/cross-build.sh
+++ b/contrib/cross-build.sh
@@ -41,12 +41,14 @@ WORK_DIR=$PWD
: ${HIDAPI_SRC:=/path/to/hidapi}
: ${LIBFTDI_SRC:=/path/to/libftdi}
: ${CAPSTONE_SRC:=/path/to/capstone}
+: ${LIBJAYLINK_SRC:=/path/to/libjaylink}
OPENOCD_SRC=`readlink -m $OPENOCD_SRC`
LIBUSB1_SRC=`readlink -m $LIBUSB1_SRC`
HIDAPI_SRC=`readlink -m $HIDAPI_SRC`
LIBFTDI_SRC=`readlink -m $LIBFTDI_SRC`
CAPSTONE_SRC=`readlink -m $CAPSTONE_SRC`
+LIBJAYLINK_SRC=`readlink -m $LIBJAYLINK_SRC`
HOST_TRIPLET=$1
BUILD_DIR=$WORK_DIR/$HOST_TRIPLET-build
@@ -54,6 +56,7 @@ LIBUSB1_BUILD_DIR=$BUILD_DIR/libusb1
HIDAPI_BUILD_DIR=$BUILD_DIR/hidapi
LIBFTDI_BUILD_DIR=$BUILD_DIR/libftdi
CAPSTONE_BUILD_DIR=$BUILD_DIR/capstone
+LIBJAYLINK_BUILD_DIR=$BUILD_DIR/libjaylink
OPENOCD_BUILD_DIR=$BUILD_DIR/openocd
## Root of host file tree
@@ -158,6 +161,16 @@ libdir=${exec_prefix}/lib \
includedir=${prefix}/include/capstone\n\n;' $CAPSTONE_PC_FILE
fi
+# libjaylink build & install into sysroot
+if [ -d $LIBJAYLINK_SRC ] ; then
+ mkdir -p $LIBJAYLINK_BUILD_DIR
+ cd $LIBJAYLINK_BUILD_DIR
+ $LIBJAYLINK_SRC/configure --build=`$LIBJAYLINK_SRC/config.guess` --host=$HOST_TRIPLET \
+ --with-sysroot=$SYSROOT --prefix=$PREFIX \
+ $LIBJAYLINK_CONFIG
+ make -j $MAKE_JOBS
+ make install DESTDIR=$SYSROOT
+fi
# OpenOCD build & install into sysroot
mkdir -p $OPENOCD_BUILD_DIR
-----------------------------------------------------------------------
Summary of changes:
.github/workflows/snapshot.yml | 11 +++++++++++
contrib/cross-build.sh | 13 +++++++++++++
2 files changed, 24 insertions(+)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2023-04-01 16:11:22
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Main OpenOCD repository".
The branch, master has been updated
via 4b9b55a832e43815a1dd1b219107a01a1beadc1e (commit)
from c1b14d678fd77095ef5c076c0e927aeed6a753c7 (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 4b9b55a832e43815a1dd1b219107a01a1beadc1e
Author: Erhan Kurubas <erh...@es...>
Date: Sat Mar 25 02:56:19 2023 +0300
github/workflow: increase delete-tag-and-release version
During setup job in the GH actions, GH tries to resolve
all actions before starting to run the scripts.
It can not find 0.2.0 version inside
'dev-drprasad/delete-tag-and-release 'repo and action fails.
This patch fixes that error.
Also, switched to the latest ubuntu image
Hidapi version updated to 0.13.1
Signed-off-by: Erhan Kurubas <erh...@es...>
Change-Id: I02af41f6189d5a28f874c9b008073d74de46b4ca
Reviewed-on: https://review.openocd.org/c/openocd/+/7551
Tested-by: jenkins
Reviewed-by: Antonio Borneo <bor...@gm...>
diff --git a/.github/workflows/snapshot.yml b/.github/workflows/snapshot.yml
index e5997a055..b48388ef7 100644
--- a/.github/workflows/snapshot.yml
+++ b/.github/workflows/snapshot.yml
@@ -8,7 +8,7 @@ name: OpenOCD Snapshot
jobs:
package:
- runs-on: [ubuntu-18.04]
+ runs-on: [ubuntu-20.04]
env:
DL_DIR: ../downloads
BUILD_DIR: ../build
@@ -30,7 +30,7 @@ jobs:
echo "LIBUSB1_SRC=$PWD/libusb-${LIBUSB1_VER}" >> $GITHUB_ENV
- name: Prepare hidapi
env:
- HIDAPI_VER: 0.11.2
+ HIDAPI_VER: 0.13.1
run: |
mkdir -p $DL_DIR && cd $DL_DIR
wget "https://github.com/libusb/hidapi/archive/hidapi-${HIDAPI_VER}.tar.gz"
@@ -82,6 +82,7 @@ jobs:
# add missing dlls
cd $HOST-root/usr
cp `$HOST-gcc --print-file-name=libwinpthread-1.dll` ./bin/
+ # required by libftdi1.dll. For the gcc-mingw-10.3.x or later "libgcc_s_dw2-1.dll" will need to be copied.
cp `$HOST-gcc --print-file-name=libgcc_s_sjlj-1.dll` ./bin/
# prepare the artifact
ARTIFACT="openocd-${OPENOCD_TAG}-${HOST}.tar.gz"
@@ -90,11 +91,11 @@ jobs:
echo "IS_PRE_RELEASE=$IS_PRE_RELEASE" >> $GITHUB_ENV
echo "ARTIFACT_PATH=$PWD/$ARTIFACT" >> $GITHUB_ENV
- name: Publish OpenOCD packaged for windows
- uses: actions/upload-artifact@v2
+ uses: actions/upload-artifact@v3
with:
path: ${{ env.ARTIFACT_PATH }}
- name: Delete 'latest' Release
- uses: dev-drprasad/delete-tag-and-release@v0.2.0
+ uses: dev-drprasad/delete-tag-and-release@v0.2.1
with:
delete_release: true
tag_name: ${{ env.RELEASE_NAME }}
-----------------------------------------------------------------------
Summary of changes:
.github/workflows/snapshot.yml | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2023-03-28 09:38:24
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Main OpenOCD repository".
The branch, master has been updated
via c1b14d678fd77095ef5c076c0e927aeed6a753c7 (commit)
from b939224ab6e6e28e5211aac0303951ae4fabaf1f (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 c1b14d678fd77095ef5c076c0e927aeed6a753c7
Author: panciyan <pan...@es...>
Date: Mon Mar 20 02:26:58 2023 +0000
flash/nor: missing fileio_close.
If the file read abnormally, need to close it which was opened before.
Signed-off-by: panciyan <pan...@es...>
Change-Id: I6142f154741dcd38088b7add2793219ee4dd2ae9
Reviewed-on: https://review.openocd.org/c/openocd/+/7546
Tested-by: jenkins
Reviewed-by: Tomas Vanek <va...@fb...>
diff --git a/src/flash/nor/tcl.c b/src/flash/nor/tcl.c
index ecbcf00aa..22c1710ad 100644
--- a/src/flash/nor/tcl.c
+++ b/src/flash/nor/tcl.c
@@ -814,6 +814,7 @@ COMMAND_HANDLER(handle_flash_write_bank_command)
if (buf_cnt != length) {
LOG_ERROR("Short read");
free(buffer);
+ fileio_close(fileio);
return ERROR_FAIL;
}
-----------------------------------------------------------------------
Summary of changes:
src/flash/nor/tcl.c | 1 +
1 file changed, 1 insertion(+)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2023-03-28 09:36:36
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Main OpenOCD repository".
The branch, master has been updated
via b939224ab6e6e28e5211aac0303951ae4fabaf1f (commit)
from f0e8f7b790f6d945c35b4bb868cafee5fcea3a22 (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 b939224ab6e6e28e5211aac0303951ae4fabaf1f
Author: Wolfram Sang <ws...@ke...>
Date: Sun Mar 5 08:38:14 2023 +0100
tcl/board: add Calao USB-A9G20
Add a basic config.
Signed-off-by: Wolfram Sang <ws...@ke...>
Change-Id: Ie68e5fbb26b1c2f3028e561af0255fa71ec61828
Reviewed-on: https://review.openocd.org/c/openocd/+/7524
Tested-by: jenkins
Reviewed-by: Tomas Vanek <va...@fb...>
diff --git a/tcl/board/calao-usb-a9g20-c01.cfg b/tcl/board/calao-usb-a9g20-c01.cfg
new file mode 100644
index 000000000..6c4bd40fe
--- /dev/null
+++ b/tcl/board/calao-usb-a9g20-c01.cfg
@@ -0,0 +1,14 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+# CALAO Systems USB-A9G20-C01
+
+adapter driver ftdi
+ftdi device_desc "USB-A9G20"
+ftdi vid_pid 0x0403 0x6010
+ftdi layout_init 0x0c08 0x0f1b
+ftdi layout_signal nTRST -data 0x0100 -noe 0x0400
+ftdi layout_signal nSRST -data 0x0200 -noe 0x0800
+
+transport select jtag
+
+source [find target/at91sam9g20.cfg]
-----------------------------------------------------------------------
Summary of changes:
tcl/board/{calao-usb-a9260.cfg => calao-usb-a9g20-c01.cfg} | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
copy tcl/board/{calao-usb-a9260.cfg => calao-usb-a9g20-c01.cfg} (60%)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2023-03-28 09:35:51
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Main OpenOCD repository".
The branch, master has been updated
via f0e8f7b790f6d945c35b4bb868cafee5fcea3a22 (commit)
from e9a7221b68d0775d9c96c8a12a7a26e2729caf37 (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 f0e8f7b790f6d945c35b4bb868cafee5fcea3a22
Author: Wolfram Sang <ws...@ke...>
Date: Fri Mar 3 12:26:46 2023 +0100
tcl/board/calao-usb-a9260: fix and refactor broken support
The old configuration files did not work because of a missing
'at91sam9260minimal.cfg' file. Also, the config files were placed
wrongly. Update them, put them to the proper location, merge the two
supported boards into one, remove now superfluous include, remove
defunct web page, etc.. Tested with a Calao USB-A9G20 and a hacked
'device_desc' to match. Native support for it will come next.
Signed-off-by: Wolfram Sang <ws...@ke...>
Change-Id: Iec578c8777c5a6134e132dbac17c2988c7634742
Reviewed-on: https://review.openocd.org/c/openocd/+/7522
Tested-by: jenkins
Reviewed-by: Tomas Vanek <va...@fb...>
diff --git a/tcl/board/calao-usb-a9260.cfg b/tcl/board/calao-usb-a9260.cfg
new file mode 100644
index 000000000..52fede0fa
--- /dev/null
+++ b/tcl/board/calao-usb-a9260.cfg
@@ -0,0 +1,14 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+# CALAO Systems USB-A9260 (C01 and C02)
+
+adapter driver ftdi
+ftdi device_desc "USB-A9260"
+ftdi vid_pid 0x0403 0x6001 0x0403 0x6010
+ftdi layout_init 0x0c08 0x0f1b
+ftdi layout_signal nTRST -data 0x0100 -noe 0x0400
+ftdi layout_signal nSRST -data 0x0200 -noe 0x0800
+
+transport select jtag
+
+source [find target/at91sam9260.cfg]
diff --git a/tcl/interface/calao-usb-a9260.cfg b/tcl/interface/calao-usb-a9260.cfg
deleted file mode 100644
index ff652ef8f..000000000
--- a/tcl/interface/calao-usb-a9260.cfg
+++ /dev/null
@@ -1,12 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-
-#
-# CALAO Systems USB-A9260 common -C01 -C02 setup
-#
-# http://www.calao-systems.com/
-#
-# See calao-usb-a9260-c01.cfg and calao-usb-a9260-c02.cfg.
-#
-
-adapter srst delay 200
-jtag_ntrst_delay 200
diff --git a/tcl/interface/ftdi/calao-usb-a9260-c01.cfg b/tcl/interface/ftdi/calao-usb-a9260-c01.cfg
deleted file mode 100644
index c84e77874..000000000
--- a/tcl/interface/ftdi/calao-usb-a9260-c01.cfg
+++ /dev/null
@@ -1,24 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-
-#
-# CALAO Systems USB-A9260-C01
-#
-# http://www.calao-systems.com/
-#
-
-echo "WARNING!"
-echo "This file was not tested with real interface, but is assumed to work as this"
-echo "interface uses the same layout as configs that were verified. Please report your"
-echo "experience with this file to openocd-devel mailing list, so it could be marked"
-echo "as working or fixed."
-
-adapter driver ftdi
-ftdi device_desc "USB-A9260"
-ftdi vid_pid 0x0403 0x6010
-
-ftdi layout_init 0x0c08 0x0f1b
-ftdi layout_signal nTRST -data 0x0100 -noe 0x0400
-ftdi layout_signal nSRST -data 0x0200 -noe 0x0800
-
-script interface/calao-usb-a9260.cfg
-script target/at91sam9260minimal.cfg
diff --git a/tcl/interface/ftdi/calao-usb-a9260-c02.cfg b/tcl/interface/ftdi/calao-usb-a9260-c02.cfg
deleted file mode 100644
index 9d79b2600..000000000
--- a/tcl/interface/ftdi/calao-usb-a9260-c02.cfg
+++ /dev/null
@@ -1,24 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-or-later
-
-#
-# CALAO Systems USB-A9260-C02
-#
-# http://www.calao-systems.com/
-#
-
-echo "WARNING!"
-echo "This file was not tested with real interface, but is assumed to work as this"
-echo "interface uses the same layout as configs that were verified. Please report your"
-echo "experience with this file to openocd-devel mailing list, so it could be marked"
-echo "as working or fixed."
-
-adapter driver ftdi
-ftdi device_desc "USB-A9260"
-ftdi vid_pid 0x0403 0x6001
-
-ftdi layout_init 0x0c08 0x0f1b
-ftdi layout_signal nTRST -data 0x0100 -noe 0x0400
-ftdi layout_signal nSRST -data 0x0200 -noe 0x0800
-
-script interface/calao-usb-a9260.cfg
-script target/at91sam9260minimal.cfg
-----------------------------------------------------------------------
Summary of changes:
.../jtagkey2p.cfg => board/calao-usb-a9260.cfg} | 15 +++++++-------
tcl/interface/calao-usb-a9260.cfg | 12 -----------
tcl/interface/ftdi/calao-usb-a9260-c01.cfg | 24 ----------------------
tcl/interface/ftdi/calao-usb-a9260-c02.cfg | 24 ----------------------
4 files changed, 7 insertions(+), 68 deletions(-)
copy tcl/{interface/ftdi/jtagkey2p.cfg => board/calao-usb-a9260.cfg} (53%)
delete mode 100644 tcl/interface/calao-usb-a9260.cfg
delete mode 100644 tcl/interface/ftdi/calao-usb-a9260-c01.cfg
delete mode 100644 tcl/interface/ftdi/calao-usb-a9260-c02.cfg
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2023-03-25 18:16: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 e9a7221b68d0775d9c96c8a12a7a26e2729caf37 (commit)
from 12b405a4ac3dddd18e2fd822e135bb783cae0236 (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 e9a7221b68d0775d9c96c8a12a7a26e2729caf37
Author: Antonio Borneo <bor...@gm...>
Date: Tue Dec 20 00:11:41 2022 +0100
target: rewrite command 'target smp' as COMMAND_HANDLER
This also fixes an incorrect return ERROR_xx from a jim command,
propagated from return value of rtos_smp_init().
Change-Id: Icf4893c00aabd8fadd60077c5e8a2e926f687518
Signed-off-by: Antonio Borneo <bor...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/7511
Tested-by: jenkins
diff --git a/src/target/target.c b/src/target/target.c
index 3fdb34ec6..47abd2823 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -6404,9 +6404,8 @@ COMMAND_HANDLER(handle_target_names)
static struct target_list *
__attribute__((warn_unused_result))
-create_target_list_node(Jim_Obj *const name) {
- int len;
- const char *targetname = Jim_GetString(name, &len);
+create_target_list_node(const char *targetname)
+{
struct target *target = get_target(targetname);
LOG_DEBUG("%s ", targetname);
if (!target)
@@ -6422,7 +6421,8 @@ create_target_list_node(Jim_Obj *const name) {
return new;
}
-static int get_target_with_common_rtos_type(struct list_head *lh, struct target **result)
+static int get_target_with_common_rtos_type(struct command_invocation *cmd,
+ struct list_head *lh, struct target **result)
{
struct target *target = NULL;
struct target_list *curr;
@@ -6430,39 +6430,39 @@ static int get_target_with_common_rtos_type(struct list_head *lh, struct target
struct rtos *curr_rtos = curr->target->rtos;
if (curr_rtos) {
if (target && target->rtos && target->rtos->type != curr_rtos->type) {
- LOG_ERROR("Different rtos types in members of one smp target!");
- return JIM_ERR;
+ command_print(cmd, "Different rtos types in members of one smp target!");
+ return ERROR_FAIL;
}
target = curr->target;
}
}
*result = target;
- return JIM_OK;
+ return ERROR_OK;
}
-static int jim_target_smp(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
+COMMAND_HANDLER(handle_target_smp)
{
static int smp_group = 1;
- if (argc == 1) {
+ if (CMD_ARGC == 0) {
LOG_DEBUG("Empty SMP target");
- return JIM_OK;
+ return ERROR_OK;
}
- LOG_DEBUG("%d", argc);
- /* argv[1] = target to associate in smp
- * argv[2] = target to associate in smp
- * argv[3] ...
+ LOG_DEBUG("%d", CMD_ARGC);
+ /* CMD_ARGC[0] = target to associate in smp
+ * CMD_ARGC[1] = target to associate in smp
+ * CMD_ARGC[2] ...
*/
struct list_head *lh = malloc(sizeof(*lh));
if (!lh) {
LOG_ERROR("Out of memory");
- return JIM_ERR;
+ return ERROR_FAIL;
}
INIT_LIST_HEAD(lh);
- for (int i = 1; i < argc; i++) {
- struct target_list *new = create_target_list_node(argv[i]);
+ for (unsigned int i = 0; i < CMD_ARGC; i++) {
+ struct target_list *new = create_target_list_node(CMD_ARGV[i]);
if (new)
list_add_tail(&new->lh, lh);
}
@@ -6476,14 +6476,13 @@ static int jim_target_smp(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
smp_group++;
struct target *rtos_target;
- int retval = get_target_with_common_rtos_type(lh, &rtos_target);
- if (retval == JIM_OK && rtos_target)
+ int retval = get_target_with_common_rtos_type(CMD, lh, &rtos_target);
+ if (retval == ERROR_OK && rtos_target)
retval = rtos_smp_init(rtos_target);
return retval;
}
-
static int jim_target_create(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
struct jim_getopt_info goi;
@@ -6536,7 +6535,7 @@ static const struct command_registration target_subcommand_handlers[] = {
{
.name = "smp",
.mode = COMMAND_ANY,
- .jim_handler = jim_target_smp,
+ .handler = handle_target_smp,
.usage = "targetname1 targetname2 ...",
.help = "gather several target in a smp list"
},
-----------------------------------------------------------------------
Summary of changes:
src/target/target.c | 41 ++++++++++++++++++++---------------------
1 file changed, 20 insertions(+), 21 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2023-03-25 18:16:12
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Main OpenOCD repository".
The branch, master has been updated
via 12b405a4ac3dddd18e2fd822e135bb783cae0236 (commit)
via d9d698103e974b2a94c611864cccb92359509b7d (commit)
from 26f457896c456c57a57719e484d055d444ba67ee (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 12b405a4ac3dddd18e2fd822e135bb783cae0236
Author: Antonio Borneo <bor...@gm...>
Date: Mon Dec 19 23:58:01 2022 +0100
target: rewrite command 'target names' as COMMAND_HANDLER
Print one entry per line.
While there add the mandatory 'usage' field.
Change-Id: Ia832684817f3bdbfa4cb943cd97e3f9fb2605902
Signed-off-by: Antonio Borneo <bor...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/7510
Tested-by: jenkins
diff --git a/src/target/target.c b/src/target/target.c
index b77a25a2a..3fdb34ec6 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -6388,20 +6388,18 @@ COMMAND_HANDLER(handle_target_types)
return ERROR_OK;
}
-static int jim_target_names(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
+COMMAND_HANDLER(handle_target_names)
{
- if (argc != 1) {
- Jim_WrongNumArgs(interp, 1, argv, "Too many parameters");
- return JIM_ERR;
- }
- Jim_SetResult(interp, Jim_NewListObj(interp, NULL, 0));
+ if (CMD_ARGC != 0)
+ return ERROR_COMMAND_SYNTAX_ERROR;
+
struct target *target = all_targets;
while (target) {
- Jim_ListAppendElement(interp, Jim_GetResult(interp),
- Jim_NewStringObj(interp, target_name(target), -1));
+ command_print(CMD, "%s", target_name(target));
target = target->next;
}
- return JIM_OK;
+
+ return ERROR_OK;
}
static struct target_list *
@@ -6531,8 +6529,9 @@ static const struct command_registration target_subcommand_handlers[] = {
{
.name = "names",
.mode = COMMAND_ANY,
- .jim_handler = jim_target_names,
+ .handler = handle_target_names,
.help = "Returns the names of all targets as a list of strings",
+ .usage = "",
},
{
.name = "smp",
commit d9d698103e974b2a94c611864cccb92359509b7d
Author: Antonio Borneo <bor...@gm...>
Date: Mon Dec 19 23:54:10 2022 +0100
target: rewrite command 'target types' as COMMAND_HANDLER
Print one entry per line.
While there add the mandatory 'usage' field.
Change-Id: I135556e12154e33fdbd0f71d89f6fe37c69813b7
Signed-off-by: Antonio Borneo <bor...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/7509
Tested-by: jenkins
diff --git a/src/target/target.c b/src/target/target.c
index ae5f74cbf..b77a25a2a 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -6377,18 +6377,15 @@ COMMAND_HANDLER(handle_target_current)
return ERROR_OK;
}
-static int jim_target_types(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
+COMMAND_HANDLER(handle_target_types)
{
- if (argc != 1) {
- Jim_WrongNumArgs(interp, 1, argv, "Too many parameters");
- return JIM_ERR;
- }
- Jim_SetResult(interp, Jim_NewListObj(interp, NULL, 0));
- for (unsigned x = 0; target_types[x]; x++) {
- Jim_ListAppendElement(interp, Jim_GetResult(interp),
- Jim_NewStringObj(interp, target_types[x]->name, -1));
- }
- return JIM_OK;
+ if (CMD_ARGC != 0)
+ return ERROR_COMMAND_SYNTAX_ERROR;
+
+ for (unsigned int x = 0; target_types[x]; x++)
+ command_print(CMD, "%s", target_types[x]->name);
+
+ return ERROR_OK;
}
static int jim_target_names(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
@@ -6526,9 +6523,10 @@ static const struct command_registration target_subcommand_handlers[] = {
{
.name = "types",
.mode = COMMAND_ANY,
- .jim_handler = jim_target_types,
+ .handler = handle_target_types,
.help = "Returns the available target types as "
"a list of strings",
+ .usage = "",
},
{
.name = "names",
-----------------------------------------------------------------------
Summary of changes:
src/target/target.c | 41 +++++++++++++++++++----------------------
1 file changed, 19 insertions(+), 22 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2023-03-25 18:15: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 26f457896c456c57a57719e484d055d444ba67ee (commit)
via 583efa68f71b9ad8e06b8e1246af25fc6c70e052 (commit)
from 2dda0e37d91f3ba9345dc20253ac162ff449504d (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 26f457896c456c57a57719e484d055d444ba67ee
Author: Antonio Borneo <bor...@gm...>
Date: Mon Dec 19 23:50:23 2022 +0100
target: rewrite command 'target current' as COMMAND_HANDLER
While there add the mandatory 'usage' field.
Change-Id: I3e5b826ca58f7ade30a443ada0cb4a9cd9ea35c2
Signed-off-by: Antonio Borneo <bor...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/7508
Tested-by: jenkins
diff --git a/src/target/target.c b/src/target/target.c
index 4e2914648..ae5f74cbf 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -6365,19 +6365,16 @@ static int target_create(struct jim_getopt_info *goi)
return JIM_OK;
}
-static int jim_target_current(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
+COMMAND_HANDLER(handle_target_current)
{
- if (argc != 1) {
- Jim_WrongNumArgs(interp, 1, argv, "Too many parameters");
- return JIM_ERR;
- }
- struct command_context *cmd_ctx = current_command_context(interp);
- assert(cmd_ctx);
+ if (CMD_ARGC != 0)
+ return ERROR_COMMAND_SYNTAX_ERROR;
- struct target *target = get_current_target_or_null(cmd_ctx);
+ struct target *target = get_current_target_or_null(CMD_CTX);
if (target)
- Jim_SetResultString(interp, target_name(target), -1);
- return JIM_OK;
+ command_print(CMD, "%s", target_name(target));
+
+ return ERROR_OK;
}
static int jim_target_types(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
@@ -6522,8 +6519,9 @@ static const struct command_registration target_subcommand_handlers[] = {
{
.name = "current",
.mode = COMMAND_ANY,
- .jim_handler = jim_target_current,
+ .handler = handle_target_current,
.help = "Returns the currently selected target",
+ .usage = "",
},
{
.name = "types",
commit 583efa68f71b9ad8e06b8e1246af25fc6c70e052
Author: Antonio Borneo <bor...@gm...>
Date: Mon Dec 19 23:44:04 2022 +0100
target: rewrite command 'arp_halt_gdb' as COMMAND_HANDLER
While there add the mandatory 'usage' field.
Change-Id: I5389881dac25877dc32930ec36ee546e48ecc14d
Signed-off-by: Antonio Borneo <bor...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/7507
Tested-by: jenkins
diff --git a/src/target/target.c b/src/target/target.c
index a2c857a95..4e2914648 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -5740,20 +5740,14 @@ COMMAND_HANDLER(handle_target_examine_deferred)
return ERROR_OK;
}
-static int jim_target_halt_gdb(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
+COMMAND_HANDLER(handle_target_halt_gdb)
{
- if (argc != 1) {
- Jim_WrongNumArgs(interp, 1, argv, "[no parameters]");
- return JIM_ERR;
- }
- struct command_context *cmd_ctx = current_command_context(interp);
- assert(cmd_ctx);
- struct target *target = get_current_target(cmd_ctx);
+ if (CMD_ARGC != 0)
+ return ERROR_COMMAND_SYNTAX_ERROR;
- if (target_call_event_callbacks(target, TARGET_EVENT_GDB_HALT) != ERROR_OK)
- return JIM_ERR;
+ struct target *target = get_current_target(CMD_CTX);
- return JIM_OK;
+ return target_call_event_callbacks(target, TARGET_EVENT_GDB_HALT);
}
static int jim_target_poll(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
@@ -6096,8 +6090,9 @@ static const struct command_registration target_instance_command_handlers[] = {
{
.name = "arp_halt_gdb",
.mode = COMMAND_EXEC,
- .jim_handler = jim_target_halt_gdb,
+ .handler = handle_target_halt_gdb,
.help = "used internally for reset processing to halt GDB",
+ .usage = "",
},
{
.name = "arp_poll",
-----------------------------------------------------------------------
Summary of changes:
src/target/target.c | 39 ++++++++++++++++-----------------------
1 file changed, 16 insertions(+), 23 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2023-03-25 18:15: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 2dda0e37d91f3ba9345dc20253ac162ff449504d (commit)
via cca64798f8f01f2f06dbc020113cf9497b56f68b (commit)
from 113ba58231683e8cba329bf83b96d2192c39ad93 (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 2dda0e37d91f3ba9345dc20253ac162ff449504d
Author: Antonio Borneo <bor...@gm...>
Date: Mon Dec 19 23:41:22 2022 +0100
target: rewrite command 'examine_deferred' as COMMAND_HANDLER
Check for empty command line, add the mandatory 'usage' field.
Change-Id: I9c3606242ec3dda9026fe19222162a110e618bff
Signed-off-by: Antonio Borneo <bor...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/7506
Tested-by: jenkins
diff --git a/src/target/target.c b/src/target/target.c
index 264b85f21..a2c857a95 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -5728,14 +5728,16 @@ COMMAND_HANDLER(handle_target_was_examined)
return ERROR_OK;
}
-static int jim_target_examine_deferred(Jim_Interp *interp, int argc, Jim_Obj * const *argv)
+COMMAND_HANDLER(handle_target_examine_deferred)
{
- struct command_context *cmd_ctx = current_command_context(interp);
- assert(cmd_ctx);
- struct target *target = get_current_target(cmd_ctx);
+ if (CMD_ARGC != 0)
+ return ERROR_COMMAND_SYNTAX_ERROR;
- Jim_SetResultBool(interp, target->defer_examine);
- return JIM_OK;
+ struct target *target = get_current_target(CMD_CTX);
+
+ command_print(CMD, "%d", target->defer_examine ? 1 : 0);
+
+ return ERROR_OK;
}
static int jim_target_halt_gdb(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
@@ -6087,8 +6089,9 @@ static const struct command_registration target_instance_command_handlers[] = {
{
.name = "examine_deferred",
.mode = COMMAND_EXEC,
- .jim_handler = jim_target_examine_deferred,
+ .handler = handle_target_examine_deferred,
.help = "used internally for reset processing",
+ .usage = "",
},
{
.name = "arp_halt_gdb",
commit cca64798f8f01f2f06dbc020113cf9497b56f68b
Author: Antonio Borneo <bor...@gm...>
Date: Mon Dec 19 23:37:07 2022 +0100
target: rewrite command 'was_examined' as COMMAND_HANDLER
Check for empty command line, add the mandatory 'usage' field.
Change-Id: I3f59448458fe01268bf5f4293aea5adcbd6d8279
Signed-off-by: Antonio Borneo <bor...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/7505
Tested-by: jenkins
diff --git a/src/target/target.c b/src/target/target.c
index da9cab904..264b85f21 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -5716,14 +5716,16 @@ static int jim_target_examine(Jim_Interp *interp, int argc, Jim_Obj *const *argv
return JIM_OK;
}
-static int jim_target_was_examined(Jim_Interp *interp, int argc, Jim_Obj * const *argv)
+COMMAND_HANDLER(handle_target_was_examined)
{
- struct command_context *cmd_ctx = current_command_context(interp);
- assert(cmd_ctx);
- struct target *target = get_current_target(cmd_ctx);
+ if (CMD_ARGC != 0)
+ return ERROR_COMMAND_SYNTAX_ERROR;
- Jim_SetResultBool(interp, target_was_examined(target));
- return JIM_OK;
+ struct target *target = get_current_target(CMD_CTX);
+
+ command_print(CMD, "%d", target_was_examined(target) ? 1 : 0);
+
+ return ERROR_OK;
}
static int jim_target_examine_deferred(Jim_Interp *interp, int argc, Jim_Obj * const *argv)
@@ -6078,8 +6080,9 @@ static const struct command_registration target_instance_command_handlers[] = {
{
.name = "was_examined",
.mode = COMMAND_EXEC,
- .jim_handler = jim_target_was_examined,
+ .handler = handle_target_was_examined,
.help = "used internally for reset processing",
+ .usage = "",
},
{
.name = "examine_deferred",
-----------------------------------------------------------------------
Summary of changes:
src/target/target.c | 34 ++++++++++++++++++++--------------
1 file changed, 20 insertions(+), 14 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2023-03-25 18:15: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 113ba58231683e8cba329bf83b96d2192c39ad93 (commit)
via 584986ab1c9902fb58d928c1cb4ae885989fecbf (commit)
from 6f8c27dcfc51c3775f11785711d44563adb6eb17 (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 113ba58231683e8cba329bf83b96d2192c39ad93
Author: Antonio Borneo <bor...@gm...>
Date: Mon Dec 19 23:25:21 2022 +0100
target: rewrite command 'target curstate' as COMMAND_HANDLER
While there, add the mandatory 'usage' field.
Change-Id: Ibfda6f56a1450e2eb9ad3092d756de0778f4a092
Signed-off-by: Antonio Borneo <bor...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/7504
Tested-by: jenkins
diff --git a/src/target/target.c b/src/target/target.c
index 07c3c29a4..da9cab904 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -5904,18 +5904,19 @@ COMMAND_HANDLER(handle_target_event_list)
command_print(CMD, "***END***");
return ERROR_OK;
}
-static int jim_target_current_state(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
+
+COMMAND_HANDLER(handle_target_current_state)
{
- if (argc != 1) {
- Jim_WrongNumArgs(interp, 1, argv, "[no parameters]");
- return JIM_ERR;
- }
- struct command_context *cmd_ctx = current_command_context(interp);
- assert(cmd_ctx);
- struct target *target = get_current_target(cmd_ctx);
- Jim_SetResultString(interp, target_state_name(target), -1);
- return JIM_OK;
+ if (CMD_ARGC != 0)
+ return ERROR_COMMAND_SYNTAX_ERROR;
+
+ struct target *target = get_current_target(CMD_CTX);
+
+ command_print(CMD, "%s", target_state_name(target));
+
+ return ERROR_OK;
}
+
static int jim_target_invoke_event(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
struct jim_getopt_info goi;
@@ -6063,8 +6064,9 @@ static const struct command_registration target_instance_command_handlers[] = {
{
.name = "curstate",
.mode = COMMAND_EXEC,
- .jim_handler = jim_target_current_state,
+ .handler = handle_target_current_state,
.help = "displays the current state of this target",
+ .usage = "",
},
{
.name = "arp_examine",
commit 584986ab1c9902fb58d928c1cb4ae885989fecbf
Author: Antonio Borneo <bor...@gm...>
Date: Mon Dec 19 23:15:54 2022 +0100
target: rewrite command 'read_memory' as COMMAND_HANDLER
While there, fix typo on 'exceeds'.
In a following patch, the output could be formatted and split in N
values per line to make it easier to read by humans.
Change-Id: I295111a80934393011e46311f6cf6c13f2bdc0a3
Signed-off-by: Antonio Borneo <bor...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/7503
Tested-by: jenkins
diff --git a/src/target/target.c b/src/target/target.c
index ae419ac8b..07c3c29a4 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -4592,57 +4592,36 @@ static int target_mem2array(Jim_Interp *interp, struct target *target, int argc,
return e;
}
-static int target_jim_read_memory(Jim_Interp *interp, int argc,
- Jim_Obj * const *argv)
+COMMAND_HANDLER(handle_target_read_memory)
{
/*
- * argv[1] = memory address
- * argv[2] = desired element width in bits
- * argv[3] = number of elements to read
- * argv[4] = optional "phys"
+ * CMD_ARGV[0] = memory address
+ * CMD_ARGV[1] = desired element width in bits
+ * CMD_ARGV[2] = number of elements to read
+ * CMD_ARGV[3] = optional "phys"
*/
- if (argc < 4 || argc > 5) {
- Jim_WrongNumArgs(interp, 1, argv, "address width count ['phys']");
- return JIM_ERR;
- }
+ if (CMD_ARGC < 3 || CMD_ARGC > 4)
+ return ERROR_COMMAND_SYNTAX_ERROR;
/* Arg 1: Memory address. */
- jim_wide wide_addr;
- int e;
- e = Jim_GetWide(interp, argv[1], &wide_addr);
-
- if (e != JIM_OK)
- return e;
-
- target_addr_t addr = (target_addr_t)wide_addr;
+ target_addr_t addr;
+ COMMAND_PARSE_NUMBER(u64, CMD_ARGV[0], addr);
/* Arg 2: Bit width of one element. */
- long l;
- e = Jim_GetLong(interp, argv[2], &l);
-
- if (e != JIM_OK)
- return e;
-
- const unsigned int width_bits = l;
+ unsigned int width_bits;
+ COMMAND_PARSE_NUMBER(uint, CMD_ARGV[1], width_bits);
/* Arg 3: Number of elements to read. */
- e = Jim_GetLong(interp, argv[3], &l);
-
- if (e != JIM_OK)
- return e;
-
- size_t count = l;
+ unsigned int count;
+ COMMAND_PARSE_NUMBER(uint, CMD_ARGV[2], count);
/* Arg 4: Optional 'phys'. */
bool is_phys = false;
-
- if (argc > 4) {
- const char *phys = Jim_GetString(argv[4], NULL);
-
- if (strcmp(phys, "phys")) {
- Jim_SetResultFormatted(interp, "invalid argument '%s', must be 'phys'", phys);
- return JIM_ERR;
+ if (CMD_ARGC == 4) {
+ if (strcmp(CMD_ARGV[3], "phys")) {
+ command_print(CMD, "invalid argument '%s', must be 'phys'", CMD_ARGV[3]);
+ return ERROR_COMMAND_ARGUMENT_INVALID;
}
is_phys = true;
@@ -4655,37 +4634,33 @@ static int target_jim_read_memory(Jim_Interp *interp, int argc,
case 64:
break;
default:
- Jim_SetResultString(interp, "invalid width, must be 8, 16, 32 or 64", -1);
- return JIM_ERR;
+ command_print(CMD, "invalid width, must be 8, 16, 32 or 64");
+ return ERROR_COMMAND_ARGUMENT_INVALID;
}
const unsigned int width = width_bits / 8;
if ((addr + (count * width)) < addr) {
- Jim_SetResultString(interp, "read_memory: addr + count wraps to zero", -1);
- return JIM_ERR;
+ command_print(CMD, "read_memory: addr + count wraps to zero");
+ return ERROR_COMMAND_ARGUMENT_INVALID;
}
if (count > 65536) {
- Jim_SetResultString(interp, "read_memory: too large read request, exeeds 64K elements", -1);
- return JIM_ERR;
+ command_print(CMD, "read_memory: too large read request, exceeds 64K elements");
+ return ERROR_COMMAND_ARGUMENT_INVALID;
}
- struct command_context *cmd_ctx = current_command_context(interp);
- assert(cmd_ctx != NULL);
- struct target *target = get_current_target(cmd_ctx);
+ struct target *target = get_current_target(CMD_CTX);
const size_t buffersize = 4096;
uint8_t *buffer = malloc(buffersize);
if (!buffer) {
LOG_ERROR("Failed to allocate memory");
- return JIM_ERR;
+ return ERROR_FAIL;
}
- Jim_Obj *result_list = Jim_NewListObj(interp, NULL, 0);
- Jim_IncrRefCount(result_list);
-
+ char *separator = "";
while (count > 0) {
const unsigned int max_chunk_len = buffersize / width;
const size_t chunk_len = MIN(count, max_chunk_len);
@@ -4698,11 +4673,15 @@ static int target_jim_read_memory(Jim_Interp *interp, int argc,
retval = target_read_memory(target, addr, width, chunk_len, buffer);
if (retval != ERROR_OK) {
- LOG_ERROR("read_memory: read at " TARGET_ADDR_FMT " with width=%u and count=%zu failed",
+ LOG_DEBUG("read_memory: read at " TARGET_ADDR_FMT " with width=%u and count=%zu failed",
addr, width_bits, chunk_len);
- Jim_SetResultString(interp, "read_memory: failed to read memory", -1);
- e = JIM_ERR;
- break;
+ /*
+ * FIXME: we append the errmsg to the list of value already read.
+ * Add a way to flush and replace old output, but LOG_DEBUG() it
+ */
+ command_print(CMD, "read_memory: failed to read memory");
+ free(buffer);
+ return retval;
}
for (size_t i = 0; i < chunk_len ; i++) {
@@ -4723,11 +4702,8 @@ static int target_jim_read_memory(Jim_Interp *interp, int argc,
break;
}
- char value_buf[19];
- snprintf(value_buf, sizeof(value_buf), "0x%" PRIx64, v);
-
- Jim_ListAppendElement(interp, result_list,
- Jim_NewStringObj(interp, value_buf, -1));
+ command_print_sameline(CMD, "%s0x%" PRIx64, separator, v);
+ separator = " ";
}
count -= chunk_len;
@@ -4736,15 +4712,7 @@ static int target_jim_read_memory(Jim_Interp *interp, int argc,
free(buffer);
- if (e != JIM_OK) {
- Jim_DecrRefCount(interp, result_list);
- return e;
- }
-
- Jim_SetResult(interp, result_list);
- Jim_DecrRefCount(interp, result_list);
-
- return JIM_OK;
+ return ERROR_OK;
}
static int get_u64_array_element(Jim_Interp *interp, const char *varname, size_t idx, uint64_t *val)
@@ -6074,7 +6042,7 @@ static const struct command_registration target_instance_command_handlers[] = {
{
.name = "read_memory",
.mode = COMMAND_EXEC,
- .jim_handler = target_jim_read_memory,
+ .handler = handle_target_read_memory,
.help = "Read Tcl list of 8/16/32/64 bit numbers from target memory",
.usage = "address width count ['phys']",
},
@@ -7203,7 +7171,7 @@ static const struct command_registration target_exec_command_handlers[] = {
{
.name = "read_memory",
.mode = COMMAND_EXEC,
- .jim_handler = target_jim_read_memory,
+ .handler = handle_target_read_memory,
.help = "Read Tcl list of 8/16/32/64 bit numbers from target memory",
.usage = "address width count ['phys']",
},
-----------------------------------------------------------------------
Summary of changes:
src/target/target.c | 134 ++++++++++++++++++++--------------------------------
1 file changed, 52 insertions(+), 82 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2023-03-25 18:14:43
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Main OpenOCD repository".
The branch, master has been updated
via 6f8c27dcfc51c3775f11785711d44563adb6eb17 (commit)
via 90ddac12e38ab21b1d3934235e0d1242e0f13616 (commit)
from 5d39a8852ab604bed29d9e0d28da2cb5f7a87958 (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 6f8c27dcfc51c3775f11785711d44563adb6eb17
Author: Antonio Borneo <bor...@gm...>
Date: Mon Dec 19 21:00:42 2022 +0100
target: arm_tpiu_swo: rewrite command 'tpiu init' as COMMAND_HANDLER
Change-Id: Iaaccfc62dd85267066a152c434f254d1b9a0c4f1
Signed-off-by: Antonio Borneo <bor...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/7502
Tested-by: jenkins
diff --git a/src/target/arm_tpiu_swo.c b/src/target/arm_tpiu_swo.c
index 55201e6fe..5cea682ec 100644
--- a/src/target/arm_tpiu_swo.c
+++ b/src/target/arm_tpiu_swo.c
@@ -994,23 +994,21 @@ COMMAND_HANDLER(handle_arm_tpiu_swo_names)
return ERROR_OK;
}
-static int jim_arm_tpiu_swo_init(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
+COMMAND_HANDLER(handle_arm_tpiu_swo_init)
{
- struct command_context *cmd_ctx = current_command_context(interp);
struct arm_tpiu_swo_object *obj;
- int retval = JIM_OK;
+ int retval = ERROR_OK;
+
+ if (CMD_ARGC != 0)
+ return ERROR_COMMAND_SYNTAX_ERROR;
- if (argc != 1) {
- Jim_WrongNumArgs(interp, 1, argv, "Too many parameters");
- return JIM_ERR;
- }
list_for_each_entry(obj, &all_tpiu_swo, lh) {
if (!obj->deferred_enable)
continue;
LOG_DEBUG("%s: running enable during init", obj->name);
- int retval2 = command_run_linef(cmd_ctx, "%s enable", obj->name);
+ int retval2 = command_run_linef(CMD_CTX, "%s enable", obj->name);
if (retval2 != ERROR_OK)
- retval = JIM_ERR;
+ retval = retval2;
}
return retval;
}
@@ -1189,7 +1187,7 @@ static const struct command_registration arm_tpiu_swo_subcommand_handlers[] = {
{
.name = "init",
.mode = COMMAND_EXEC,
- .jim_handler = jim_arm_tpiu_swo_init,
+ .handler = handle_arm_tpiu_swo_init,
.usage = "",
.help = "Initialize TPIU and SWO",
},
commit 90ddac12e38ab21b1d3934235e0d1242e0f13616
Author: Antonio Borneo <bor...@gm...>
Date: Mon Dec 19 20:56:40 2022 +0100
target: arm_tpiu_swo: rewrite command 'tpiu names' as COMMAND_HANDLER
While there, format in a human readable way the output list by
using one line per tpiu name.
Change-Id: I937c92b6c1e92509cf8aa96be1517a51bc363600
Signed-off-by: Antonio Borneo <bor...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/7501
Tested-by: jenkins
diff --git a/src/target/arm_tpiu_swo.c b/src/target/arm_tpiu_swo.c
index 3cf306377..55201e6fe 100644
--- a/src/target/arm_tpiu_swo.c
+++ b/src/target/arm_tpiu_swo.c
@@ -981,20 +981,17 @@ err_exit:
return JIM_ERR;
}
-static int jim_arm_tpiu_swo_names(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
+COMMAND_HANDLER(handle_arm_tpiu_swo_names)
{
struct arm_tpiu_swo_object *obj;
- if (argc != 1) {
- Jim_WrongNumArgs(interp, 1, argv, "Too many parameters");
- return JIM_ERR;
- }
- Jim_SetResult(interp, Jim_NewListObj(interp, NULL, 0));
- list_for_each_entry(obj, &all_tpiu_swo, lh) {
- Jim_ListAppendElement(interp, Jim_GetResult(interp),
- Jim_NewStringObj(interp, obj->name, -1));
- }
- return JIM_OK;
+ if (CMD_ARGC != 0)
+ return ERROR_COMMAND_SYNTAX_ERROR;
+
+ list_for_each_entry(obj, &all_tpiu_swo, lh)
+ command_print(CMD, "%s", obj->name);
+
+ return ERROR_OK;
}
static int jim_arm_tpiu_swo_init(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
@@ -1185,7 +1182,7 @@ static const struct command_registration arm_tpiu_swo_subcommand_handlers[] = {
{
.name = "names",
.mode = COMMAND_ANY,
- .jim_handler = jim_arm_tpiu_swo_names,
+ .handler = handle_arm_tpiu_swo_names,
.usage = "",
.help = "Lists all registered TPIU and SWO objects by name",
},
-----------------------------------------------------------------------
Summary of changes:
src/target/arm_tpiu_swo.c | 39 +++++++++++++++++----------------------
1 file changed, 17 insertions(+), 22 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2023-03-25 18:14:30
|
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 5d39a8852ab604bed29d9e0d28da2cb5f7a87958 (commit)
via 8fa6db6e8e992793f5dcc23a7182e2b0cb70257e (commit)
from f76e67a440bb1761b90ea0cab89e0422a4224779 (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 5d39a8852ab604bed29d9e0d28da2cb5f7a87958
Author: Antonio Borneo <bor...@gm...>
Date: Mon Dec 19 20:52:51 2022 +0100
target: arm_tpiu_swo: rewrite command 'tpiu enable' as COMMAND_HANDLER
Change-Id: Ia600948b99a229ef0490b7f576df62f880db8546
Signed-off-by: Antonio Borneo <bor...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/7500
Tested-by: jenkins
diff --git a/src/target/arm_tpiu_swo.c b/src/target/arm_tpiu_swo.c
index 897a9316c..3cf306377 100644
--- a/src/target/arm_tpiu_swo.c
+++ b/src/target/arm_tpiu_swo.c
@@ -595,54 +595,52 @@ static const struct service_driver arm_tpiu_swo_service_driver = {
.keep_client_alive_handler = NULL,
};
-static int jim_arm_tpiu_swo_enable(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
+COMMAND_HANDLER(handle_arm_tpiu_swo_enable)
{
- struct command *c = jim_to_command(interp);
- struct arm_tpiu_swo_object *obj = c->jim_handler_data;
- struct command_context *cmd_ctx = current_command_context(interp);
+ struct arm_tpiu_swo_object *obj = CMD_DATA;
uint32_t value;
int retval;
- if (argc != 1) {
- Jim_WrongNumArgs(interp, 1, argv, "Too many parameters");
- return JIM_ERR;
- }
+ if (CMD_ARGC != 0)
+ return ERROR_COMMAND_SYNTAX_ERROR;
- if (cmd_ctx->mode == COMMAND_CONFIG) {
+ if (CMD_CTX->mode == COMMAND_CONFIG) {
LOG_DEBUG("%s: enable deferred", obj->name);
obj->deferred_enable = true;
- return JIM_OK;
+ return ERROR_OK;
}
if (obj->enabled)
- return JIM_OK;
+ return ERROR_OK;
if (transport_is_hla() && obj->spot.ap_num != 0) {
- LOG_ERROR("Invalid access port 0x%" PRIx64 ". Only AP#0 allowed with hla transport", obj->spot.ap_num);
- return JIM_ERR;
+ command_print(CMD,
+ "Invalid access port 0x%" PRIx64 ". Only AP#0 allowed with hla transport",
+ obj->spot.ap_num);
+ return ERROR_FAIL;
}
if (!obj->traceclkin_freq) {
- LOG_ERROR("Trace clock-in frequency not set");
- return JIM_ERR;
+ command_print(CMD, "Trace clock-in frequency not set");
+ return ERROR_FAIL;
}
if (obj->pin_protocol == TPIU_SPPR_PROTOCOL_MANCHESTER || obj->pin_protocol == TPIU_SPPR_PROTOCOL_UART)
if (!obj->swo_pin_freq)
LOG_DEBUG("SWO pin frequency not set, will be autodetected by the adapter");
- struct target *target = get_current_target(cmd_ctx);
+ struct target *target = get_current_target(CMD_CTX);
/* START_DEPRECATED_TPIU */
if (obj->recheck_ap_cur_target) {
if (strcmp(target->type->name, "cortex_m") &&
strcmp(target->type->name, "hla_target")) {
LOG_ERROR(MSG "Current target is not a Cortex-M nor a HLA");
- return JIM_ERR;
+ return ERROR_FAIL;
}
if (!target_was_examined(target)) {
LOG_ERROR(MSG "Current target not examined yet");
- return JIM_ERR;
+ return ERROR_FAIL;
}
struct cortex_m_common *cm = target_to_cm(target);
obj->recheck_ap_cur_target = false;
@@ -660,8 +658,8 @@ static int jim_arm_tpiu_swo_enable(Jim_Interp *interp, int argc, Jim_Obj *const
if (!obj->ap) {
obj->ap = dap_get_ap(obj->spot.dap, obj->spot.ap_num);
if (!obj->ap) {
- LOG_ERROR("Cannot get AP");
- return JIM_ERR;
+ command_print(CMD, "Cannot get AP");
+ return ERROR_FAIL;
}
}
@@ -670,8 +668,8 @@ static int jim_arm_tpiu_swo_enable(Jim_Interp *interp, int argc, Jim_Obj *const
retval = wrap_read_u32(target, obj->ap, obj->spot.base + TPIU_DEVID_OFFSET, &value);
if (retval != ERROR_OK) {
- LOG_ERROR("Unable to read %s", obj->name);
- return JIM_ERR;
+ command_print(CMD, "Unable to read %s", obj->name);
+ return retval;
}
switch (obj->pin_protocol) {
case TPIU_SPPR_PROTOCOL_SYNC:
@@ -687,21 +685,20 @@ static int jim_arm_tpiu_swo_enable(Jim_Interp *interp, int argc, Jim_Obj *const
value = 0;
}
if (!value) {
- struct jim_nvp *p;
- jim_nvp_value2name(interp, nvp_arm_tpiu_swo_protocol_opts, obj->pin_protocol, &p);
- LOG_ERROR("%s does not support protocol %s", obj->name, p->name);
- return JIM_ERR;
+ struct jim_nvp *p = jim_nvp_value2name_simple(nvp_arm_tpiu_swo_protocol_opts, obj->pin_protocol);
+ command_print(CMD, "%s does not support protocol %s", obj->name, p->name);
+ return ERROR_FAIL;
}
if (obj->pin_protocol == TPIU_SPPR_PROTOCOL_SYNC) {
retval = wrap_read_u32(target, obj->ap, obj->spot.base + TPIU_SSPSR_OFFSET, &value);
if (retval != ERROR_OK) {
- LOG_ERROR("Cannot read TPIU register SSPSR");
- return JIM_ERR;
+ command_print(CMD, "Cannot read TPIU register SSPSR");
+ return retval;
}
if (!(value & BIT(obj->port_width - 1))) {
- LOG_ERROR("TPIU does not support port-width of %d bits", obj->port_width);
- return JIM_ERR;
+ command_print(CMD, "TPIU does not support port-width of %d bits", obj->port_width);
+ return ERROR_FAIL;
}
}
@@ -713,41 +710,42 @@ static int jim_arm_tpiu_swo_enable(Jim_Interp *interp, int argc, Jim_Obj *const
struct arm_tpiu_swo_priv_connection *priv = malloc(sizeof(*priv));
if (!priv) {
LOG_ERROR("Out of memory");
- return JIM_ERR;
+ return ERROR_FAIL;
}
priv->obj = obj;
LOG_INFO("starting trace server for %s on %s", obj->name, &obj->out_filename[1]);
retval = add_service(&arm_tpiu_swo_service_driver, &obj->out_filename[1],
CONNECTION_LIMIT_UNLIMITED, priv);
if (retval != ERROR_OK) {
- LOG_ERROR("Can't configure trace TCP port %s", &obj->out_filename[1]);
- return JIM_ERR;
+ command_print(CMD, "Can't configure trace TCP port %s", &obj->out_filename[1]);
+ return retval;
}
} else if (strcmp(obj->out_filename, "-")) {
obj->file = fopen(obj->out_filename, "ab");
if (!obj->file) {
- LOG_ERROR("Can't open trace destination file \"%s\"", obj->out_filename);
- return JIM_ERR;
+ command_print(CMD, "Can't open trace destination file \"%s\"", obj->out_filename);
+ return ERROR_FAIL;
}
}
retval = adapter_config_trace(true, obj->pin_protocol, obj->port_width,
&swo_pin_freq, obj->traceclkin_freq, &prescaler);
if (retval != ERROR_OK) {
- LOG_ERROR("Failed to start adapter's trace");
+ command_print(CMD, "Failed to start adapter's trace");
arm_tpiu_swo_close_output(obj);
- return JIM_ERR;
+ return retval;
}
if (obj->pin_protocol == TPIU_SPPR_PROTOCOL_MANCHESTER || obj->pin_protocol == TPIU_SPPR_PROTOCOL_UART)
if (!swo_pin_freq) {
if (obj->swo_pin_freq)
- LOG_ERROR("Adapter rejected SWO pin frequency %d Hz", obj->swo_pin_freq);
+ command_print(CMD, "Adapter rejected SWO pin frequency %d Hz", obj->swo_pin_freq);
else
- LOG_ERROR("Adapter does not support auto-detection of SWO pin frequency nor a default value");
+ command_print(CMD,
+ "Adapter does not support auto-detection of SWO pin frequency nor a default value");
arm_tpiu_swo_close_output(obj);
- return JIM_ERR;
+ return ERROR_FAIL;
}
if (obj->swo_pin_freq != swo_pin_freq)
@@ -799,10 +797,10 @@ static int jim_arm_tpiu_swo_enable(Jim_Interp *interp, int argc, Jim_Obj *const
/* END_DEPRECATED_TPIU */
obj->enabled = true;
- return JIM_OK;
+ return ERROR_OK;
error_exit:
- LOG_ERROR("Error!");
+ command_print(CMD, "Error!");
if (obj->en_capture) {
obj->en_capture = false;
@@ -811,13 +809,11 @@ error_exit:
target_unregister_timer_callback(arm_tpiu_swo_poll_trace, obj);
- retval = adapter_config_trace(false, 0, 0, NULL, 0, NULL);
- if (retval != ERROR_OK) {
- LOG_ERROR("Failed to stop adapter's trace");
- return JIM_ERR;
- }
+ int retval1 = adapter_config_trace(false, 0, 0, NULL, 0, NULL);
+ if (retval1 != ERROR_OK)
+ command_print(CMD, "Failed to stop adapter's trace");
}
- return JIM_ERR;
+ return retval;
}
COMMAND_HANDLER(handle_arm_tpiu_swo_disable)
@@ -882,7 +878,7 @@ static const struct command_registration arm_tpiu_swo_instance_command_handlers[
{
.name = "enable",
.mode = COMMAND_ANY,
- .jim_handler = jim_arm_tpiu_swo_enable,
+ .handler = handle_arm_tpiu_swo_enable,
.usage = "",
.help = "Enables the TPIU/SWO output",
},
commit 8fa6db6e8e992793f5dcc23a7182e2b0cb70257e
Author: Antonio Borneo <bor...@gm...>
Date: Mon Dec 19 20:28:56 2022 +0100
target: arm_tpiu_swo: rewrite command 'tpiu disable' as COMMAND_HANDLER
Change-Id: I689482f898bde2afa2881b2f311676a6b98abb9a
Signed-off-by: Antonio Borneo <bor...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/7499
Tested-by: jenkins
diff --git a/src/target/arm_tpiu_swo.c b/src/target/arm_tpiu_swo.c
index 7096db305..897a9316c 100644
--- a/src/target/arm_tpiu_swo.c
+++ b/src/target/arm_tpiu_swo.c
@@ -820,18 +820,15 @@ error_exit:
return JIM_ERR;
}
-static int jim_arm_tpiu_swo_disable(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
+COMMAND_HANDLER(handle_arm_tpiu_swo_disable)
{
- struct command *c = jim_to_command(interp);
- struct arm_tpiu_swo_object *obj = c->jim_handler_data;
+ struct arm_tpiu_swo_object *obj = CMD_DATA;
- if (argc != 1) {
- Jim_WrongNumArgs(interp, 1, argv, "Too many parameters");
- return JIM_ERR;
- }
+ if (CMD_ARGC != 0)
+ return ERROR_COMMAND_SYNTAX_ERROR;
if (!obj->enabled)
- return JIM_OK;
+ return ERROR_OK;
obj->enabled = false;
arm_tpiu_swo_handle_event(obj, TPIU_SWO_EVENT_PRE_DISABLE);
@@ -845,20 +842,19 @@ static int jim_arm_tpiu_swo_disable(Jim_Interp *interp, int argc, Jim_Obj *const
int retval = adapter_config_trace(false, 0, 0, NULL, 0, NULL);
if (retval != ERROR_OK) {
- LOG_ERROR("Failed to stop adapter's trace");
- return JIM_ERR;
+ command_print(CMD, "Failed to stop adapter's trace");
+ return retval;
}
}
arm_tpiu_swo_handle_event(obj, TPIU_SWO_EVENT_POST_DISABLE);
/* START_DEPRECATED_TPIU */
- struct command_context *cmd_ctx = current_command_context(interp);
- struct target *target = get_current_target(cmd_ctx);
+ struct target *target = get_current_target(CMD_CTX);
target_handle_event(target, TARGET_EVENT_TRACE_CONFIG);
/* END_DEPRECATED_TPIU */
- return JIM_OK;
+ return ERROR_OK;
}
static const struct command_registration arm_tpiu_swo_instance_command_handlers[] = {
@@ -893,7 +889,7 @@ static const struct command_registration arm_tpiu_swo_instance_command_handlers[
{
.name = "disable",
.mode = COMMAND_EXEC,
- .jim_handler = jim_arm_tpiu_swo_disable,
+ .handler = handle_arm_tpiu_swo_disable,
.usage = "",
.help = "Disables the TPIU/SWO output",
},
-----------------------------------------------------------------------
Summary of changes:
src/target/arm_tpiu_swo.c | 118 +++++++++++++++++++++-------------------------
1 file changed, 55 insertions(+), 63 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2023-03-25 18:14: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 f76e67a440bb1761b90ea0cab89e0422a4224779 (commit)
via fbb7a50cbd5b9cda29698b3192e2a4596b3a6371 (commit)
from 254598ba25265b79bac4a5e32fa2abb5d252d2cb (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 f76e67a440bb1761b90ea0cab89e0422a4224779
Author: Antonio Borneo <bor...@gm...>
Date: Mon Dec 19 18:35:23 2022 +0100
target: arm_dap: rewrite command 'dap names' as COMMAND_HANDLER
While there, format in a human readable way the output list by
using one line per dap name.
Change-Id: I24a47350105b90db15808c61790f05d807120739
Signed-off-by: Antonio Borneo <bor...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/7498
Tested-by: jenkins
diff --git a/src/target/arm_dap.c b/src/target/arm_dap.c
index e21136dd6..bc9d96236 100644
--- a/src/target/arm_dap.c
+++ b/src/target/arm_dap.c
@@ -421,20 +421,16 @@ static int jim_dap_create(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
return dap_create(&goi);
}
-static int jim_dap_names(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
+COMMAND_HANDLER(handle_dap_names)
{
+ if (CMD_ARGC != 0)
+ return ERROR_COMMAND_SYNTAX_ERROR;
+
struct arm_dap_object *obj;
+ list_for_each_entry(obj, &all_dap, lh)
+ command_print(CMD, "%s", obj->name);
- if (argc != 1) {
- Jim_WrongNumArgs(interp, 1, argv, "Too many parameters");
- return JIM_ERR;
- }
- Jim_SetResult(interp, Jim_NewListObj(interp, NULL, 0));
- list_for_each_entry(obj, &all_dap, lh) {
- Jim_ListAppendElement(interp, Jim_GetResult(interp),
- Jim_NewStringObj(interp, obj->name, -1));
- }
- return JIM_OK;
+ return ERROR_OK;
}
COMMAND_HANDLER(handle_dap_init)
@@ -500,7 +496,7 @@ static const struct command_registration dap_subcommand_handlers[] = {
{
.name = "names",
.mode = COMMAND_ANY,
- .jim_handler = jim_dap_names,
+ .handler = handle_dap_names,
.usage = "",
.help = "Lists all registered DAP instances by name",
},
commit fbb7a50cbd5b9cda29698b3192e2a4596b3a6371
Author: Antonio Borneo <bor...@gm...>
Date: Mon Dec 19 18:29:08 2022 +0100
jtag: rewrite command 'flush_count' as COMMAND_HANDLER
While there:
- check the number of command parameters;
- add the mandatory 'usage' field.
Change-Id: I7cd16f049753caedf19f313f7dc84be98efdba42
Signed-off-by: Antonio Borneo <bor...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/7497
Tested-by: jenkins
diff --git a/src/jtag/tcl.c b/src/jtag/tcl.c
index c6ca04810..b3cbc48b4 100644
--- a/src/jtag/tcl.c
+++ b/src/jtag/tcl.c
@@ -249,12 +249,15 @@ static int jim_command_pathmove(Jim_Interp *interp, int argc, Jim_Obj * const *a
return JIM_OK;
}
-
-static int jim_command_flush_count(Jim_Interp *interp, int argc, Jim_Obj * const *args)
+COMMAND_HANDLER(handle_jtag_flush_count)
{
- Jim_SetResult(interp, Jim_NewIntObj(interp, jtag_get_flush_queue_count()));
+ if (CMD_ARGC != 0)
+ return ERROR_COMMAND_SYNTAX_ERROR;
- return JIM_OK;
+ int count = jtag_get_flush_queue_count();
+ command_print_sameline(CMD, "%d", count);
+
+ return ERROR_OK;
}
/* REVISIT Just what about these should "move" ... ?
@@ -279,9 +282,10 @@ static const struct command_registration jtag_command_handlers_to_move[] = {
{
.name = "flush_count",
.mode = COMMAND_EXEC,
- .jim_handler = jim_command_flush_count,
+ .handler = handle_jtag_flush_count,
.help = "Returns the number of times the JTAG queue "
"has been flushed.",
+ .usage = "",
},
{
.name = "pathmove",
-----------------------------------------------------------------------
Summary of changes:
src/jtag/tcl.c | 14 +++++++++-----
src/target/arm_dap.c | 20 ++++++++------------
2 files changed, 17 insertions(+), 17 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2023-03-25 18:13: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 254598ba25265b79bac4a5e32fa2abb5d252d2cb (commit)
via ff0fdcf61427b76f1cfc9c3ecd551f058c0957d0 (commit)
from 27741252571d7c34b9049275d02cf6c34b1ae7d2 (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 254598ba25265b79bac4a5e32fa2abb5d252d2cb
Author: Antonio Borneo <bor...@gm...>
Date: Mon Dec 19 18:23:11 2022 +0100
jtag: rewrite command 'jtag arp_init-reset' as COMMAND_HANDLER
While there add the mandatory 'usage' field.
Change-Id: I316fb31e24e94985dcc724e428b0384be7ef5bdd
Signed-off-by: Antonio Borneo <bor...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/7496
Tested-by: jenkins
diff --git a/src/jtag/tcl.c b/src/jtag/tcl.c
index f154295dd..c6ca04810 100644
--- a/src/jtag/tcl.c
+++ b/src/jtag/tcl.c
@@ -672,27 +672,18 @@ COMMAND_HANDLER(handle_jtag_arp_init)
return jtag_init_inner(CMD_CTX);
}
-static int jim_jtag_arp_init_reset(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
+COMMAND_HANDLER(handle_jtag_arp_init_reset)
{
- int e = ERROR_OK;
- struct jim_getopt_info goi;
- jim_getopt_setup(&goi, interp, argc-1, argv + 1);
- if (goi.argc != 0) {
- Jim_WrongNumArgs(goi.interp, 1, goi.argv-1, "(no params)");
- return JIM_ERR;
- }
- struct command_context *context = current_command_context(interp);
+ if (CMD_ARGC != 0)
+ return ERROR_COMMAND_SYNTAX_ERROR;
+
if (transport_is_jtag())
- e = jtag_init_reset(context);
- else if (transport_is_swd())
- e = swd_init_reset(context);
+ return jtag_init_reset(CMD_CTX);
- if (e != ERROR_OK) {
- Jim_Obj *obj = Jim_NewIntObj(goi.interp, e);
- Jim_SetResultFormatted(goi.interp, "error: %#s", obj);
- return JIM_ERR;
- }
- return JIM_OK;
+ if (transport_is_swd())
+ return swd_init_reset(CMD_CTX);
+
+ return ERROR_OK;
}
int jim_jtag_newtap(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
@@ -842,9 +833,10 @@ static const struct command_registration jtag_subcommand_handlers[] = {
{
.name = "arp_init-reset",
.mode = COMMAND_ANY,
- .jim_handler = jim_jtag_arp_init_reset,
+ .handler = handle_jtag_arp_init_reset,
.help = "Uses TRST and SRST to try resetting everything on "
- "the JTAG scan chain, then performs 'jtag arp_init'."
+ "the JTAG scan chain, then performs 'jtag arp_init'.",
+ .usage = "",
},
{
.name = "newtap",
commit ff0fdcf61427b76f1cfc9c3ecd551f058c0957d0
Author: Antonio Borneo <bor...@gm...>
Date: Mon Dec 19 18:18:48 2022 +0100
jtag: rewrite command 'jtag arp_init' as COMMAND_HANDLER
While there add the mandatory 'usage' field.
Change-Id: I3491ed79d11c5a3e81cc9afd2423da14b8df72ff
Signed-off-by: Antonio Borneo <bor...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/7495
Tested-by: jenkins
diff --git a/src/jtag/tcl.c b/src/jtag/tcl.c
index 83cb0a18b..f154295dd 100644
--- a/src/jtag/tcl.c
+++ b/src/jtag/tcl.c
@@ -664,22 +664,12 @@ static void jtag_tap_handle_event(struct jtag_tap *tap, enum jtag_event e)
}
}
-static int jim_jtag_arp_init(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
+COMMAND_HANDLER(handle_jtag_arp_init)
{
- struct jim_getopt_info goi;
- jim_getopt_setup(&goi, interp, argc-1, argv + 1);
- if (goi.argc != 0) {
- Jim_WrongNumArgs(goi.interp, 1, goi.argv-1, "(no params)");
- return JIM_ERR;
- }
- struct command_context *context = current_command_context(interp);
- int e = jtag_init_inner(context);
- if (e != ERROR_OK) {
- Jim_Obj *obj = Jim_NewIntObj(goi.interp, e);
- Jim_SetResultFormatted(goi.interp, "error: %#s", obj);
- return JIM_ERR;
- }
- return JIM_OK;
+ if (CMD_ARGC != 0)
+ return ERROR_COMMAND_SYNTAX_ERROR;
+
+ return jtag_init_inner(CMD_CTX);
}
static int jim_jtag_arp_init_reset(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
@@ -843,10 +833,11 @@ static const struct command_registration jtag_subcommand_handlers[] = {
{
.name = "arp_init",
.mode = COMMAND_ANY,
- .jim_handler = jim_jtag_arp_init,
+ .handler = handle_jtag_arp_init,
.help = "Validates JTAG scan chain against the list of "
"declared TAPs using just the four standard JTAG "
"signals.",
+ .usage = "",
},
{
.name = "arp_init-reset",
-----------------------------------------------------------------------
Summary of changes:
src/jtag/tcl.c | 55 +++++++++++++++++++------------------------------------
1 file changed, 19 insertions(+), 36 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2023-03-25 18:13:07
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Main OpenOCD repository".
The branch, master has been updated
via 27741252571d7c34b9049275d02cf6c34b1ae7d2 (commit)
via 19e2a0d6af3783e572a80e4cbf0f471f6dbf66e7 (commit)
from 5da4ef25c8a2e57325bc1706c07f54cc99ce0ce1 (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 27741252571d7c34b9049275d02cf6c34b1ae7d2
Author: Antonio Borneo <bor...@gm...>
Date: Mon Dec 19 18:08:03 2022 +0100
jtag: rewrite command 'jtag names' as COMMAND_HANDLER
While there:
- format in a human readable way the output list by using one line
per tap name;
- add the mandatory 'usage' field.
Change-Id: I295449220c78fac8973478b265413342ea832f61
Signed-off-by: Antonio Borneo <bor...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/7494
Tested-by: jenkins
diff --git a/src/jtag/tcl.c b/src/jtag/tcl.c
index fc0d562e2..83cb0a18b 100644
--- a/src/jtag/tcl.c
+++ b/src/jtag/tcl.c
@@ -805,24 +805,15 @@ int jim_jtag_configure(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
return jtag_tap_configure_cmd(&goi, t);
}
-static int jim_jtag_names(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
+COMMAND_HANDLER(handle_jtag_names)
{
- struct jim_getopt_info goi;
- jim_getopt_setup(&goi, interp, argc-1, argv + 1);
- if (goi.argc != 0) {
- Jim_WrongNumArgs(goi.interp, 1, goi.argv, "Too many parameters");
- return JIM_ERR;
- }
- Jim_SetResult(goi.interp, Jim_NewListObj(goi.interp, NULL, 0));
- struct jtag_tap *tap;
+ if (CMD_ARGC != 0)
+ return ERROR_COMMAND_SYNTAX_ERROR;
- for (tap = jtag_all_taps(); tap; tap = tap->next_tap) {
- Jim_ListAppendElement(goi.interp,
- Jim_GetResult(goi.interp),
- Jim_NewStringObj(goi.interp,
- tap->dotted_name, -1));
- }
- return JIM_OK;
+ for (struct jtag_tap *tap = jtag_all_taps(); tap; tap = tap->next_tap)
+ command_print(CMD, "%s", tap->dotted_name);
+
+ return ERROR_OK;
}
COMMAND_HANDLER(handle_jtag_init_command)
@@ -921,8 +912,9 @@ static const struct command_registration jtag_subcommand_handlers[] = {
{
.name = "names",
.mode = COMMAND_ANY,
- .jim_handler = jim_jtag_names,
+ .handler = handle_jtag_names,
.help = "Returns list of all JTAG tap names.",
+ .usage = "",
},
{
.chain = jtag_command_handlers_to_move,
commit 19e2a0d6af3783e572a80e4cbf0f471f6dbf66e7
Author: Antonio Borneo <bor...@gm...>
Date: Sun Dec 18 22:11:14 2022 +0100
jtag: rewrite command 'adapter name' as COMMAND_HANDLER
Trivial change.
Add the mandatory 'usage' field.
Change-Id: Id92af5cd873fb86f5de79f785f156d1ef734b005
Signed-off-by: Antonio Borneo <bor...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/7493
Tested-by: jenkins
diff --git a/src/jtag/adapter.c b/src/jtag/adapter.c
index eb73fcb9a..76a6620be 100644
--- a/src/jtag/adapter.c
+++ b/src/jtag/adapter.c
@@ -378,21 +378,18 @@ done:
return equal;
}
-static int jim_adapter_name(Jim_Interp *interp, int argc, Jim_Obj * const *argv)
+COMMAND_HANDLER(handle_adapter_name)
{
- struct jim_getopt_info goi;
- jim_getopt_setup(&goi, interp, argc-1, argv + 1);
-
/* return the name of the interface */
/* TCL code might need to know the exact type... */
/* FUTURE: we allow this as a means to "set" the interface. */
- if (goi.argc != 0) {
- Jim_WrongNumArgs(goi.interp, 1, goi.argv-1, "(no params)");
- return JIM_ERR;
- }
- const char *name = adapter_driver ? adapter_driver->name : NULL;
- Jim_SetResultString(goi.interp, name ? name : "undefined", -1);
- return JIM_OK;
+
+ if (CMD_ARGC != 0)
+ return ERROR_COMMAND_SYNTAX_ERROR;
+
+ command_print(CMD, "%s", adapter_driver ? adapter_driver->name : "undefined");
+
+ return ERROR_OK;
}
COMMAND_HANDLER(adapter_transports_command)
@@ -1127,9 +1124,10 @@ static const struct command_registration adapter_command_handlers[] = {
{
.name = "name",
.mode = COMMAND_ANY,
- .jim_handler = jim_adapter_name,
+ .handler = handle_adapter_name,
.help = "Returns the name of the currently "
"selected adapter (driver)",
+ .usage = "",
},
{
.name = "srst",
-----------------------------------------------------------------------
Summary of changes:
src/jtag/adapter.c | 22 ++++++++++------------
src/jtag/tcl.c | 26 +++++++++-----------------
2 files changed, 19 insertions(+), 29 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2023-03-25 18:12:54
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Main OpenOCD repository".
The branch, master has been updated
via 5da4ef25c8a2e57325bc1706c07f54cc99ce0ce1 (commit)
from c4f2337d02d3c0d452a9958e44e82a8e6454dead (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 5da4ef25c8a2e57325bc1706c07f54cc99ce0ce1
Author: Antonio Borneo <bor...@gm...>
Date: Mon Dec 19 17:55:13 2022 +0100
target: cti: rewrite command 'cti names' as COMMAND_HANDLER
While there, format in a human readable way the output list by
using one line per cti name.
Change-Id: I6d4870ee512fe7e6935d73355c2377ad805ccc3b
Signed-off-by: Antonio Borneo <bor...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/7492
Tested-by: jenkins
diff --git a/src/target/arm_cti.c b/src/target/arm_cti.c
index 3612874e2..7637ad015 100644
--- a/src/target/arm_cti.c
+++ b/src/target/arm_cti.c
@@ -525,20 +525,17 @@ static int jim_cti_create(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
return cti_create(&goi);
}
-static int jim_cti_names(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
+COMMAND_HANDLER(cti_handle_names)
{
struct arm_cti *obj;
- if (argc != 1) {
- Jim_WrongNumArgs(interp, 1, argv, "Too many parameters");
- return JIM_ERR;
- }
- Jim_SetResult(interp, Jim_NewListObj(interp, NULL, 0));
- list_for_each_entry(obj, &all_cti, lh) {
- Jim_ListAppendElement(interp, Jim_GetResult(interp),
- Jim_NewStringObj(interp, obj->name, -1));
- }
- return JIM_OK;
+ if (CMD_ARGC != 0)
+ return ERROR_COMMAND_SYNTAX_ERROR;
+
+ list_for_each_entry(obj, &all_cti, lh)
+ command_print(CMD, "%s", obj->name);
+
+ return ERROR_OK;
}
@@ -553,7 +550,7 @@ static const struct command_registration cti_subcommand_handlers[] = {
{
.name = "names",
.mode = COMMAND_ANY,
- .jim_handler = jim_cti_names,
+ .handler = cti_handle_names,
.usage = "",
.help = "Lists all registered CTI objects by name",
},
-----------------------------------------------------------------------
Summary of changes:
src/target/arm_cti.c | 21 +++++++++------------
1 file changed, 9 insertions(+), 12 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2023-03-25 18:12: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 c4f2337d02d3c0d452a9958e44e82a8e6454dead (commit)
from 21e6252965d8cf82660344a7d6c12d64269d7387 (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 c4f2337d02d3c0d452a9958e44e82a8e6454dead
Author: Antonio Borneo <bor...@gm...>
Date: Mon Dec 19 13:02:59 2022 +0100
target: armv4_5: rewrite commands 'arm mcr/mrc' as COMMAND_HANDLER
While there, add a check for target halted and check the number of
parameters accordingly to the command name.
Change-Id: I9e8bb109c35039561997d14782fac682267aee65
Signed-off-by: Antonio Borneo <bor...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/7491
Tested-by: jenkins
diff --git a/src/target/armv4_5.c b/src/target/armv4_5.c
index 48af5035a..9586adc97 100644
--- a/src/target/armv4_5.c
+++ b/src/target/armv4_5.c
@@ -989,36 +989,37 @@ COMMAND_HANDLER(handle_arm_disassemble_command)
#endif
}
-static int jim_mcrmrc(Jim_Interp *interp, int argc, Jim_Obj * const *argv)
+COMMAND_HANDLER(handle_armv4_5_mcrmrc)
{
- struct command_context *context;
- struct target *target;
- struct arm *arm;
- int retval;
+ bool is_mcr = false;
+ unsigned int arg_cnt = 5;
+
+ if (!strcmp(CMD_NAME, "mcr")) {
+ is_mcr = true;
+ arg_cnt = 6;
+ }
- context = current_command_context(interp);
- assert(context);
+ if (arg_cnt != CMD_ARGC)
+ return ERROR_COMMAND_SYNTAX_ERROR;
- target = get_current_target(context);
+ struct target *target = get_current_target(CMD_CTX);
if (!target) {
- LOG_ERROR("%s: no current target", __func__);
- return JIM_ERR;
+ command_print(CMD, "no current target");
+ return ERROR_FAIL;
}
if (!target_was_examined(target)) {
- LOG_ERROR("%s: not yet examined", target_name(target));
- return JIM_ERR;
+ command_print(CMD, "%s: not yet examined", target_name(target));
+ return ERROR_TARGET_NOT_EXAMINED;
}
- arm = target_to_arm(target);
+
+ struct arm *arm = target_to_arm(target);
if (!is_arm(arm)) {
- LOG_ERROR("%s: not an ARM", target_name(target));
- return JIM_ERR;
+ command_print(CMD, "%s: not an ARM", target_name(target));
+ return ERROR_FAIL;
}
- if ((argc < 6) || (argc > 7)) {
- /* FIXME use the command name to verify # params... */
- LOG_ERROR("%s: wrong number of arguments", __func__);
- return JIM_ERR;
- }
+ if (target->state != TARGET_HALTED)
+ return ERROR_TARGET_NOT_HALTED;
int cpnum;
uint32_t op1;
@@ -1026,95 +1027,68 @@ static int jim_mcrmrc(Jim_Interp *interp, int argc, Jim_Obj * const *argv)
uint32_t crn;
uint32_t crm;
uint32_t value;
- long l;
/* NOTE: parameter sequence matches ARM instruction set usage:
* MCR pNUM, op1, rX, CRn, CRm, op2 ; write CP from rX
* MRC pNUM, op1, rX, CRn, CRm, op2 ; read CP into rX
* The "rX" is necessarily omitted; it uses Tcl mechanisms.
*/
- retval = Jim_GetLong(interp, argv[1], &l);
- if (retval != JIM_OK)
- return retval;
- if (l & ~0xf) {
- LOG_ERROR("%s: %s %d out of range", __func__,
- "coprocessor", (int) l);
- return JIM_ERR;
+ COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], cpnum);
+ if (cpnum & ~0xf) {
+ command_print(CMD, "coprocessor %d out of range", cpnum);
+ return ERROR_COMMAND_ARGUMENT_INVALID;
}
- cpnum = l;
- retval = Jim_GetLong(interp, argv[2], &l);
- if (retval != JIM_OK)
- return retval;
- if (l & ~0x7) {
- LOG_ERROR("%s: %s %d out of range", __func__,
- "op1", (int) l);
- return JIM_ERR;
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], op1);
+ if (op1 & ~0x7) {
+ command_print(CMD, "op1 %d out of range", op1);
+ return ERROR_COMMAND_ARGUMENT_INVALID;
}
- op1 = l;
- retval = Jim_GetLong(interp, argv[3], &l);
- if (retval != JIM_OK)
- return retval;
- if (l & ~0xf) {
- LOG_ERROR("%s: %s %d out of range", __func__,
- "CRn", (int) l);
- return JIM_ERR;
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[2], crn);
+ if (crn & ~0xf) {
+ command_print(CMD, "CRn %d out of range", crn);
+ return ERROR_COMMAND_ARGUMENT_INVALID;
}
- crn = l;
- retval = Jim_GetLong(interp, argv[4], &l);
- if (retval != JIM_OK)
- return retval;
- if (l & ~0xf) {
- LOG_ERROR("%s: %s %d out of range", __func__,
- "CRm", (int) l);
- return JIM_ERR;
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[3], crm);
+ if (crm & ~0xf) {
+ command_print(CMD, "CRm %d out of range", crm);
+ return ERROR_COMMAND_ARGUMENT_INVALID;
}
- crm = l;
- retval = Jim_GetLong(interp, argv[5], &l);
- if (retval != JIM_OK)
- return retval;
- if (l & ~0x7) {
- LOG_ERROR("%s: %s %d out of range", __func__,
- "op2", (int) l);
- return JIM_ERR;
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[4], op2);
+ if (op2 & ~0x7) {
+ command_print(CMD, "op2 %d out of range", op2);
+ return ERROR_COMMAND_ARGUMENT_INVALID;
}
- op2 = l;
-
- value = 0;
- /* FIXME don't assume "mrc" vs "mcr" from the number of params;
- * that could easily be a typo! Check both...
- *
+ /*
* FIXME change the call syntax here ... simplest to just pass
* the MRC() or MCR() instruction to be executed. That will also
* let us support the "mrc2" and "mcr2" opcodes (toggling one bit)
* if that's ever needed.
*/
- if (argc == 7) {
- retval = Jim_GetLong(interp, argv[6], &l);
- if (retval != JIM_OK)
- return retval;
- value = l;
+ if (is_mcr) {
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[5], value);
/* NOTE: parameters reordered! */
/* ARMV4_5_MCR(cpnum, op1, 0, crn, crm, op2) */
- retval = arm->mcr(target, cpnum, op1, op2, crn, crm, value);
+ int retval = arm->mcr(target, cpnum, op1, op2, crn, crm, value);
if (retval != ERROR_OK)
- return JIM_ERR;
+ return retval;
} else {
+ value = 0;
/* NOTE: parameters reordered! */
/* ARMV4_5_MRC(cpnum, op1, 0, crn, crm, op2) */
- retval = arm->mrc(target, cpnum, op1, op2, crn, crm, &value);
+ int retval = arm->mrc(target, cpnum, op1, op2, crn, crm, &value);
if (retval != ERROR_OK)
- return JIM_ERR;
+ return retval;
- Jim_SetResult(interp, Jim_NewIntObj(interp, value));
+ command_print(CMD, "0x%" PRIx32, value);
}
- return JIM_OK;
+ return ERROR_OK;
}
static const struct command_registration arm_exec_command_handlers[] = {
@@ -1128,14 +1102,14 @@ static const struct command_registration arm_exec_command_handlers[] = {
{
.name = "mcr",
.mode = COMMAND_EXEC,
- .jim_handler = &jim_mcrmrc,
+ .handler = handle_armv4_5_mcrmrc,
.help = "write coprocessor register",
.usage = "cpnum op1 CRn CRm op2 value",
},
{
.name = "mrc",
.mode = COMMAND_EXEC,
- .jim_handler = &jim_mcrmrc,
+ .handler = handle_armv4_5_mcrmrc,
.help = "read coprocessor register",
.usage = "cpnum op1 CRn CRm op2",
},
-----------------------------------------------------------------------
Summary of changes:
src/target/armv4_5.c | 132 +++++++++++++++++++++------------------------------
1 file changed, 53 insertions(+), 79 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2023-03-25 18:11:41
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Main OpenOCD repository".
The branch, master has been updated
via 21e6252965d8cf82660344a7d6c12d64269d7387 (commit)
via 0332da1f1518b0cb4150965614c09fcc7319ddbe (commit)
from 880ae3f07744a09e267bde00cf405c85a6f10482 (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 21e6252965d8cf82660344a7d6c12d64269d7387
Author: Antonio Borneo <bor...@gm...>
Date: Mon Dec 19 12:49:20 2022 +0100
target: aarch64: rewrite commands 'aarch64 mcr/mrc' as COMMAND_HANDLER
This also fixes an incorrect return ERROR_TARGET_NOT_HALTED from a
jim command.
Change-Id: I99a02a21bedb64e60944e295c7cf24356e07be60
Signed-off-by: Antonio Borneo <bor...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/7490
Tested-by: jenkins
diff --git a/src/target/aarch64.c b/src/target/aarch64.c
index 8e90e6400..3c33032e9 100644
--- a/src/target/aarch64.c
+++ b/src/target/aarch64.c
@@ -2952,53 +2952,41 @@ COMMAND_HANDLER(aarch64_mask_interrupts_command)
return ERROR_OK;
}
-static int jim_mcrmrc(Jim_Interp *interp, int argc, Jim_Obj * const *argv)
+COMMAND_HANDLER(aarch64_mcrmrc_command)
{
- struct command *c = jim_to_command(interp);
- struct command_context *context;
- struct target *target;
- struct arm *arm;
- int retval;
bool is_mcr = false;
- int arg_cnt = 0;
+ unsigned int arg_cnt = 5;
- if (!strcmp(c->name, "mcr")) {
+ if (!strcmp(CMD_NAME, "mcr")) {
is_mcr = true;
- arg_cnt = 7;
- } else {
arg_cnt = 6;
}
- context = current_command_context(interp);
- assert(context);
+ if (arg_cnt != CMD_ARGC)
+ return ERROR_COMMAND_SYNTAX_ERROR;
- target = get_current_target(context);
+ struct target *target = get_current_target(CMD_CTX);
if (!target) {
- LOG_ERROR("%s: no current target", __func__);
- return JIM_ERR;
+ command_print(CMD, "no current target");
+ return ERROR_FAIL;
}
if (!target_was_examined(target)) {
- LOG_ERROR("%s: not yet examined", target_name(target));
- return JIM_ERR;
+ command_print(CMD, "%s: not yet examined", target_name(target));
+ return ERROR_TARGET_NOT_EXAMINED;
}
- arm = target_to_arm(target);
+ struct arm *arm = target_to_arm(target);
if (!is_arm(arm)) {
- LOG_ERROR("%s: not an ARM", target_name(target));
- return JIM_ERR;
+ command_print(CMD, "%s: not an ARM", target_name(target));
+ return ERROR_FAIL;
}
if (target->state != TARGET_HALTED)
return ERROR_TARGET_NOT_HALTED;
if (arm->core_state == ARM_STATE_AARCH64) {
- LOG_ERROR("%s: not 32-bit arm target", target_name(target));
- return JIM_ERR;
- }
-
- if (argc != arg_cnt) {
- LOG_ERROR("%s: wrong number of arguments", __func__);
- return JIM_ERR;
+ command_print(CMD, "%s: not 32-bit arm target", target_name(target));
+ return ERROR_FAIL;
}
int cpnum;
@@ -3007,87 +2995,62 @@ static int jim_mcrmrc(Jim_Interp *interp, int argc, Jim_Obj * const *argv)
uint32_t crn;
uint32_t crm;
uint32_t value;
- long l;
/* NOTE: parameter sequence matches ARM instruction set usage:
* MCR pNUM, op1, rX, CRn, CRm, op2 ; write CP from rX
* MRC pNUM, op1, rX, CRn, CRm, op2 ; read CP into rX
* The "rX" is necessarily omitted; it uses Tcl mechanisms.
*/
- retval = Jim_GetLong(interp, argv[1], &l);
- if (retval != JIM_OK)
- return retval;
- if (l & ~0xf) {
- LOG_ERROR("%s: %s %d out of range", __func__,
- "coprocessor", (int) l);
- return JIM_ERR;
+ COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], cpnum);
+ if (cpnum & ~0xf) {
+ command_print(CMD, "coprocessor %d out of range", cpnum);
+ return ERROR_COMMAND_ARGUMENT_INVALID;
}
- cpnum = l;
- retval = Jim_GetLong(interp, argv[2], &l);
- if (retval != JIM_OK)
- return retval;
- if (l & ~0x7) {
- LOG_ERROR("%s: %s %d out of range", __func__,
- "op1", (int) l);
- return JIM_ERR;
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], op1);
+ if (op1 & ~0x7) {
+ command_print(CMD, "op1 %d out of range", op1);
+ return ERROR_COMMAND_ARGUMENT_INVALID;
}
- op1 = l;
- retval = Jim_GetLong(interp, argv[3], &l);
- if (retval != JIM_OK)
- return retval;
- if (l & ~0xf) {
- LOG_ERROR("%s: %s %d out of range", __func__,
- "CRn", (int) l);
- return JIM_ERR;
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[2], crn);
+ if (crn & ~0xf) {
+ command_print(CMD, "CRn %d out of range", crn);
+ return ERROR_COMMAND_ARGUMENT_INVALID;
}
- crn = l;
- retval = Jim_GetLong(interp, argv[4], &l);
- if (retval != JIM_OK)
- return retval;
- if (l & ~0xf) {
- LOG_ERROR("%s: %s %d out of range", __func__,
- "CRm", (int) l);
- return JIM_ERR;
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[3], crm);
+ if (crm & ~0xf) {
+ command_print(CMD, "CRm %d out of range", crm);
+ return ERROR_COMMAND_ARGUMENT_INVALID;
}
- crm = l;
- retval = Jim_GetLong(interp, argv[5], &l);
- if (retval != JIM_OK)
- return retval;
- if (l & ~0x7) {
- LOG_ERROR("%s: %s %d out of range", __func__,
- "op2", (int) l);
- return JIM_ERR;
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[4], op2);
+ if (op2 & ~0x7) {
+ command_print(CMD, "op2 %d out of range", op2);
+ return ERROR_COMMAND_ARGUMENT_INVALID;
}
- op2 = l;
- value = 0;
-
- if (is_mcr == true) {
- retval = Jim_GetLong(interp, argv[6], &l);
- if (retval != JIM_OK)
- return retval;
- value = l;
+ if (is_mcr) {
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[5], value);
/* NOTE: parameters reordered! */
/* ARMV4_5_MCR(cpnum, op1, 0, crn, crm, op2) */
- retval = arm->mcr(target, cpnum, op1, op2, crn, crm, value);
+ int retval = arm->mcr(target, cpnum, op1, op2, crn, crm, value);
if (retval != ERROR_OK)
- return JIM_ERR;
+ return retval;
} else {
+ value = 0;
/* NOTE: parameters reordered! */
/* ARMV4_5_MRC(cpnum, op1, 0, crn, crm, op2) */
- retval = arm->mrc(target, cpnum, op1, op2, crn, crm, &value);
+ int retval = arm->mrc(target, cpnum, op1, op2, crn, crm, &value);
if (retval != ERROR_OK)
- return JIM_ERR;
+ return retval;
- Jim_SetResult(interp, Jim_NewIntObj(interp, value));
+ command_print(CMD, "0x%" PRIx32, value);
}
- return JIM_OK;
+ return ERROR_OK;
}
static const struct command_registration aarch64_exec_command_handlers[] = {
@@ -3122,14 +3085,14 @@ static const struct command_registration aarch64_exec_command_handlers[] = {
{
.name = "mcr",
.mode = COMMAND_EXEC,
- .jim_handler = jim_mcrmrc,
+ .handler = aarch64_mcrmrc_command,
.help = "write coprocessor register",
.usage = "cpnum op1 CRn CRm op2 value",
},
{
.name = "mrc",
.mode = COMMAND_EXEC,
- .jim_handler = jim_mcrmrc,
+ .handler = aarch64_mcrmrc_command,
.help = "read coprocessor register",
.usage = "cpnum op1 CRn CRm op2",
},
commit 0332da1f1518b0cb4150965614c09fcc7319ddbe
Author: Antonio Borneo <bor...@gm...>
Date: Sun Dec 18 22:42:18 2022 +0100
rtt: rewrite command 'rtt channellist' as COMMAND_HANDLER
This also fixes a mistake of the jim command returning ERROR_xx
when function rtt_read_channel_info() returns error.
While there:
- format in a human readable way the output dictionary list, while
preserving the structure of its TCL data;
- add check for the number of parameters.
Change-Id: Ica2b623699d3a606d3992975c836dae96f74b26d
Signed-off-by: Antonio Borneo <bor...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/7489
Tested-by: jenkins
diff --git a/src/rtt/tcl.c b/src/rtt/tcl.c
index 7cbdccf56..f949aa1c9 100644
--- a/src/rtt/tcl.c
+++ b/src/rtt/tcl.c
@@ -150,17 +150,17 @@ COMMAND_HANDLER(handle_rtt_channels_command)
return ERROR_OK;
}
-static int jim_channel_list(Jim_Interp *interp, int argc,
- Jim_Obj * const *argv)
+COMMAND_HANDLER(handle_channel_list)
{
- Jim_Obj *list;
- Jim_Obj *channel_list;
char channel_name[CHANNEL_NAME_SIZE];
const struct rtt_control *ctrl;
struct rtt_channel_info info;
+ if (CMD_ARGC != 0)
+ return ERROR_COMMAND_SYNTAX_ERROR;
+
if (!rtt_found_cb()) {
- Jim_SetResultFormatted(interp, "rtt: Control block not available");
+ command_print(CMD, "rtt: Control block not available");
return ERROR_FAIL;
}
@@ -169,81 +169,47 @@ static int jim_channel_list(Jim_Interp *interp, int argc,
info.name = channel_name;
info.name_length = sizeof(channel_name);
- list = Jim_NewListObj(interp, NULL, 0);
- channel_list = Jim_NewListObj(interp, NULL, 0);
+ command_print(CMD, "{");
for (unsigned int i = 0; i < ctrl->num_up_channels; i++) {
- int ret;
- Jim_Obj *tmp;
-
- ret = rtt_read_channel_info(i, RTT_CHANNEL_TYPE_UP, &info);
-
+ int ret = rtt_read_channel_info(i, RTT_CHANNEL_TYPE_UP, &info);
if (ret != ERROR_OK)
return ret;
if (!info.size)
continue;
- tmp = Jim_NewListObj(interp, NULL, 0);
-
- Jim_ListAppendElement(interp, tmp, Jim_NewStringObj(interp,
- "name", -1));
- Jim_ListAppendElement(interp, tmp, Jim_NewStringObj(interp,
- info.name, -1));
-
- Jim_ListAppendElement(interp, tmp, Jim_NewStringObj(interp,
- "size", -1));
- Jim_ListAppendElement(interp, tmp, Jim_NewIntObj(interp,
- info.size));
-
- Jim_ListAppendElement(interp, tmp, Jim_NewStringObj(interp,
- "flags", -1));
- Jim_ListAppendElement(interp, tmp, Jim_NewIntObj(interp,
- info.flags));
-
- Jim_ListAppendElement(interp, channel_list, tmp);
+ command_print(CMD,
+ " {\n"
+ " name %s\n"
+ " size 0x%" PRIx32 "\n"
+ " flags 0x%" PRIx32 "\n"
+ " }",
+ info.name, info.size, info.flags);
}
- Jim_ListAppendElement(interp, list, channel_list);
-
- channel_list = Jim_NewListObj(interp, NULL, 0);
+ command_print(CMD, "}\n{");
for (unsigned int i = 0; i < ctrl->num_down_channels; i++) {
- int ret;
- Jim_Obj *tmp;
-
- ret = rtt_read_channel_info(i, RTT_CHANNEL_TYPE_DOWN, &info);
-
+ int ret = rtt_read_channel_info(i, RTT_CHANNEL_TYPE_DOWN, &info);
if (ret != ERROR_OK)
return ret;
if (!info.size)
continue;
- tmp = Jim_NewListObj(interp, NULL, 0);
-
- Jim_ListAppendElement(interp, tmp, Jim_NewStringObj(interp,
- "name", -1));
- Jim_ListAppendElement(interp, tmp, Jim_NewStringObj(interp,
- info.name, -1));
-
- Jim_ListAppendElement(interp, tmp, Jim_NewStringObj(interp,
- "size", -1));
- Jim_ListAppendElement(interp, tmp, Jim_NewIntObj(interp,
- info.size));
-
- Jim_ListAppendElement(interp, tmp, Jim_NewStringObj(interp,
- "flags", -1));
- Jim_ListAppendElement(interp, tmp, Jim_NewIntObj(interp,
- info.flags));
-
- Jim_ListAppendElement(interp, channel_list, tmp);
+ command_print(CMD,
+ " {\n"
+ " name %s\n"
+ " size 0x%" PRIx32 "\n"
+ " flags 0x%" PRIx32 "\n"
+ " }",
+ info.name, info.size, info.flags);
}
- Jim_ListAppendElement(interp, list, channel_list);
- Jim_SetResult(interp, list);
+ command_print(CMD, "}");
- return JIM_OK;
+ return ERROR_OK;
}
static const struct command_registration rtt_subcommand_handlers[] = {
@@ -284,7 +250,7 @@ static const struct command_registration rtt_subcommand_handlers[] = {
},
{
.name = "channellist",
- .jim_handler = jim_channel_list,
+ .handler = handle_channel_list,
.mode = COMMAND_EXEC,
.help = "list available channels",
.usage = ""
-----------------------------------------------------------------------
Summary of changes:
src/rtt/tcl.c | 86 +++++++++++-----------------------
src/target/aarch64.c | 129 ++++++++++++++++++---------------------------------
2 files changed, 72 insertions(+), 143 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2023-03-25 18:11:23
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Main OpenOCD repository".
The branch, master has been updated
via 880ae3f07744a09e267bde00cf405c85a6f10482 (commit)
from 842a12f4caf307e756045c14011c402a20da30b6 (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 880ae3f07744a09e267bde00cf405c85a6f10482
Author: Antonio Borneo <bor...@gm...>
Date: Sun Dec 18 19:12:35 2022 +0100
openocd: rewrite command 'version' as COMMAND_HANDLER
Trivial change.
While there:
- add the mandatory 'usage' field;
- document the optional parameter 'git';
- reword the documentation.
Change-Id: I6be4d4423128fa026a62e2ef355f77b69d50397e
Signed-off-by: Antonio Borneo <bor...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/7488
Tested-by: jenkins
diff --git a/doc/openocd.texi b/doc/openocd.texi
index 26a59e6a7..67661845d 100644
--- a/doc/openocd.texi
+++ b/doc/openocd.texi
@@ -9101,8 +9101,10 @@ format. Optional @option{start} and @option{end} parameters allow to
limit the address range.
@end deffn
-@deffn {Command} {version}
-Displays a string identifying the version of this OpenOCD server.
+@deffn {Command} {version} [git]
+Returns a string identifying the version of this OpenOCD server.
+With option @option{git}, it returns the git version obtained at compile time
+through ``git describe''.
@end deffn
@deffn {Command} {virt2phys} virtual_address
diff --git a/src/openocd.c b/src/openocd.c
index 875da5a62..54c5eb34f 100644
--- a/src/openocd.c
+++ b/src/openocd.c
@@ -51,24 +51,23 @@ static const char openocd_startup_tcl[] = {
};
/* Give scripts and TELNET a way to find out what version this is */
-static int jim_version_command(Jim_Interp *interp, int argc,
- Jim_Obj * const *argv)
+COMMAND_HANDLER(handler_version_command)
{
- if (argc > 2)
- return JIM_ERR;
- const char *str = "";
- char *version_str;
- version_str = OPENOCD_VERSION;
+ char *version_str = OPENOCD_VERSION;
- if (argc == 2)
- str = Jim_GetString(argv[1], NULL);
+ if (CMD_ARGC > 1)
+ return ERROR_COMMAND_SYNTAX_ERROR;
+
+ if (CMD_ARGC == 1) {
+ if (strcmp("git", CMD_ARGV[0]))
+ return ERROR_COMMAND_ARGUMENT_INVALID;
- if (strcmp("git", str) == 0)
version_str = GITVERSION;
+ }
- Jim_SetResult(interp, Jim_NewStringObj(interp, version_str, -1));
+ command_print(CMD, "%s", version_str);
- return JIM_OK;
+ return ERROR_OK;
}
static int log_target_callback_event_handler(struct target *target,
@@ -194,9 +193,10 @@ COMMAND_HANDLER(handle_add_script_search_dir_command)
static const struct command_registration openocd_command_handlers[] = {
{
.name = "version",
- .jim_handler = jim_version_command,
+ .handler = handler_version_command,
.mode = COMMAND_ANY,
.help = "show program version",
+ .usage = "[git]",
},
{
.name = "noinit",
-----------------------------------------------------------------------
Summary of changes:
doc/openocd.texi | 6 ++++--
src/openocd.c | 26 +++++++++++++-------------
2 files changed, 17 insertions(+), 15 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2023-03-25 18:10:29
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Main OpenOCD repository".
The branch, master has been updated
via 842a12f4caf307e756045c14011c402a20da30b6 (commit)
via 80fc9fabc66a0bc767467fa14c703e5a9f340cd3 (commit)
from d05c68667129705ecfd42c6029a60e849518d50c (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 842a12f4caf307e756045c14011c402a20da30b6
Author: Antonio Borneo <bor...@gm...>
Date: Sun Dec 18 18:49:02 2022 +0100
helper: util: rewrite command 'ms' as COMMAND_HANDLER
Use full 64 bits in output; no reason to truncate at 32 bits.
Change-Id: I433815a381e147731ff0da2c805170649a9bcf38
Signed-off-by: Antonio Borneo <bor...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/7487
Reviewed-by: Tomas Vanek <va...@fb...>
Tested-by: jenkins
diff --git a/src/helper/util.c b/src/helper/util.c
index bf18f8e60..5e12021ff 100644
--- a/src/helper/util.c
+++ b/src/helper/util.c
@@ -13,28 +13,21 @@
#include "log.h"
#include "time_support.h"
-static int jim_util_ms(Jim_Interp *interp,
- int argc,
- Jim_Obj * const *argv)
+COMMAND_HANDLER(handler_util_ms)
{
- if (argc != 1) {
- Jim_WrongNumArgs(interp, 1, argv, "ls ?dir?");
- return JIM_ERR;
- }
+ if (CMD_ARGC != 0)
+ return ERROR_COMMAND_SYNTAX_ERROR;
- /* Cast from 64 to 32 bit int works for 2's-compliment
- * when calculating differences*/
- Jim_SetResult(interp, Jim_NewIntObj(interp, (int)timeval_ms()));
+ command_print(CMD, "%" PRId64, timeval_ms());
- return JIM_OK;
+ return ERROR_OK;
}
static const struct command_registration util_command_handlers[] = {
- /* jim handlers */
{
.name = "ms",
.mode = COMMAND_ANY,
- .jim_handler = jim_util_ms,
+ .handler = handler_util_ms,
.help =
"Returns ever increasing milliseconds. Used to calculate differences in time.",
.usage = "",
commit 80fc9fabc66a0bc767467fa14c703e5a9f340cd3
Author: Antonio Borneo <bor...@gm...>
Date: Sun Dec 18 16:09:02 2022 +0100
flash: nor: rewrite command 'flash list' as COMMAND_HANDLER
The mixed use of jim commands and OpenOCD commands is error prone
due to handling of errors through JIM_xx and ERROR_yy.
Rewrite the jim command 'flash list' as OpenOCD command.
While there:
- format in a human readable way the output dictionary list, while
preserving the structure of its TCL data;
- add the mandatory 'usage' field.
Change-Id: I1ee69870d3ab3c1cfc46cd2b8ec03de6b2300bd6
Signed-off-by: Antonio Borneo <bor...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/7486
Reviewed-by: Tomas Vanek <va...@fb...>
Tested-by: jenkins
diff --git a/src/flash/nor/tcl.c b/src/flash/nor/tcl.c
index 4ff6d9838..ecbcf00aa 100644
--- a/src/flash/nor/tcl.c
+++ b/src/flash/nor/tcl.c
@@ -1324,40 +1324,27 @@ COMMAND_HANDLER(handle_flash_banks_command)
return ERROR_OK;
}
-static int jim_flash_list(Jim_Interp *interp, int argc, Jim_Obj * const *argv)
+COMMAND_HANDLER(handle_flash_list)
{
- if (argc != 1) {
- Jim_WrongNumArgs(interp, 1, argv,
- "no arguments to 'flash list' command");
- return JIM_ERR;
- }
-
- Jim_Obj *list = Jim_NewListObj(interp, NULL, 0);
+ if (CMD_ARGC != 0)
+ return ERROR_COMMAND_SYNTAX_ERROR;
for (struct flash_bank *p = flash_bank_list(); p; p = p->next) {
- Jim_Obj *elem = Jim_NewListObj(interp, NULL, 0);
-
- Jim_ListAppendElement(interp, elem, Jim_NewStringObj(interp, "name", -1));
- Jim_ListAppendElement(interp, elem, Jim_NewStringObj(interp, p->name, -1));
- Jim_ListAppendElement(interp, elem, Jim_NewStringObj(interp, "driver", -1));
- Jim_ListAppendElement(interp, elem, Jim_NewStringObj(interp, p->driver->name, -1));
- Jim_ListAppendElement(interp, elem, Jim_NewStringObj(interp, "base", -1));
- Jim_ListAppendElement(interp, elem, Jim_NewIntObj(interp, p->base));
- Jim_ListAppendElement(interp, elem, Jim_NewStringObj(interp, "size", -1));
- Jim_ListAppendElement(interp, elem, Jim_NewIntObj(interp, p->size));
- Jim_ListAppendElement(interp, elem, Jim_NewStringObj(interp, "bus_width", -1));
- Jim_ListAppendElement(interp, elem, Jim_NewIntObj(interp, p->bus_width));
- Jim_ListAppendElement(interp, elem, Jim_NewStringObj(interp, "chip_width", -1));
- Jim_ListAppendElement(interp, elem, Jim_NewIntObj(interp, p->chip_width));
- Jim_ListAppendElement(interp, elem, Jim_NewStringObj(interp, "target", -1));
- Jim_ListAppendElement(interp, elem, Jim_NewStringObj(interp, target_name(p->target), -1));
-
- Jim_ListAppendElement(interp, list, elem);
+ command_print(CMD,
+ "{\n"
+ " name %s\n"
+ " driver %s\n"
+ " base " TARGET_ADDR_FMT "\n"
+ " size 0x%" PRIx32 "\n"
+ " bus_width %u\n"
+ " chip_width %u\n"
+ " target %s\n"
+ "}",
+ p->name, p->driver->name, p->base, p->size, p->bus_width, p->chip_width,
+ target_name(p->target));
}
- Jim_SetResult(interp, list);
-
- return JIM_OK;
+ return ERROR_OK;
}
COMMAND_HANDLER(handle_flash_init_command)
@@ -1404,8 +1391,9 @@ static const struct command_registration flash_config_command_handlers[] = {
{
.name = "list",
.mode = COMMAND_ANY,
- .jim_handler = jim_flash_list,
+ .handler = handle_flash_list,
.help = "Returns a list of details about the flash banks.",
+ .usage = "",
},
COMMAND_REGISTRATION_DONE
};
-----------------------------------------------------------------------
Summary of changes:
src/flash/nor/tcl.c | 48 ++++++++++++++++++------------------------------
src/helper/util.c | 19 ++++++-------------
2 files changed, 24 insertions(+), 43 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2023-03-25 18:10:05
|
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 d05c68667129705ecfd42c6029a60e849518d50c (commit)
via 1ec8b83cbdb407536966b4e455dbb39d1cb42b3a (commit)
from 5f6ceebbba3a34fc4bfcf56e963739dd2e9cf056 (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 d05c68667129705ecfd42c6029a60e849518d50c
Author: Antonio Borneo <bor...@gm...>
Date: Sun Dec 18 15:26:56 2022 +0100
transport: rewrite command 'transport select' as COMMAND_HANDLER
The mixed use of jim commands and OpenOCD commands is error prone
due to handling of errors through JIM_xx and ERROR_yy.
Rewrite the jim command 'transport select' as OpenOCD command.
This fixes and incorrect check for the return value of function
transport_select(); it returns ERROR_yy but the check is on JIM_xx.
While there, fix the coding style.
Change-Id: I9f3e8394c1a0cc0312b414c58275e1220217bbed
Signed-off-by: Antonio Borneo <bor...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/7485
Reviewed-by: Tomas Vanek <va...@fb...>
Tested-by: jenkins
diff --git a/src/transport/transport.c b/src/transport/transport.c
index c05db3f00..81d3d583b 100644
--- a/src/transport/transport.c
+++ b/src/transport/transport.c
@@ -252,64 +252,62 @@ COMMAND_HANDLER(handle_transport_list)
* set supported by the debug adapter being used. Return value
* is scriptable (allowing "if swd then..." etc).
*/
-static int jim_transport_select(Jim_Interp *interp, int argc, Jim_Obj * const *argv)
+COMMAND_HANDLER(handle_transport_select)
{
- int res;
- switch (argc) {
- case 1: /* autoselect if necessary, then return/display current config */
- if (!session) {
- if (!allowed_transports) {
- LOG_ERROR("Debug adapter does not support any transports? Check config file order.");
- return JIM_ERR;
- }
- LOG_INFO("auto-selecting first available session transport \"%s\". "
- "To override use 'transport select <transport>'.", allowed_transports[0]);
- res = transport_select(global_cmd_ctx, allowed_transports[0]);
- if (res != JIM_OK)
- return res;
- }
- Jim_SetResultString(interp, session->name, -1);
- return JIM_OK;
- case 2: /* assign */
- if (session) {
- if (!strcmp(session->name, argv[1]->bytes)) {
- LOG_WARNING("Transport \"%s\" was already selected", session->name);
- Jim_SetResultString(interp, session->name, -1);
- return JIM_OK;
- } else {
- LOG_ERROR("Can't change session's transport after the initial selection was made");
- return JIM_ERR;
- }
- }
+ if (CMD_ARGC > 1)
+ return ERROR_COMMAND_SYNTAX_ERROR;
- /* Is this transport supported by our debug adapter?
- * Example, "JTAG-only" means SWD is not supported.
- *
- * NOTE: requires adapter to have been set up, with
- * transports declared via C.
- */
+ if (CMD_ARGC == 0) {
+ /* autoselect if necessary, then return/display current config */
+ if (!session) {
if (!allowed_transports) {
- LOG_ERROR("Debug adapter doesn't support any transports?");
- return JIM_ERR;
+ command_print(CMD, "Debug adapter does not support any transports? Check config file order.");
+ return ERROR_FAIL;
}
+ LOG_INFO("auto-selecting first available session transport \"%s\". "
+ "To override use 'transport select <transport>'.", allowed_transports[0]);
+ int retval = transport_select(CMD_CTX, allowed_transports[0]);
+ if (retval != ERROR_OK)
+ return retval;
+ }
+ command_print(CMD, "%s", session->name);
+ return ERROR_OK;
+ }
- for (unsigned i = 0; allowed_transports[i]; i++) {
+ /* assign transport */
+ if (session) {
+ if (!strcmp(session->name, CMD_ARGV[0])) {
+ LOG_WARNING("Transport \"%s\" was already selected", session->name);
+ command_print(CMD, "%s", session->name);
+ return ERROR_OK;
+ }
+ command_print(CMD, "Can't change session's transport after the initial selection was made");
+ return ERROR_FAIL;
+ }
- if (strcmp(allowed_transports[i], argv[1]->bytes) == 0) {
- if (transport_select(global_cmd_ctx, argv[1]->bytes) == ERROR_OK) {
- Jim_SetResultString(interp, session->name, -1);
- return JIM_OK;
- }
- return JIM_ERR;
- }
- }
+ /* Is this transport supported by our debug adapter?
+ * Example, "JTAG-only" means SWD is not supported.
+ *
+ * NOTE: requires adapter to have been set up, with
+ * transports declared via C.
+ */
+ if (!allowed_transports) {
+ command_print(CMD, "Debug adapter doesn't support any transports?");
+ return ERROR_FAIL;
+ }
- LOG_ERROR("Debug adapter doesn't support '%s' transport", argv[1]->bytes);
- return JIM_ERR;
- default:
- Jim_WrongNumArgs(interp, 1, argv, "[too many parameters]");
- return JIM_ERR;
+ for (unsigned int i = 0; allowed_transports[i]; i++) {
+ if (!strcmp(allowed_transports[i], CMD_ARGV[0])) {
+ int retval = transport_select(CMD_CTX, CMD_ARGV[0]);
+ if (retval != ERROR_OK)
+ return retval;
+ command_print(CMD, "%s", session->name);
+ return ERROR_OK;
+ }
}
+
+ command_print(CMD, "Debug adapter doesn't support '%s' transport", CMD_ARGV[0]);
+ return ERROR_FAIL;
}
static const struct command_registration transport_commands[] = {
@@ -333,7 +331,7 @@ static const struct command_registration transport_commands[] = {
},
{
.name = "select",
- .jim_handler = jim_transport_select,
+ .handler = handle_transport_select,
.mode = COMMAND_ANY,
.help = "Select this session's transport",
.usage = "[transport_name]",
commit 1ec8b83cbdb407536966b4e455dbb39d1cb42b3a
Author: Antonio Borneo <bor...@gm...>
Date: Mon Dec 19 00:01:00 2022 +0100
helper: command: rewrite command 'ocd_find' as COMMAND_HANDLER
The mixed use of jim commands and OpenOCD commands is error prone
due to handling of errors through JIM_xx and ERROR_yy.
Rewrite the jim command 'ocd_find' as OpenOCD command.
Change-Id: Id775bccc12840bcf95d8c19787beda5e7c3107fc
Signed-off-by: Antonio Borneo <bor...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/7484
Reviewed-by: Tomas Vanek <va...@fb...>
Tested-by: jenkins
diff --git a/src/helper/command.c b/src/helper/command.c
index b358e18aa..235bec858 100644
--- a/src/helper/command.c
+++ b/src/helper/command.c
@@ -662,19 +662,19 @@ void command_done(struct command_context *cmd_ctx)
}
/* find full path to file */
-static int jim_find(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
+COMMAND_HANDLER(handle_find)
{
- if (argc != 2)
- return JIM_ERR;
- const char *file = Jim_GetString(argv[1], NULL);
- char *full_path = find_file(file);
+ if (CMD_ARGC != 1)
+ return ERROR_COMMAND_SYNTAX_ERROR;
+
+ char *full_path = find_file(CMD_ARGV[0]);
if (!full_path)
- return JIM_ERR;
- Jim_Obj *result = Jim_NewStringObj(interp, full_path, strlen(full_path));
+ return ERROR_COMMAND_ARGUMENT_INVALID;
+
+ command_print(CMD, "%s", full_path);
free(full_path);
- Jim_SetResult(interp, result);
- return JIM_OK;
+ return ERROR_OK;
}
COMMAND_HANDLER(handle_echo)
@@ -1165,7 +1165,7 @@ static const struct command_registration command_builtin_handlers[] = {
{
.name = "ocd_find",
.mode = COMMAND_ANY,
- .jim_handler = jim_find,
+ .handler = handle_find,
.help = "find full path to file",
.usage = "file",
},
-----------------------------------------------------------------------
Summary of changes:
src/helper/command.c | 20 +++++-----
src/transport/transport.c | 100 +++++++++++++++++++++++-----------------------
2 files changed, 59 insertions(+), 61 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2023-03-25 18:09:40
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Main OpenOCD repository".
The branch, master has been updated
via 5f6ceebbba3a34fc4bfcf56e963739dd2e9cf056 (commit)
from f8631c3650c0e3a3c3e16726f1ca3748d163cc69 (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 5f6ceebbba3a34fc4bfcf56e963739dd2e9cf056
Author: Antonio Borneo <bor...@gm...>
Date: Fri Mar 10 11:41:54 2023 +0100
svf: make command 'svf' syntax consistent
The command 'svf' is the only command in OpenOCD that accepts
options in both forms 'option' and '-option'.
Deprecate the option format without the leading '-'.
Update the documentation and fix the on-line help.
While there:
- switch to use the new nvp.h helper;
- return ERROR_COMMAND_ARGUMENT_INVALID on invalid command args;
- fix some minor coding style rule.
Change-Id: I5b944403d92a3fa1e12d5faafc1d2a139bc16a7d
Signed-off-by: Antonio Borneo <bor...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/7534
Tested-by: jenkins
diff --git a/doc/openocd.texi b/doc/openocd.texi
index 0de101b6d..26a59e6a7 100644
--- a/doc/openocd.texi
+++ b/doc/openocd.texi
@@ -11432,8 +11432,8 @@ way to represent JTAG test patterns in text files.
In a debug session using JTAG for its transport protocol,
OpenOCD supports running such test files.
-@deffn {Command} {svf} @file{filename} [@option{-tap @var{tapname}}] [@option{[-]quiet}] @
- [@option{[-]nil}] [@option{[-]progress}] [@option{[-]ignore_error}] @
+@deffn {Command} {svf} @file{filename} [@option{-tap @var{tapname}}] [@option{-quiet}] @
+ [@option{-nil}] [@option{-progress}] [@option{-ignore_error}] @
[@option{-noreset}] [@option{-addcycles @var{cyclecount}}]
This issues a JTAG reset (Test-Logic-Reset) and then
runs the SVF script from @file{filename}.
@@ -11447,11 +11447,11 @@ Command options:
specified by the SVF file with HIR, TIR, HDR and TDR commands;
instead, calculate them automatically according to the current JTAG
chain configuration, targeting @var{tapname};
-@item @option{[-]quiet} do not log every command before execution;
-@item @option{[-]nil} ``dry run'', i.e., do not perform any operations
+@item @option{-quiet} do not log every command before execution;
+@item @option{-nil} ``dry run'', i.e., do not perform any operations
on the real interface;
-@item @option{[-]progress} enable progress indication;
-@item @option{[-]ignore_error} continue execution despite TDO check
+@item @option{-progress} enable progress indication;
+@item @option{-ignore_error} continue execution despite TDO check
errors.
@item @option{-noreset} omit JTAG reset (Test-Logic-Reset) before executing
content of the SVF file;
diff --git a/src/svf/svf.c b/src/svf/svf.c
index 2a1331280..dd3d5175c 100644
--- a/src/svf/svf.c
+++ b/src/svf/svf.c
@@ -22,6 +22,7 @@
#include "svf.h"
#include "helper/system.h"
#include <helper/time_support.h>
+#include <helper/nvp.h>
#include <stdbool.h>
/* SVF command */
@@ -346,6 +347,37 @@ int svf_add_statemove(tap_state_t state_to)
return ERROR_FAIL;
}
+enum svf_cmd_param {
+ OPT_ADDCYCLES,
+ OPT_IGNORE_ERROR,
+ OPT_NIL,
+ OPT_NORESET,
+ OPT_PROGRESS,
+ OPT_QUIET,
+ OPT_TAP,
+ /* DEPRECATED */
+ DEPRECATED_OPT_IGNORE_ERROR,
+ DEPRECATED_OPT_NIL,
+ DEPRECATED_OPT_PROGRESS,
+ DEPRECATED_OPT_QUIET,
+};
+
+static const struct nvp svf_cmd_opts[] = {
+ { .name = "-addcycles", .value = OPT_ADDCYCLES },
+ { .name = "-ignore_error", .value = OPT_IGNORE_ERROR },
+ { .name = "-nil", .value = OPT_NIL },
+ { .name = "-noreset", .value = OPT_NORESET },
+ { .name = "-progress", .value = OPT_PROGRESS },
+ { .name = "-quiet", .value = OPT_QUIET },
+ { .name = "-tap", .value = OPT_TAP },
+ /* DEPRECATED */
+ { .name = "ignore_error", .value = DEPRECATED_OPT_IGNORE_ERROR },
+ { .name = "nil", .value = DEPRECATED_OPT_NIL },
+ { .name = "progress", .value = DEPRECATED_OPT_PROGRESS },
+ { .name = "quiet", .value = DEPRECATED_OPT_QUIET },
+ { .name = NULL, .value = -1 }
+};
+
COMMAND_HANDLER(handle_svf_command)
{
#define SVF_MIN_NUM_OF_OPTIONS 1
@@ -355,10 +387,11 @@ COMMAND_HANDLER(handle_svf_command)
int64_t time_measure_ms;
int time_measure_s, time_measure_m;
- /* use NULL to indicate a "plain" svf file which accounts for
+ /*
+ * use NULL to indicate a "plain" svf file which accounts for
* any additional devices in the scan chain, otherwise the device
* that should be affected
- */
+ */
struct jtag_tap *tap = NULL;
if ((CMD_ARGC < SVF_MIN_NUM_OF_OPTIONS) || (CMD_ARGC > SVF_MAX_NUM_OF_OPTIONS))
@@ -373,48 +406,74 @@ COMMAND_HANDLER(handle_svf_command)
svf_addcycles = 0;
for (unsigned int i = 0; i < CMD_ARGC; i++) {
- if (strcmp(CMD_ARGV[i], "-addcycles") == 0) {
+ const struct nvp *n = nvp_name2value(svf_cmd_opts, CMD_ARGV[i]);
+ switch (n->value) {
+ case OPT_ADDCYCLES:
svf_addcycles = atoi(CMD_ARGV[i + 1]);
if (svf_addcycles > SVF_MAX_ADDCYCLES) {
command_print(CMD, "addcycles: %s out of range", CMD_ARGV[i + 1]);
if (svf_fd)
fclose(svf_fd);
svf_fd = NULL;
- return ERROR_FAIL;
+ return ERROR_COMMAND_ARGUMENT_INVALID;
}
i++;
- } else if (strcmp(CMD_ARGV[i], "-tap") == 0) {
+ break;
+
+ case OPT_TAP:
tap = jtag_tap_by_string(CMD_ARGV[i+1]);
if (!tap) {
command_print(CMD, "Tap: %s unknown", CMD_ARGV[i+1]);
if (svf_fd)
fclose(svf_fd);
svf_fd = NULL;
- return ERROR_FAIL;
+ return ERROR_COMMAND_ARGUMENT_INVALID;
}
i++;
- } else if ((strcmp(CMD_ARGV[i],
- "quiet") == 0) || (strcmp(CMD_ARGV[i], "-quiet") == 0))
+ break;
+
+ case DEPRECATED_OPT_QUIET:
+ LOG_INFO("DEPRECATED flag '%s'; use '-%s'", CMD_ARGV[i], CMD_ARGV[i]);
+ /* fallthrough */
+ case OPT_QUIET:
svf_quiet = 1;
- else if ((strcmp(CMD_ARGV[i], "nil") == 0) || (strcmp(CMD_ARGV[i], "-nil") == 0))
+ break;
+
+ case DEPRECATED_OPT_NIL:
+ LOG_INFO("DEPRECATED flag '%s'; use '-%s'", CMD_ARGV[i], CMD_ARGV[i]);
+ /* fallthrough */
+ case OPT_NIL:
svf_nil = 1;
- else if ((strcmp(CMD_ARGV[i],
- "progress") == 0) || (strcmp(CMD_ARGV[i], "-progress") == 0))
+ break;
+
+ case DEPRECATED_OPT_PROGRESS:
+ LOG_INFO("DEPRECATED flag '%s'; use '-%s'", CMD_ARGV[i], CMD_ARGV[i]);
+ /* fallthrough */
+ case OPT_PROGRESS:
svf_progress_enabled = 1;
- else if ((strcmp(CMD_ARGV[i],
- "ignore_error") == 0) || (strcmp(CMD_ARGV[i], "-ignore_error") == 0))
+ break;
+
+ case DEPRECATED_OPT_IGNORE_ERROR:
+ LOG_INFO("DEPRECATED flag '%s'; use '-%s'", CMD_ARGV[i], CMD_ARGV[i]);
+ /* fallthrough */
+ case OPT_IGNORE_ERROR:
svf_ignore_error = 1;
- else if (strcmp(CMD_ARGV[i], "-noreset") == 0)
+ break;
+
+ case OPT_NORESET:
svf_noreset = true;
- else {
+ break;
+
+ default:
svf_fd = fopen(CMD_ARGV[i], "r");
if (!svf_fd) {
int err = errno;
command_print(CMD, "open(\"%s\"): %s", CMD_ARGV[i], strerror(err));
/* no need to free anything now */
return ERROR_COMMAND_SYNTAX_ERROR;
- } else
- LOG_USER("svf processing file: \"%s\"", CMD_ARGV[i]);
+ }
+ LOG_USER("svf processing file: \"%s\"", CMD_ARGV[i]);
+ break;
}
}
@@ -1576,7 +1635,7 @@ static const struct command_registration svf_command_handlers[] = {
.handler = handle_svf_command,
.mode = COMMAND_EXEC,
.help = "Runs a SVF file.",
- .usage = "[-tap device.tap] <file> [quiet] [nil] [progress] [ignore_error] [-noreset] [-addcycles numcycles]",
+ .usage = "[-tap device.tap] [-quiet] [-nil] [-progress] [-ignore_error] [-noreset] [-addcycles numcycles] file",
},
COMMAND_REGISTRATION_DONE
};
-----------------------------------------------------------------------
Summary of changes:
doc/openocd.texi | 12 +++----
src/svf/svf.c | 95 +++++++++++++++++++++++++++++++++++++++++++++-----------
2 files changed, 83 insertions(+), 24 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|
|
From: openocd-gerrit <ope...@us...> - 2023-03-25 18:09:13
|
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 f8631c3650c0e3a3c3e16726f1ca3748d163cc69 (commit)
from 86827a961a22815ebd5fa367468ca7444f0ee2e1 (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 f8631c3650c0e3a3c3e16726f1ca3748d163cc69
Author: Antonio Borneo <bor...@gm...>
Date: Fri Mar 10 12:01:03 2023 +0100
svf: fix memory leak on error during command execution
If svf_set_padding() returns error, jump to free_all label to
prevent any memory leak.
Propagate the error reported by svf_set_padding() instead of
overwriting it.
Use command_print() instead of LOG_ERROR() for command output.
Change-Id: I61fd89cad10652f2f9ef1f9d48a040e35253c3d4
Signed-off-by: Antonio Borneo <bor...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/7533
Tested-by: jenkins
Reviewed-by: Tomas Vanek <va...@fb...>
diff --git a/src/svf/svf.c b/src/svf/svf.c
index 05fb21d63..2a1331280 100644
--- a/src/svf/svf.c
+++ b/src/svf/svf.c
@@ -473,27 +473,31 @@ COMMAND_HANDLER(handle_svf_command)
}
/* HDR %d TDI (0) */
- if (svf_set_padding(&svf_para.hdr_para, header_dr_len, 0) != ERROR_OK) {
- LOG_ERROR("failed to set data header");
- return ERROR_FAIL;
+ ret = svf_set_padding(&svf_para.hdr_para, header_dr_len, 0);
+ if (ret != ERROR_OK) {
+ command_print(CMD, "failed to set data header");
+ goto free_all;
}
/* HIR %d TDI (0xFF) */
- if (svf_set_padding(&svf_para.hir_para, header_ir_len, 0xFF) != ERROR_OK) {
- LOG_ERROR("failed to set instruction header");
- return ERROR_FAIL;
+ ret = svf_set_padding(&svf_para.hir_para, header_ir_len, 0xFF);
+ if (ret != ERROR_OK) {
+ command_print(CMD, "failed to set instruction header");
+ goto free_all;
}
/* TDR %d TDI (0) */
- if (svf_set_padding(&svf_para.tdr_para, trailer_dr_len, 0) != ERROR_OK) {
- LOG_ERROR("failed to set data trailer");
- return ERROR_FAIL;
+ ret = svf_set_padding(&svf_para.tdr_para, trailer_dr_len, 0);
+ if (ret != ERROR_OK) {
+ command_print(CMD, "failed to set data trailer");
+ goto free_all;
}
/* TIR %d TDI (0xFF) */
- if (svf_set_padding(&svf_para.tir_para, trailer_ir_len, 0xFF) != ERROR_OK) {
- LOG_ERROR("failed to set instruction trailer");
- return ERROR_FAIL;
+ ret = svf_set_padding(&svf_para.tir_para, trailer_ir_len, 0xFF);
+ if (ret != ERROR_OK) {
+ command_print(CMD, "failed to set instruction trailer");
+ goto free_all;
}
}
-----------------------------------------------------------------------
Summary of changes:
src/svf/svf.c | 28 ++++++++++++++++------------
1 file changed, 16 insertions(+), 12 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|