Skip to content

Commit f32f178

Browse files
authored
Merge pull request #1231 from en-sc/en-sc/from_upstream
Merge up to 1f3f635 from upstream
2 parents 56b7830 + 95cb368 commit f32f178

Some content is hidden

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

97 files changed

+3014
-445
lines changed

.checkpatch.conf

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

.github/workflows/snapshot.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,14 @@ jobs:
6666
cd libjaylink-${LIBJAYLINK_VER}
6767
./autogen.sh
6868
echo "LIBJAYLINK_SRC=$PWD" >> $GITHUB_ENV
69+
- name: Prepare jimtcl
70+
env:
71+
JIMTCL_VER: 0.83
72+
run: |
73+
mkdir -p $DL_DIR && cd $DL_DIR
74+
wget https://github.com/msteveb/jimtcl/archive/refs/tags/${JIMTCL_VER}.tar.gz
75+
tar -xzf ${JIMTCL_VER}.tar.gz
76+
echo "JIMTCL_SRC=$PWD/jimtcl-${JIMTCL_VER}" >> $GITHUB_ENV
6977
- name: Package OpenOCD for windows
7078
env:
7179
MAKE_JOBS: 2
@@ -75,6 +83,7 @@ jobs:
7583
LIBFTDI_CONFIG: -DSTATICLIBS=OFF -DEXAMPLES=OFF -DFTDI_EEPROM=OFF
7684
CAPSTONE_CONFIG: "CAPSTONE_BUILD_CORE_ONLY=yes CAPSTONE_STATIC=yes CAPSTONE_SHARED=no"
7785
LIBJAYLINK_CONFIG: --enable-shared --disable-static
86+
JIMTCL_CONFIG: --with-ext=json --minimal --disable-ssl
7887
run: |
7988
# check if there is tag pointing at HEAD, otherwise take the HEAD SHA-1 as OPENOCD_TAG
8089
OPENOCD_TAG="`git tag --points-at HEAD`"

Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ AUTOMAKE_OPTIONS = gnu 1.6
77
.DELETE_ON_ERROR:
88

99
# make sure we pass the correct jimtcl flags to distcheck
10-
DISTCHECK_CONFIGURE_FLAGS = --disable-install-jim
10+
AM_DISTCHECK_CONFIGURE_FLAGS = --disable-install-jim
1111

1212
# do not run Jim Tcl tests (esp. during distcheck)
1313
check-recursive: SUBDIRS :=

README

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,9 +209,7 @@ You'll also need:
209209
- make
210210
- libtool
211211
- pkg-config >= 0.23 or pkgconf
212-
213-
OpenOCD uses jimtcl library; build from git can retrieve jimtcl as git
214-
submodule.
212+
- libjim >= 0.79
215213

216214
Additionally, for building from git:
217215

configure.ac

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,8 @@ m4_define([SERIAL_PORT_ADAPTERS],
173173

174174
m4_define([LINUXSPIDEV_ADAPTER],
175175
[[[linuxspidev], [Linux spidev driver], [LINUXSPIDEV]]])
176+
m4_define([VDEBUG_ADAPTER],
177+
[[[vdebug], [Cadence Virtual Debug Interface], [VDEBUG]]])
176178

177179
# The word 'Adapter' in "Dummy Adapter" below must begin with a capital letter
178180
# because there is an M4 macro called 'adapter'.
@@ -303,6 +305,7 @@ AC_ARG_ADAPTERS([
303305
LINUXSPIDEV_ADAPTER,
304306
SERIAL_PORT_ADAPTERS,
305307
DUMMY_ADAPTER,
308+
VDEBUG_ADAPTER,
306309
PCIE_ADAPTERS,
307310
LIBJAYLINK_ADAPTERS
308311
],[auto])
@@ -325,10 +328,6 @@ AC_ARG_ENABLE([jtag_vpi],
325328
AS_HELP_STRING([--enable-jtag_vpi], [Enable building support for JTAG VPI]),
326329
[build_jtag_vpi=$enableval], [build_jtag_vpi=no])
327330

328-
AC_ARG_ENABLE([vdebug],
329-
AS_HELP_STRING([--enable-vdebug], [Enable building support for Cadence Virtual Debug Interface]),
330-
[build_vdebug=$enableval], [build_vdebug=no])
331-
332331
AC_ARG_ENABLE([jtag_dpi],
333332
AS_HELP_STRING([--enable-jtag_dpi], [Enable building support for JTAG DPI]),
334333
[build_jtag_dpi=$enableval], [build_jtag_dpi=no])
@@ -582,12 +581,6 @@ AS_IF([test "x$build_jtag_vpi" = "xyes"], [
582581
AC_DEFINE([BUILD_JTAG_VPI], [0], [0 if you don't want JTAG VPI.])
583582
])
584583

585-
AS_IF([test "x$build_vdebug" = "xyes"], [
586-
AC_DEFINE([BUILD_VDEBUG], [1], [1 if you want Cadence vdebug interface.])
587-
], [
588-
AC_DEFINE([BUILD_VDEBUG], [0], [0 if you don't want Cadence vdebug interface.])
589-
])
590-
591584
AS_IF([test "x$build_jtag_dpi" = "xyes"], [
592585
AC_DEFINE([BUILD_JTAG_DPI], [1], [1 if you want JTAG DPI.])
593586
], [
@@ -739,6 +732,7 @@ PROCESS_ADAPTERS([PCIE_ADAPTERS], ["x$is_linux" = "xyes"], [Linux build])
739732
PROCESS_ADAPTERS([SERIAL_PORT_ADAPTERS], ["x$can_build_buspirate" = "xyes"],
740733
[internal error: validation should happen beforehand])
741734
PROCESS_ADAPTERS([LINUXSPIDEV_ADAPTER], ["x$is_linux" = "xyes"], [Linux spidev])
735+
PROCESS_ADAPTERS([VDEBUG_ADAPTER], [true], [unused])
742736
PROCESS_ADAPTERS([DUMMY_ADAPTER], [true], [unused])
743737

744738
AS_IF([test "x$enable_linuxgpiod" != "xno"], [
@@ -787,7 +781,6 @@ AM_CONDITIONAL([IMX_GPIO], [test "x$build_imx_gpio" = "xyes"])
787781
AM_CONDITIONAL([AM335XGPIO], [test "x$build_am335xgpio" = "xyes"])
788782
AM_CONDITIONAL([BITBANG], [test "x$build_bitbang" = "xyes"])
789783
AM_CONDITIONAL([JTAG_VPI], [test "x$build_jtag_vpi" = "xyes"])
790-
AM_CONDITIONAL([VDEBUG], [test "x$build_vdebug" = "xyes"])
791784
AM_CONDITIONAL([JTAG_DPI], [test "x$build_jtag_dpi" = "xyes"])
792785
AM_CONDITIONAL([USB_BLASTER_DRIVER], [test "x$enable_usb_blaster" != "xno" -o "x$enable_usb_blaster_2" != "xno"])
793786
AM_CONDITIONAL([AMTJTAGACCEL], [test "x$build_amtjtagaccel" = "xyes"])
@@ -893,6 +886,7 @@ m4_foreach([adapter], [USB1_ADAPTERS,
893886
LIBGPIOD_ADAPTERS,
894887
LIBJAYLINK_ADAPTERS, PCIE_ADAPTERS, SERIAL_PORT_ADAPTERS,
895888
LINUXSPIDEV_ADAPTER,
889+
VDEBUG_ADAPTER,
896890
DUMMY_ADAPTER,
897891
OPTIONAL_LIBRARIES,
898892
COVERAGE],

contrib/cross-build.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,15 @@ WORK_DIR=$PWD
4242
: ${LIBFTDI_SRC:=/path/to/libftdi}
4343
: ${CAPSTONE_SRC:=/path/to/capstone}
4444
: ${LIBJAYLINK_SRC:=/path/to/libjaylink}
45+
: ${JIMTCL_SRC:=/path/to/jimtcl}
4546

4647
OPENOCD_SRC=`readlink -m $OPENOCD_SRC`
4748
LIBUSB1_SRC=`readlink -m $LIBUSB1_SRC`
4849
HIDAPI_SRC=`readlink -m $HIDAPI_SRC`
4950
LIBFTDI_SRC=`readlink -m $LIBFTDI_SRC`
5051
CAPSTONE_SRC=`readlink -m $CAPSTONE_SRC`
5152
LIBJAYLINK_SRC=`readlink -m $LIBJAYLINK_SRC`
53+
JIMTCL_SRC=`readlink -m $JIMTCL_SRC`
5254

5355
HOST_TRIPLET=$1
5456
BUILD_DIR=$WORK_DIR/$HOST_TRIPLET-build
@@ -57,6 +59,7 @@ HIDAPI_BUILD_DIR=$BUILD_DIR/hidapi
5759
LIBFTDI_BUILD_DIR=$BUILD_DIR/libftdi
5860
CAPSTONE_BUILD_DIR=$BUILD_DIR/capstone
5961
LIBJAYLINK_BUILD_DIR=$BUILD_DIR/libjaylink
62+
JIMTCL_BUILD_DIR=$BUILD_DIR/jimtcl
6063
OPENOCD_BUILD_DIR=$BUILD_DIR/openocd
6164

6265
## Root of host file tree
@@ -172,6 +175,18 @@ if [ -d $LIBJAYLINK_SRC ] ; then
172175
make install DESTDIR=$SYSROOT
173176
fi
174177

178+
# jimtcl build & install into sysroot
179+
if [ -d $JIMTCL_SRC ] ; then
180+
mkdir -p $JIMTCL_BUILD_DIR
181+
cd $JIMTCL_BUILD_DIR
182+
$JIMTCL_SRC/configure --host=$HOST_TRIPLET --prefix=$PREFIX \
183+
$JIMTCL_CONFIG
184+
make -j $MAKE_JOBS
185+
# Running "make" does not create this file for static builds on Windows but "make install" still expects it
186+
touch $JIMTCL_BUILD_DIR/build-jim-ext
187+
make install DESTDIR=$SYSROOT
188+
fi
189+
175190
# OpenOCD build & install into sysroot
176191
mkdir -p $OPENOCD_BUILD_DIR
177192
cd $OPENOCD_BUILD_DIR

contrib/loaders/flash/dw-spi/Makefile

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# SPDX-License-Identifier: GPL-2.0-or-later
2+
3+
TOOLCHAIN:=mipsel-linux-gnu-
4+
CC:=$(TOOLCHAIN)gcc
5+
OBJCOPY:=$(TOOLCHAIN)objcopy
6+
CFLAGS:=-O2 -Wall -Wextra -fpic -Wno-int-to-pointer-cast
7+
SRC=dw-spi.c
8+
OBJ=$(patsubst %.c, %.o,$(SRC))
9+
10+
# sparx-iv
11+
ifeq ($(TOOLCHAIN),mipsel-linux-gnu-)
12+
CFLAGS+= -march=24kec
13+
endif
14+
15+
all: \
16+
$(TOOLCHAIN)transaction.inc \
17+
$(TOOLCHAIN)erase.inc \
18+
$(TOOLCHAIN)check_fill.inc \
19+
$(TOOLCHAIN)program.inc \
20+
$(TOOLCHAIN)read.inc
21+
22+
$(TOOLCHAIN)%.bin: $(OBJ)
23+
$(OBJCOPY) --dump-section .$*=$@ $<
24+
25+
%.inc: %.bin
26+
xxd -i > $@ < $<
27+
28+
.PHONY: clean
29+
clean:
30+
rm -rf .ccls-cache
31+
find . \( \
32+
-iname "*.o" \
33+
-o -iname "*.bin" \
34+
-o -iname "*.inc" \
35+
\) -delete

0 commit comments

Comments
 (0)