Add nix flakes support #2
49
flake.nix
49
flake.nix
@ -35,6 +35,49 @@
|
|||||||
cargo = rust;
|
cargo = rust;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
itm = rustPlatform.buildRustPackage rec {
|
||||||
|
version = "0.3.1";
|
||||||
|
pname = "itm";
|
||||||
|
|
||||||
|
src = pkgs.fetchFromGitHub {
|
||||||
|
owner = "rust-embedded";
|
||||||
|
repo = "itm";
|
||||||
|
rev = "v${version}";
|
||||||
|
sha256 = "sha256-UmWI3NOE8Lf8ICHOR8nNpbCP9+g3R8XHRX+nUJsH6pY=";
|
||||||
|
};
|
||||||
|
|
||||||
|
cargoPatches = [ ./itm-cargo-lock.patch ];
|
||||||
|
|||||||
|
cargoSha256 = "sha256-3odQabrzjFm5rTkeqZWDFLnculwGeB3gG71jNuCtqIo=";
|
||||||
|
nativeBuildInputs = [ pkgs.pkgconfig ];
|
||||||
|
|
||||||
|
doCheck = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
runOpenOcdBlock = pkgs.writeShellScriptBin "run-openocd-block" ''
|
||||||
|
openocd -f openocd/openocd.cfg
|
||||||
|
'';
|
||||||
|
|
||||||
|
openocdFlash = pkgs.writeShellScriptBin "openocd-flash" ''
|
||||||
|
openocd -f openocd/openocd.cfg -f openocd/main.cfg
|
||||||
|
'';
|
||||||
|
|
||||||
|
publishMqtt = pkgs.writeShellScriptBin "publish-mqtt" ''
|
||||||
|
mosquitto_pub -h localhost -t $1 -m "$2" -d
|
||||||
|
'';
|
||||||
|
|
||||||
|
openOCDFlashCustomised = pkgs.writeShellScriptBin "openocd-flash-customised" ''
|
||||||
|
python3 flash.py $@
|
||||||
|
openocd -f openocd/openocd.cfg \
|
||||||
|
-c "init
|
||||||
|
reset init
|
||||||
|
halt
|
||||||
|
stm32h7x mass_erase 1
|
||||||
|
flash write_image erase target/thumbv7em-none-eabihf/release/humpback-dds
|
||||||
|
flash write_image flash_config.bin 0x081e0000 bin
|
||||||
|
reset run
|
||||||
|
shutdown"
|
||||||
|
'';
|
||||||
|
|
||||||
humpback-dds = rustPlatform.buildRustPackage rec {
|
humpback-dds = rustPlatform.buildRustPackage rec {
|
||||||
name = "humpback-dds";
|
name = "humpback-dds";
|
||||||
version = "0.0.0";
|
version = "0.0.0";
|
||||||
@ -87,8 +130,12 @@
|
|||||||
buildInputs = with pkgs; [
|
buildInputs = with pkgs; [
|
||||||
rustPlatform.rust.rustc
|
rustPlatform.rust.rustc
|
||||||
rustPlatform.rust.cargo
|
rustPlatform.rust.cargo
|
||||||
openocd dfu-util
|
openocd dfu-util
|
||||||
yosys nextpnr icestorm
|
yosys nextpnr icestorm
|
||||||
|
gdb mosquitto
|
||||||
|
itm runOpenOcdBlock
|
||||||
|
openocdFlash publishMqtt
|
||||||
|
openOCDFlashCustomised
|
||||||
] ++ (with python3Packages; [
|
] ++ (with python3Packages; [
|
||||||
numpy matplotlib migen
|
numpy matplotlib migen
|
||||||
]);
|
]);
|
||||||
|
File diff suppressed because it is too large
Load Diff
21
nix/itm.nix
21
nix/itm.nix
@ -1,21 +0,0 @@
|
|||||||
{ stdenv, fetchFromGitHub, rustPlatform, pkgconfig }:
|
|
||||||
|
|
||||||
rustPlatform.buildRustPackage rec {
|
|
||||||
version = "0.3.1";
|
|
||||||
pname = "itm";
|
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
|
||||||
owner = "rust-embedded";
|
|
||||||
repo = "itm";
|
|
||||||
rev = "v${version}";
|
|
||||||
sha256 = "15pa0ydm19vz8p3wairpx3vqzc55rp4lgki143ybgw44sgf8hraj";
|
|
||||||
};
|
|
||||||
|
|
||||||
cargoPatches = [ ./itm-cargo-lock.patch ];
|
|
||||||
|
|
||||||
cargoSha256 = "1x2pagfxwhgxliygw7325qsg3ccn276f4slg9cql0sf1s304qj4g";
|
|
||||||
|
|
||||||
nativeBuildInputs = [ pkgconfig ];
|
|
||||||
|
|
||||||
doCheck = false;
|
|
||||||
}
|
|
@ -1,22 +0,0 @@
|
|||||||
{ stdenv, fetchFromGitHub, python3Packages }:
|
|
||||||
|
|
||||||
python3Packages.buildPythonPackage rec {
|
|
||||||
name = "migen";
|
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
|
||||||
owner = "m-labs";
|
|
||||||
repo = "migen";
|
|
||||||
rev = "7bc4eb1387b39159a74c1dbd1b820728e0bfbbaa";
|
|
||||||
sha256 = "039jk8y7f0vhr32svg3nd23i88c0bhws8ngxwk9bdznfxvhiy1h6";
|
|
||||||
fetchSubmodules = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
propagatedBuildInputs = with python3Packages; [ colorama ];
|
|
||||||
|
|
||||||
meta = with stdenv.lib; {
|
|
||||||
description = "A refreshed Python toolbox for building complex digital hardware";
|
|
||||||
homepage = "https://m-labs.hk";
|
|
||||||
license = licenses.bsd2;
|
|
||||||
maintainers = [ maintainers.sb0 ];
|
|
||||||
};
|
|
||||||
}
|
|
@ -1,66 +0,0 @@
|
|||||||
{ stdenv, lib, fetchgit, autoreconfHook,fetchpatch, libftdi1, libusb1, pkgconfig, hidapi }:
|
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
|
||||||
pname = "openocd";
|
|
||||||
version = "0.10.0-dev";
|
|
||||||
|
|
||||||
src = fetchgit {
|
|
||||||
url = "https://git.code.sf.net/p/openocd/code";
|
|
||||||
rev = "7c88e76a76588fa0e3ab645adfc46e8baff6a3e4";
|
|
||||||
sha256 = "04ia0rjyil5353dw4mmrmwpald6lqqliaypadp467421dvp0xv97";
|
|
||||||
fetchSubmodules = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
nativeBuildInputs = [ pkgconfig autoreconfHook];
|
|
||||||
buildInputs = [ libftdi1 libusb1 hidapi];
|
|
||||||
|
|
||||||
configureFlags = [
|
|
||||||
"--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")
|
|
||||||
"--enable-remote-bitbang"
|
|
||||||
];
|
|
||||||
|
|
||||||
NIX_CFLAGS_COMPILE = toString (lib.optionals stdenv.cc.isGNU [
|
|
||||||
"-Wno-implicit-fallthrough"
|
|
||||||
"-Wno-format-truncation"
|
|
||||||
"-Wno-format-overflow"
|
|
||||||
"-Wno-error=tautological-compare"
|
|
||||||
"-Wno-error=array-bounds"
|
|
||||||
"-Wno-error=cpp"
|
|
||||||
]);
|
|
||||||
|
|
||||||
postInstall = lib.optionalString stdenv.isLinux ''
|
|
||||||
mkdir -p "$out/etc/udev/rules.d"
|
|
||||||
rules="$out/share/openocd/contrib/60-openocd.rules"
|
|
||||||
if [ ! -f "$rules" ]; then
|
|
||||||
echo "$rules is missing, must update the Nix file."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
ln -s "$rules" "$out/etc/udev/rules.d/"
|
|
||||||
'';
|
|
||||||
|
|
||||||
meta = with lib; {
|
|
||||||
description = "Free and Open On-Chip Debugging, In-System Programming and Boundary-Scan Testing";
|
|
||||||
longDescription = ''
|
|
||||||
OpenOCD provides on-chip programming and debugging support with a layered
|
|
||||||
architecture of JTAG interface and TAP support, debug target support
|
|
||||||
(e.g. ARM, MIPS), and flash chip drivers (e.g. CFI, NAND, etc.). Several
|
|
||||||
network interfaces are available for interactiving with OpenOCD: HTTP,
|
|
||||||
telnet, TCL, and GDB. The GDB server enables OpenOCD to function as a
|
|
||||||
"remote target" for source-level debugging of embedded systems using the
|
|
||||||
GNU GDB program.
|
|
||||||
'';
|
|
||||||
homepage = "http://openocd.sourceforge.net/";
|
|
||||||
license = licenses.gpl2Plus;
|
|
||||||
maintainers = with maintainers; [ bjornfor ];
|
|
||||||
platforms = platforms.unix;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
@ -1,24 +0,0 @@
|
|||||||
{ recurseIntoAttrs, stdenv, lib,
|
|
||||||
makeRustPlatform, defaultCrateOverrides,
|
|
||||||
fetchurl, patchelf,
|
|
||||||
rustManifest ? ./channel-rust-nightly.toml
|
|
||||||
}:
|
|
||||||
|
|
||||||
let
|
|
||||||
targets = [
|
|
||||||
"thumbv7em-none-eabihf" # For ARM Cortex-M4 or M7 w/ FPU support
|
|
||||||
];
|
|
||||||
rustChannel =
|
|
||||||
lib.rustLib.fromManifestFile rustManifest {
|
|
||||||
inherit stdenv fetchurl patchelf;
|
|
||||||
};
|
|
||||||
rust =
|
|
||||||
rustChannel.rust.override {
|
|
||||||
inherit targets;
|
|
||||||
};
|
|
||||||
|
|
||||||
in
|
|
||||||
makeRustPlatform {
|
|
||||||
rustc = rust;
|
|
||||||
cargo = rust;
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user
Is this tested? AFAIK you need
"${self}/itm-cargo-lock.patch"
Either works, but it's the same principle as