Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge up to a510d51a78f14fbb8416037a587ce1bfc6016d24 from upstream #1215

Merged
merged 14 commits into from
Jan 31, 2025

Conversation

en-sc
Copy link
Collaborator

@en-sc en-sc commented Jan 27, 2025

No conflicts.

Richard Pasek and others added 13 commits January 22, 2025 15:21
To alleviate the need to bitbang SWD, I've written a SWD SPI
implementation. This code is inspired by the work of [email protected]
as shown at github.com/lupyuen/openocd-spi but with the desire to be
more generic. This implementation makes use of the more common 4 wire
SPI port using full duplex transfers to be able to capture the SWD ACK
bits when a SWD TX operation is in progress.

TEST:
  Connects successfully with the following combinations:
  Hosts:
    Raspberry Pi 4B
    Unnamed Qualcomm SoC with QUPv3 based SPI port
  Targets:
    Raspberry Pi 2040
    Nordic nRF52840
    NXP RT500

Change-Id: Ic2f38a1806085d527e6f999a3d15aea6f32d1019
Signed-off-by: Richard Pasek <[email protected]>
Reviewed-on: https://review.openocd.org/c/openocd/+/8645
Reviewed-by: Tomas Vanek <[email protected]>
Reviewed-by: Antonio Borneo <[email protected]>
Reviewed-by: zapb <[email protected]>
Tested-by: jenkins
Extend the struct armv7m_regs to include the optional pointer
to a struct reg_data_type.

Update armv7m_build_reg_cache() to check for the new optional
field and to use it.

Change-Id: I57c7f9abefd614308be8aa8419d687477b44679d
Signed-off-by: Antonio Borneo <[email protected]>
Reviewed-on: https://review.openocd.org/c/openocd/+/8680
Tested-by: jenkins
The register 'vpr' is present when MVFR1.MVE is not zero.
For the moment, reuse the existing flag 'fp_feature'. To be
reviewed for the case of MVE supported without floating point.

The documentation of GDB [1] reports that the register 'vpr'
should be represented as 3 fields.

Tested on Cortex-M55 based STM32N6570.

Change-Id: I8737a24d01a13eeb09a0f2075b96be400f9f91c6
Signed-off-by: Antonio Borneo <[email protected]>
Link: [1] https://sourceware.org/gdb/download/onlinedocs/gdb.html/ARM-Features.html#M_002dprofile-Vector-Extension-_0028MVE_0029
Reviewed-on: https://review.openocd.org/c/openocd/+/8681
Tested-by: jenkins
Fix checkpatch errors

	ERROR:SUSPECT_CODE_INDENT: suspect code indent for
	conditional statements

Change-Id: I94d4fa5720c25dd2fb0334a824cd9026babcce4e
Signed-off-by: Antonio Borneo <[email protected]>
Reviewed-on: https://review.openocd.org/c/openocd/+/8497
Tested-by: jenkins
If the device has at lest one FlexNVM bank and it is set as EE backup
only, the bank has no protection blocks.

kinetis_fill_fcf() collects protection data from all banks before
flash write of the sector containing FCF block. In case it encountered
a FlexNVM bank with no protection blocks assert failed.

Failed flash write of previously erased FCF block could cause
engaging debugging lock (if the device was run or reset).

Skip banks with zero protection blocks.
Replace assert() by LOG_ERROR() as we have to finish FCF write.

Change-Id: Ibe7e7ec6d0db4453b8a53c8256987621b809c99d
Signed-off-by: Tomas Vanek <[email protected]>
Suggested-by: Jasper v. Blanckenburg <[email protected]>
Fixes: https://sourceforge.net/p/openocd/tickets/448/
Reviewed-on: https://review.openocd.org/c/openocd/+/8719
Tested-by: jenkins
Reviewed-by: Jasper v. Blanckenburg <[email protected]>
Reviewed-by: Antonio Borneo <[email protected]>
On GCC version 13.2,
the previous code emitted the following warning on Windows:

openocd/src/jtag/drivers/vdebug.c:254:19: warning: comparison of integer expressions of different signedness: 'int' and 'long long unsigned int' [-Wsign-compare]
  254 |         if (hsock == INVALID_SOCKET)

This patch fixes it and brings it in line with other socket handling code.

Change-Id: I7e05f83c6905cfaf66b68e8988c783e80cee4a48
Signed-off-by: Marek Vrbka <[email protected]>
Reviewed-on: https://review.openocd.org/c/openocd/+/8717
Tested-by: jenkins
Reviewed-by: Jan Matyas <[email protected]>
Reviewed-by: Jacek Wuwer <[email protected]>
Reviewed-by: Antonio Borneo <[email protected]>
Reviewed-by: R. Diez <[email protected]>
In case the option is passed with a single `:` in `optstring` argument,
the call to `getopt_long()` should return `?`.

Therefore the check on `optarg` is redundand in case of `l` and `c`.

Change-Id: I1ac176fdae449a34db0a0496b69a9ea65ccd6aec
Signed-off-by: Evgeniy Naydanov <[email protected]>
Reported-by: Antonio Borneo <[email protected]>
Reviewed-on: https://review.openocd.org/c/openocd/+/8718
Tested-by: jenkins
Reviewed-by: Antonio Borneo <[email protected]>
Before the patch an error in opening the log file (e.g. can't write a
file) was ignored when specified via `-l`.
E.g.:
```
> touch log
> chmod -w log
> openocd -l log -c shutdown
...
failed to open output log "log"
shutdown command invoked
> echo $?
0
```

After the patch:
```
...
> openocd -l log -c shutdown
...
failed to open output log "log"
> echo $?
1
```

Change-Id: Ibab45f580dc46a499bf967c4afad071f9c2972a2
Signed-off-by: Evgeniy Naydanov <[email protected]>
Reviewed-on: https://review.openocd.org/c/openocd/+/8666
Tested-by: jenkins
Reviewed-by: Antonio Borneo <[email protected]>
The check if 'elf.h' defines the type 'Elf64_Ehdr' is currently
done through 'grep' on the file. While there is no false positive,
so far, such test could incorrectly find the text inside a comment
or in a block guarded by #if/#endif.

Use the autoconf macro AC_CHECK_TYPE() to detect if the type is
properly declared.

Change-Id: Ibb74db3d90ac6d1589b9dc1e5a7ae59e47945e78
Signed-off-by: Antonio Borneo <[email protected]>
Reviewed-on: https://review.openocd.org/c/openocd/+/8591
Tested-by: jenkins
The feature for 'malloc-logging' uses functionalities that are
available only in GNU libc.

Detect in 'configure' if OpenOCD is being compiled with glibc.
Set the macro '_DEBUG_FREE_SPACE_' only in case of glibc.

Change-Id: I43e9b87c7ad47171cfe3e7c1e5f96f11e19f98d0
Signed-off-by: Antonio Borneo <[email protected]>
Reviewed-on: https://review.openocd.org/c/openocd/+/8592
Tested-by: jenkins
The glibc API 'mallinfo' is deprecated and the new 'mallinfo2'
should be used from glibc 2.33 (2021-02-01).

Throw an error when '--enable-malloc-logging' is used on systems
that compile without glibc.
Detect the glibc version and, for backward compatibility, define
'mallinfo2' as the old 'mallinfo'. Define a macro for the format
of 'fordblks'.

Change-Id: I68bff7b1b58f0ec2669db0b911f19c1c5a26ed30
Reported-by: Steven J. Hill <[email protected]>
Signed-off-by: Antonio Borneo <[email protected]>
Reviewed-on: https://review.openocd.org/c/openocd/+/8589
Tested-by: jenkins
jimtcl was integrated as Git submodule for convenience and probably also
because packages were not widely available at the time. Today, jimtcl is
available in many popular package repositories [1] and the integration
as Git submodule adds unnecessary complexity to the OpenOCD build
process. For details, see the discussion on the mailing list in [2].

Disable the jimtcl Git submodule by default and announce it as
deprecated feature that will be removed in the next release. This gives
package maintainers time to adapt to the change and, if necessary,
build a package for jimtcl.

[1] https://repology.org/project/jimtcl/versions
[2] https://sourceforge.net/p/openocd/mailman/message/58786630/

Change-Id: I07930ac07f7d7a6317c08b21dc118f4f128b331c
Signed-off-by: Marc Schink <[email protected]>
Reviewed-on: https://review.openocd.org/c/openocd/+/8380
Tested-by: jenkins
Reviewed-by: Paul Fertser <[email protected]>
Reviewed-by: Antonio Borneo <[email protected]>
Building OpenOCD with jimtcl and libjaylink Git submodules is deprecated
and will be removed in the upcoming releases. The remaining 'git2cl'
submodule is only required during the OpenOCD release process.

Only set up Git submodules when the 'with-submodules' argument is used,
for example during the OpenOCD release process or for the transition
period until all submodules are replaced by external dependencies.

We keep the existing 'nosubmodule' argument in order to not break
automatic testing with Jenkins.

Change-Id: Ia4fd765e3a2d6b2c40b084a1ffdf919d5f4f35bb
Signed-off-by: Marc Schink <[email protected]>
Reviewed-on: https://review.openocd.org/c/openocd/+/8381
Tested-by: jenkins
Reviewed-by: Antonio Borneo <[email protected]>
Reviewed-by: R. Diez <[email protected]>
@en-sc en-sc force-pushed the en-sc/from_upstream branch from c7a2bc5 to cf75793 Compare January 27, 2025 15:39
@en-sc
Copy link
Collaborator Author

en-sc commented Jan 27, 2025

Changed .github/workflows due to internall jimtcl deprecation.
Will need to update https://github.com/riscv-software-src/riscv-tests/blob/master/.github/workflows/spike-openocd-tests.yml

@en-sc en-sc force-pushed the en-sc/from_upstream branch from cf75793 to 14a74e9 Compare January 27, 2025 15:44
@JanMatCodasip
Copy link
Collaborator

JanMatCodasip commented Jan 27, 2025

The CI is now failing with the message below. Apparently, the Ubuntu repositories do not contain a 32-bit variant of libjim (JimTcl) library.

E: Unable to locate package libjim-dev:i386

It can be fixed by building the 32-bit JimTcl interpreter library from source. It should be straightforward. This worked for me:

git clone https://github.com/msteveb/jimtcl.git
cd jimtcl
git checkout <tag>

export CFLAGS=-m32
export CC=clang

./configure && make && make install

@JanMatCodasip
Copy link
Collaborator

Apart from the failing CI (above comment), I checked the incoming commits and all look OK.

@TommyMurphyTM1234
Copy link
Collaborator

The CI is now failing with the message below. Apparently, the Ubuntu repositories do not contain a 32-bit variant of libjim (JimTcl) library.

E: Unable to locate package libjim-dev:i386

It can be fixed by building the 32-bit JimTcl interpreter library from source. It should be straightforward. This worked for me:

git clone https://github.com/msteveb/jimtcl.git
cd jimtcl
git checkout <tag>

export CFLAGS=-m32
export CC=clang

./configure && make && make install

Is this of any use?

3) in meantime, you can still build using the old deprecated way with
submodules by running
./bootstrap with-submodules
./configure --enable-internal-jimtcl

Although, I presume that this is just a stopgap measure that will, itself, eventually be deprecated/dropped?

@en-sc en-sc force-pushed the en-sc/from_upstream branch 11 times, most recently from 915a3d3 to d057050 Compare January 28, 2025 19:06
@en-sc en-sc force-pushed the en-sc/from_upstream branch 2 times, most recently from 02ac6ff to 1dc8805 Compare January 28, 2025 19:11
Changed `.github/workflows` due to internall `jimtcl` deprecation.

Change-Id: I628922a843a7116955cd6b48c48b0cd104bcaf20
Signed-off-by: Evgeniy Naydanov <[email protected]>
@en-sc en-sc force-pushed the en-sc/from_upstream branch from 1dc8805 to 309c25f Compare January 28, 2025 19:13
@en-sc en-sc requested a review from JanMatCodasip January 28, 2025 19:36
@en-sc
Copy link
Collaborator Author

en-sc commented Jan 28, 2025

Although, I presume that this is just a stopgap measure that will, itself, eventually be deprecated/dropped?

@TommyMurphyTM1234, I believe it will be dropped eventually, so I've opted to implement out-of-tree build in the CI.

Copy link
Collaborator

@JanMatCodasip JanMatCodasip left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you.

@en-sc en-sc merged commit 495f144 into riscv-collab:riscv Jan 31, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants