Skip to content

Commit

Permalink
Complete merge
Browse files Browse the repository at this point in the history
  • Loading branch information
maxgerhardt committed Dec 24, 2024
1 parent 9acceee commit 65a5690
Show file tree
Hide file tree
Showing 1,882 changed files with 91,702 additions and 49,634 deletions.
29 changes: 29 additions & 0 deletions .checkpatch.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# SPDX-License-Identifier: GPL-2.0-or-later

--max-line-length=120
--tab-size=4
--show-types
--strict

--typedefsfile tools/scripts/typedefs.txt

--ignore AVOID_EXTERNS
--ignore BLOCK_COMMENT_STYLE
--ignore COMPLEX_MACRO
--ignore CONST_STRUCT
--ignore ENOSYS
--ignore FILE_PATH_CHANGES
--ignore GERRIT_CHANGE_ID
--ignore LINE_SPACING
--ignore LOGICAL_CONTINUATIONS
--ignore MACRO_WITH_FLOW_CONTROL
--ignore NEW_TYPEDEFS
--ignore PARENTHESIS_ALIGNMENT
--ignore PREFER_DEFINED_ATTRIBUTE_MACRO
--ignore PREFER_FALLTHROUGH
--ignore PREFER_KERNEL_TYPES
--ignore SPLIT_STRING
--ignore SSCANF_TO_KSTRTO
--ignore SWITCH_CASE_INDENT_LEVEL
--ignore TRACING_LOGGING
--ignore VOLATILE
31 changes: 26 additions & 5 deletions .github/workflows/snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -22,22 +22,30 @@ jobs:
- run: ./bootstrap
- name: Prepare libusb1
env:
LIBUSB1_VER: 1.0.24
LIBUSB1_VER: 1.0.26
run: |
mkdir -p $DL_DIR && cd $DL_DIR
wget "https://github.com/libusb/libusb/releases/download/v${LIBUSB1_VER}/libusb-${LIBUSB1_VER}.tar.bz2"
tar -xjf libusb-${LIBUSB1_VER}.tar.bz2
echo "LIBUSB1_SRC=$PWD/libusb-${LIBUSB1_VER}" >> $GITHUB_ENV
- name: Prepare hidapi
env:
HIDAPI_VER: 0.10.1
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"
tar -xzf hidapi-${HIDAPI_VER}.tar.gz
cd hidapi-hidapi-${HIDAPI_VER}
./bootstrap
echo "HIDAPI_SRC=$PWD" >> $GITHUB_ENV
- name: Prepare libftdi
env:
LIBFTDI_VER: 1.5
run: |
mkdir -p $DL_DIR && cd $DL_DIR
wget "http://www.intra2net.com/en/developer/libftdi/download/libftdi1-${LIBFTDI_VER}.tar.bz2"
tar -xjf libftdi1-${LIBFTDI_VER}.tar.bz2
echo "LIBFTDI_SRC=$PWD/libftdi1-${LIBFTDI_VER}" >> $GITHUB_ENV
- name: Prepare capstone
env:
CAPSTONE_VER: 4.0.2
Expand All @@ -48,13 +56,25 @@ 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
HOST: i686-w64-mingw32
LIBUSB1_CONFIG: --enable-shared --disable-static
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`"
Expand All @@ -73,6 +93,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"
Expand All @@ -81,11 +102,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/[email protected].0
uses: dev-drprasad/[email protected].1
with:
delete_release: true
tag_name: ${{ env.RELEASE_NAME }}
Expand Down
20 changes: 17 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
*.la
*.in

# generated source files
src/jtag/minidriver_imp.h
src/jtag/jtag_minidriver.h
# coverage files (gcov)
*.gcda
*.gcno

# OpenULINK driver files generated by SDCC
src/jtag/drivers/OpenULINK/*.rel
Expand Down Expand Up @@ -84,6 +84,9 @@ patches
.cproject
.settings

# VSCode stuff
.vscode

# Emacs temp files
*~

Expand All @@ -100,3 +103,14 @@ tags
GPATH
GRTAGS
GTAGS

# checkpatch script files
.checkpatch-camelcase.*

# clangd (e.g. for advanced code completion and linting) generates cache files
# into .cache
.cache

# A compile_commands.json can be generated using bear and will help tools such
# as clangd to locate header files and use correct $CFLAGS
compile_commands.json
5 changes: 1 addition & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
[submodule "tools/git2cl"]
path = tools/git2cl
url = https://repo.or.cz/git2cl.git
[submodule "jimtcl"]
path = jimtcl
url = https://github.com/msteveb/jimtcl.git
[submodule "src/jtag/drivers/libjaylink"]
path = src/jtag/drivers/libjaylink
url = https://repo.or.cz/libjaylink.git
url = https://gitlab.zapb.de/libjaylink/libjaylink.git
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-License-Identifier: GPL-2.0+
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright Marek Vasut <[email protected]>

# OpenOCD on Travis CI - https://travis-ci.org/
Expand Down
14 changes: 2 additions & 12 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -1,12 +1,2 @@
Dominic Rath <[email protected]>
Magnus Lundin <[email protected]>
Michael Fischer <[email protected]>
Spencer Oliver <[email protected]>
Carsten Schlote <[email protected]>
Øyvind Harboe <[email protected]>
Duane Ellis <[email protected]>
Michael Schwingen <[email protected]>
Rick Altherr <[email protected]>
David Brownell <[email protected]>
Vincint Palatin <[email protected]>
Zachary T Welch <[email protected]>
Please check the source code files and/or Git history for a list of all authors
and contributors.
143 changes: 133 additions & 10 deletions HACKING
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,37 @@ patch:
src/openocd -s ../tcl -f /path/to/openocd.cfg
@endcode

- Sparse Static Analyzer

Using this tool allows identifying some bug in C code.
In the future, OpenOCD would use the sparse attribute 'bitwise' to
detect incorrect endianness assignments.

Example usage:
@code
mkdir build-sparse; cd build-sparse
../configure CC=cgcc CFLAGS="-Wsparse-all -Wno-declaration-after-statement \
-Wno-unknown-attribute -Wno-transparent-union -Wno-tautological-compare \
-Wno-vla -Wno-flexible-array-array -D__FLT_EVAL_METHOD__=0"
make
@endcode

- Code coverage analysis

By inspecting the code coverage, you can identify potential gaps in your testing
and use that information to improve your test scenarios.

Example usage:
@code
mkdir build-gcov; cd build-gcov
../configure --enable-gcov [...]
make
# ... Now execute your test scenarios to collect OpenOCD code coverage ...
lcov --capture --directory ./src --output-file openocd-coverage.info
genhtml openocd-coverage.info --output-directory coverage_report
# ... Open coverage_report/index.html in a web browser ...
@endcode

Please consider performing these additional checks where appropriate
(especially Clang Static Analyzer for big portions of new code) and
mention the results (e.g. "Valgrind-clean, no new Clang analyzer
Expand Down Expand Up @@ -140,10 +171,6 @@ topics. It is possible because @c for/master is not a traditional Git
branch.
-# You will need to install this hook, we will look into a better solution:
@code
scp -p -P 29418 [email protected]:hooks/commit-msg .git/hooks/
@endcode
Or with http only:
@code
wget https://review.openocd.org/tools/hooks/commit-msg
mv commit-msg .git/hooks
chmod +x .git/hooks/commit-msg
Expand Down Expand Up @@ -171,18 +198,48 @@ while(!done) {
@endcode
\note use "git add ." before commit to add new files.

Comment template, notice the short first line w/topic. The topic field
should identify the main part or subsystem the patch touches. Check
git log for examples.
@code
topic: Short comment
\note check @ref checkpatch for hint about checkpatch script

Commit message template, notice the short first line.
The field '<c>specify touched area</c>'
should identify the main part or subsystem the patch touches.
@code{.unparsed}
specify touched area: short comment
<blank line>
Longer comments over several lines, explaining (where applicable) the
reason for the patch and the general idea the solution is based on,
any major design decisions, etc...
any major design decisions, etc. Limit each comment line's length to 75
characters; since 75 it's too short for a URL, you can put the URL in a
separate line preceded by 'Link: '.
<blank line>
Signed-off-by: ...
@endcode
Examples:
@code{.unparsed}
flash/nor/atsame5: add SAME59 support

Add new device ID
@endcode
@code{.unparsed}
flash/nor: flash driver for XYZ123

Add new flash driver for internal flash of ...
@endcode
@code{.unparsed}
target/cortex_m: fix segmentation fault in cmd 'soft_reset_halt'

soft_reset_halt command failed reproducibly under following conditions: ...
Test for NULL pointer and return error ...

Reported-by: John Reporter <[email protected]>
Fixes: 123456789abc ("target: the commit where the problem started")
BugLink: https://sourceforge.net/p/openocd/tickets/999/
@endcode
@code{.unparsed}
doc: fix typos
@endcode
See "git log" for more examples.

-# Next you need to make sure that your patches
are on top of the latest stuff on the server and
that there are no conflicts:
Expand All @@ -201,6 +258,72 @@ git push review

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

@section checkpatch About checkpatch script

OpenOCD source code includes the script checkpatch to let developers to
verify their patches before submitting them for review (see @ref gerrit).

Every patch for OpenOCD project that is submitted for review on Gerrit
is tested by Jenkins. Jenkins will run the checkpatch script to analyze
each patch.
If the script highlights either errors or warnings, Gerrit will add the
score "-1" to the patch and maintainers will probably ignore the patch,
waiting for the developer to send a fixed version.

The script checkpatch verifies the SPDX tag for new files against a very
short list of license tags.
If the license of your contribution is not listed there, but compatible
with OpenOCD license, please alert the maintainers or add the missing
license in the first patch of your patch series.

The script checkpatch has been originally developed for the Linux kernel
source code, thus includes specific tests and checks related to Linux
coding style and to Linux code structure. While the script has been
adapted for OpenOCD specificities, it still includes some Linux related
test. It is then possible that it triggers sometimes some <em>false
positive</em>!

If you think that the error identified by checkpatch is a false
positive, please report it to the openocd-devel mailing list or prepare
a patch for fixing checkpatch and send it to Gerrit for review.

\attention The procedure below is allowed only for <em>exceptional
cases</em>. Do not use it to submit normal patches.

There are <em>exceptional cases</em> in which you need to skip some of
the tests from checkpatch in order to pass the approval from Gerrit.

For example, a patch that modify one line inside a big comment block
will not show the beginning or the end of the comment block. This can
prevent checkpatch to detect the comment block. Checkpatch can wrongly
consider the modified comment line as a code line, triggering a set of
false errors.

Only for <em>exceptional cases</em>, it is allowed to submit patches
to Gerrit with the special field 'Checkpatch-ignore:' in the commit
message. This field will cause checkpatch to ignore the error types
listed in the field, only for the patch itself.
For errors in the commit message, the special field has to be put in
the commit message before the line that produces the error.
The special field must be added <em>before</em> the 'Signed-off-by:'
line, otherwise it is ignored.
To ignore multiple errors, either add multiple lines with the special
field or add multiple error types, separated by space or commas, in a
single line.
The error type is printed by checkpatch on failure.
For example the names of Windows APIs mix lower and upper case chars,
in violation of OpenOCD coding style, triggering a 'CAMELCASE' error:
@code
CHECK:CAMELCASE: Avoid CamelCase: <WSAGetLastError>
#96105: FILE: src/helper/log.c:505:
+ error_code = WSAGetLastError();
@endcode
Adding in the commit message of the patch the line:
@code
Checkpatch-ignore: CAMELCASE
@endcode
will force checkpatch to ignore the CAMELCASE error.

@section timeline When can I expect my contribution to be committed?

The code review is intended to take as long as a week or two to allow
Expand Down
20 changes: 20 additions & 0 deletions LICENSES/exceptions/eCos-exception-2.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
SPDX-Exception-Identifier: eCos-exception-2.0
SPDX-URL: https://spdx.org/licenses/eCos-exception-2.0.html
SPDX-Licenses: GPL-2.0-only, GPL-2.0-or-later
Usage-Guide:
This exception is used together with one of the above SPDX-Licenses.
To use this exception add it with the keyword WITH to one of the
identifiers in the SPDX-Licenses tag:
SPDX-License-Identifier: <SPDX-License> WITH eCos-exception-2.0
License-Text:

As a special exception, if other files instantiate templates or use
macros or inline functions from this file, or you compile this
file and link it with other works to produce a work based on this
file, this file does not by itself cause the resulting work to be
covered by the GNU General Public License. However the source code for
this file must still be made available in accordance with section (3)
of the GNU General Public License.

This exception does not invalidate any other reasons why a work based on
this file might be covered by the GNU General Public License.
Loading

0 comments on commit 65a5690

Please sign in to comment.