Skip to content

Commit c748a92

Browse files
Ampere OpenOCD 2020.11.05 (v0.9.0)
1 parent 325cd19 commit c748a92

File tree

244 files changed

+11676
-5841
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

244 files changed

+11676
-5841
lines changed

README

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,10 @@ libraries that OpenOCD depends on. Alternatively, you can specify
284284
*_CFLAGS and *_LIBS environment variables directly, see "./configure
285285
--help" for the details.
286286

287+
For a more or less complete script that does all this for you, see
288+
289+
contrib/cross-build.sh
290+
287291
Parallel Port Dongles
288292
---------------------
289293

bootstrap

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,12 @@ fi
2424
# bootstrap the autotools
2525
(
2626
set -x
27-
aclocal
27+
aclocal --warnings=all
28+
# Apparently, not all versions of libtoolize support option --warnings=all .
2829
${libtoolize} --automake --copy
29-
autoconf
30-
autoheader
31-
automake --gnu --add-missing --copy
30+
autoconf --warnings=all
31+
autoheader --warnings=all
32+
automake --warnings=all --gnu --add-missing --copy
3233
)
3334

3435
if [ -n "$SKIP_SUBMODULE" ]; then

configure.ac

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ AH_BOTTOM([
2222
#include <helper/replacements.h>
2323
])
2424

25-
AC_LANG_C
25+
AC_LANG([C])
2626
AC_PROG_CC
2727
AC_PROG_CC_C99
2828
AM_PROG_CC_C_O
@@ -34,7 +34,7 @@ m4_defun([_LT_AC_LANG_CXX_CONFIG], [:])
3434
m4_defun([_LT_AC_LANG_F77_CONFIG], [:])
3535
m4_defun([_LT_AC_LANG_GCJ_CONFIG], [:])
3636
AC_DISABLE_SHARED
37-
AC_PROG_LIBTOOL
37+
LT_INIT
3838
AC_SUBST([LIBTOOL_DEPS])
3939

4040
dnl configure checks required for Jim files (these are obsolete w/ C99)
@@ -127,7 +127,8 @@ m4_define([USB0_ADAPTERS],
127127
[[armjtagew], [Olimex ARM-JTAG-EW Programmer], [ARMJTAGEW]]])
128128

129129
m4_define([HIDAPI_ADAPTERS],
130-
[[[cmsis_dap], [CMSIS-DAP Compliant Debugger], [CMSIS_DAP]]])
130+
[[[cmsis_dap], [CMSIS-DAP Compliant Debugger], [CMSIS_DAP]],
131+
[[nulink], [Nu-Link Programmer], [HLADAPTER_NULINK]]])
131132

132133
m4_define([HIDAPI_USB1_ADAPTERS],
133134
[[[kitprog], [Cypress KitProg Programmer], [KITPROG]]])
@@ -658,6 +659,15 @@ PKG_CHECK_MODULES([LIBUSB1], [libusb-1.0], [
658659

659660
PKG_CHECK_MODULES([LIBUSB0], [libusb], [use_libusb0=yes], [use_libusb0=no])
660661

662+
PKG_CHECK_MODULES([CAPSTONE], [capstone], [have_capstone=yes],
663+
[have_capstone=no])
664+
665+
AS_IF([test "x$have_capstone" = "xyes"], [
666+
AC_DEFINE([HAVE_CAPSTONE], [1], [1 if you have captone disassembly framework.])
667+
], [
668+
AC_DEFINE([HAVE_CAPSTONE], [0], [0 if you don't have captone disassembly framework.])
669+
])
670+
661671
for hidapi_lib in hidapi hidapi-hidraw hidapi-libusb; do
662672
PKG_CHECK_MODULES([HIDAPI],[$hidapi_lib],[
663673
use_hidapi=yes
@@ -716,7 +726,7 @@ AS_IF([test "x$enable_linuxgpiod" != "xno"], [
716726
build_bitbang=yes
717727
])
718728

719-
AS_IF([test "x$enable_stlink" != "xno" -o "x$enable_ti_icdi" != "xno"], [
729+
AS_IF([test "x$enable_stlink" != "xno" -o "x$enable_ti_icdi" != "xno" -o "x$enable_nulink" != "xno"], [
720730
AC_DEFINE([BUILD_HLADAPTER], [1], [1 if you want the High Level JTAG driver.])
721731
AM_CONDITIONAL([HLADAPTER], [true])
722732
], [
@@ -725,6 +735,7 @@ AS_IF([test "x$enable_stlink" != "xno" -o "x$enable_ti_icdi" != "xno"], [
725735
])
726736
AM_CONDITIONAL([HLADAPTER_STLINK], [test "x$enable_stlink" != "xno"])
727737
AM_CONDITIONAL([HLADAPTER_ICDI], [test "x$enable_ti_icdi" != "xno"])
738+
AM_CONDITIONAL([HLADAPTER_NULINK], [test "x$enable_nulink" != "xno"])
728739

729740
AS_IF([test "x$enable_jlink" != "xno"], [
730741
AS_IF([test "x$use_internal_libjaylink" = "xyes"], [
@@ -777,6 +788,7 @@ AM_CONDITIONAL([USE_LIBGPIOD], [test "x$use_libgpiod" = "xyes"])
777788
AM_CONDITIONAL([USE_HIDAPI], [test "x$use_hidapi" = "xyes"])
778789
AM_CONDITIONAL([USE_LIBJAYLINK], [test "x$use_libjaylink" = "xyes"])
779790
AM_CONDITIONAL([RSHIM], [test "x$build_rshim" = "xyes"])
791+
AM_CONDITIONAL([HAVE_CAPSTONE], [test "x$have_capstone" = "xyes"])
780792

781793
AM_CONDITIONAL([MINIDRIVER], [test "x$build_minidriver" = "xyes"])
782794
AM_CONDITIONAL([MINIDRIVER_DUMMY], [test "x$build_minidriver_dummy" = "xyes"])

contrib/60-openocd.rules

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,13 @@ ATTRS{idVendor}=="0403", ATTRS{idProduct}=="c141", MODE="660", GROUP="plugdev",
5555
# Amontec JTAGkey and JTAGkey-tiny
5656
ATTRS{idVendor}=="0403", ATTRS{idProduct}=="cff8", MODE="660", GROUP="plugdev", TAG+="uaccess"
5757

58+
# Nuvoton NuLink
59+
ATTRS{idVendor}=="0416", ATTRS{idProduct}=="511b", MODE="660", GROUP="plugdev", TAG+="uaccess"
60+
ATTRS{idVendor}=="0416", ATTRS{idProduct}=="511c", MODE="660", GROUP="plugdev", TAG+="uaccess"
61+
ATTRS{idVendor}=="0416", ATTRS{idProduct}=="511d", MODE="660", GROUP="plugdev", TAG+="uaccess"
62+
ATTRS{idVendor}=="0416", ATTRS{idProduct}=="5200", MODE="660", GROUP="plugdev", TAG+="uaccess"
63+
ATTRS{idVendor}=="0416", ATTRS{idProduct}=="5201", MODE="660", GROUP="plugdev", TAG+="uaccess"
64+
5865
# TI ICDI
5966
ATTRS{idVendor}=="0451", ATTRS{idProduct}=="c32a", MODE="660", GROUP="plugdev", TAG+="uaccess"
6067

contrib/cross-build.sh

Lines changed: 40 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
#
1616
# This script is probably more useful as a reference than as a complete build
1717
# tool but for some configurations it may be usable as-is. It only cross-
18-
# builds libusb-1.0 from source, but the script can be extended to build other
19-
# prerequisites in a similar manner.
18+
# builds libusb-1.0, hidapi and libftdi from source, but the script can be
19+
# extended to build other prerequisites in a similar manner.
2020
#
2121
# Usage:
2222
# export LIBUSB1_SRC=/path/to/libusb-1.0
@@ -36,17 +36,20 @@ WORK_DIR=$PWD
3636

3737
## Source code paths, customize as necessary
3838
: ${OPENOCD_SRC:="`dirname "$0"`/.."}
39-
: ${LIBUSB1_SRC:=/path/to/libusb}
39+
: ${LIBUSB1_SRC:=/path/to/libusb1}
4040
: ${HIDAPI_SRC:=/path/to/hidapi}
41+
: ${LIBFTDI_SRC:=/path/to/libftdi}
4142

4243
OPENOCD_SRC=`readlink -m $OPENOCD_SRC`
4344
LIBUSB1_SRC=`readlink -m $LIBUSB1_SRC`
4445
HIDAPI_SRC=`readlink -m $HIDAPI_SRC`
46+
LIBFTDI_SRC=`readlink -m $LIBFTDI_SRC`
4547

4648
HOST_TRIPLET=$1
4749
BUILD_DIR=$WORK_DIR/$HOST_TRIPLET-build
4850
LIBUSB1_BUILD_DIR=$BUILD_DIR/libusb1
4951
HIDAPI_BUILD_DIR=$BUILD_DIR/hidapi
52+
LIBFTDI_BUILD_DIR=$BUILD_DIR/libftdi
5053
OPENOCD_BUILD_DIR=$BUILD_DIR/openocd
5154

5255
## Root of host file tree
@@ -55,8 +58,12 @@ SYSROOT=$WORK_DIR/$HOST_TRIPLET-root
5558
## Install location within host file tree
5659
: ${PREFIX=/usr}
5760

61+
## Make parallel jobs
62+
: ${MAKE_JOBS:=1}
63+
5864
## OpenOCD-only install dir for packaging
59-
PACKAGE_DIR=$WORK_DIR/openocd_`git --git-dir=$OPENOCD_SRC/.git describe`_$HOST_TRIPLET
65+
: ${OPENOCD_TAG:=`git --git-dir=$OPENOCD_SRC/.git describe --tags`}
66+
PACKAGE_DIR=$WORK_DIR/openocd_${OPENOCD_TAG}_${HOST_TRIPLET}
6067

6168
#######
6269

@@ -86,13 +93,15 @@ rm -rf $SYSROOT $BUILD_DIR
8693
mkdir -p $SYSROOT
8794

8895
# libusb-1.0 build & install into sysroot
89-
mkdir -p $LIBUSB1_BUILD_DIR
90-
cd $LIBUSB1_BUILD_DIR
91-
$LIBUSB1_SRC/configure --build=`$LIBUSB1_SRC/config.guess` --host=$HOST_TRIPLET \
92-
--with-sysroot=$SYSROOT --prefix=$PREFIX \
93-
$LIBUSB1_CONFIG
94-
make
95-
make install DESTDIR=$SYSROOT
96+
if [ -d $LIBUSB1_SRC ] ; then
97+
mkdir -p $LIBUSB1_BUILD_DIR
98+
cd $LIBUSB1_BUILD_DIR
99+
$LIBUSB1_SRC/configure --build=`$LIBUSB1_SRC/config.guess` --host=$HOST_TRIPLET \
100+
--with-sysroot=$SYSROOT --prefix=$PREFIX \
101+
$LIBUSB1_CONFIG
102+
make -j $MAKE_JOBS
103+
make install DESTDIR=$SYSROOT
104+
fi
96105

97106
# hidapi build & install into sysroot
98107
if [ -d $HIDAPI_SRC ] ; then
@@ -101,7 +110,22 @@ if [ -d $HIDAPI_SRC ] ; then
101110
$HIDAPI_SRC/configure --build=`$HIDAPI_SRC/config.guess` --host=$HOST_TRIPLET \
102111
--with-sysroot=$SYSROOT --prefix=$PREFIX \
103112
$HIDAPI_CONFIG
104-
make
113+
make -j $MAKE_JOBS
114+
make install DESTDIR=$SYSROOT
115+
fi
116+
117+
# libftdi build & install into sysroot
118+
if [ -d $LIBFTDI_SRC ] ; then
119+
mkdir -p $LIBFTDI_BUILD_DIR
120+
cd $LIBFTDI_BUILD_DIR
121+
# libftdi requires libusb1 static libraries, granted by:
122+
# export LIBUSB1_CONFIG="--enable-static ..."
123+
cmake $LIBFTDI_CONFIG \
124+
-DLIBUSB_INCLUDE_DIR=${SYSROOT}${PREFIX}/include/libusb-1.0 \
125+
-DLIBUSB_LIBRARIES=${SYSROOT}${PREFIX}/lib/libusb-1.0.a \
126+
-DCMAKE_INSTALL_PREFIX=${PREFIX} \
127+
-DPKG_CONFIG_EXECUTABLE=`which pkg-config` \
128+
$LIBFTDI_SRC
105129
make install DESTDIR=$SYSROOT
106130
fi
107131

@@ -111,9 +135,10 @@ cd $OPENOCD_BUILD_DIR
111135
$OPENOCD_SRC/configure --build=`$OPENOCD_SRC/config.guess` --host=$HOST_TRIPLET \
112136
--with-sysroot=$SYSROOT --prefix=$PREFIX \
113137
$OPENOCD_CONFIG
114-
make
115-
make install DESTDIR=$SYSROOT
138+
make -j $MAKE_JOBS
139+
make install-strip DESTDIR=$SYSROOT
116140

117141
# Separate OpenOCD install w/o dependencies. OpenOCD will have to be linked
118142
# statically or have dependencies packaged/installed separately.
119-
make install DESTDIR=$PACKAGE_DIR
143+
make install-strip DESTDIR=$PACKAGE_DIR
144+

doc/openocd.texi

Lines changed: 87 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,12 @@ Texas Instruments has an adapter called @b{ICDI}.
505505
It is not to be confused with the FTDI based adapters that were originally fitted to their
506506
evaluation boards. This is the adapter fitted to the Stellaris LaunchPad.
507507

508+
@section USB Nuvoton Nu-Link
509+
Nuvoton has an adapter called @b{Nu-Link}.
510+
It is available either as stand-alone dongle and embedded on development boards.
511+
It supports SWD, serial port bridge and mass storage for firmware update.
512+
Both Nu-Link v1 and v2 are supported.
513+
508514
@section USB CMSIS-DAP based
509515
ARM has released a interface standard called CMSIS-DAP that simplifies connecting
510516
debuggers to ARM Cortex based targets @url{http://www.keil.com/support/man/docs/dapdebug/dapdebug_introduction.htm}.
@@ -609,6 +615,12 @@ produced, PDF schematics are easily found and it is easy to make.
609615
@* A JTAG driver acting as a client for the JTAG VPI server interface.
610616
@* Link: @url{http://github.com/fjullien/jtag_vpi}
611617

618+
@item @b{jtag_dpi}
619+
@* A JTAG driver acting as a client for the SystemVerilog Direct Programming
620+
Interface (DPI) for JTAG devices. DPI allows OpenOCD to connect to the JTAG
621+
interface of a hardware model written in SystemVerilog, for example, on an
622+
emulation model of target hardware.
623+
612624
@item @b{xlnx_pcie_xvc}
613625
@* A JTAG driver exposing Xilinx Virtual Cable over PCI Express to OpenOCD as JTAG/SWD interface.
614626

@@ -712,8 +724,11 @@ Configuration files and scripts are searched for in
712724
@item the current directory,
713725
@item any search dir specified on the command line using the @option{-s} option,
714726
@item any search dir specified using the @command{add_script_search_dir} command,
715-
@item @file{$HOME/.openocd} (not on Windows),
716727
@item a directory in the @env{OPENOCD_SCRIPTS} environment variable (if set),
728+
@item @file{%APPDATA%/OpenOCD} (only on Windows),
729+
@item @file{$HOME/Library/Preferences/org.openocd} (only on Darwin),
730+
@item @file{$XDG_CONFIG_HOME/openocd} (@env{$XDG_CONFIG_HOME} defaults to @file{$HOME/.config}),
731+
@item @file{$HOME/.openocd},
717732
@item the site wide script library @file{$pkgdatadir/site} and
718733
@item the OpenOCD-supplied script library @file{$pkgdatadir/scripts}.
719734
@end enumerate
@@ -3064,7 +3079,8 @@ This is a driver that supports multiple High Level Adapters.
30643079
This type of adapter does not expose some of the lower level api's
30653080
that OpenOCD would normally use to access the target.
30663081

3067-
Currently supported adapters include the STMicroelectronics ST-LINK and TI ICDI.
3082+
Currently supported adapters include the STMicroelectronics ST-LINK, TI ICDI
3083+
and Nuvoton Nu-Link.
30683084
ST-LINK firmware version >= V2.J21.S4 recommended due to issues with earlier
30693085
versions of firmware where serial number is reset after first use. Suggest
30703086
using ST firmware update utility to upgrade ST-LINK firmware even if current
@@ -3078,7 +3094,7 @@ Currently Not Supported.
30783094
Specifies the serial number of the adapter.
30793095
@end deffn
30803096

3081-
@deffn {Config Command} {hla_layout} (@option{stlink}|@option{icdi})
3097+
@deffn {Config Command} {hla_layout} (@option{stlink}|@option{icdi}|@option{nulink})
30823098
Specifies the adapter layout to use.
30833099
@end deffn
30843100

@@ -3228,6 +3244,22 @@ This value is only used with the standard variant.
32283244
@end deffn
32293245
@end deffn
32303246

3247+
3248+
@deffn {Interface Driver} {jtag_dpi}
3249+
SystemVerilog Direct Programming Interface (DPI) compatible driver for
3250+
JTAG devices in emulation. The driver acts as a client for the SystemVerilog
3251+
DPI server interface.
3252+
3253+
@deffn {Config Command} {jtag_dpi_set_port} port
3254+
Specifies the TCP/IP port number of the SystemVerilog DPI server interface.
3255+
@end deffn
3256+
3257+
@deffn {Config Command} {jtag_dpi_set_address} address
3258+
Specifies the TCP/IP address of the SystemVerilog DPI server interface.
3259+
@end deffn
3260+
@end deffn
3261+
3262+
32313263
@section Transport Configuration
32323264
@cindex Transport
32333265
As noted earlier, depending on the version of OpenOCD you use,
@@ -9342,6 +9374,12 @@ target code relies on. In a configuration file, the command would typically be c
93429374
However, normally it is not necessary to use the command at all.
93439375
@end deffn
93449376

9377+
@deffn Command {aarch64 disassemble} address [count]
9378+
@cindex disassemble
9379+
Disassembles @var{count} instructions starting at @var{address}.
9380+
If @var{count} is not specified, a single instruction is disassembled.
9381+
@end deffn
9382+
93459383
@deffn Command {aarch64 smp} [on|off]
93469384
Display, enable or disable SMP handling mode. The state of SMP handling influences the way targets in an SMP group
93479385
are handled by the run control. With SMP handling enabled, issuing halt or resume to one core will trigger
@@ -9676,8 +9714,31 @@ This is used to access 64-bit floating point registers on 32-bit targets.
96769714
@end deffn
96779715

96789716
@deffn Command {riscv set_prefer_sba} on|off
9679-
When on, prefer to use System Bus Access to access memory. When off, prefer to
9680-
use the Program Buffer to access memory.
9717+
When on, prefer to use System Bus Access to access memory. When off (default),
9718+
prefer to use the Program Buffer to access memory.
9719+
@end deffn
9720+
9721+
@deffn Command {riscv set_enable_virtual} on|off
9722+
When on, memory accesses are performed on physical or virtual memory depending
9723+
on the current system configuration. When off (default), all memory accessses are performed
9724+
on physical memory.
9725+
@end deffn
9726+
9727+
@deffn Command {riscv set_enable_virt2phys} on|off
9728+
When on (default), memory accesses are performed on physical or virtual memory
9729+
depending on the current satp configuration. When off, all memory accessses are
9730+
performed on physical memory.
9731+
@end deffn
9732+
9733+
@deffn Command {riscv resume_order} normal|reversed
9734+
Some software assumes all harts are executing nearly continuously. Such
9735+
software may be sensitive to the order that harts are resumed in. On harts
9736+
that don't support hasel, this option allows the user to choose the order the
9737+
harts are resumed in. If you are using this option, it's probably masking a
9738+
race condition problem in your code.
9739+
9740+
Normal order is from lowest hart index to highest. This is the default
9741+
behavior. Reversed order is from highest hart index to lowest.
96819742
@end deffn
96829743

96839744
@deffn Command {riscv set_ir} (@option{idcode}|@option{dtmcs}|@option{dmi}) [value]
@@ -9691,6 +9752,26 @@ When utilizing version 0.11 of the RISC-V Debug Specification,
96919752
and DBUS registers, respectively.
96929753
@end deffn
96939754

9755+
@deffn Command {riscv use_bscan_tunnel} value
9756+
Enable or disable use of a BSCAN tunnel to reach DM. Supply the width of
9757+
the DM transport TAP's instruction register to enable. Supply a value of 0 to disable.
9758+
@end deffn
9759+
9760+
@deffn Command {riscv set_ebreakm} on|off
9761+
Control dcsr.ebreakm. When on (default), M-mode ebreak instructions trap to
9762+
OpenOCD. When off, they generate a breakpoint exception handled internally.
9763+
@end deffn
9764+
9765+
@deffn Command {riscv set_ebreaks} on|off
9766+
Control dcsr.ebreaks. When on (default), S-mode ebreak instructions trap to
9767+
OpenOCD. When off, they generate a breakpoint exception handled internally.
9768+
@end deffn
9769+
9770+
@deffn Command {riscv set_ebreaku} on|off
9771+
Control dcsr.ebreaku. When on (default), U-mode ebreak instructions trap to
9772+
OpenOCD. When off, they generate a breakpoint exception handled internally.
9773+
@end deffn
9774+
96949775
@subsection RISC-V Authentication Commands
96959776

96969777
The following commands can be used to authenticate to a RISC-V system. Eg. a
@@ -9714,7 +9795,7 @@ Write the 32-bit value to authdata.
97149795
The following commands allow direct access to the Debug Module Interface, which
97159796
can be used to interact with custom debug features.
97169797

9717-
@deffn Command {riscv dmi_read}
9798+
@deffn Command {riscv dmi_read} address
97189799
Perform a 32-bit DMI read at address, returning the value.
97199800
@end deffn
97209801

0 commit comments

Comments
 (0)