[PATCH] gnu: Add riscv-openocd.

  • Done
  • quality assurance status badge
Details
3 participants
  • Andreas Enge
  • Ludovic Courtès
  • Malte Frank Gerdes
Owner
unassigned
Submitted by
Malte Frank Gerdes
Severity
normal
M
M
Malte Frank Gerdes wrote on 7 Oct 2020 22:02
(address . guix-patches@gnu.org)
86lfgh6bzy.fsf@gmail.com
Hi,

this adds OpenOCD with RISC-V support to Guix.

There is a problem though: riscv-openocd bundles libjaylink, which is
also available as a package. The available package cannot be used
because it is too old and riscv-openocd has riscv-specific additions
made to it. So the question is: does this justify using the bundled
library or should I do something? (if yes, what?)

I have successfully used the package to communicate via JTAG with a
Sipeed Nano and a JLink V8.

I built this package successfully on: x86_64-linux, aarch64-linux


Malte
A
A
Andreas Enge wrote on 9 Oct 2020 21:02
(name . Malte Frank Gerdes)(address . malte.f.gerdes@gmail.com)(address . 43852@debbugs.gnu.org)
20201009190257.GA2052@jurong
Hello,

since I am speaking as someone who does not know what these packages are
about, please take what follows with a grain of salt.

On Wed, Oct 07, 2020 at 10:02:09PM +0200, Malte Frank Gerdes wrote:
Toggle quote (5 lines)
> libjaylink ... is
> ... available as a package. The available package ...
> ... is too old ...
> ... should I do something?

Written like this, I would say you could try updating it, independently
of your target package. Then the question is whether you break anything
else:
guix refresh -l libjaylink
A single dependent package: openocd@0.10.0

So there already is an openocd, which maybe should be updated at the same
time?

And do you really need a new package, or could it be enough to provide
more inputs or configuration flags to the existing one? Otherwise, how
about inheriting? The name also is weird, see the section in the manual;
we normally keep the upstream project name.

Andreas
M
M
Malte Frank Gerdes wrote on 10 Oct 2020 16:02
[PATCH v2] gnu: Add riscv-openocd.
(name . Andreas Enge)(address . andreas@enge.fr)(address . 43852@debbugs.gnu.org)
86blha2n79.fsf_-_@gmail.com
Andreas Enge <andreas@enge.fr> writes:

Toggle quote (5 lines)
> Hello,
>
> since I am speaking as someone who does not know what these packages are
> about, please take what follows with a grain of salt.

Feedback is always good! especially when it leads to realizing how it
should actually be done.

Toggle quote (15 lines)
> On Wed, Oct 07, 2020 at 10:02:09PM +0200, Malte Frank Gerdes wrote:
>> libjaylink ... is
>> ... available as a package. The available package ...
>> ... is too old ...
>> ... should I do something?
>
> Written like this, I would say you could try updating it, independently
> of your target package. Then the question is whether you break anything
> else:
> guix refresh -l libjaylink
> A single dependent package: openocd@0.10.0
>
> So there already is an openocd, which maybe should be updated at the same
> time?

The problem was: i didn't realize that libjaylink has a new release and
that it's actually possible to clone it; because the official upstream
repo seems to be locked behind a login. But there is a mirror of it on
repo.or.cz - which i'm now using.

Toggle quote (5 lines)
> And do you really need a new package, or could it be enough to provide
> more inputs or configuration flags to the existing one? Otherwise, how
> about inheriting? The name also is weird, see the section in the manual;
> we normally keep the upstream project name.

I used riscv/riscv-openocd as the upstream repo (github), but it seems
that this isn't necessary. So i'm now just updating the package we
already have. It doesn't have a new release, so i had to use the git
master.


Malte
From 5be71d32e9694fadea411a267e36333697510bb1 Mon Sep 17 00:00:00 2001
From: Malte Frank Gerdes <malte.f.gerdes@gmail.com>
Date: Sat, 10 Oct 2020 15:24:46 +0200
Subject: [PATCH 1/2] gnu: libjaylink: Update to 0.2.0

* gnu/packages/embedded.scm (libjaylink): Update to 0.2.0
[origin]: Substitute upstream repository location.
---
gnu/packages/embedded.scm | 52 ++++++++++++++++++---------------------
1 file changed, 24 insertions(+), 28 deletions(-)

Toggle diff (66 lines)
diff --git a/gnu/packages/embedded.scm b/gnu/packages/embedded.scm
index f9f0e04238..1eacb72a45 100644
--- a/gnu/packages/embedded.scm
+++ b/gnu/packages/embedded.scm
@@ -458,35 +458,31 @@ languages are C and C++.")
,@(package-arguments gdb)))))
(define-public libjaylink
- ;; No release tarballs available.
- (let ((commit "699b7001d34a79c8e7064503dde1bede786fd7f0")
- (revision "2"))
- (package
- (name "libjaylink")
- (version (string-append "0.1.0-" revision "."
- (string-take commit 7)))
- (source (origin
- (method git-fetch)
- (uri (git-reference
- (url "https://git.zapb.de/libjaylink.git")
- (commit commit)))
- (file-name (string-append name "-" version "-checkout"))
- (sha256
- (base32
- "034872d44myycnzn67v5b8ixrgmg8sk32aqalvm5x7108w2byww1"))))
- (build-system gnu-build-system)
- (native-inputs
- `(("autoconf" ,autoconf)
- ("automake" ,automake)
- ("libtool" ,libtool)
- ("pkg-config" ,pkg-config)))
- (inputs
- `(("libusb" ,libusb)))
- (home-page "https://repo.or.cz/w/libjaylink.git")
- (synopsis "Library to interface Segger J-Link devices")
- (description "libjaylink is a shared library written in C to access
+ (package
+ (name "libjaylink")
+ (version "0.2.0")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://repo.or.cz/libjaylink.git")
+ (commit version)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "0ndyfh51hiqyv2yscpj6qd091w7myxxjid3a6rx8f6k233vy826q"))))
+ (build-system gnu-build-system)
+ (native-inputs
+ `(("autoconf" ,autoconf)
+ ("automake" ,automake)
+ ("libtool" ,libtool)
+ ("pkg-config" ,pkg-config)))
+ (inputs
+ `(("libusb" ,libusb)))
+ (home-page "https://repo.or.cz/w/libjaylink.git")
+ (synopsis "Library to interface Segger J-Link devices")
+ (description "libjaylink is a shared library written in C to access
SEGGER J-Link and compatible devices.")
- (license license:gpl2+))))
+ (license license:gpl2+)))
(define-public jimtcl
(package
--
2.28.0
L
L
Ludovic Courtès wrote on 22 Oct 2020 16:49
(name . Malte Frank Gerdes)(address . malte.f.gerdes@gmail.com)
87a6wetiwx.fsf@gnu.org
Hello,

Malte Frank Gerdes <malte.f.gerdes@gmail.com> skribis:

Toggle quote (8 lines)
>>From 5be71d32e9694fadea411a267e36333697510bb1 Mon Sep 17 00:00:00 2001
> From: Malte Frank Gerdes <malte.f.gerdes@gmail.com>
> Date: Sat, 10 Oct 2020 15:24:46 +0200
> Subject: [PATCH 1/2] gnu: libjaylink: Update to 0.2.0
>
> * gnu/packages/embedded.scm (libjaylink): Update to 0.2.0
> [origin]: Substitute upstream repository location.

[...]

Toggle quote (14 lines)
>>From de5299f976f54ef431e856ca15b045408495491b Mon Sep 17 00:00:00 2001
> From: Malte Frank Gerdes <malte.f.gerdes@gmail.com>
> Date: Sat, 10 Oct 2020 15:31:14 +0200
> Subject: [PATCH 2/2] gnu: openocd: Update to
> 9a877a83a1c8b1f105cdc0de46c5cbc4d9e8799e.
>
> * gnu/packages/embedded.scm (openocd): Update to 9a877a83a1c8b1f105cdc0de46c5cbc4d9e8799e.
> [version]: Substitute release with current master.
> [source]: Remove openocd-nrf52.patch
> [arguments]: Replace bootstrap build phase.
>
> * gnu/local.mk: Remove openocd-nrf52.patch.
> * gnu/packages/patches/openocd-nrf52.patch: Remove file.

I believe this addresses the concerns Andreas raised, so I’ve applied
them now.

(I’ve Cc’d Ricardo, Danny, and Mathieu, who also work in this area, just
so they notice.)

Thanks!

Ludo’.
Closed
?