git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #58600 from AerialX/msp430-mspds

MSP430 debug stack

commitf6899555d0526cc4600faada2bca1b2060558949 authorRobert Hensing <roberth@users.noreply.github.com> dateFri 7 May 2021, 13:01 (6 years ago) parentedb9e329aae499
4 files changed+145
pkgs/development/misc/msp430/mspds/binary.nix+35 pkgs/development/misc/msp430/mspds/bsl430.patch+51 pkgs/development/misc/msp430/mspds/default.nix+56 pkgs/top-level/all-packages.nix+3
pkgs/development/misc/msp430/mspds/binary.nixnew file+35
@@ -0,0 +1,35 @@
1+{ stdenv, lib, fetchurl, unzip, autoPatchelfHook }:
2+
3+with lib;
4+
5+let
6+ archPostfix = optionalString (stdenv.is64bit && !stdenv.isDarwin) "_64";
7+in stdenv.mkDerivation rec {
8+ pname = "msp-debug-stack-bin";
9+ version = "3.15.1.1";
10+ src = fetchurl {
11+ url = "http://software-dl.ti.com/msp430/msp430_public_sw/mcu/msp430/MSPDS/3_15_1_001/export/MSP430_DLL_Developer_Package_Rev_3_15_1_1.zip";
12+ sha256 = "1m1ssrwbhqvqwbp3m4hnjyxnz3f9d4acz9vl1av3fbnhvxr0d2hb";
13+ };
14+ sourceRoot = ".";
15+
16+ libname =
17+ if stdenv.hostPlatform.isWindows then "MSP430${archPostfix}.dll"
18+ else "libmsp430${archPostfix}${stdenv.hostPlatform.extensions.sharedLibrary}";
19+
20+ nativeBuildInputs = [ unzip autoPatchelfHook ];
21+ buildInputs = [ stdenv.cc.cc ];
22+
23+ installPhase = ''
24+ install -Dm0755 $libname $out/lib/''${libname//_64/}
25+ install -Dm0644 -t $out/include Inc/*.h
26+ '';
27+
28+ meta = {
29+ description = "Unfree binary release of the TI MSP430 FET debug driver";
30+ homepage = https://www.ti.com/tool/MSPDS;
31+ license = licenses.unfree;
32+ platforms = platforms.linux ++ platforms.darwin;
33+ maintainers = with maintainers; [ aerialx ];
34+ };
35+}
pkgs/development/misc/msp430/mspds/bsl430.patchnew file+51
@@ -0,0 +1,51 @@
1+diff -ruN a/Makefile b/Makefile
2+--- a/Makefile 2020-06-03 16:10:18.000000000 -0700
3++++ b/Makefile 2020-07-21 18:03:12.464121056 -0700
4+@@ -42,7 +42,7 @@
5+
6+ PLATFORM := $(shell uname -s)
7+ ifeq ($(PLATFORM),Linux)
8+- CXX:= g++
9++ CXX?= g++
10+
11+ STATICOUTPUT := linux64
12+
13+@@ -68,7 +68,7 @@
14+
15+ HIDOBJ := $(LIBTHIRD)/hid-libusb.o
16+ else
17+- CXX:= clang++
18++ CXX?= clang++
19+
20+ OUTPUT := libmsp430.dylib
21+ STATICOUTPUT := mac64
22+@@ -134,7 +134,7 @@
23+ $(CXX) -c -o $@ $< $(USE_PCH) $(CXXFLAGS) $(INCLUDES) $(DEFINES)
24+
25+ $(BSLLIB):
26+- $(MAKE) -C ./ThirdParty/BSL430_DLL
27++ $(MAKE) -C ./ThirdParty/BSL430_DLL OUTPUT=../../$(BSLLIB)
28+
29+ install:
30+ cp $(OUTPUT) /usr/local/lib/
31+diff -ruN a/ThirdParty/BSL430_DLL/Makefile b/ThirdParty/BSL430_DLL/Makefile
32+--- a/ThirdParty/BSL430_DLL/Makefile 2019-11-18 13:16:00.000000000 -0800
33++++ b/ThirdParty/BSL430_DLL/Makefile 2020-07-21 18:02:55.987782494 -0700
34+@@ -36,7 +36,7 @@
35+
36+ PLATFORM := $(shell uname -s)
37+ ifeq ($(PLATFORM),Linux)
38+- CXX:= g++
39++ CXX?= g++
40+
41+ ifdef BIT32
42+ CXXFLAGS += -m32
43+@@ -47,7 +47,7 @@
44+ INCLUDES += -I$(BOOST_DIR)
45+ endif
46+ else
47+- CXX:= clang++
48++ CXX?= clang++
49+
50+ ifdef BOOST_DIR
51+ INCLUDES += -I$(BOOST_DIR)/include
pkgs/development/misc/msp430/mspds/default.nixnew file+56
@@ -0,0 +1,56 @@
1+{ stdenv
2+, lib
3+, fetchurl, unzip
4+, boost, pugixml
5+, hidapi
6+, libusb1 ? null
7+}:
8+
9+with lib;
10+assert stdenv.isLinux -> libusb1 != null;
11+
12+let
13+ hidapiDriver = optionalString stdenv.isLinux "-libusb";
14+
15+in stdenv.mkDerivation {
16+ pname = "msp-debug-stack";
17+ version = "3.15.1.1";
18+
19+ src = fetchurl {
20+ url = "http://software-dl.ti.com/msp430/msp430_public_sw/mcu/msp430/MSPDS/3_15_1_001/export/MSPDebugStack_OS_Package_3_15_1_1.zip";
21+ sha256 = "1j5sljqwc20zrb50mrji4mnmw5i680qc7n0lb0pakrrxqjc9m9g3";
22+ };
23+ sourceRoot = ".";
24+
25+ enableParallelBuilding = true;
26+ libName = "libmsp430${stdenv.hostPlatform.extensions.sharedLibrary}";
27+ makeFlags = [ "OUTPUT=$(libName)" "HIDOBJ=" ];
28+ NIX_LDFLAGS = [ "-lpugixml" "-lhidapi${hidapiDriver}" ];
29+ NIX_CFLAGS_COMPILE = [ "-I${hidapi}/include/hidapi" ];
30+
31+ patches = [ ./bsl430.patch ];
32+
33+ preBuild = ''
34+ rm ThirdParty/src/pugixml.cpp
35+ rm ThirdParty/include/pugi{config,xml}.hpp
36+ '' + optionalString stdenv.isDarwin ''
37+ makeFlagsArray+=(OUTNAME="-install_name ")
38+ '';
39+
40+ installPhase = ''
41+ install -Dm0755 -t $out/lib $libName
42+ install -Dm0644 -t $out/include DLL430_v3/include/*.h
43+ '';
44+
45+ nativeBuildInputs = [ unzip ];
46+ buildInputs = [ boost hidapi pugixml ]
47+ ++ optional stdenv.isLinux libusb1;
48+
49+ meta = {
50+ description = "TI MSP430 FET debug driver";
51+ homepage = https://www.ti.com/tool/MSPDS;
52+ license = licenses.bsd3;
53+ platforms = platforms.linux ++ platforms.darwin;
54+ maintainers = with maintainers; [ aerialx ];
55+ };
56+}
pkgs/top-level/all-packages.nix+3
@@ -12307,6 +12307,9 @@ in
1230712307 newlib = newlibCross;
1230812308 };
1230912309
12310+ mspds = callPackage ../development/misc/msp430/mspds { };
12311+ mspds-bin = callPackage ../development/misc/msp430/mspds/binary.nix { };
12312+
1231012313 mspdebug = callPackage ../development/misc/msp430/mspdebug.nix { };
1231112314
1231212315 vc4-newlib = callPackage ../development/misc/vc4/newlib.nix {};