Skip to content

Commit a7220bb

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents 0bccc95 + a468365 commit a7220bb

File tree

1,302 files changed

+84107
-39472
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,302 files changed

+84107
-39472
lines changed

.checkpatch.conf

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
--ignore LINE_SPACING
1818
--ignore LOGICAL_CONTINUATIONS
1919
--ignore MACRO_WITH_FLOW_CONTROL
20-
--ignore NEW_TYPEDEFS
2120
--ignore PARENTHESIS_ALIGNMENT
2221
--ignore PREFER_DEFINED_ATTRIBUTE_MACRO
2322
--ignore PREFER_FALLTHROUGH
@@ -27,3 +26,14 @@
2726
--ignore SWITCH_CASE_INDENT_LEVEL
2827
--ignore TRACING_LOGGING
2928
--ignore VOLATILE
29+
30+
# ESPRESSIF
31+
--no-signoff
32+
--ignore COMMIT_MESSAGE
33+
--ignore BAD_SIGN_OFF
34+
--ignore UNKNOWN_COMMIT_ID
35+
--exclude src/jtag/drivers/libjaylink
36+
--exclude tools/git2cl
37+
--exclude .gitlab
38+
--exclude HACKING
39+
--exclude testing/esp
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
name: Common Build Steps for Windows, Linux and Macos
2+
inputs:
3+
arch:
4+
required: true
5+
runs:
6+
using: "composite"
7+
steps:
8+
- name: build
9+
shell: bash
10+
env:
11+
ARCH: ${{ inputs.arch }}
12+
BUILD_DIR: build
13+
OPENOCD_CONFIGURE_OPTS: "--disable-doxygen-html --enable-remote-bitbang"
14+
run: |
15+
mkdir -p $BUILD_DIR
16+
export PREFIX="$(realpath $BUILD_DIR)/opt"
17+
export DL_DIR="$(realpath $BUILD_DIR)/dl"
18+
mkdir -p $PREFIX $DL_DIR
19+
20+
if [[ "$ARCH" =~ macos ]]; then
21+
export LDFLAGS="-Wl,-framework,CoreFoundation -Wl,-framework,IOKit -Wl,-framework,Security"
22+
fi
23+
24+
# Set platform-specific variables
25+
if [[ "$ARCH" == "windows" ]]; then
26+
export CONF_HOST="i686-w64-mingw32"
27+
export HOST_CC="${CONF_HOST}-gcc"
28+
else
29+
export CONF_HOST=""
30+
export HOST_CC="gcc"
31+
fi
32+
33+
# LIBUSB
34+
export LIBUSB_VER=libusb-1.0.26
35+
cd $DL_DIR && wget https://dl.espressif.com/dl/$LIBUSB_VER.tar.gz -O $LIBUSB_VER.tar.gz
36+
tar xzf $LIBUSB_VER.tar.gz && rm $LIBUSB_VER.tar.gz && pushd $LIBUSB_VER && ./bootstrap.sh
37+
./configure --prefix="$PREFIX" --host=${CONF_HOST} --enable-shared=no --enable-static=yes CC=${HOST_CC}
38+
make install
39+
export PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig
40+
popd
41+
42+
# HIDAPI
43+
export HIDAPI_VER=hidapi-0.14.0
44+
cd $DL_DIR && wget https://dl.espressif.com/dl/hidapi-$HIDAPI_VER.tar.gz -O $HIDAPI_VER.tar.gz
45+
tar xzf $HIDAPI_VER.tar.gz && rm $HIDAPI_VER.tar.gz && pushd hidapi-$HIDAPI_VER && ./bootstrap
46+
./configure --prefix="$PREFIX" --host=${CONF_HOST} --enable-shared=no --enable-static=yes --disable-testgui CC=${HOST_CC} CFLAGS=-std=gnu99
47+
make install
48+
popd
49+
50+
# LIBJAYLINK
51+
export LIBJAYLINK_VER=libjaylink-0.3.1
52+
cd $DL_DIR && wget https://dl.espressif.com/dl/$LIBJAYLINK_VER.tar.gz -O $LIBJAYLINK_VER.tar.gz
53+
tar xzf $LIBJAYLINK_VER.tar.gz && rm $LIBJAYLINK_VER.tar.gz && pushd $LIBJAYLINK_VER
54+
./autogen.sh
55+
./configure --prefix="$PREFIX" --host=${CONF_HOST} --disable-shared CC=${HOST_CC}
56+
make install
57+
popd
58+
59+
# ZLIB (Windows only)
60+
if [[ $ARCH == "windows" ]]; then
61+
export ZLIB_VER=zlib-1.2.11
62+
cd $DL_DIR && wget https://dl.espressif.com/dl/$ZLIB_VER.tar.xz -O $ZLIB_VER.tar.xz
63+
tar xf $ZLIB_VER.tar.xz && rm $ZLIB_VER.tar.xz && pushd $ZLIB_VER
64+
make -f win32/Makefile.gcc BINARY_PATH=$PREFIX/lib INCLUDE_PATH=$PREFIX/include/zlib LIBRARY_PATH=$PREFIX/lib SHARED_MODE=1 PREFIX=${CONF_HOST}- install
65+
export CPPFLAGS="-I$PREFIX/include/zlib"
66+
export LDFLAGS="-L$PREFIX/lib"
67+
popd
68+
fi
69+
70+
# JIMTCL
71+
export JIMTCL_VER=jimtcl-0.83
72+
cd $DL_DIR && wget https://dl.espressif.com/dl/$JIMTCL_VER.tar.gz -O $JIMTCL_VER.tar.gz
73+
tar xzf $JIMTCL_VER.tar.gz && rm $JIMTCL_VER.tar.gz && pushd $JIMTCL_VER
74+
./configure --prefix="$PREFIX" --host=${CONF_HOST} --disable-shared CC=${HOST_CC}
75+
make
76+
# Running "make" does not create this file for static builds on Windows but "make install" still expects it
77+
touch build-jim-ext
78+
make install
79+
popd
80+
81+
cd $PREFIX/../..
82+
./bootstrap
83+
./configure --prefix="$PREFIX/openocd" --host=${CONF_HOST} $OPENOCD_CONFIGURE_OPTS CC=${HOST_CC}
84+
make -j $(nproc)
85+
make install-strip
86+
87+
if [[ $ARCH == "windows" ]]; then
88+
cp $PREFIX/lib/zlib1.dll $PREFIX/openocd/bin
89+
cp `$HOST_CC --print-file-name=libgcc_s_dw2-1.dll` $PREFIX/openocd/bin/
90+
fi
91+
92+
echo "ARTIFACT_PATH=$PREFIX/openocd" >> $GITHUB_ENV
93+
94+
- name: Upload artifact
95+
uses: actions/upload-artifact@v4
96+
with:
97+
name: openocd-${{ inputs.arch }}
98+
path: ${{ env.ARTIFACT_PATH }}/*

.github/workflows/build_openocd.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Build OpenOCD for Windows, MacOS, and Linux
2+
3+
on:
4+
workflow_call: {}
5+
workflow_dispatch: {}
6+
7+
jobs:
8+
build-macos-x86:
9+
runs-on: macos-13
10+
steps:
11+
- name: Ensure architecture is x86_64
12+
run: |
13+
if [[ "$(uname -m)" != "x86_64" ]]; then
14+
echo "Error: Expected x86_64 architecture but got $(uname -m)" >&2
15+
exit 1
16+
fi
17+
- uses: actions/checkout@v4
18+
- name: install deps
19+
run: brew install automake texinfo coreutils
20+
- name: Build and Upload OpenOCD artifact
21+
uses: ./.github/actions/common-build-steps
22+
with:
23+
arch: macos-x86
24+
25+
build-macos-arm64:
26+
runs-on: macos-latest
27+
steps:
28+
- name: Ensure architecture is arm64
29+
run: |
30+
if [[ "$(uname -m)" != "arm64" ]]; then
31+
echo "Error: Expected arm64 architecture but got $(uname -m)" >&2
32+
exit 1
33+
fi
34+
- uses: actions/checkout@v4
35+
- name: install deps
36+
run: brew install automake libtool texinfo coreutils
37+
- name: Build and Upload OpenOCD artifact
38+
uses: ./.github/actions/common-build-steps
39+
with:
40+
arch: macos-arm64
41+
42+
build-linux:
43+
runs-on: ubuntu-latest
44+
steps:
45+
- uses: actions/checkout@v4
46+
- name: install deps
47+
run: sudo apt-get install libudev-dev systemd --force-yes -y
48+
- name: Build and Upload OpenOCD artifact
49+
uses: ./.github/actions/common-build-steps
50+
with:
51+
arch: linux
52+
53+
build-windows:
54+
runs-on: ubuntu-latest
55+
steps:
56+
- uses: actions/checkout@v4
57+
- name: install deps
58+
run: sudo apt-get install libtool-bin libudev-dev gcc-mingw-w64-i686
59+
- name: Build and Upload OpenOCD artifact
60+
uses: ./.github/actions/common-build-steps
61+
with:
62+
arch: windows

.github/workflows/ci_workflow.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Build and Test OpenOCD Workflow
2+
3+
on:
4+
push:
5+
workflow_dispatch: # (to start the workflow manually)
6+
7+
jobs:
8+
build-openocd:
9+
name: Build OpenOCD
10+
uses: ./.github/workflows/build_openocd.yml
11+
12+
test-openocd:
13+
name: Test OpenOCD
14+
uses: ./.github/workflows/test_openocd.yml
15+
needs: build-openocd

.github/workflows/test_openocd.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Test OpenOCD
2+
3+
on:
4+
workflow_call: {}
5+
workflow_dispatch: {}
6+
jobs:
7+
run-macos-x86-host:
8+
name: Test OpenOCD on MacOS-x86
9+
runs-on: macos-13
10+
steps:
11+
- name: Checkout repository
12+
uses: actions/checkout@v4
13+
- name: Download files / artifacts from build job
14+
uses: actions/download-artifact@v4
15+
with:
16+
name: openocd-macos-x86
17+
- name: Set up Python
18+
uses: actions/setup-python@v5
19+
with:
20+
python-version: '3.10'
21+
- name: Run and check OpenOCD
22+
run: chmod +x bin/openocd && python tools/test_openocd.py bin/openocd
23+
24+
run-macos-arm64-host:
25+
name: Test OpenOCD on MacOS-arm64
26+
runs-on: macos-latest
27+
steps:
28+
- name: Checkout repository
29+
uses: actions/checkout@v4
30+
- name: Download files / artifacts from build job
31+
uses: actions/download-artifact@v4
32+
with:
33+
name: openocd-macos-arm64
34+
- name: Set up Python
35+
uses: actions/setup-python@v5
36+
with:
37+
python-version: '3.10'
38+
- name: Run and check OpenOCD
39+
run: chmod +x bin/openocd && python tools/test_openocd.py bin/openocd
40+
41+
run-linux-host:
42+
name: Test OpenOCD on Linux
43+
runs-on: ubuntu-latest
44+
steps:
45+
- name: Checkout repository
46+
uses: actions/checkout@v4
47+
- name: Download files / artifacts from build job
48+
uses: actions/download-artifact@v4
49+
with:
50+
name: openocd-linux
51+
- name: Set up Python
52+
uses: actions/setup-python@v5
53+
with:
54+
python-version: '3.10'
55+
- name: Run and check OpenOCD
56+
run: chmod +x bin/openocd && python tools/test_openocd.py bin/openocd
57+
58+
run-win-host:
59+
name: Test OpenOCD on Windows
60+
runs-on: windows-latest
61+
steps:
62+
- name: Checkout repository
63+
uses: actions/checkout@v4
64+
- name: Download files / artifacts from build job
65+
uses: actions/download-artifact@v4
66+
with:
67+
name: openocd-windows
68+
- name: Set up Python
69+
uses: actions/setup-python@v5
70+
with:
71+
python-version: '3.10'
72+
- name: Run and check OpenOCD
73+
run: python tools/test_openocd.py bin\openocd

.gitignore

Lines changed: 6 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

0 commit comments

Comments
 (0)