about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/misc/sam-ba/default.nix
blob: 291063f43cb183f452b79f55d8802496a2bbb9fc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
{ lib, stdenv, fetchzip, glib, zlib, libglvnd, python3, autoPatchelfHook }:

stdenv.mkDerivation rec {
  version = "3.5";
  pname = "sam-ba";

  src = fetchzip {
    url = "https://ww1.microchip.com/downloads/en/DeviceDoc/sam-ba_${version}-linux_x86_64.tar.gz";
    sha256 = "1k0nbgyc98z94nphm2q7s82b274clfnayf4a2kv93l5594rzdbp1";
  };

  buildInputs = [
    glib
    libglvnd
    zlib

    (python3.withPackages (ps: [ps.pyserial]))
  ];

  nativeBuildInputs = [ autoPatchelfHook ];

  installPhase = ''
    runHook preInstall

    mkdir -p "$out/bin/" \
             "$out/opt/sam-ba/"
    cp -a . "$out/opt/sam-ba/"
    ln -sr "$out/opt/sam-ba/sam-ba" "$out/bin/"
    ln -sr "$out/opt/sam-ba/multi_sam-ba.py" "$out/bin/"

    runHook postInstall
  '';

  meta = with lib; {
    description = "Programming tools for Atmel SAM3/7/9 ARM-based microcontrollers";
    longDescription = ''
      Atmel SAM-BA software provides an open set of tools for programming the
      Atmel SAM3, SAM7 and SAM9 ARM-based microcontrollers.
    '';
    # Alternatively: https://www.microchip.com/en-us/development-tool/SAM-BA-In-system-Programmer
    homepage = "http://www.at91.com/linux4sam/bin/view/Linux4SAM/SoftwareTools";
    license = lib.licenses.gpl2Only;
    platforms = [ "x86_64-linux" ];
    maintainers = [ maintainers.bjornfor ];
  };
}