Skip to content

Commit

Permalink
Merge remote-tracking branch 'oficial/riscv' into riscv_spinal
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/flash/nor/drivers.c
#	src/jtag/interfaces.c
#	src/target/riscv/riscv.c
#	src/target/target.c
  • Loading branch information
Dolu1990 committed Mar 5, 2024
2 parents 058dfa5 + ca7d882 commit f6d1e19
Show file tree
Hide file tree
Showing 1,845 changed files with 85,517 additions and 43,643 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
13 changes: 9 additions & 4 deletions .github/workflows/checkpatch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,23 @@ jobs:
BUILD_DIR: ../build
steps:
- name: Checkout Code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 50
fetch-depth: 0
- name: Checkout Base
run: |
git fetch origin ${{ github.event.pull_request.base.ref }}
echo "The current base for checkpatch is: $(git show FETCH_HEAD --oneline --raw)"
- name: Install required packages (apt-get)
run: |
sudo apt-get update
sudo apt-get install patchutils
sudo apt-get install patchutils python3-ply python3-git
- name: Run checkpatch
run: |
git diff -U20 HEAD~40 \
git diff --patch FETCH_HEAD \
| filterdiff \
-x "a/src/jtag/drivers/libjaylink/*" \
-x "a/tools/git2cl/*" \
-x "a/.github/*" \
-x "a/HACKING" \
| ./tools/scripts/checkpatch.pl --no-signoff -
30 changes: 24 additions & 6 deletions .github/workflows/linux-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ name: Linux Build
jobs:
# 32-bit, clang
build32:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
env:
CFLAGS: -m32
CC: clang
Expand All @@ -22,7 +22,6 @@ jobs:
- run: file src/openocd | grep 32-bit
- run: src/openocd --version


# 64-bit, gcc
build64:
runs-on: ubuntu-latest
Expand All @@ -31,13 +30,32 @@ jobs:
CC: gcc
steps:
- name: Checkout Code
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Configure environment
run: |
TAG=$(git rev-parse --short HEAD)
echo "TAG=$TAG" >> $GITHUB_OUTPUT
echo "NAME=openocd64-$TAG" >> $GITHUB_ENV
- name: Install required packages (apt-get)
run: |
sudo apt-get update
sudo apt-get install libusb-1.0-0 libusb-1.0-0-dev
- run: ./bootstrap
- run: ./configure --enable-remote-bitbang --enable-jtag_vpi --enable-ftdi-cjtag
- run: ./configure --enable-remote-bitbang --enable-jtag_vpi --enable-ftdi-cjtag --prefix /tmp/${{ env.NAME }}
- run: make -j`nproc`
- run: file src/openocd | grep 64-bit
- run: src/openocd --version
- name: Check that we built something
run: |
file src/openocd | grep 64-bit
src/openocd --version
- name: Package
# Package into tgz so that github stores a compressed artifact, even
# though it zips that artifact again before it sends it back to be
# downloaded.
run: |
make install
tar zcvf ${{ env.NAME }}.tgz -C /tmp ${{ env.NAME }}
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: ${{ env.NAME }}
path: ${{ env.NAME }}.tgz
50 changes: 45 additions & 5 deletions .github/workflows/snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

# Copyright (C) 2020 by Tarek BOUCHKATI <[email protected]>

on: pull_request
on: push

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,14 +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"
CAPSTONE_CFLAGS: -I$(CAPSTONE_SRC)/include/capstone
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 @@ -74,10 +93,31 @@ 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"
tar -czf $ARTIFACT *
echo "RELEASE_NAME=$RELEASE_NAME" >> $GITHUB_ENV
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@v3
with:
path: ${{ env.ARTIFACT_PATH }}
- name: Delete 'latest' Release
uses: dev-drprasad/[email protected]
with:
delete_release: true
tag_name: ${{ env.RELEASE_NAME }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Release
uses: ncipollo/release-action@v1
with:
tag: ${{ env.RELEASE_NAME }}
commit: ${{ github.sha }}
draft: false
artifacts: ${{ env.ARTIFACT_PATH }}
prerelease: ${{ env.IS_PRE_RELEASE }}
token: ${{ secrets.GITHUB_TOKEN }}
136 changes: 136 additions & 0 deletions .github/workflows/spike-openocd-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
# Build Spike and run a couple of debug tests.

name: Test OpenOCD against 2 spike configurations

env:
SPIKE_REPO: https://github.com/riscv-software-src/riscv-isa-sim.git
SPIKE_REV: master
RISCV_TESTS_REPO: https://github.com/riscv-software-src/riscv-tests.git
RISCV_TESTS_REV: master
TOOLCHAIN_URL: https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack/releases/download/v12.2.0-1/xpack-riscv-none-elf-gcc-12.2.0-1-linux-x64.tar.gz

on:
# Run on merges to master to populate the cache with entities that are
# accessible by every pull request.
push:
branches:
- riscv
pull_request:
types: [synchronize, opened, reopened]

# There is some commented out code below that would be useful in adding this
# workflow to other repos. Ideally we can come up with something that would
# leave this file almost identical between repos, so they can all easily run
# this test suite.

jobs:
test:
name: Test debug (Ubuntu)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Install packages
run: |
sudo apt-get update
sudo apt-get install -y device-tree-compiler build-essential
- name: Get revisions of dependencies
run: |
SPIKE_COMMIT=$( git ls-remote "$SPIKE_REPO" master | awk '{ print $1; }' )
RISC_V_TESTS_COMMIT=$( git ls-remote "$RISCV_TESTS_REPO" master | awk '{ print $1; }' )
echo "Revison of Spike: $SPIKE_COMMIT"
echo "Revision of RISC-V tests: $RISC_V_TESTS_COMMIT"
# Save for later use
echo "SPIKE_COMMIT=$SPIKE_COMMIT" >> $GITHUB_ENV
echo "RISC_V_TESTS_COMMIT=$RISC_V_TESTS_COMMIT" >> $GITHUB_ENV
- name: Get the toolchain from cache (if available)
id: cache-toolchain
uses: actions/cache@v3
with:
path: /opt/riscv/toolchain
key: "toolchain-${{env.TOOLCHAIN_URL}}"

- name: Get spike from cache (if available)
id: cache-spike
uses: actions/cache@v3
with:
path: /opt/riscv/spike
key: "spike-${{env.SPIKE_COMMIT}}"

- if: ${{ steps.cache-toolchain.outputs.cache-hit != 'true' }}
name: Download Toolchain (if not cached)
run: |
mkdir -p /opt/riscv/toolchain
wget --progress=dot:giga $TOOLCHAIN_URL -O /tmp/toolchain.tar.gz
- if: ${{ steps.cache-toolchain.outputs.cache-hit != 'true' }}
name: Install Toolchain (if not cached)
run: tar zxf /tmp/toolchain.tar.gz --strip-components=1 -C /opt/riscv/toolchain

- if: ${{ steps.cache-spike.outputs.cache-hit != 'true' }}
name: Download Spike source (if not cached)
run: |
git clone "$SPIKE_REPO"
cd riscv-isa-sim
git checkout "$SPIKE_COMMIT"
git submodule update --init --recursive
- if: ${{ steps.cache-spike.outputs.cache-hit != 'true' }}
name: Build Spike (if not cached)
run: |
cd riscv-isa-sim
mkdir build && cd build
../configure --prefix=/opt/riscv/spike
make -j"$(nproc 2> /dev/null || sysctl -n hw.ncpu)"
make install
- name: Build OpenOCD
run: |
#cd riscv-openocd
./bootstrap
./configure --prefix=/opt/riscv
make -j"$(nproc 2> /dev/null || sysctl -n hw.ncpu)"
ls -l src/openocd
# - name: Download OpenOCD
# run: |
# git clone --recurse-submodules https://github.com/riscv/riscv-openocd.git
# cd riscv-openocd
# git checkout 43ea20dfbb6c815004a51106a3b2009d7f6c4940

- name: Download Tests
run: |
git clone "$RISCV_TESTS_REPO"
cd riscv-tests
git checkout "$RISCV_TESTS_REV"
git submodule update --init --recursive
- name: Run Spike32 Tests
id: spike32-tests
run: |
cd riscv-tests/debug
./gdbserver.py targets/RISC-V/spike32.py --print-failures \
--gcc /opt/riscv/toolchain/bin/riscv-none-elf-gcc \
--gdb /opt/riscv/toolchain/bin/riscv-none-elf-gdb \
--sim_cmd /opt/riscv/spike/bin/spike \
--server_cmd $GITHUB_WORKSPACE/src/openocd
- name: Run Spike64-2 Tests
if: success() || steps.spike32-tests.conclusion == 'failure'
run: |
cd riscv-tests/debug
./gdbserver.py targets/RISC-V/spike64-2.py --print-failures \
--gcc /opt/riscv/toolchain/bin/riscv-none-elf-gcc \
--gdb /opt/riscv/toolchain/bin/riscv-none-elf-gdb \
--sim_cmd /opt/riscv/spike/bin/spike \
--server_cmd $GITHUB_WORKSPACE/src/openocd
- name: Archive test logs
# Proceed even if there was a failed test
if: ${{ success() || failure() }}
uses: actions/upload-artifact@v3
with:
name: test-logs
path: riscv-tests/debug/logs
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,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
Loading

0 comments on commit f6d1e19

Please sign in to comment.