Skip to content

Commit 65a5690

Browse files
committed
Complete merge
1 parent 9acceee commit 65a5690

File tree

1,882 files changed

+91702
-49634
lines changed

Some content is hidden

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

1,882 files changed

+91702
-49634
lines changed

.checkpatch.conf

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# SPDX-License-Identifier: GPL-2.0-or-later
2+
3+
--max-line-length=120
4+
--tab-size=4
5+
--show-types
6+
--strict
7+
8+
--typedefsfile tools/scripts/typedefs.txt
9+
10+
--ignore AVOID_EXTERNS
11+
--ignore BLOCK_COMMENT_STYLE
12+
--ignore COMPLEX_MACRO
13+
--ignore CONST_STRUCT
14+
--ignore ENOSYS
15+
--ignore FILE_PATH_CHANGES
16+
--ignore GERRIT_CHANGE_ID
17+
--ignore LINE_SPACING
18+
--ignore LOGICAL_CONTINUATIONS
19+
--ignore MACRO_WITH_FLOW_CONTROL
20+
--ignore NEW_TYPEDEFS
21+
--ignore PARENTHESIS_ALIGNMENT
22+
--ignore PREFER_DEFINED_ATTRIBUTE_MACRO
23+
--ignore PREFER_FALLTHROUGH
24+
--ignore PREFER_KERNEL_TYPES
25+
--ignore SPLIT_STRING
26+
--ignore SSCANF_TO_KSTRTO
27+
--ignore SWITCH_CASE_INDENT_LEVEL
28+
--ignore TRACING_LOGGING
29+
--ignore VOLATILE

.github/workflows/snapshot.yml

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ name: OpenOCD Snapshot
88

99
jobs:
1010
package:
11-
runs-on: [ubuntu-18.04]
11+
runs-on: [ubuntu-20.04]
1212
env:
1313
DL_DIR: ../downloads
1414
BUILD_DIR: ../build
@@ -22,22 +22,30 @@ jobs:
2222
- run: ./bootstrap
2323
- name: Prepare libusb1
2424
env:
25-
LIBUSB1_VER: 1.0.24
25+
LIBUSB1_VER: 1.0.26
2626
run: |
2727
mkdir -p $DL_DIR && cd $DL_DIR
2828
wget "https://github.com/libusb/libusb/releases/download/v${LIBUSB1_VER}/libusb-${LIBUSB1_VER}.tar.bz2"
2929
tar -xjf libusb-${LIBUSB1_VER}.tar.bz2
3030
echo "LIBUSB1_SRC=$PWD/libusb-${LIBUSB1_VER}" >> $GITHUB_ENV
3131
- name: Prepare hidapi
3232
env:
33-
HIDAPI_VER: 0.10.1
33+
HIDAPI_VER: 0.13.1
3434
run: |
3535
mkdir -p $DL_DIR && cd $DL_DIR
3636
wget "https://github.com/libusb/hidapi/archive/hidapi-${HIDAPI_VER}.tar.gz"
3737
tar -xzf hidapi-${HIDAPI_VER}.tar.gz
3838
cd hidapi-hidapi-${HIDAPI_VER}
3939
./bootstrap
4040
echo "HIDAPI_SRC=$PWD" >> $GITHUB_ENV
41+
- name: Prepare libftdi
42+
env:
43+
LIBFTDI_VER: 1.5
44+
run: |
45+
mkdir -p $DL_DIR && cd $DL_DIR
46+
wget "http://www.intra2net.com/en/developer/libftdi/download/libftdi1-${LIBFTDI_VER}.tar.bz2"
47+
tar -xjf libftdi1-${LIBFTDI_VER}.tar.bz2
48+
echo "LIBFTDI_SRC=$PWD/libftdi1-${LIBFTDI_VER}" >> $GITHUB_ENV
4149
- name: Prepare capstone
4250
env:
4351
CAPSTONE_VER: 4.0.2
@@ -48,13 +56,25 @@ jobs:
4856
wget "https://github.com/aquynh/capstone/archive/${CAPSTONE_VER}.tar.gz"
4957
tar -xzf ${CAPSTONE_VER}.tar.gz
5058
echo "CAPSTONE_SRC=$PWD/capstone-${CAPSTONE_VER}" >> $GITHUB_ENV
59+
- name: Prepare libjaylink
60+
env:
61+
LIBJAYLINK_VER: 0.3.1
62+
run: |
63+
mkdir -p $DL_DIR && cd $DL_DIR
64+
wget https://gitlab.zapb.de/libjaylink/libjaylink/-/archive/${LIBJAYLINK_VER}/libjaylink-${LIBJAYLINK_VER}.tar.gz
65+
tar -xzf libjaylink-${LIBJAYLINK_VER}.tar.gz
66+
cd libjaylink-${LIBJAYLINK_VER}
67+
./autogen.sh
68+
echo "LIBJAYLINK_SRC=$PWD" >> $GITHUB_ENV
5169
- name: Package OpenOCD for windows
5270
env:
5371
MAKE_JOBS: 2
5472
HOST: i686-w64-mingw32
5573
LIBUSB1_CONFIG: --enable-shared --disable-static
5674
HIDAPI_CONFIG: --enable-shared --disable-static --disable-testgui
75+
LIBFTDI_CONFIG: -DSTATICLIBS=OFF -DEXAMPLES=OFF -DFTDI_EEPROM=OFF
5776
CAPSTONE_CONFIG: "CAPSTONE_BUILD_CORE_ONLY=yes CAPSTONE_STATIC=yes CAPSTONE_SHARED=no"
77+
LIBJAYLINK_CONFIG: --enable-shared --disable-static
5878
run: |
5979
# check if there is tag pointing at HEAD, otherwise take the HEAD SHA-1 as OPENOCD_TAG
6080
OPENOCD_TAG="`git tag --points-at HEAD`"
@@ -73,6 +93,7 @@ jobs:
7393
# add missing dlls
7494
cd $HOST-root/usr
7595
cp `$HOST-gcc --print-file-name=libwinpthread-1.dll` ./bin/
96+
# required by libftdi1.dll. For the gcc-mingw-10.3.x or later "libgcc_s_dw2-1.dll" will need to be copied.
7697
cp `$HOST-gcc --print-file-name=libgcc_s_sjlj-1.dll` ./bin/
7798
# prepare the artifact
7899
ARTIFACT="openocd-${OPENOCD_TAG}-${HOST}.tar.gz"
@@ -81,11 +102,11 @@ jobs:
81102
echo "IS_PRE_RELEASE=$IS_PRE_RELEASE" >> $GITHUB_ENV
82103
echo "ARTIFACT_PATH=$PWD/$ARTIFACT" >> $GITHUB_ENV
83104
- name: Publish OpenOCD packaged for windows
84-
uses: actions/upload-artifact@v2
105+
uses: actions/upload-artifact@v3
85106
with:
86107
path: ${{ env.ARTIFACT_PATH }}
87108
- name: Delete 'latest' Release
88-
uses: dev-drprasad/delete-tag-and-release@v0.2.0
109+
uses: dev-drprasad/delete-tag-and-release@v0.2.1
89110
with:
90111
delete_release: true
91112
tag_name: ${{ env.RELEASE_NAME }}

.gitignore

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
*.la
1212
*.in
1313

14-
# generated source files
15-
src/jtag/minidriver_imp.h
16-
src/jtag/jtag_minidriver.h
14+
# coverage files (gcov)
15+
*.gcda
16+
*.gcno
1717

1818
# OpenULINK driver files generated by SDCC
1919
src/jtag/drivers/OpenULINK/*.rel
@@ -84,6 +84,9 @@ patches
8484
.cproject
8585
.settings
8686

87+
# VSCode stuff
88+
.vscode
89+
8790
# Emacs temp files
8891
*~
8992

@@ -100,3 +103,14 @@ tags
100103
GPATH
101104
GRTAGS
102105
GTAGS
106+
107+
# checkpatch script files
108+
.checkpatch-camelcase.*
109+
110+
# clangd (e.g. for advanced code completion and linting) generates cache files
111+
# into .cache
112+
.cache
113+
114+
# A compile_commands.json can be generated using bear and will help tools such
115+
# as clangd to locate header files and use correct $CFLAGS
116+
compile_commands.json

.gitmodules

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1-
[submodule "tools/git2cl"]
2-
path = tools/git2cl
3-
url = https://repo.or.cz/git2cl.git
41
[submodule "jimtcl"]
52
path = jimtcl
63
url = https://github.com/msteveb/jimtcl.git
74
[submodule "src/jtag/drivers/libjaylink"]
85
path = src/jtag/drivers/libjaylink
9-
url = https://repo.or.cz/libjaylink.git
6+
url = https://gitlab.zapb.de/libjaylink/libjaylink.git

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SPDX-License-Identifier: GPL-2.0+
1+
# SPDX-License-Identifier: GPL-2.0-or-later
22
# Copyright Marek Vasut <marex@denx.de>
33

44
# OpenOCD on Travis CI - https://travis-ci.org/

AUTHORS

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,2 @@
1-
Dominic Rath <Dominic.Rath@gmx.de>
2-
Magnus Lundin <lundin@mlu.mine.nu>
3-
Michael Fischer <fischermi@t-online.de>
4-
Spencer Oliver <spen@spen-soft.co.uk>
5-
Carsten Schlote <schlote@vahanus.net>
6-
Øyvind Harboe <oyvind.harboe@zylin.com>
7-
Duane Ellis <openocd@duaneellis.com>
8-
Michael Schwingen <michael@schwingen.org>
9-
Rick Altherr <kc8apf@users.berlios.de>
10-
David Brownell <dbrownell@users.sourceforge.net>
11-
Vincint Palatin <vpalatin@users.berlios.de>
12-
Zachary T Welch <zw@superlucidity.net>
1+
Please check the source code files and/or Git history for a list of all authors
2+
and contributors.

HACKING

Lines changed: 133 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,37 @@ patch:
7777
src/openocd -s ../tcl -f /path/to/openocd.cfg
7878
@endcode
7979

80+
- Sparse Static Analyzer
81+
82+
Using this tool allows identifying some bug in C code.
83+
In the future, OpenOCD would use the sparse attribute 'bitwise' to
84+
detect incorrect endianness assignments.
85+
86+
Example usage:
87+
@code
88+
mkdir build-sparse; cd build-sparse
89+
../configure CC=cgcc CFLAGS="-Wsparse-all -Wno-declaration-after-statement \
90+
-Wno-unknown-attribute -Wno-transparent-union -Wno-tautological-compare \
91+
-Wno-vla -Wno-flexible-array-array -D__FLT_EVAL_METHOD__=0"
92+
make
93+
@endcode
94+
95+
- Code coverage analysis
96+
97+
By inspecting the code coverage, you can identify potential gaps in your testing
98+
and use that information to improve your test scenarios.
99+
100+
Example usage:
101+
@code
102+
mkdir build-gcov; cd build-gcov
103+
../configure --enable-gcov [...]
104+
make
105+
# ... Now execute your test scenarios to collect OpenOCD code coverage ...
106+
lcov --capture --directory ./src --output-file openocd-coverage.info
107+
genhtml openocd-coverage.info --output-directory coverage_report
108+
# ... Open coverage_report/index.html in a web browser ...
109+
@endcode
110+
80111
Please consider performing these additional checks where appropriate
81112
(especially Clang Static Analyzer for big portions of new code) and
82113
mention the results (e.g. "Valgrind-clean, no new Clang analyzer
@@ -140,10 +171,6 @@ topics. It is possible because @c for/master is not a traditional Git
140171
branch.
141172
-# You will need to install this hook, we will look into a better solution:
142173
@code
143-
scp -p -P 29418 USERNAME@review.openocd.org:hooks/commit-msg .git/hooks/
144-
@endcode
145-
Or with http only:
146-
@code
147174
wget https://review.openocd.org/tools/hooks/commit-msg
148175
mv commit-msg .git/hooks
149176
chmod +x .git/hooks/commit-msg
@@ -171,18 +198,48 @@ while(!done) {
171198
@endcode
172199
\note use "git add ." before commit to add new files.
173200

174-
Comment template, notice the short first line w/topic. The topic field
175-
should identify the main part or subsystem the patch touches. Check
176-
git log for examples.
177-
@code
178-
topic: Short comment
201+
\note check @ref checkpatch for hint about checkpatch script
202+
203+
Commit message template, notice the short first line.
204+
The field '<c>specify touched area</c>'
205+
should identify the main part or subsystem the patch touches.
206+
@code{.unparsed}
207+
specify touched area: short comment
179208
<blank line>
180209
Longer comments over several lines, explaining (where applicable) the
181210
reason for the patch and the general idea the solution is based on,
182-
any major design decisions, etc...
211+
any major design decisions, etc. Limit each comment line's length to 75
212+
characters; since 75 it's too short for a URL, you can put the URL in a
213+
separate line preceded by 'Link: '.
183214
<blank line>
184215
Signed-off-by: ...
185216
@endcode
217+
Examples:
218+
@code{.unparsed}
219+
flash/nor/atsame5: add SAME59 support
220+
221+
Add new device ID
222+
@endcode
223+
@code{.unparsed}
224+
flash/nor: flash driver for XYZ123
225+
226+
Add new flash driver for internal flash of ...
227+
@endcode
228+
@code{.unparsed}
229+
target/cortex_m: fix segmentation fault in cmd 'soft_reset_halt'
230+
231+
soft_reset_halt command failed reproducibly under following conditions: ...
232+
Test for NULL pointer and return error ...
233+
234+
Reported-by: John Reporter <rep9876@gmail.com>
235+
Fixes: 123456789abc ("target: the commit where the problem started")
236+
BugLink: https://sourceforge.net/p/openocd/tickets/999/
237+
@endcode
238+
@code{.unparsed}
239+
doc: fix typos
240+
@endcode
241+
See "git log" for more examples.
242+
186243
-# Next you need to make sure that your patches
187244
are on top of the latest stuff on the server and
188245
that there are no conflicts:
@@ -201,6 +258,72 @@ git push review
201258

202259
Further reading: http://www.coreboot.org/Git
203260

261+
@section checkpatch About checkpatch script
262+
263+
OpenOCD source code includes the script checkpatch to let developers to
264+
verify their patches before submitting them for review (see @ref gerrit).
265+
266+
Every patch for OpenOCD project that is submitted for review on Gerrit
267+
is tested by Jenkins. Jenkins will run the checkpatch script to analyze
268+
each patch.
269+
If the script highlights either errors or warnings, Gerrit will add the
270+
score "-1" to the patch and maintainers will probably ignore the patch,
271+
waiting for the developer to send a fixed version.
272+
273+
The script checkpatch verifies the SPDX tag for new files against a very
274+
short list of license tags.
275+
If the license of your contribution is not listed there, but compatible
276+
with OpenOCD license, please alert the maintainers or add the missing
277+
license in the first patch of your patch series.
278+
279+
The script checkpatch has been originally developed for the Linux kernel
280+
source code, thus includes specific tests and checks related to Linux
281+
coding style and to Linux code structure. While the script has been
282+
adapted for OpenOCD specificities, it still includes some Linux related
283+
test. It is then possible that it triggers sometimes some <em>false
284+
positive</em>!
285+
286+
If you think that the error identified by checkpatch is a false
287+
positive, please report it to the openocd-devel mailing list or prepare
288+
a patch for fixing checkpatch and send it to Gerrit for review.
289+
290+
\attention The procedure below is allowed only for <em>exceptional
291+
cases</em>. Do not use it to submit normal patches.
292+
293+
There are <em>exceptional cases</em> in which you need to skip some of
294+
the tests from checkpatch in order to pass the approval from Gerrit.
295+
296+
For example, a patch that modify one line inside a big comment block
297+
will not show the beginning or the end of the comment block. This can
298+
prevent checkpatch to detect the comment block. Checkpatch can wrongly
299+
consider the modified comment line as a code line, triggering a set of
300+
false errors.
301+
302+
Only for <em>exceptional cases</em>, it is allowed to submit patches
303+
to Gerrit with the special field 'Checkpatch-ignore:' in the commit
304+
message. This field will cause checkpatch to ignore the error types
305+
listed in the field, only for the patch itself.
306+
For errors in the commit message, the special field has to be put in
307+
the commit message before the line that produces the error.
308+
The special field must be added <em>before</em> the 'Signed-off-by:'
309+
line, otherwise it is ignored.
310+
To ignore multiple errors, either add multiple lines with the special
311+
field or add multiple error types, separated by space or commas, in a
312+
single line.
313+
The error type is printed by checkpatch on failure.
314+
For example the names of Windows APIs mix lower and upper case chars,
315+
in violation of OpenOCD coding style, triggering a 'CAMELCASE' error:
316+
@code
317+
CHECK:CAMELCASE: Avoid CamelCase: <WSAGetLastError>
318+
#96105: FILE: src/helper/log.c:505:
319+
+ error_code = WSAGetLastError();
320+
@endcode
321+
Adding in the commit message of the patch the line:
322+
@code
323+
Checkpatch-ignore: CAMELCASE
324+
@endcode
325+
will force checkpatch to ignore the CAMELCASE error.
326+
204327
@section timeline When can I expect my contribution to be committed?
205328

206329
The code review is intended to take as long as a week or two to allow
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
SPDX-Exception-Identifier: eCos-exception-2.0
2+
SPDX-URL: https://spdx.org/licenses/eCos-exception-2.0.html
3+
SPDX-Licenses: GPL-2.0-only, GPL-2.0-or-later
4+
Usage-Guide:
5+
This exception is used together with one of the above SPDX-Licenses.
6+
To use this exception add it with the keyword WITH to one of the
7+
identifiers in the SPDX-Licenses tag:
8+
SPDX-License-Identifier: <SPDX-License> WITH eCos-exception-2.0
9+
License-Text:
10+
11+
As a special exception, if other files instantiate templates or use
12+
macros or inline functions from this file, or you compile this
13+
file and link it with other works to produce a work based on this
14+
file, this file does not by itself cause the resulting work to be
15+
covered by the GNU General Public License. However the source code for
16+
this file must still be made available in accordance with section (3)
17+
of the GNU General Public License.
18+
19+
This exception does not invalidate any other reasons why a work based on
20+
this file might be covered by the GNU General Public License.

0 commit comments

Comments
 (0)