diff options
Diffstat (limited to 'pkgs/development/embedded')
39 files changed, 756 insertions, 261 deletions
diff --git a/pkgs/development/embedded/arduino/arduino-cli/default.nix b/pkgs/development/embedded/arduino/arduino-cli/default.nix index a432058f083bd..6e762699bcdb2 100644 --- a/pkgs/development/embedded/arduino/arduino-cli/default.nix +++ b/pkgs/development/embedded/arduino/arduino-cli/default.nix @@ -1,31 +1,71 @@ -{ lib, stdenv, buildGoModule, fetchFromGitHub, buildFHSUserEnv }: +{ lib, stdenv, buildGoModule, fetchFromGitHub, buildFHSEnv, installShellFiles, go-task }: let pkg = buildGoModule rec { pname = "arduino-cli"; - version = "0.21.1"; + version = "0.33.0"; src = fetchFromGitHub { owner = "arduino"; repo = pname; rev = version; - sha256 = "sha256-IXzN6CnZCzrkcLVNmKc1WB0V+TTa56CBzASzK0FQO8c="; + hash = "sha256-iwVxaNkz4AgLXPRjzD3vNJ7k+whWvpQUl66nSmRFW+U="; }; + nativeBuildInputs = [ + installShellFiles + ]; + + nativeCheckInputs = [ + go-task + ]; + subPackages = [ "." ]; - vendorSha256 = "sha256-VWoKHIRQfs4dbsOzV3AQpqWsCPDm/rVKGMsc4xZvbhU="; + vendorHash = "sha256-efZnuxXbC31u7FciULGYvpaWiCm9boQRLUpxW9evyJQ="; + + postPatch = let + skipTests = [ + # tries to "go install" + "TestDummyMonitor" + # try to Get "https://downloads.arduino.cc/libraries/library_index.tar.bz2" + "TestDownloadAndChecksums" + "TestParseArgs" + "TestParseReferenceCores" + "TestPlatformSearch" + "TestPlatformSearchSorting" + ]; + in '' + substituteInPlace Taskfile.yml \ + --replace "go test" "go test -p $NIX_BUILD_CORES -skip '(${lib.concatStringsSep "|" skipTests})'" + ''; + + doCheck = stdenv.isLinux; - doCheck = false; + checkPhase = '' + runHook preCheck + task go:test + runHook postCheck + ''; ldflags = [ "-s" "-w" "-X github.com/arduino/arduino-cli/version.versionString=${version}" "-X github.com/arduino/arduino-cli/version.commit=unknown" ] ++ lib.optionals stdenv.isLinux [ "-extldflags '-static'" ]; + postInstall = '' + export HOME="$(mktemp -d)" + for s in {bash,zsh,fish}; do + $out/bin/arduino-cli completion $s > completion.$s + installShellCompletion --cmd arduino-cli --$s completion.$s + done + unset HOME + ''; + meta = with lib; { inherit (src.meta) homepage; description = "Arduino from the command line"; + changelog = "https://github.com/arduino/arduino-cli/releases/tag/${version}"; license = licenses.gpl3Only; maintainers = with maintainers; [ ryantm ]; }; @@ -34,10 +74,10 @@ let in if stdenv.isLinux then -# buildFHSUserEnv is needed because the arduino-cli downloads compiler +# buildFHSEnv is needed because the arduino-cli downloads compiler # toolchains from the internet that have their interpreters pointed at # /lib64/ld-linux-x86-64.so.2 - buildFHSUserEnv + buildFHSEnv { inherit (pkg) name meta; @@ -45,7 +85,9 @@ if stdenv.isLinux then extraInstallCommands = '' mv $out/bin/$name $out/bin/arduino-cli + cp -r ${pkg.outPath}/share $out/share ''; + passthru.pureGoPkg = pkg; targetPkgs = pkgs: with pkgs; [ zlib diff --git a/pkgs/development/embedded/arduino/arduino-core/chrootenv.nix b/pkgs/development/embedded/arduino/arduino-core/chrootenv.nix index 4c13b2493a9a4..a97fa50aebf2c 100644 --- a/pkgs/development/embedded/arduino/arduino-core/chrootenv.nix +++ b/pkgs/development/embedded/arduino/arduino-core/chrootenv.nix @@ -1,8 +1,8 @@ -{ lib, buildFHSUserEnv, arduino-core-unwrapped, withGui ? false, withTeensyduino ? false }: +{ lib, buildFHSEnv, arduino-core-unwrapped, withGui ? false, withTeensyduino ? false }: let arduino-unwrapped = arduino-core-unwrapped.override { inherit withGui withTeensyduino; }; in -buildFHSUserEnv { +buildFHSEnv { name = "arduino"; targetPkgs = @@ -14,7 +14,7 @@ buildFHSUserEnv { pyserial ])) ]); - multiPkgs = null; + multiArch = false; extraInstallCommands = '' ${lib.optionalString withGui '' diff --git a/pkgs/development/embedded/arduino/arduino-language-server/default.nix b/pkgs/development/embedded/arduino/arduino-language-server/default.nix new file mode 100644 index 0000000000000..da3d1e7e7c603 --- /dev/null +++ b/pkgs/development/embedded/arduino/arduino-language-server/default.nix @@ -0,0 +1,40 @@ +{ lib +, stdenv +, buildGoModule +, fetchFromGitHub +}: + +buildGoModule rec { + pname = "arduino-language-server"; + version = "0.7.4"; + + src = fetchFromGitHub { + owner = "arduino"; + repo = "arduino-language-server"; + rev = "refs/tags/${version}"; + hash = "sha256-A5JcHdcSrRC1BxoJsPtLKBq1fu58SvwHm9hbgu8Uy5k="; + }; + + subPackages = [ "." ]; + + vendorHash = "sha256-SKqorfgesYE0kXR/Fm6gI7Me0CxtDeNsTRGYuGJW+vo="; + + doCheck = false; + + ldflags = [ + "-s" + "-w" + "-X github.com/arduino/arduino-language-server/version.versionString=${version}" + "-X github.com/arduino/arduino-language-server/version.commit=unknown" + ] ++ lib.optionals stdenv.isLinux [ + "-extldflags '-static'" + ]; + + meta = with lib; { + description = "An Arduino Language Server based on Clangd to Arduino code autocompletion"; + homepage = "https://github.com/arduino/arduino-language-server"; + changelog = "https://github.com/arduino/arduino-language-server/releases/tag/${version}"; + license = licenses.asl20; + maintainers = with maintainers; [ BattleCh1cken ]; + }; +} diff --git a/pkgs/development/embedded/arduino/arduinoOTA/default.nix b/pkgs/development/embedded/arduino/arduinoOTA/default.nix new file mode 100644 index 0000000000000..92da1a77f18ef --- /dev/null +++ b/pkgs/development/embedded/arduino/arduinoOTA/default.nix @@ -0,0 +1,33 @@ +{ lib +, buildGoModule +, fetchFromGitHub +, nix-update-script +}: +buildGoModule rec { + pname = "arduinoOTA"; + version = "1.4.1"; + + src = fetchFromGitHub { + owner = "arduino"; + repo = pname; + rev = version; + hash = "sha256-HaNMkeV/PDEotYp8+rUKFaBxGbZO8qA99Yp2sa6glz8="; + }; + + vendorHash = null; + + postPatch = '' + substituteInPlace version/version.go \ + --replace 'versionString = ""' 'versionString = "${version}"' + ''; + + passthru.updateScript = nix-update-script { }; + + meta = with lib; { + homepage = "https://github.com/arduino/arduinoOTA"; + description = "A tool for uploading programs to Arduino boards over a network"; + license = licenses.gpl3; + maintainers = with maintainers; [ poelzi ]; + platforms = platforms.all; + }; +} diff --git a/pkgs/development/embedded/avrdude/default.nix b/pkgs/development/embedded/avrdude/default.nix index 83dbf2a18fae3..556db9dc303c1 100644 --- a/pkgs/development/embedded/avrdude/default.nix +++ b/pkgs/development/embedded/avrdude/default.nix @@ -1,23 +1,36 @@ -{ lib, stdenv, fetchurl, bison, flex, libusb-compat-0_1, libelf, libftdi1, readline -# docSupport is a big dependency, disabled by default -, docSupport ? false, texLive ? null, texinfo ? null, texi2html ? null -}: - -assert docSupport -> texLive != null && texinfo != null && texi2html != null; +{ lib, stdenv, fetchFromGitHub, cmake, bison, flex, libusb-compat-0_1, libelf +, libftdi1, readline +# documentation building is broken on darwin +, docSupport ? (!stdenv.isDarwin), texlive, texinfo, texi2html, unixtools }: stdenv.mkDerivation rec { pname = "avrdude"; - version = "7.0"; + version = "7.2"; - src = fetchurl { - url = "mirror://savannah/${pname}/${pname}-${version}.tar.gz"; - sha256 = "sha256-wO9l2Y1gQMoLTytwDVFGPCoflGZUQfOdFdl0Qtu3m1Q="; + src = fetchFromGitHub { + owner = "avrdudes"; + repo = pname; + rev = "v${version}"; + sha256 = "sha256-/JyhMBcjNklyyXZEFZGTjrTNyafXEdHEhcLz6ZQx9aU="; }; - configureFlags = lib.optionals docSupport "--enable-doc"; + nativeBuildInputs = [ cmake bison flex ] ++ lib.optionals docSupport [ + unixtools.more + texlive.combined.scheme-medium + texinfo + texi2html + ]; + + buildInputs = [ libusb-compat-0_1 libelf libftdi1 readline ]; + + cmakeFlags = lib.optionals docSupport [ + "-DBUILD_DOC=ON" + ]; - buildInputs = [ bison flex libusb-compat-0_1 libelf libftdi1 readline ] - ++ lib.optionals docSupport [ texLive texinfo texi2html ]; + # dvips output references texlive in comments, resulting in a huge closure + postInstall = lib.optionalString docSupport '' + rm $out/share/doc/${pname}/*.ps + ''; meta = with lib; { description = "Command-line tool for programming Atmel AVR microcontrollers"; diff --git a/pkgs/development/embedded/blackmagic/default.nix b/pkgs/development/embedded/blackmagic/default.nix index abb5e19f8bf29..cef7ba5f89ca5 100644 --- a/pkgs/development/embedded/blackmagic/default.nix +++ b/pkgs/development/embedded/blackmagic/default.nix @@ -10,15 +10,15 @@ stdenv.mkDerivation rec { pname = "blackmagic"; - version = "unstable-2022-04-16"; + version = "1.8.2"; # `git describe --always` - firmwareVersion = "v1.7.1-415-gc4869a5"; + firmwareVersion = "v${version}"; src = fetchFromGitHub { owner = "blacksphere"; repo = "blackmagic"; - rev = "c4869a54733ae92099a7316954e34d1ab7b6097c"; - hash = "sha256-0MC1v/5u/txSshxkOI5TErMRRrYCcHly3qbVTAk9Vc0="; + rev = firmwareVersion; + hash = "sha256-NGzoohmpVwGOncr9AvHYANMf/oEskjmTXYj/Kdx2RwM="; fetchSubmodules = true; }; diff --git a/pkgs/development/embedded/blackmagic/helper.sh b/pkgs/development/embedded/blackmagic/helper.sh index bae57f633cfbf..9185253b39d4b 100755 --- a/pkgs/development/embedded/blackmagic/helper.sh +++ b/pkgs/development/embedded/blackmagic/helper.sh @@ -11,7 +11,7 @@ out=${out:-/tmp} ################################################################################ export CFLAGS=$NIX_CFLAGS_COMPILE export MAKEFLAGS="\ - ${enableParallelBuilding:+-j${NIX_BUILD_CORES} -l${NIX_BUILD_CORES}}" + ${enableParallelBuilding:+-j${NIX_BUILD_CORES}}" ################################################################################ PRODUCTS="blackmagic.bin blackmagic.hex blackmagic_dfu.bin blackmagic_dfu.hex" diff --git a/pkgs/development/embedded/blisp/default.nix b/pkgs/development/embedded/blisp/default.nix new file mode 100644 index 0000000000000..9758b6a2bc390 --- /dev/null +++ b/pkgs/development/embedded/blisp/default.nix @@ -0,0 +1,42 @@ +{ lib +, stdenv +, fetchFromGitHub +, argtable +, cmake +, libserialport +, pkg-config +, IOKit +}: + +stdenv.mkDerivation { + pname = "blisp"; + version = "unstable-2023-06-03"; + + src = fetchFromGitHub { + owner = "pine64"; + repo = "blisp"; + rev = "048a72408218788d519a87bcdfb23bcf9ed91a84"; + hash = "sha256-hipJrr0D4uEN2hk8ooXeg0gv0X3w4U9ReXbC4oPEPwI="; + }; + + nativeBuildInputs = [ cmake pkg-config ]; + + buildInputs = [ + argtable + libserialport + ] ++ lib.optional stdenv.isDarwin IOKit; + + cmakeFlags = [ + "-DBLISP_BUILD_CLI=ON" + "-DBLISP_USE_SYSTEM_LIBRARIES=ON" + ]; + + meta = with lib; { + description = "ISP tool & library for Bouffalo Labs RISC-V Microcontrollers and SoCs"; + license = licenses.mit; + homepage = "https://github.com/pine64/blisp"; + maintainers = [ maintainers.fortuneteller2k ]; + }; +} +# TODO: update when next stable release supports building without vendored +# libraries diff --git a/pkgs/development/embedded/bossa/arduino.nix b/pkgs/development/embedded/bossa/arduino.nix new file mode 100644 index 0000000000000..04e483ff38b5e --- /dev/null +++ b/pkgs/development/embedded/bossa/arduino.nix @@ -0,0 +1,13 @@ +{ bossa, git, fetchFromGitHub }: + +bossa.overrideAttrs (attrs: rec { + pname = "bossa-arduino"; + version = "1.9.1-arduino2"; + + src = fetchFromGitHub { + owner = "arduino"; + repo = "BOSSA"; + rev = version; + sha256 = "sha256-sBJ6QMd7cTClDnGCeOU0FT6IczEjqqRxCD7kef5GuY8="; + }; +}) diff --git a/pkgs/development/embedded/bossa/bossa-no-applet-build.patch b/pkgs/development/embedded/bossa/bossa-no-applet-build.patch deleted file mode 100644 index 4284245f485d7..0000000000000 --- a/pkgs/development/embedded/bossa/bossa-no-applet-build.patch +++ /dev/null @@ -1,16 +0,0 @@ -diff --git a/Makefile b/Makefile -index cc8882e..97b11ee 100644 ---- a/Makefile -+++ b/Makefile -@@ -184,11 +184,6 @@ $(foreach src,$(COMMON_SRCS),$(eval $(call common_obj,$(src)))) - # Applet rules - # - define applet_obj --$(SRCDIR)/$(1:%.asm=%.cpp): $(SRCDIR)/$(1) -- @echo APPLET $(1:%.asm=%) -- $$(Q)$$(ARMAS) -o $$(@:%.o=%.obj) $$< -- $$(Q)$$(ARMOBJCOPY) -O binary $$(@:%.o=%.obj) $$(@:%.o=%.bin) -- $$(Q)appletgen $(1:%.asm=%) $(SRCDIR) $(OBJDIR) - $(OBJDIR)/$(1:%.asm=%.o): $(SRCDIR)/$(1:%.asm=%.cpp) - @echo CPP APPLET $$< - $$(Q)$$(CXX) $$(COMMON_CXXFLAGS) -c -o $$(@) $$(<:%.asm=%.cpp) diff --git a/pkgs/development/embedded/bossa/default.nix b/pkgs/development/embedded/bossa/default.nix index fbb1b4c1fd40d..58ee0642fb380 100644 --- a/pkgs/development/embedded/bossa/default.nix +++ b/pkgs/development/embedded/bossa/default.nix @@ -1,4 +1,11 @@ -{ lib, stdenv, fetchFromGitHub, wxGTK, libX11, readline }: +{ lib +, stdenv +, fetchFromGitHub +, wxGTK32 +, libX11 +, readline +, darwin +}: let # BOSSA needs a "bin2c" program to embed images. @@ -15,23 +22,37 @@ let in stdenv.mkDerivation rec { pname = "bossa"; - version = "1.8"; + version = "1.9.1"; src = fetchFromGitHub { owner = "shumatech"; repo = "BOSSA"; rev = version; - sha256 = "sha256-dZeBy63OzIaLUfAg6awnk83FtLKVxPoYAYs5t7BBM6Y="; + sha256 = "sha256-8M3MU/+Y1L6SaQ1yoC9Z27A/gGruZdopLnL1z7h7YJw="; }; - patches = [ ./bossa-no-applet-build.patch ]; + postPatch = '' + substituteInPlace Makefile \ + --replace "-arch x86_64" "" + ''; nativeBuildInputs = [ bin2c ]; - buildInputs = [ wxGTK libX11 readline ]; + buildInputs = [ + wxGTK32 + libX11 + readline + ] ++ lib.optionals stdenv.isDarwin [ + darwin.apple_sdk.frameworks.Cocoa + ]; - # Explicitly specify targets so they don't get stripped. - makeFlags = [ "bin/bossac" "bin/bossash" "bin/bossa" ]; - NIX_CFLAGS_COMPILE = "-Wno-error=deprecated-declarations"; + makeFlags = [ + "WXVERSION=3.2" + # Explicitly specify targets so they don't get stripped. + "bin/bossac" + "bin/bossash" + "bin/bossa" + ]; + env.NIX_CFLAGS_COMPILE = "-Wno-error=deprecated-declarations"; installPhase = '' mkdir -p $out/bin @@ -49,6 +70,6 @@ stdenv.mkDerivation rec { ''; homepage = "http://www.shumatech.com/web/products/bossa"; license = licenses.bsd3; - platforms = platforms.linux; + platforms = platforms.unix; }; } diff --git a/pkgs/development/embedded/edl/default.nix b/pkgs/development/embedded/edl/default.nix new file mode 100644 index 0000000000000..2e1f09ffd2089 --- /dev/null +++ b/pkgs/development/embedded/edl/default.nix @@ -0,0 +1,45 @@ +{ lib, stdenv, fetchFromGitHub, python3Packages }: + +python3Packages.buildPythonPackage rec { + pname = "edl"; + version = "unstable-2022-09-07"; + + src = fetchFromGitHub rec { + owner = "bkerler"; + repo = "edl"; + rev = "f6b94da5faa003b48d24a5f4a8f0b8495626fd5b"; + fetchSubmodules = true; + hash = "sha256-bxnRy+inWNArE2gUA/qDPy7NKvqBm43sbxdIaTc9N28="; + }; + # edl has a spurious dependency on "usb" which has nothing to do with the + # project and was probably added by accident trying to add pyusb + postPatch = '' + sed -i '/'usb'/d' setup.py + ''; + # No tests set up + doCheck = false; + # EDL loaders are ELFs but shouldn't be touched, rest is Python anyways + dontStrip = true; + propagatedBuildInputs = with python3Packages; [ + pyusb + pyserial + docopt + pylzma + pycryptodome + lxml + colorama + # usb + capstone + keystone-engine + ]; + + meta = with lib; { + homepage = "https://github.com/bkerler/edl"; + description = "Qualcomm EDL tool (Sahara / Firehose / Diag)"; + license = licenses.mit; + maintainers = with maintainers; [ lorenz ]; + # Case-sensitive files in 'Loader' submodule + broken = stdenv.isDarwin; + }; +} + diff --git a/pkgs/development/embedded/elf2uf2-rs/default.nix b/pkgs/development/embedded/elf2uf2-rs/default.nix index fac10a28107fd..d26c0072265c9 100644 --- a/pkgs/development/embedded/elf2uf2-rs/default.nix +++ b/pkgs/development/embedded/elf2uf2-rs/default.nix @@ -1,31 +1,32 @@ -{ lib, stdenv, rustPlatform, fetchFromGitHub, pkg-config, udev }: +{ lib, stdenv, rustPlatform, fetchCrate, pkg-config, udev, CoreFoundation, DiskArbitration, Foundation }: rustPlatform.buildRustPackage rec { pname = "elf2uf2-rs"; - version = "unstable-2021-12-12"; + version = "1.3.7"; - src = fetchFromGitHub { - owner = "JoNil"; - repo = pname; - rev = "91ae98873ed01971ab1543b98266a5ad2ec09210"; - sha256 = "sha256-DGrT+YdDLdTYy5SWcQ+DNbpifGjrF8UTXyEeE/ug564="; + src = fetchCrate { + inherit pname version; + sha256 = "sha256-2ZilZIYXCNrKJlkHBsz/2/pMtF+UDfjDlt53ylcwgus="; }; nativeBuildInputs = [ pkg-config ]; - buildInputs = [ - udev - ]; + buildInputs = lib.optional stdenv.isLinux udev + ++ lib.optionals stdenv.isDarwin [ + CoreFoundation + DiskArbitration + Foundation + ]; - cargoSha256 = "sha256-5ui1+987xICP2wUSHy4YzKskn52W51Pi4DbEh+GbSPE="; + cargoSha256 = "sha256-+3Rqlzkrw9XfM3PelGNbnRGaWQLbzVJ7iJgvGgVt5FE="; meta = with lib; { description = "Convert ELF files to UF2 for USB Flashing Bootloaders"; homepage = "https://github.com/JoNil/elf2uf2-rs"; license = with licenses; [ bsd0 ]; - platforms = platforms.linux; - maintainers = with maintainers; [ polygon ]; + platforms = platforms.linux ++ platforms.darwin; + maintainers = with maintainers; [ polygon fortuneteller2k ]; }; } diff --git a/pkgs/development/embedded/fpga/apio/default.nix b/pkgs/development/embedded/fpga/apio/default.nix index 3b5ad6012360f..b201ca169d4dc 100644 --- a/pkgs/development/embedded/fpga/apio/default.nix +++ b/pkgs/development/embedded/fpga/apio/default.nix @@ -60,7 +60,7 @@ buildPythonApplication rec { tinyprog # needed for upload to TinyFPGA ]; - checkInputs = [ + nativeCheckInputs = [ pytestCheckHook ]; diff --git a/pkgs/development/embedded/fpga/ecpdap/default.nix b/pkgs/development/embedded/fpga/ecpdap/default.nix index 38ba9d78712ea..799915b1b7f68 100644 --- a/pkgs/development/embedded/fpga/ecpdap/default.nix +++ b/pkgs/development/embedded/fpga/ecpdap/default.nix @@ -2,16 +2,16 @@ rustPlatform.buildRustPackage rec { pname = "ecpdap"; - version = "0.1.7"; + version = "0.1.8"; src = fetchFromGitHub { owner = "adamgreig"; repo = pname; rev = "v${version}"; - sha256 = "sha256-fdvpGmEy54i48H6YJ4E1LIuogimNEL8PJS5ScoW/6DM="; + sha256 = "sha256-KXfEQnbhUUKsCDKhPBjwjF9eJMuiCx5o7gOSzyWv36s="; }; - cargoSha256 = "sha256-2YARNoHVDBwGr8FE/oRlNZMX/vCPIre7OnZbr04eF/M="; + cargoSha256 = "sha256-BEfsNSzrdV/tnzWk4oOwchOupW6PzZ8TEx7zUzwLBV8="; nativeBuildInputs = [ pkg-config ]; diff --git a/pkgs/development/embedded/fpga/lattice-diamond/default.nix b/pkgs/development/embedded/fpga/lattice-diamond/default.nix index e8bc4c1b1be53..f80261720cf67 100644 --- a/pkgs/development/embedded/fpga/lattice-diamond/default.nix +++ b/pkgs/development/embedded/fpga/lattice-diamond/default.nix @@ -1,5 +1,5 @@ { lib, stdenv, rpmextract, patchelf, makeWrapper, file, requireFile, glib, zlib, - freetype, fontconfig, xorg, libusb-compat-0_1 }: + freetype, fontconfig, xorg, libusb-compat-0_1, coreutils }: stdenv.mkDerivation { pname = "diamond"; @@ -67,7 +67,7 @@ stdenv.mkDerivation { done # Patch executable ELFs. - for path in bin/lin64 ispfpga/bin/lin64; do + for path in bin/lin64 ispfpga/bin/lin64 synpbase/linux_a_64 synpbase/linux_a_64/mbin; do cd $out/$prefix/$path for f in *; do if ! file $f | grep -q "ELF 64-bit LSB executable" ; then @@ -79,19 +79,22 @@ stdenv.mkDerivation { # dependencies from nix. patchelf \ --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ - --set-rpath "$libPath" --force-rpath \ + --set-rpath "$libPath:$out/$prefix/bin/lin64:$out/$prefix/ispfpga/bin/lin64" \ + --force-rpath \ $f done done + # Patch absolute /usr/bin/id path in script + sed -i -e "s#/usr/bin/id#${coreutils}/bin/id#" $out/$prefix/synpbase/bin/config/platform_set + # Remove 32-bit libz. rm $out/$prefix/bin/lin64/libz.{so,so.1} - # Make wrappers (should these target more than the 'diamond' tool?). - # The purpose of these is just to call the target program using its - # absolute path - otherwise, it will crash. + # Make wrappers. The purpose of these is just to call the target program + # using its absolute path - otherwise, it will crash. mkdir -p bin - for tool in diamond ; do + for tool in diamond pnmainc ddtcmd ; do makeWrapper $out/$prefix/bin/lin64/$tool $out/bin/$tool done ''; diff --git a/pkgs/development/embedded/fpga/openfpgaloader/default.nix b/pkgs/development/embedded/fpga/openfpgaloader/default.nix index b44f78c03c469..eb44e39c49a98 100644 --- a/pkgs/development/embedded/fpga/openfpgaloader/default.nix +++ b/pkgs/development/embedded/fpga/openfpgaloader/default.nix @@ -1,36 +1,46 @@ -{ stdenv -, lib +{ + cmake , fetchFromGitHub -, cmake -, pkg-config +, hidapi +, lib , libftdi1 , libusb1 +, pkg-config +, stdenv , udev +, zlib }: -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "openfpgaloader"; - version = "0.6.0"; + version = "0.11.0"; src = fetchFromGitHub { owner = "trabucayre"; repo = "openFPGALoader"; - rev = "v${version}"; - sha256 = "sha256-gPRBHy7WVra4IlGvzrhNqbEbOQtYtUC+zQ+SnJTMvRA="; + rev = "v${finalAttrs.version}"; + hash = "sha256-OiyuhDrK4w13lRmgfmMlZ+1gvRZCJxsOF6MzLy3CFpg="; }; - nativeBuildInputs = [ cmake pkg-config ]; + nativeBuildInputs = [ + cmake + pkg-config + ]; buildInputs = [ + hidapi libftdi1 libusb1 udev + zlib ]; - meta = with lib; { + meta = { + broken = stdenv.isDarwin; # error: Package ‘systemd-253.6’ is not available on the requested Darwin platform. description = "Universal utility for programming FPGAs"; homepage = "https://github.com/trabucayre/openFPGALoader"; - license = licenses.agpl3Only; - maintainers = with maintainers; [ danderson ]; + license = lib.licenses.agpl3Only; + maintainers = with lib.maintainers; [ danderson ]; + platforms = lib.platforms.linux; }; -} +}) diff --git a/pkgs/development/embedded/fpga/tinyprog/default.nix b/pkgs/development/embedded/fpga/tinyprog/default.nix index 06a8c3e98712d..4872111b811c5 100644 --- a/pkgs/development/embedded/fpga/tinyprog/default.nix +++ b/pkgs/development/embedded/fpga/tinyprog/default.nix @@ -15,7 +15,7 @@ with python3Packages; buildPythonApplication rec { sha256 = "0zbrvvb957z2lwbfd39ixqdsnd2w4wfjirwkqdrqm27bjz308731"; }; - sourceRoot = "source/programmer"; + sourceRoot = "${src.name}/programmer"; propagatedBuildInputs = [ pyserial diff --git a/pkgs/development/embedded/fpga/trellis/default.nix b/pkgs/development/embedded/fpga/trellis/default.nix index 32a4bcdac0734..f0ff4a47b4c35 100644 --- a/pkgs/development/embedded/fpga/trellis/default.nix +++ b/pkgs/development/embedded/fpga/trellis/default.nix @@ -1,34 +1,32 @@ { lib, stdenv, fetchFromGitHub, python3, boost, cmake }: let - rev = "2f06397673bbca3da11928d538b8ab7d01c944c6"; + rev = "488f4e71073062de314c55a037ede7cf03a3324c"; # git describe --tags - realVersion = "1.0-534-g${builtins.substring 0 7 rev}"; + realVersion = "1.2.1-14-g${builtins.substring 0 7 rev}"; + + main_src = fetchFromGitHub { + owner = "YosysHQ"; + repo = "prjtrellis"; + inherit rev; + hash = "sha256-Blbu+0rlM/3izbF0XCvkNpSAND0IclWEwK7anzyrpvw="; + name = "trellis"; + }; + + database_src = fetchFromGitHub { + owner = "YosysHQ"; + repo = "prjtrellis-db"; + rev = "35d900a94ff0db152679a67bf6e4fbf40ebc34aa"; + hash = "sha256-r6viR8y9ZjURGNbsa0/YY8lzy9kGzjuu408ntxwpqm0="; + name = "trellis-database"; + }; + in stdenv.mkDerivation rec { pname = "trellis"; - version = "2021-12-14"; - - srcs = [ - (fetchFromGitHub { - owner = "YosysHQ"; - repo = "prjtrellis"; - inherit rev; - hash = "sha256-m5CalAIbzY2bhOvpBbPBeLZeDp+itk1HlRsSmtiddaA="; - name = "trellis"; - }) + version = "unstable-2022-09-14"; - (fetchFromGitHub { - owner = "YosysHQ"; - repo = "prjtrellis-db"; - # note: the upstream submodule points to revision 0ee729d20eaf, - # but that's just the tip of the branch that was merged into master. - # fdf4bf275a is the merge commit itself - rev = "fdf4bf275a7402654bc643db537173e2fbc86103"; - sha256 = "eDq2wU2pnfK9bOkEVZ07NQPv02Dc6iB+p5GTtVBiyQA="; - name = "trellis-database"; - }) - ]; - sourceRoot = "trellis"; + srcs = [ main_src database_src ]; + sourceRoot = main_src.name; buildInputs = [ boost ]; nativeBuildInputs = [ cmake python3 ]; @@ -39,7 +37,7 @@ in stdenv.mkDerivation rec { ]; preConfigure = '' - rmdir database && ln -sfv ${builtins.elemAt srcs 1} ./database + rmdir database && ln -sfv ${database_src} ./database cd libtrellis ''; diff --git a/pkgs/development/embedded/jtag-remote-server/default.nix b/pkgs/development/embedded/jtag-remote-server/default.nix new file mode 100644 index 0000000000000..4a2c9c3df3d2b --- /dev/null +++ b/pkgs/development/embedded/jtag-remote-server/default.nix @@ -0,0 +1,24 @@ +{ stdenv, fetchFromGitHub, lib, cmake, pkg-config, libftdi1 }: + +stdenv.mkDerivation rec { + pname = "jtag-remote-server"; + version = "1.2"; + + src = fetchFromGitHub { + owner = "jiegec"; + repo = pname; + rev = "v${version}"; + hash = "sha256-qtgO0BO2hvWi/E2RzGTTuQynKbh7/OLeoLcm60dqro8="; + }; + + nativeBuildInputs = [ cmake pkg-config ]; + buildInputs = [ libftdi1 ]; + + meta = with lib; { + description = "Remote JTAG server for remote debugging"; + homepage = "https://github.com/jiegec/jtag-remote-server"; + license = licenses.mit; + maintainers = with maintainers; [ nickcao ]; + platforms = platforms.unix; + }; +} diff --git a/pkgs/development/embedded/nmrpflash/default.nix b/pkgs/development/embedded/nmrpflash/default.nix index e9a26363db345..71bc394987205 100644 --- a/pkgs/development/embedded/nmrpflash/default.nix +++ b/pkgs/development/embedded/nmrpflash/default.nix @@ -1,21 +1,19 @@ { fetchFromGitHub -, gcc , lib , libnl , libpcap , pkg-config , stdenv -, writeShellScriptBin }: stdenv.mkDerivation rec { pname = "nmrpflash"; - version = "0.9.16"; + version = "0.9.20"; src = fetchFromGitHub { owner = "jclehner"; repo = "nmrpflash"; rev = "v${version}"; - sha256 = "sha256-0nqdbXf1syUe7o5hoNIKLruKxkNaUsGolfZzoQY15j4=="; + sha256 = "sha256-xfKZXaKzSTnCOC8qt6Zc/eidc1bnrKZOJPw/wwMoCaM="; }; nativeBuildInputs = [ pkg-config ]; @@ -23,7 +21,7 @@ stdenv.mkDerivation rec { buildInputs = [ libnl libpcap ]; PREFIX = "${placeholder "out"}"; - STANDALONE_VERSION = "${version}"; + STANDALONE_VERSION = version; preInstall = '' mkdir -p $out/bin diff --git a/pkgs/development/embedded/openocd/default.nix b/pkgs/development/embedded/openocd/default.nix index c80f5f3dd573e..954f043a2ade1 100644 --- a/pkgs/development/embedded/openocd/default.nix +++ b/pkgs/development/embedded/openocd/default.nix @@ -1,55 +1,60 @@ { stdenv , lib -, fetchpatch , fetchurl , pkg-config , hidapi -, libftdi1 +, jimtcl +, libjaylink , libusb1 , libgpiod + +, enableFtdi ? true, libftdi1 + +# Allow selection the hardware targets (SBCs, JTAG Programmers, JTAG Adapters) +, extraHardwareSupport ? [] }: stdenv.mkDerivation rec { pname = "openocd"; - version = "0.11.0"; + version = "0.12.0"; src = fetchurl { url = "mirror://sourceforge/project/${pname}/${pname}/${version}/${pname}-${version}.tar.bz2"; - sha256 = "0z8y7mmv0mhn2l5gs3vz6l7cnwak7agklyc7ml33f7gz99rwx8s3"; + sha256 = "sha256-ryVHiL6Yhh8r2RA/5uYKd07Jaow3R0Tu+Rl/YEMHWvo="; }; nativeBuildInputs = [ pkg-config ]; - buildInputs = [ hidapi libftdi1 libusb1 ] - ++ lib.optional stdenv.isLinux libgpiod; - - patches = [ - # Patch is upstream, so can be removed when OpenOCD 0.12.0 or later is released. - (fetchpatch - { - url = "https://github.com/openocd-org/openocd/commit/cff0e417da58adef1ceef9a63a99412c2cc87ff3.patch"; - sha256 = "Xxzf5miWy4S34sbQq8VQdAbY/oqGyhL/AJxiEPRuj3Q="; - }) - ]; + buildInputs = [ hidapi jimtcl libftdi1 libjaylink libusb1 ] + ++ + # tracking issue for v2 api changes https://sourceforge.net/p/openocd/tickets/306/ + lib.optional stdenv.isLinux (libgpiod.overrideAttrs (old: rec { + version = "1.6.4"; + src = fetchurl { + url = "https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/snapshot/libgpiod-${version}.tar.gz"; + sha256 = "sha256-gp1KwmjfB4U2CdZ8/H9HbpqnNssqaKYwvpno+tGXvgo="; + }; + })); configureFlags = [ "--disable-werror" + "--disable-internal-jimtcl" + "--disable-internal-libjaylink" "--enable-jtag_vpi" - "--enable-usb_blaster_libftdi" - (lib.enableFeature (! stdenv.isDarwin) "amtjtagaccel") - (lib.enableFeature (! stdenv.isDarwin) "gw16012") - "--enable-presto_libftdi" - "--enable-openjtag_ftdi" - (lib.enableFeature (! stdenv.isDarwin) "oocd_trace") "--enable-buspirate" - (lib.enableFeature stdenv.isLinux "sysfsgpio") - (lib.enableFeature stdenv.isLinux "linuxgpiod") "--enable-remote-bitbang" - ]; + (lib.enableFeature enableFtdi "ftdi") + (lib.enableFeature stdenv.isLinux "linuxgpiod") + (lib.enableFeature stdenv.isLinux "sysfsgpio") + ] ++ + map (hardware: "--enable-${hardware}") extraHardwareSupport + ; + + enableParallelBuilding = true; - NIX_CFLAGS_COMPILE = lib.optionals stdenv.cc.isGNU [ + env.NIX_CFLAGS_COMPILE = toString (lib.optionals stdenv.cc.isGNU [ "-Wno-error=cpp" "-Wno-error=strict-prototypes" # fixes build failure with hidapi 0.10.0 - ]; + ]); postInstall = lib.optionalString stdenv.isLinux '' mkdir -p "$out/etc/udev/rules.d" diff --git a/pkgs/development/embedded/orbuculum/default.nix b/pkgs/development/embedded/orbuculum/default.nix new file mode 100644 index 0000000000000..e6a69e22be2d0 --- /dev/null +++ b/pkgs/development/embedded/orbuculum/default.nix @@ -0,0 +1,59 @@ +{ lib +, stdenv +, fetchFromGitHub +, meson +, ninja +, pkg-config +, czmq +, libusb1 +, ncurses +, SDL2 +}: + +stdenv.mkDerivation rec { + pname = "orbuculum"; + version = "2.1.0"; + + src = fetchFromGitHub { + owner = "orbcode"; + repo = pname; + rev = "V${version}"; + sha256 = "sha256-Ohcc8739W/EmDjOYhcMgzEPVhzbWrUYgsPLdy4qzxhY="; + }; + + prePatch = '' + substituteInPlace meson.build --replace \ + "/etc/udev/rules.d" "$out/etc/udev/rules.d" + ''; + + nativeBuildInputs = [ + meson + ninja + pkg-config + ]; + + buildInputs = [ + czmq + libusb1 + ncurses + SDL2 + ]; + + installFlags = [ + "INSTALL_ROOT=$(out)/" + ]; + + postInstall = '' + mkdir -p $out/etc/udev/rules.d/ + cp $src/Support/60-orbcode.rules $out/etc/udev/rules.d/ + ''; + + meta = with lib; { + description = "Cortex M SWO SWV Demux and Postprocess for the ORBTrace"; + homepage = "https://orbcode.org"; + changelog = "https://github.com/orbcode/orbuculum/blob/V${version}/CHANGES.md"; + license = licenses.bsd3; + maintainers = with maintainers; [ newam ]; + platforms = platforms.linux; + }; +} diff --git a/pkgs/development/embedded/platformio/chrootenv.nix b/pkgs/development/embedded/platformio/chrootenv.nix index fbabfe982de01..55adb0edaa750 100644 --- a/pkgs/development/embedded/platformio/chrootenv.nix +++ b/pkgs/development/embedded/platformio/chrootenv.nix @@ -1,28 +1,25 @@ -{ lib, buildFHSUserEnv, version, src }: +{ lib, buildFHSEnv, platformio-core }: let pio-pkgs = pkgs: let - python = pkgs.python3.override { - packageOverrides = self: super: { - platformio = self.callPackage ./core.nix { inherit version src; }; - }; - }; + inherit (platformio-core) python; in (with pkgs; [ + platformio-core zlib git xdg-user-dirs + ncurses ]) ++ (with python.pkgs; [ python setuptools pip bottle - platformio ]); in -buildFHSUserEnv { +buildFHSEnv { name = "platformio"; targetPkgs = pio-pkgs; @@ -38,10 +35,8 @@ buildFHSUserEnv { }; extraInstallCommands = '' - mkdir -p $out/lib/udev/rules.d - ln -s $out/bin/platformio $out/bin/pio - ln -s ${src}/scripts/99-platformio-udev.rules $out/lib/udev/rules.d/99-platformio-udev.rules + ln -s ${platformio-core.udev}/lib $out/lib ''; runScript = "platformio"; diff --git a/pkgs/development/embedded/platformio/core.nix b/pkgs/development/embedded/platformio/core.nix index f44ba4e95b8e7..e02e76e3ccce3 100644 --- a/pkgs/development/embedded/platformio/core.nix +++ b/pkgs/development/embedded/platformio/core.nix @@ -3,27 +3,40 @@ , fetchPypi , git , spdx-license-list-data -, version, src }: -let - python = python3.override { - packageOverrides = self: super: { - starlette = super.starlette.overridePythonAttrs (oldAttrs: rec { - version = "0.20.0"; - src = fetchFromGitHub { - owner = "encode"; - repo = "starlette"; - rev = version; - sha256 = "sha256-bSgPjKqM262PSufz1LHwrdM+uU8xO55Mifv66HRN02Y="; - }; - }); - }; - }; -in -with python.pkgs; buildPythonApplication rec { +with python3.pkgs; buildPythonApplication rec { pname = "platformio"; - inherit version src; + + version = "6.1.6"; + + # pypi tarballs don't contain tests - https://github.com/platformio/platformio-core/issues/1964 + src = fetchFromGitHub { + owner = "platformio"; + repo = "platformio-core"; + rev = "v${version}"; + sha256 = "sha256-BEeMfdmAWqFbQUu8YKKrookQVgmhfZBqXnzeb2gfhms="; + }; + + outputs = [ "out" "udev" ]; + + patches = [ + ./fix-searchpath.patch + ./use-local-spdx-license-list.patch + ./missing-udev-rules-nixos.patch + ]; + + postPatch = '' + substitute platformio/package/manifest/schema.py platformio/package/manifest/schema.py \ + --subst-var-by SPDX_LICENSE_LIST_DATA '${spdx-license-list-data.json}' + + substituteInPlace setup.py \ + --replace 'aiofiles==%s" % ("0.8.0" if PY36 else "22.1.*")' 'aiofiles"' \ + --replace 'starlette==%s" % ("0.19.1" if PY36 else "0.23.*")' 'starlette"' \ + --replace 'uvicorn==%s" % ("0.16.0" if PY36 else "0.20.*")' 'uvicorn"' \ + --replace 'tabulate==%s" % ("0.8.10" if PY36 else "0.9.*")' 'tabulate>=0.8.10,<=0.9"' \ + --replace 'wsproto==%s" % ("1.0.0" if PY36 else "1.2.*")' 'wsproto"' + ''; propagatedBuildInputs = [ aiofiles @@ -47,15 +60,50 @@ with python.pkgs; buildPythonApplication rec { zeroconf ]; - HOME = "/tmp"; + preCheck = '' + export HOME=$(mktemp -d) + export PATH=$PATH:$out/bin + ''; - checkInputs = [ + nativeCheckInputs = [ jsondiff pytestCheckHook - tox ]; - pytestFlagsArray = (map (e: "--deselect tests/${e}") [ + # Install udev rules into a separate output so all of platformio-core is not a dependency if + # you want to use the udev rules on NixOS but not install platformio in your system packages. + postInstall = '' + mkdir -p $udev/lib/udev/rules.d + cp platformio/assets/system/99-platformio-udev.rules $udev/lib/udev/rules.d/99-platformio-udev.rules + ''; + + disabledTestPaths = [ + "tests/commands/pkg/test_install.py" + "tests/commands/pkg/test_list.py" + "tests/commands/pkg/test_outdated.py" + "tests/commands/pkg/test_search.py" + "tests/commands/pkg/test_show.py" + "tests/commands/pkg/test_uninstall.py" + "tests/commands/pkg/test_update.py" + "tests/commands/test_boards.py" + "tests/commands/test_check.py" + "tests/commands/test_platform.py" + "tests/commands/test_run.py" + "tests/commands/test_test.py" + "tests/misc/test_maintenance.py" + # requires internet connection + "tests/misc/ino2cpp/test_ino2cpp.py" + ]; + + disabledTests = [ + # requires internet connection + "test_api_cache" + "test_ping_internet_ips" + ]; + + pytestFlagsArray = [ + "tests" + ] ++ (map (e: "--deselect tests/${e}") [ "commands/pkg/test_exec.py::test_pkg_specified" "commands/pkg/test_exec.py::test_unrecognized_options" "commands/test_ci.py::test_ci_boards" @@ -112,43 +160,13 @@ with python.pkgs; buildPythonApplication rec { "test_misc.py::test_ping_internet_ips" "test_misc.py::test_platformio_cli" "test_pkgmanifest.py::test_packages" - ]) ++ (map (e: "--ignore=tests/${e}") [ - "commands/pkg/test_install.py" - "commands/pkg/test_list.py" - "commands/pkg/test_outdated.py" - "commands/pkg/test_search.py" - "commands/pkg/test_show.py" - "commands/pkg/test_uninstall.py" - "commands/pkg/test_update.py" - "commands/test_boards.py" - "commands/test_check.py" - "commands/test_platform.py" - "commands/test_run.py" - "commands/test_test.py" - "commands/test_update.py" - "test_ino2cpp.py" - "test_maintenance.py" - ]) ++ [ - "tests" - ]; - - patches = [ - ./fix-searchpath.patch - ./use-local-spdx-license-list.patch - ./missing-udev-rules-nixos.patch - ]; - - postPatch = '' - substitute platformio/package/manifest/schema.py platformio/package/manifest/schema.py \ - --subst-var-by SPDX_LICENSE_LIST_DATA '${spdx-license-list-data.json}' + ]); - substituteInPlace setup.py \ - --replace "wsproto==1.0.*" "wsproto" \ - --replace "zeroconf==0.38.*" "zeroconf" - ''; + passthru = { + python = python3; + }; meta = with lib; { - broken = stdenv.isAarch64; description = "An open source ecosystem for IoT development"; homepage = "https://platformio.org"; license = licenses.asl20; diff --git a/pkgs/development/embedded/platformio/default.nix b/pkgs/development/embedded/platformio/default.nix index 000c23898ff48..956d7dee06cd9 100644 --- a/pkgs/development/embedded/platformio/default.nix +++ b/pkgs/development/embedded/platformio/default.nix @@ -1,21 +1,13 @@ - -{ newScope, fetchFromGitHub }: +{ newScope, fetchFromGitHub, python3Packages }: let callPackage = newScope self; - version = "6.0.1"; - - # pypi tarballs don't contain tests - https://github.com/platformio/platformio-core/issues/1964 - src = fetchFromGitHub { - owner = "platformio"; - repo = "platformio-core"; - rev = "v${version}"; - sha256 = "sha256-noLdQctAaMNmfuxI3iybHFx3Q9aTr3gZaUZ+/uO+fnA="; - }; - self = { - platformio-chrootenv = callPackage ./chrootenv.nix { inherit version src; }; + platformio-core = python3Packages.callPackage ./core.nix { }; + + platformio-chrootenv = callPackage ./chrootenv.nix { }; }; -in self +in +self diff --git a/pkgs/development/embedded/platformio/missing-udev-rules-nixos.patch b/pkgs/development/embedded/platformio/missing-udev-rules-nixos.patch index 36af82245c532..4be06ceac8b1f 100644 --- a/pkgs/development/embedded/platformio/missing-udev-rules-nixos.patch +++ b/pkgs/development/embedded/platformio/missing-udev-rules-nixos.patch @@ -5,8 +5,6 @@ index ef1d3bab..445174fc 100644 @@ -57,6 +57,7 @@ class MissedUdevRules(InvalidUdevRules): MESSAGE = ( "Warning! Please install `99-platformio-udev.rules`. \nMore details: " - "https://docs.platformio.org/page/faq.html#platformio-udev-rules" -+ "On NixOS add the platformio package to services.udev.packages" + "https://docs.platformio.org/en/latest/core/installation/udev-rules.html" ++ "On NixOS add the platformio-core.udev package to services.udev.packages" ) - - diff --git a/pkgs/development/embedded/platformio/use-local-spdx-license-list.patch b/pkgs/development/embedded/platformio/use-local-spdx-license-list.patch index 65fcbd39d6a1d..6db8585a55f39 100644 --- a/pkgs/development/embedded/platformio/use-local-spdx-license-list.patch +++ b/pkgs/development/embedded/platformio/use-local-spdx-license-list.patch @@ -1,17 +1,23 @@ diff --git a/platformio/package/manifest/schema.py b/platformio/package/manifest/schema.py -index 416dccfd..896c3649 100644 +index 1e5f935a..26d1ac6a 100644 --- a/platformio/package/manifest/schema.py +++ b/platformio/package/manifest/schema.py -@@ -253,9 +253,6 @@ class ManifestSchema(BaseSchema): +@@ -276,9 +276,12 @@ class ManifestSchema(BaseSchema): @staticmethod @memoized(expire="1h") def load_spdx_licenses(): -- version = "3.17" +- version = "3.19" - spdx_data_url = ( - "https://raw.githubusercontent.com/spdx/license-list-data/" - "v%s/json/licenses.json" % version - ) - return json.loads(fetch_remote_content(spdx_data_url)) ++ # version = "3.19" ++ # spdx_data_url = ( ++ # "https://raw.githubusercontent.com/spdx/license-list-data/" ++ # "v%s/json/licenses.json" % version ++ # ) ++ # return json.loads(fetch_remote_content(spdx_data_url)) + with open("@SPDX_LICENSE_LIST_DATA@/json/licenses.json") as f: + spdx = json.load(f) + return spdx diff --git a/pkgs/development/embedded/stm32/stm32cubemx/default.nix b/pkgs/development/embedded/stm32/stm32cubemx/default.nix index c90abc1391dea..af496df582c1f 100644 --- a/pkgs/development/embedded/stm32/stm32cubemx/default.nix +++ b/pkgs/development/embedded/stm32/stm32cubemx/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, makeDesktopItem, copyDesktopItems, icoutils, fdupes, imagemagick, jdk11, fetchzip }: +{ lib, stdenv, makeDesktopItem, icoutils, fdupes, imagemagick, jdk11, fetchzip }: # TODO: JDK16 causes STM32CubeMX to crash right now, so we fixed the version to JDK11 # This may be fixed in a future version of STM32CubeMX. This issue has been reported to ST: # https://community.st.com/s/question/0D53W00000jnOzPSAU/stm32cubemx-crashes-on-launch-with-openjdk16 @@ -9,30 +9,36 @@ let in stdenv.mkDerivation rec { pname = "stm32cubemx"; - version = "6.5.0"; + version = "6.8.1"; src = fetchzip { url = "https://sw-center.st.com/packs/resource/library/stm32cube_mx_v${builtins.replaceStrings ["."] [""] version}-lin.zip"; - sha256 = "sha256-19RG+bJCmkaytMtDpDLbDvfKo27Z+Mo/sOrs8lOVV44="; + sha256 = "sha256-0WzdyRP09rRZzVZhwMOxA/SwHrQOYGBnv8UwvjMT22Q="; stripRoot = false; }; - nativeBuildInputs = [ icoutils fdupes imagemagick copyDesktopItems]; - desktopItems = [ - (makeDesktopItem { - name = "stm32CubeMX"; - exec = "stm32cubemx"; - desktopName = "STM32CubeMX"; - categories = [ "Development" ]; - comment = "STM32Cube initialization code generator"; - icon = "stm32cubemx"; - }) - ]; + nativeBuildInputs = [ icoutils fdupes imagemagick ]; + desktopItem = makeDesktopItem { + name = "STM32CubeMX"; + exec = "stm32cubemx"; + desktopName = "STM32CubeMX"; + categories = [ "Development" ]; + icon = "stm32cubemx"; + comment = meta.description; + terminal = false; + startupNotify = false; + mimeTypes = [ + "x-scheme-handler/sgnl" + "x-scheme-handler/signalcaptcha" + ]; + }; buildCommand = '' - mkdir -p $out/{bin,opt/STM32CubeMX} + mkdir -p $out/{bin,opt/STM32CubeMX,share/applications} + cp -r $src/MX/. $out/opt/STM32CubeMX/ chmod +rx $out/opt/STM32CubeMX/STM32CubeMX + cat << EOF > $out/bin/${pname} #!${stdenv.shell} ${jdk11}/bin/java -jar $out/opt/STM32CubeMX/STM32CubeMX @@ -52,6 +58,8 @@ stdenv.mkDerivation rec { $out/share/icons/hicolor/"$size"x"$size"/apps/${pname}.png fi done; + + cp ${desktopItem}/share/applications/*.desktop $out/share/applications ''; meta = with lib; { diff --git a/pkgs/development/embedded/stm8/stm8flash/default.nix b/pkgs/development/embedded/stm8/stm8flash/default.nix new file mode 100644 index 0000000000000..1584ee7fdf073 --- /dev/null +++ b/pkgs/development/embedded/stm8/stm8flash/default.nix @@ -0,0 +1,34 @@ +{ lib, stdenv, fetchFromGitHub, libusb1, pkg-config }: + +stdenv.mkDerivation rec { + pname = "stm8flash"; + version = "2022-03-27"; + + src = fetchFromGitHub { + owner = "vdudouyt"; + repo = "stm8flash"; + rev = "23305ce5adbb509c5cb668df31b0fd6c8759639c"; + sha256 = "sha256-fFoC2EKSmYyW2lqrdAh5A2WEtUMCenKse2ySJdNHu6w="; + }; + + strictDeps = true; + enableParallelBuilding = true; + + # NOTE: _FORTIFY_SOURCE requires compiling with optimization (-O) + env.NIX_CFLAGS_COMPILE = "-O"; + + preBuild = '' + export DESTDIR=$out; + ''; + + nativeBuildInputs = [ pkg-config ]; + buildInputs = [ libusb1 ]; + + meta = with lib; { + homepage = "https://github.com/vdudouyt/stm8flash"; + description = "A tool for flashing STM8 MCUs via ST-LINK (V1 and V2)"; + maintainers = with maintainers; [ pkharvey ]; + license = licenses.gpl2; + platforms = platforms.all; + }; +} diff --git a/pkgs/development/embedded/svdtools/default.nix b/pkgs/development/embedded/svdtools/default.nix new file mode 100644 index 0000000000000..ce55ed1bfd1b1 --- /dev/null +++ b/pkgs/development/embedded/svdtools/default.nix @@ -0,0 +1,24 @@ +{ lib +, rustPlatform +, fetchCrate +}: + +rustPlatform.buildRustPackage rec { + pname = "svdtools"; + version = "0.3.0"; + + src = fetchCrate { + inherit version pname; + hash = "sha256-B+G2HIGbuKeiys3bLR2U+P40TD8YpqzAb4oENNb8gYg="; + }; + + cargoHash = "sha256-W6/LZE98V1teiv9Wp9tsIqlY18MoMiNZ+fqTJ567xrg="; + + meta = with lib; { + description = "Tools to handle vendor-supplied, often buggy SVD files"; + homepage = "https://github.com/stm32-rs/svdtools"; + changelog = "https://github.com/stm32-rs/svdtools/blob/v${version}/CHANGELOG-rust.md"; + license = with licenses; [ asl20 /* or */ mit ]; + maintainers = with maintainers; [ newam ]; + }; +} diff --git a/pkgs/development/embedded/teensy-cmake-macros/default.nix b/pkgs/development/embedded/teensy-cmake-macros/default.nix new file mode 100644 index 0000000000000..7254becdbce70 --- /dev/null +++ b/pkgs/development/embedded/teensy-cmake-macros/default.nix @@ -0,0 +1,35 @@ +{ stdenv +, lib +, fetchFromGitHub +, cmake +, pkg-config +, callPackage +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "teensy-cmake-macros"; + version = "unstable-2023-04-15"; + + src = fetchFromGitHub { + owner = "newdigate"; + repo = "teensy-cmake-macros"; + rev = "dc401ed23e6e13a9db3cd2a65f611a4738df3b0e"; + hash = "sha256-E+BOlsCJtOScr3B5GSv1WM6rFv6cFYvm/iJ893fsmXM="; + }; + + propagatedBuildInputs = [ cmake pkg-config ]; + + passthru = { + hook = callPackage ./hook.nix { + teensy-cmake-macros = finalAttrs.finalPackage; + }; + }; + + meta = with lib; { + description = "CMake macros for building teensy projects"; + platforms = platforms.all; + homepage = "https://github.com/newdigate/teensy-cmake-macros"; + license = licenses.mit; + maintainers = [ maintainers.michaeldonovan ]; + }; +}) diff --git a/pkgs/development/embedded/teensy-cmake-macros/hook.nix b/pkgs/development/embedded/teensy-cmake-macros/hook.nix new file mode 100644 index 0000000000000..83a4e6828d4ae --- /dev/null +++ b/pkgs/development/embedded/teensy-cmake-macros/hook.nix @@ -0,0 +1,17 @@ +{ lib +, makeSetupHook +, teensy-cmake-macros +}: + +makeSetupHook { + name = "teensy-cmake-macros-hook"; + + propagatedBuildInputs = [ teensy-cmake-macros ]; + + passthru = { inherit teensy-cmake-macros; }; + + meta = { + description = "A setup hook for teensy-cmake-macros"; + inherit (teensy-cmake-macros.meta) maintainers platforms broken; + }; +} ./setup-hook.sh diff --git a/pkgs/development/embedded/teensy-cmake-macros/setup-hook.sh b/pkgs/development/embedded/teensy-cmake-macros/setup-hook.sh new file mode 100644 index 0000000000000..71026eedcf65e --- /dev/null +++ b/pkgs/development/embedded/teensy-cmake-macros/setup-hook.sh @@ -0,0 +1,5 @@ +teensyCMakeMacrosEnvHook() { + cmakeFlagsArray+=(-DCMAKE_MODULE_PATH=@out@/lib/cmake) +} + +addEnvHooks "$targetOffset" teensyCMakeMacrosEnvHook diff --git a/pkgs/development/embedded/teensy-loader-cli/default.nix b/pkgs/development/embedded/teensy-loader-cli/default.nix index ccae937702493..e8445a9955f22 100644 --- a/pkgs/development/embedded/teensy-loader-cli/default.nix +++ b/pkgs/development/embedded/teensy-loader-cli/default.nix @@ -6,15 +6,15 @@ , libusb-compat-0_1 }: -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "teensy-loader-cli"; - version = "2.1+unstable=2021-04-10"; + version = "2.2"; src = fetchFromGitHub { owner = "PaulStoffregen"; repo = "teensy_loader_cli"; - rev = "9dbbfa3b367b6c37e91e8a42dae3c6edfceccc4d"; - sha256 = "lQ1XtaWPr6nvE8NArD1980QVOH6NggO3FlfsntUjY7s="; + rev = finalAttrs.version; + sha256 = "sha256-C9Qhd6LhAES7X0sh4rofjAM+gxwuosahVQHeR76LyIo="; }; nativeBuildInputs = [ @@ -30,8 +30,8 @@ stdenv.mkDerivation rec { runHook preInstall install -Dm555 teensy_loader_cli $out/bin/teensy-loader-cli - install -Dm444 -t $out/share/doc/${pname} *.md *.txt - go-md2man -in README.md -out ${pname}.1 + install -Dm444 -t $out/share/doc/teensy-loader-cli *.md *.txt + go-md2man -in README.md -out teensy-loader-cli.1 installManPage *.1 runHook postInstall @@ -43,4 +43,4 @@ stdenv.mkDerivation rec { license = licenses.gpl3Only; platforms = platforms.unix; }; -} +}) diff --git a/pkgs/development/embedded/tytools/default.nix b/pkgs/development/embedded/tytools/default.nix index 23bab058c594d..1669ec239ac79 100644 --- a/pkgs/development/embedded/tytools/default.nix +++ b/pkgs/development/embedded/tytools/default.nix @@ -2,13 +2,13 @@ stdenv.mkDerivation rec { pname = "tytools"; - version = "0.9.7"; + version = "0.9.8"; src = fetchFromGitHub { owner = "Koromix"; repo = pname; rev = "v${version}"; - sha256 = "sha256-iF2XyWSBBCO23iY/ni+QlpgtOuWKN2JTMTz+9OLEadk="; + sha256 = "sha256-MKhh0ooDZI1Ks8vVuPRiHhpOqStetGaAhE2ulvBstxA="; }; nativeBuildInputs = [ cmake pkg-config wrapQtAppsHook ]; diff --git a/pkgs/development/embedded/uisp/default.nix b/pkgs/development/embedded/uisp/default.nix index 986a560ff6e8b..0ae31bc24fb2e 100644 --- a/pkgs/development/embedded/uisp/default.nix +++ b/pkgs/development/embedded/uisp/default.nix @@ -9,7 +9,7 @@ stdenv.mkDerivation rec { sha256 = "1bncxp5yxh9r1yrp04vvhfiva8livi1pwic7v8xj99q09zrwahvw"; }; - NIX_CFLAGS_COMPILE = "-Wno-error"; + env.NIX_CFLAGS_COMPILE = "-Wno-error"; meta = { description = "Tool for AVR microcontrollers which can interface to many hardware in-system programmers"; diff --git a/pkgs/development/embedded/wch-isp/default.nix b/pkgs/development/embedded/wch-isp/default.nix new file mode 100644 index 0000000000000..a08afa5729af7 --- /dev/null +++ b/pkgs/development/embedded/wch-isp/default.nix @@ -0,0 +1,27 @@ +{ lib, stdenv, fetchFromGitHub, pkg-config, libusb1 }: + +stdenv.mkDerivation rec { + pname = "wch-isp"; + version = "0.2.5"; + + src = fetchFromGitHub { + owner = "jmaselbas"; + repo = pname; + rev = "v${version}"; + hash = "sha256-JF1g2Qb1gG93lSaDQvltT6jCYk/dKntsIJPkQXYUvX4="; + }; + + nativeBuildInputs = [ pkg-config ]; + buildInputs = [ libusb1 ]; + + installFlags = [ "DESTDIR=$(out)" "PREFIX=" ]; + installTargets = [ "install" "install-rules" ]; + + meta = { + description = "Firmware programmer for WCH microcontrollers over USB"; + license = lib.licenses.gpl2Only; + homepage = "https://github.com/jmaselbas/wch-isp"; + maintainers = with lib.maintainers; [ lesuisse ]; + platforms = lib.platforms.unix; + }; +} diff --git a/pkgs/development/embedded/xc3sprog/default.nix b/pkgs/development/embedded/xc3sprog/default.nix index b9785bac7c5c4..393a11f8a4485 100644 --- a/pkgs/development/embedded/xc3sprog/default.nix +++ b/pkgs/development/embedded/xc3sprog/default.nix @@ -16,9 +16,14 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ cmake ]; buildInputs = [ libusb-compat-0_1 libftdi ]; + cmakeFlags = [ + # file RPATH_CHANGE could not write new RPATH + "-DCMAKE_SKIP_BUILD_RPATH=ON" + ]; + meta = with lib; { description = "Command-line tools for programming FPGAs, microcontrollers and PROMs via JTAG"; - homepage = "http://xc3sprog.sourceforge.net/"; + homepage = "https://xc3sprog.sourceforge.net/"; license = licenses.gpl2Plus; platforms = platforms.linux; maintainers = [ maintainers.bjornfor ]; |