diff mbox series

[bug#48767,6/6] gnu: Add msp430lib.

Message ID SN6PR05MB40310196EAD67B1772A298FDC5A69@SN6PR05MB4031.namprd05.prod.outlook.com
State New
Headers show
Series [bug#48767,1/6] gnu: Add gcc-msp430-support-files. | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue

Commit Message

Morgan Smith Sept. 26, 2021, 2:51 p.m. UTC
From: Morgan Smith <Morgan.J.Smith@outlook.com>

* gnu/packages/debug.scm (msp430lib): New variable.
---
 gnu/packages/debug.scm | 57 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 57 insertions(+)

Comments

M Sept. 26, 2021, 4:31 p.m. UTC | #1
Morgan.J.Smith@outlook.com schreef op zo 26-09-2021 om 10:51 [-0400]:
> From: Morgan Smith <Morgan.J.Smith@outlook.com>
> 
> * gnu/packages/debug.scm (msp430lib): New variable.
> ---
>  gnu/packages/debug.scm | 57 ++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 57 insertions(+)
> 
> diff --git a/gnu/packages/debug.scm b/gnu/packages/debug.scm
> index 7363d45c43..263a72e5ce 100644
> --- a/gnu/packages/debug.scm
> +++ b/gnu/packages/debug.scm
> @@ -36,6 +36,7 @@
>    #:use-module (gnu packages autotools)
>    #:use-module (gnu packages base)
>    #:use-module (gnu packages bash)
> +  #:use-module (gnu packages boost)
>    #:use-module (gnu packages bison)
>    #:use-module (gnu packages c)
>    #:use-module (gnu packages check)
> @@ -789,3 +790,59 @@ debugger with support for programming, disassembly and reverse
>  engineering.")
>      (home-page "https://github.com/dlbeer/mspdebug")
>      (license license:gpl2+)))
> +
> +(define (version-with-underscores version)
> +  (string-map (lambda (x) (if (eq? x #\.) #\_ x)) version))
> +
> +(define-public msp430lib
> +  (package
> +    (name "msp430lib")
> +    (version "3.15.1.1")
> +    (source (origin
> +              (method url-fetch/zipbomb)
> +              (uri (string-append
> +                    "https://software-dl.ti.com/msp430/msp430_public_sw/mcu/msp430/MSPDS/"
> +                    (version-with-underscores (version-major+minor+point version))
> +                    "_001/export/MSPDebugStack_OS_Package_"
> +                    (version-with-underscores version) ".zip"))
> +              (sha256
> +               (base32
> +                "1j5sljqwc20zrb50mrji4mnmw5i680qc7n0lb0pakrrxqjc9m9g3"))))
> +    (build-system gnu-build-system)
> +    (arguments
> +     `(#:make-flags
> +       (list
> +        (string-append "BOOST_DIR=" (assoc-ref %build-inputs "boost"))
> +        (string-append "HIDOBJ=-I" (assoc-ref %build-inputs "hidapi") "/include/hidapi"
> +                       " -lhidapi-libusb"))
> +       #:tests? #f
> +       #:phases
> +       (modify-phases %standard-phases
> +         (delete 'configure)
> +         (add-before 'build 'fix-hidapi-includes
> +           (lambda _
> +             (substitute*
> +                 '("ThirdParty/BSL430_DLL/BSL430_DLL/Physical_Interfaces/MSPBSL_PhysicalInterfaceUSB.h"
> +                   "DLL430_v3/src/TI/DLL430/HidUpdateManager.cpp")
> +               (("hidapi.h") "hidapi/hidapi.h"))))
> +         (replace 'install
> +           (lambda* (#:key outputs #:allow-other-keys)
> +             (install-file "libmsp430.so"
> +                           (string-append (assoc-ref outputs "out") "/lib")))))))
> +    (inputs
> +     `(("boost" ,boost)
> +       ("hidapi" ,hidapi)
> +       ("libusb" ,libusb)))
> +    (native-search-paths
> +     (list (search-path-specification
> +            ;; Used by mspdebug. mspdebug has a few different drivers it can
> +            ;; use to interact with MSP430's so this is an optional dependency
> +            (variable "MSPDEBUG_TILIB_PATH")
> +            (files '("lib")))))
> +    (home-page "https://www.ti.com/tool/MSPDS")
> +    (synopsis "Library used to program and debug MSP430 microcontrollers")
> +    (description "This library facilitates communication between a host computer and certain
> +MSP430 debuggers.  It is also know as @acronym{MSPDS, MSP430 Debug Stack}.
> +This is an optional dependency of mspdebug (which calls this library
> +@code{tilib})")
> +    (license license:bsd-3)))

I downloaded the ZIP and opened MSPDebugStackOpenSourcePackage_manifest.html, and noted:

[...] No reverse engineering, decompilation, or disassembly of this software is permitted with respect to any [...]

which isn't BSD-3, and isn't free software.  I also see BSD-3 in that file.
We would need to carefully check what conditions apply to the parts of MSPDS that
are used here, and remove the non-free components.

I noticed PLATFORM := $(shell uname -s) and ifeq ($(PLATFORM),Linux) in a Makefile.
I expect that won't work on the Hurd.  Maybe make that unconditional.  I also noticed
CXX:=g++.  Possibly some substitutions or (setenv "CXX" (cxx-for-target)) are required
to make the package cross-compilable.

There is a blob in Bios/include/UifBiosCore.h.  Possibly it can simply be removed.

Greetings,
Maxime
diff mbox series

Patch

diff --git a/gnu/packages/debug.scm b/gnu/packages/debug.scm
index 7363d45c43..263a72e5ce 100644
--- a/gnu/packages/debug.scm
+++ b/gnu/packages/debug.scm
@@ -36,6 +36,7 @@ 
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages base)
   #:use-module (gnu packages bash)
+  #:use-module (gnu packages boost)
   #:use-module (gnu packages bison)
   #:use-module (gnu packages c)
   #:use-module (gnu packages check)
@@ -789,3 +790,59 @@  debugger with support for programming, disassembly and reverse
 engineering.")
     (home-page "https://github.com/dlbeer/mspdebug")
     (license license:gpl2+)))
+
+(define (version-with-underscores version)
+  (string-map (lambda (x) (if (eq? x #\.) #\_ x)) version))
+
+(define-public msp430lib
+  (package
+    (name "msp430lib")
+    (version "3.15.1.1")
+    (source (origin
+              (method url-fetch/zipbomb)
+              (uri (string-append
+                    "https://software-dl.ti.com/msp430/msp430_public_sw/mcu/msp430/MSPDS/"
+                    (version-with-underscores (version-major+minor+point version))
+                    "_001/export/MSPDebugStack_OS_Package_"
+                    (version-with-underscores version) ".zip"))
+              (sha256
+               (base32
+                "1j5sljqwc20zrb50mrji4mnmw5i680qc7n0lb0pakrrxqjc9m9g3"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:make-flags
+       (list
+        (string-append "BOOST_DIR=" (assoc-ref %build-inputs "boost"))
+        (string-append "HIDOBJ=-I" (assoc-ref %build-inputs "hidapi") "/include/hidapi"
+                       " -lhidapi-libusb"))
+       #:tests? #f
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (add-before 'build 'fix-hidapi-includes
+           (lambda _
+             (substitute*
+                 '("ThirdParty/BSL430_DLL/BSL430_DLL/Physical_Interfaces/MSPBSL_PhysicalInterfaceUSB.h"
+                   "DLL430_v3/src/TI/DLL430/HidUpdateManager.cpp")
+               (("hidapi.h") "hidapi/hidapi.h"))))
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (install-file "libmsp430.so"
+                           (string-append (assoc-ref outputs "out") "/lib")))))))
+    (inputs
+     `(("boost" ,boost)
+       ("hidapi" ,hidapi)
+       ("libusb" ,libusb)))
+    (native-search-paths
+     (list (search-path-specification
+            ;; Used by mspdebug. mspdebug has a few different drivers it can
+            ;; use to interact with MSP430's so this is an optional dependency
+            (variable "MSPDEBUG_TILIB_PATH")
+            (files '("lib")))))
+    (home-page "https://www.ti.com/tool/MSPDS")
+    (synopsis "Library used to program and debug MSP430 microcontrollers")
+    (description "This library facilitates communication between a host computer and certain
+MSP430 debuggers.  It is also know as @acronym{MSPDS, MSP430 Debug Stack}.
+This is an optional dependency of mspdebug (which calls this library
+@code{tilib})")
+    (license license:bsd-3)))