2021-03-23 11:11:11 +01:00
|
|
|
{ stdenv, lib, fetchFromGitHub, fetchpatch
|
2021-01-19 07:50:56 +01:00
|
|
|
, gcc-arm-embedded, libftdi1, libusb-compat-0_1, pkg-config
|
2021-03-25 10:52:10 +01:00
|
|
|
, python3
|
2017-06-15 01:43:16 +02:00
|
|
|
}:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-14 02:05:34 +02:00
|
|
|
pname = "blackmagic";
|
2020-08-09 10:46:01 +02:00
|
|
|
version = "unstable-2020-08-05";
|
2019-08-14 02:05:34 +02:00
|
|
|
# `git describe --always`
|
2020-08-09 10:46:01 +02:00
|
|
|
firmwareVersion = "v1.6.1-539-gdd74ec8";
|
2017-06-15 01:43:16 +02:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "blacksphere";
|
|
|
|
repo = "blackmagic";
|
2020-08-09 10:46:01 +02:00
|
|
|
rev = "dd74ec8e6f734302daa1ee361af88dfb5043f166";
|
|
|
|
sha256 = "18w8y64fs7wfdypa4vm3migk5w095z8nbd8qp795f322mf2bz281";
|
2017-06-15 01:43:16 +02:00
|
|
|
fetchSubmodules = true;
|
|
|
|
};
|
|
|
|
|
2021-03-23 11:11:11 +01:00
|
|
|
patches = [
|
|
|
|
# Fix deprecation warning with libftdi 1.5
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/blacksphere/blackmagic/commit/dea4be2539c5ea63836ec78dca08b52fa8b26ab5.patch";
|
|
|
|
sha256 = "0f81simij1wdhifsxaavalc6yxzagfbgwry969dbjmxqzvrsrds5";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2018-10-12 22:21:26 +02:00
|
|
|
nativeBuildInputs = [
|
2021-01-19 07:50:56 +01:00
|
|
|
gcc-arm-embedded pkg-config
|
2021-03-25 10:52:10 +01:00
|
|
|
python3
|
2018-10-12 22:21:26 +02:00
|
|
|
];
|
|
|
|
|
2017-06-15 01:43:16 +02:00
|
|
|
buildInputs = [
|
2019-08-14 02:05:34 +02:00
|
|
|
libftdi1
|
2020-04-28 05:29:39 +02:00
|
|
|
libusb-compat-0_1
|
2017-06-15 01:43:16 +02:00
|
|
|
];
|
|
|
|
|
2021-03-25 10:52:10 +01:00
|
|
|
strictDeps = true;
|
|
|
|
|
2017-06-15 01:43:16 +02:00
|
|
|
postPatch = ''
|
|
|
|
# Prevent calling out to `git' to generate a version number:
|
|
|
|
substituteInPlace src/Makefile \
|
2019-08-14 02:05:34 +02:00
|
|
|
--replace '$(shell git describe --always --dirty)' '${firmwareVersion}'
|
2017-06-15 01:43:16 +02:00
|
|
|
|
|
|
|
# Fix scripts that generate headers:
|
|
|
|
for f in $(find scripts libopencm3/scripts -type f); do
|
|
|
|
patchShebangs "$f"
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
|
|
|
buildPhase = "${stdenv.shell} ${./helper.sh}";
|
2021-02-16 23:24:33 +01:00
|
|
|
dontInstall = true;
|
2017-06-15 01:43:16 +02:00
|
|
|
|
2019-08-14 02:05:34 +02:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2017-06-15 01:43:16 +02:00
|
|
|
meta = {
|
|
|
|
description = "In-application debugger for ARM Cortex microcontrollers";
|
|
|
|
longDescription = ''
|
|
|
|
The Black Magic Probe is a modern, in-application debugging tool
|
|
|
|
for embedded microprocessors. It allows you to see what is going
|
|
|
|
on "inside" an application running on an embedded microprocessor
|
|
|
|
while it executes.
|
|
|
|
|
|
|
|
This package builds the firmware for all supported platforms,
|
|
|
|
placing them in separate directories under the firmware
|
|
|
|
directory. It also places the FTDI version of the blackmagic
|
|
|
|
executable in the bin directory.
|
|
|
|
'';
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "https://github.com/blacksphere/blackmagic";
|
2017-06-15 01:43:16 +02:00
|
|
|
license = licenses.gpl3Plus;
|
2020-02-01 18:40:01 +01:00
|
|
|
maintainers = with maintainers; [ pjones emily sorki ];
|
|
|
|
# fails on darwin with
|
|
|
|
# arm-none-eabi-gcc: error: unrecognized command line option '-iframework'
|
|
|
|
platforms = platforms.linux;
|
2017-06-15 01:43:16 +02:00
|
|
|
};
|
|
|
|
}
|