Skip to content

Commit ab3f8f8

Browse files
committed
Merge remote-tracking branch 'riscv-openocd-fork/riscv' into fk-sc/from_upstream
Change-Id: Ie93983904c75cb35272406b8a8653a543ffe8410
2 parents b5a9765 + eb01c63 commit ab3f8f8

File tree

177 files changed

+2947
-1477
lines changed

Some content is hidden

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

177 files changed

+2947
-1477
lines changed

.github/workflows/snapshot.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ name: OpenOCD Snapshot
1111

1212
jobs:
1313
package:
14-
runs-on: [ubuntu-20.04]
14+
runs-on: [ubuntu-latest]
1515
env:
1616
DL_DIR: ../downloads
1717
BUILD_DIR: ../build
@@ -105,8 +105,8 @@ jobs:
105105
# add missing dlls
106106
cd $HOST-root/usr
107107
cp `$HOST-gcc --print-file-name=libwinpthread-1.dll` ./bin/
108-
# required by libftdi1.dll. For the gcc-mingw-10.3.x or later "libgcc_s_dw2-1.dll" will need to be copied.
109-
cp `$HOST-gcc --print-file-name=libgcc_s_sjlj-1.dll` ./bin/
108+
# required by libftdi1.dll
109+
cp `$HOST-gcc --print-file-name=libgcc_s_dw2-1.dll` ./bin/
110110
# prepare the artifact
111111
ARTIFACT="openocd-${OPENOCD_TAG}-${HOST}.tar.gz"
112112
tar -czf $ARTIFACT *
@@ -122,8 +122,7 @@ jobs:
122122
with:
123123
delete_release: true
124124
tag_name: ${{ env.RELEASE_NAME }}
125-
env:
126-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
125+
github_token: ${{ secrets.GITHUB_TOKEN }}
127126
- name: Create Release
128127
uses: ncipollo/release-action@v1
129128
with:

README

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ layered architecture of JTAG interface and TAP support including:
88
- debug target support (e.g. ARM, MIPS): single-stepping,
99
breakpoints/watchpoints, gprof profiling, etc;
1010
- flash chip drivers (e.g. CFI, NAND, internal flash);
11-
- embedded TCL interpreter for easy scripting.
11+
- embedded Tcl interpreter for easy scripting.
1212

1313
Several network interfaces are available for interacting with OpenOCD:
14-
telnet, TCL, and GDB. The GDB server enables OpenOCD to function as a
14+
telnet, Tcl, and GDB. The GDB server enables OpenOCD to function as a
1515
"remote target" for source-level debugging of embedded systems using
1616
the GNU GDB program (and the others who talk GDB protocol, e.g. IDA
1717
Pro).
@@ -42,7 +42,7 @@ openocd -f interface/ftdi/jtagkey2.cfg -c "transport select jtag" \
4242
```
4343

4444
```
45-
openocd -f interface/stlink.cfg -c "transport select hla_swd" \
45+
openocd -f interface/stlink.cfg -c "transport select swd" \
4646
-f target/stm32l0.cfg
4747
```
4848

TODO

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,30 +12,30 @@ may have evolved an idea since it was added here.
1212

1313
Feel free to send patches to add or clarify items on this list, too.
1414

15-
@section thelisttcl TCL
15+
@section thelisttcl Tcl
1616

17-
This section provides possible things to improve with OpenOCD's TCL support.
17+
This section provides possible things to improve with OpenOCD's Tcl support.
1818

1919
- Fix problem with incorrect line numbers reported for a syntax
2020
error in a reset init event.
2121

22-
- organize the TCL configurations:
22+
- organize the Tcl configurations:
2323
- provide more directory structure for boards/targets?
2424
- factor configurations into layers (encapsulation and re-use)
2525

2626
- Fix handling of variables between multiple command line "-c" and "-f"
2727
parameters. Currently variables assigned through one such parameter
2828
command/script are unset before the next one is invoked.
2929

30-
- Isolate all TCL command support:
30+
- Isolate all Tcl command support:
3131
- Pure C CLI implementations using --disable-builtin-tcl.
3232
- Allow developers to build new dongles using OpenOCD's JTAG core.
3333
- At first, provide only low-level JTAG support; target layer and
3434
above rely heavily on scripting event mechanisms.
35-
- Allow full TCL support? add --with-tcl=/path/to/installed/tcl
36-
- Move TCL support out of foo.[ch] and into foo_tcl.[ch] (other ideas?)
35+
- Allow full Tcl support? add --with-tcl=/path/to/installed/tcl
36+
- Move Tcl support out of foo.[ch] and into foo_tcl.[ch] (other ideas?)
3737
- See src/jtag/core.c and src/jtag/tcl.c for an example.
38-
- allow some of these TCL command modules to be dynamically loadable?
38+
- allow some of these Tcl command modules to be dynamically loadable?
3939

4040
@section thelistadapter Adapter
4141

@@ -60,8 +60,6 @@ changes pending in gerrit.
6060
to replicate it in the drivers, apart in case the driver sets TRST
6161
independently
6262
- add .hla_ops to "adapter"
63-
- HLA is a API level (.hla_ops). Transport should simply be {jtag,swd},
64-
not {hla_jtag,hla_swd}.
6563

6664
@subsection thelistadapterjtagcore JTAG Core
6765

@@ -77,7 +75,7 @@ directly in minidriver API for better embedded host performance.
7775

7876
The following tasks have been suggested for adding new core JTAG support:
7977

80-
- Improve autodetection of TAPs by supporting tcl escape procedures that
78+
- Improve autodetection of TAPs by supporting Tcl escape procedures that
8179
can configure discovered TAPs based on IDCODE value ... they could:
8280
- Remove guessing for irlen
8381
- Allow non-default irmask/ircapture values
@@ -135,7 +133,7 @@ TCP/IP packets handled by the server.
135133
- add BSDL support?
136134

137135
A few possible options for the above:
138-
-# Fake a TCL equivalent?
136+
-# Fake a Tcl equivalent?
139137
-# Integrate an existing library?
140138
-# Write a new C implementation a la Jim?
141139

configure.ac

Lines changed: 16 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,9 @@ m4_define([LIBFTDI_USB1_ADAPTERS],
165165
m4_define([LIBGPIOD_ADAPTERS],
166166
[[[linuxgpiod], [Linux GPIO bitbang through libgpiod], [LINUXGPIOD]]])
167167

168+
m4_define([SYSFSGPIO_ADAPTER],
169+
[[[sysfsgpio], [Linux GPIO bitbang through sysfs], [SYSFSGPIO]]])
170+
168171
m4_define([REMOTE_BITBANG_ADAPTER],
169172
[[[remote_bitbang], [Remote Bitbang driver], [REMOTE_BITBANG]]])
170173

@@ -191,6 +194,9 @@ m4_define([JTAG_VPI_ADAPTER],
191194
m4_define([RSHIM_ADAPTER],
192195
[[[rshim], [BlueField SoC via rshim], [RSHIM]]])
193196

197+
m4_define([AMTJTAGACCEL_ADAPTER],
198+
[[[amtjtagaccel], [Amontec JTAG-Accelerator driver], [AMTJTAGACCEL]]])
199+
194200
# The word 'Adapter' in "Dummy Adapter" below must begin with a capital letter
195201
# because there is an M4 macro called 'adapter'.
196202
m4_define([DUMMY_ADAPTER],
@@ -313,6 +319,7 @@ AC_ARG_ADAPTERS([
313319
LIBFTDI_ADAPTERS,
314320
LIBFTDI_USB1_ADAPTERS,
315321
LIBGPIOD_ADAPTERS,
322+
SYSFSGPIO_ADAPTER,
316323
REMOTE_BITBANG_ADAPTER,
317324
LINUXSPIDEV_ADAPTER,
318325
SERIAL_PORT_ADAPTERS,
@@ -321,6 +328,7 @@ AC_ARG_ADAPTERS([
321328
JTAG_DPI_ADAPTER,
322329
JTAG_VPI_ADAPTER,
323330
RSHIM_ADAPTER,
331+
AMTJTAGACCEL_ADAPTER,
324332
PCIE_ADAPTERS,
325333
LIBJAYLINK_ADAPTERS
326334
],[auto])
@@ -339,10 +347,6 @@ AC_ARG_ENABLE([parport_giveio],
339347
[Enable use of giveio for parport (for CygWin only)]),
340348
[parport_use_giveio=$enableval], [parport_use_giveio=])
341349

342-
AC_ARG_ENABLE([amtjtagaccel],
343-
AS_HELP_STRING([--enable-amtjtagaccel], [Enable building the Amontec JTAG-Accelerator driver]),
344-
[build_amtjtagaccel=$enableval], [build_amtjtagaccel=no])
345-
346350
AS_CASE(["${host_cpu}"],
347351
[arm*|aarch64], [
348352
AC_ARG_ENABLE([bcm2835gpio],
@@ -380,10 +384,6 @@ AC_ARG_ENABLE([gw16012],
380384
AS_HELP_STRING([--enable-gw16012], [Enable building support for the Gateworks GW16012 JTAG Programmer]),
381385
[build_gw16012=$enableval], [build_gw16012=no])
382386

383-
AC_ARG_ENABLE([sysfsgpio],
384-
AS_HELP_STRING([--enable-sysfsgpio], [Enable building support for programming driven via sysfs gpios.]),
385-
[build_sysfsgpio=$enableval], [build_sysfsgpio=no])
386-
387387
can_build_rshim=no
388388

389389
AS_CASE([$host_os],
@@ -392,10 +392,6 @@ AS_CASE([$host_os],
392392
can_build_rshim=yes
393393
],
394394
[
395-
AS_IF([test "x$build_sysfsgpio" = "xyes"], [
396-
AC_MSG_ERROR([sysfsgpio is only available on linux])
397-
])
398-
399395
AS_CASE([$host_os], [freebsd*], [
400396
can_build_rshim=yes
401397
],
@@ -564,12 +560,6 @@ AS_IF([test "x$parport_use_giveio" = "xyes"], [
564560
AC_DEFINE([PARPORT_USE_GIVEIO], [0], [0 if you don't want parport to use giveio.])
565561
])
566562

567-
AS_IF([test "x$build_amtjtagaccel" = "xyes"], [
568-
AC_DEFINE([BUILD_AMTJTAGACCEL], [1], [1 if you want the Amontec JTAG-Accelerator driver.])
569-
], [
570-
AC_DEFINE([BUILD_AMTJTAGACCEL], [0], [0 if you don't want the Amontec JTAG-Accelerator driver.])
571-
])
572-
573563
AS_IF([test "x$build_gw16012" = "xyes"], [
574564
AC_DEFINE([BUILD_GW16012], [1], [1 if you want the Gateworks GW16012 driver.])
575565
], [
@@ -585,13 +575,6 @@ PKG_CHECK_MODULES([JIMTCL], [jimtcl >= 0.79], [
585575
])
586576
])
587577

588-
AS_IF([test "x$build_sysfsgpio" = "xyes"], [
589-
build_bitbang=yes
590-
AC_DEFINE([BUILD_SYSFSGPIO], [1], [1 if you want the SysfsGPIO driver.])
591-
], [
592-
AC_DEFINE([BUILD_SYSFSGPIO], [0], [0 if you don't want SysfsGPIO driver.])
593-
])
594-
595578
PKG_CHECK_MODULES([LIBUSB1], [libusb-1.0], [
596579
use_libusb1=yes
597580
AC_DEFINE([HAVE_LIBUSB1], [1], [Define if you have libusb-1.x])
@@ -683,6 +666,7 @@ PROCESS_ADAPTERS([HIDAPI_USB1_ADAPTERS], ["x$use_hidapi" = "xyes" -a "x$use_libu
683666
PROCESS_ADAPTERS([LIBFTDI_ADAPTERS], ["x$use_libftdi" = "xyes"], [libftdi])
684667
PROCESS_ADAPTERS([LIBFTDI_USB1_ADAPTERS], ["x$use_libftdi" = "xyes" -a "x$use_libusb1" = "xyes"], [libftdi and libusb-1.x])
685668
PROCESS_ADAPTERS([LIBGPIOD_ADAPTERS], ["x$use_libgpiod" = "xyes"], [Linux libgpiod])
669+
PROCESS_ADAPTERS([SYSFSGPIO_ADAPTER], ["x$is_linux" = "xyes"], [Linux sysfs])
686670
PROCESS_ADAPTERS([REMOTE_BITBANG_ADAPTER], [true], [unused])
687671
PROCESS_ADAPTERS([LIBJAYLINK_ADAPTERS], ["x$use_libjaylink" = "xyes"], [libjaylink-0.2])
688672
PROCESS_ADAPTERS([PCIE_ADAPTERS], ["x$is_linux" = "xyes"], [Linux build])
@@ -694,12 +678,17 @@ PROCESS_ADAPTERS([JTAG_DPI_ADAPTER], [true], [unused])
694678
PROCESS_ADAPTERS([JTAG_VPI_ADAPTER], [true], [unused])
695679
PROCESS_ADAPTERS([RSHIM_ADAPTER], ["x$can_build_rshim" = "xyes"],
696680
[internal error: validation should happen beforehand])
681+
PROCESS_ADAPTERS([AMTJTAGACCEL_ADAPTER], [true], [unused])
697682
PROCESS_ADAPTERS([DUMMY_ADAPTER], [true], [unused])
698683

699684
AS_IF([test "x$enable_linuxgpiod" != "xno"], [
700685
build_bitbang=yes
701686
])
702687

688+
AS_IF([test "x$enable_sysfsgpio" != "xno"], [
689+
build_bitbang=yes
690+
])
691+
703692
AS_IF([test "x$enable_remote_bitbang" != "xno"], [
704693
build_bitbang=yes
705694
])
@@ -735,9 +724,7 @@ AM_CONDITIONAL([IMX_GPIO], [test "x$build_imx_gpio" = "xyes"])
735724
AM_CONDITIONAL([AM335XGPIO], [test "x$build_am335xgpio" = "xyes"])
736725
AM_CONDITIONAL([BITBANG], [test "x$build_bitbang" = "xyes"])
737726
AM_CONDITIONAL([USB_BLASTER_DRIVER], [test "x$enable_usb_blaster" != "xno" -o "x$enable_usb_blaster_2" != "xno"])
738-
AM_CONDITIONAL([AMTJTAGACCEL], [test "x$build_amtjtagaccel" = "xyes"])
739727
AM_CONDITIONAL([GW16012], [test "x$build_gw16012" = "xyes"])
740-
AM_CONDITIONAL([SYSFSGPIO], [test "x$build_sysfsgpio" = "xyes"])
741728
AM_CONDITIONAL([USE_LIBUSB1], [test "x$use_libusb1" = "xyes"])
742729
AM_CONDITIONAL([IS_CYGWIN], [test "x$is_cygwin" = "xyes"])
743730
AM_CONDITIONAL([IS_MINGW], [test "x$is_mingw" = "xyes"])
@@ -831,13 +818,15 @@ m4_foreach([adapter], [USB1_ADAPTERS,
831818
HIDAPI_ADAPTERS, HIDAPI_USB1_ADAPTERS, LIBFTDI_ADAPTERS,
832819
LIBFTDI_USB1_ADAPTERS,
833820
LIBGPIOD_ADAPTERS,
821+
SYSFSGPIO_ADAPTER,
834822
REMOTE_BITBANG_ADAPTER,
835823
LIBJAYLINK_ADAPTERS, PCIE_ADAPTERS, SERIAL_PORT_ADAPTERS,
836824
LINUXSPIDEV_ADAPTER,
837825
VDEBUG_ADAPTER,
838826
JTAG_DPI_ADAPTER,
839827
JTAG_VPI_ADAPTER,
840828
RSHIM_ADAPTER,
829+
AMTJTAGACCEL_ADAPTER,
841830
DUMMY_ADAPTER,
842831
OPTIONAL_LIBRARIES,
843832
COVERAGE],

doc/manual/config_files.txt

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
/** @page config_files Configuration Files
2+
3+
This page gives an overview of the different configuration files, what purpose they serve and how they are structured.
4+
The goal of this guide is to ensure well-structured and consistent configuration files.
5+
6+
All configuration files are stored in the @c tcl directory of the project directory.
7+
These files must follow the @ref styletcl and @ref naming_convention.
8+
There are different types of configuration files:
9+
10+
- @ref interface_configs
11+
- @ref target_configs
12+
- @ref board_configs
13+
14+
@note This guideline must be followed for new configuration files.
15+
There may be configuration files that do not comply with this guide for legacy reasons.
16+
17+
18+
@section interface_configs Interface
19+
20+
This configuration file represents a debug (interface) adapter.
21+
This is usually a USB device that provides an interface to one or more transports such as JTAG or SWD.
22+
Other interfaces like ethernet or parallel port are also represented.
23+
24+
A debug adapter configuration file must use the following scheme:
25+
26+
@verbatim
27+
tcl/interface/[vendor]/<adapter name>.cfg
28+
@endverbatim
29+
30+
The `vendor` directory for debug adapters is often omitted because multiple adapters from the same vendor can be represented by a common configuration file.
31+
One counter example are FTDI-based debug adapters.
32+
There are various devices, either standalone or development boards which use FTDI chips but use different chip models or settings.
33+
Their corresponding configuration files are stored in the `ftdi` folder.
34+
35+
The name of the `vendor` folder can also be a more generic term such as `parport` as it is used for parallel port based debug adapters.
36+
37+
If it is foreseeable that new configuration files will be added in the future, create a `vendor` directory even if there is only a single file at the moment.
38+
This prevents that files have to be moved in the future.
39+
40+
@section target_configs Target
41+
42+
This configuration file represents an actual chip.
43+
For example, a microcontroller, FPGA, CPLD, or system on chip (SoC).
44+
A target configuration file always represents an entire device series or family.
45+
46+
A target configuration file must use the following scheme:
47+
48+
@verbatim
49+
tcl/target/<vendor>/<target name>.cfg
50+
@endverbatim
51+
52+
Use the device series or family as `target name`.
53+
For example, the configuration file for the nRF54L series from Nordic Semiconductor is located here:
54+
55+
@verbatim
56+
tcl/target/nordic/nrf54l.cfg
57+
@endverbatim
58+
59+
If there are many similarities between different targets, use a common file to share large pieces of code.
60+
Do not use a single file to represent multiple device series or families.
61+
62+
@section board_configs Board
63+
64+
This configuration file represents a circuit board, for example, a development board.
65+
A board may also contain an on-board debug adapter.
66+
67+
A board configuration file includes existing target and, if available, interface configuration files, since a target is used on many boards.
68+
69+
Reuse existing target and interface configuration files whenever possible.
70+
If a board needs an external debug adapter, do @b not write adapter specific configuration files.
71+
72+
73+
A board configuration file must use the following scheme:
74+
75+
@verbatim
76+
tcl/board/<vendor>/<board name>[-suffix].cfg
77+
@endverbatim
78+
79+
For example, the board configuration file for the NUCLEO-U083RC from STMicroelectronics is located here:
80+
81+
@verbatim
82+
tcl/board/st/nucleo-u083rc.cfg
83+
@endverbatim
84+
85+
In case a board supports different features, a `suffix` can be used to indicate this.
86+
Make sure that the suffix is short and meaningful.
87+
88+
For example, the on-board debug adapter of the FRDM-KV11Z development board can be flashed with a SEGGER J-Link compatible firmware.
89+
Hence, there is the following configuration file:
90+
91+
@verbatim
92+
tcl/board/nxp/frdm-kv11z-jlink.cfg
93+
@endverbatim
94+
95+
The use of a suffix should be chosen carefully.
96+
In many cases it is sufficient to make a certain feature accessible via a variable.
97+
98+
Use a single configuration file for each board.
99+
If there are many similarities between different boards, use a common file to share large pieces of code.
100+
101+
102+
@section naming_convention Naming Convention
103+
104+
105+
The following naming conventions for configuration files and directories must be used:
106+
107+
- Use only lower-case letters and digits for directory and filenames
108+
- Use hyphen characters between consecutive words in identifiers (e.g. `more-than-one-word`)
109+
110+
- Use a common abbreviation for the vendor name, such as
111+
- @c ti for Texas Instruments
112+
- @c st for STMicroelectronics
113+
- @c silabs for Silicon Labs
114+
115+
An extensive list of abbreviations for vendor names can be found [here](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/vendor-prefixes.yaml).
116+
117+
*/

doc/manual/helper.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ portability API.
2121

2222
/** @page helperjim OpenOCD Jim API
2323

24-
The Jim API provides access to a small-footprint TCL implementation.
24+
The Jim API provides access to a small-footprint Tcl implementation.
2525

2626
Visit http://jim.tcl.tk/ for more information on Jim.
2727

0 commit comments

Comments
 (0)