You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

84 lines
2.6 KiB
Nix

{ lib
, stdenv
, curl
, pkgconfig
, libusb
, fetchgit
/*
# It is unclear whether upstream is authorized to redistribute the
# firmware, so we should not have cachix mirror them until that is
# clarified
, includeFirmware ? false
}
*/
}:
stdenv.mkDerivation rec {
name = "em100";
version = "unstable-2022may02-86631c9"; # upstream does not appear to have formal releases
src = fetchgit {
url = "https://review.coreboot.org/em100";
rev = "7cd8c935239ab63ea7dd583183d8144e38c42186";
hash = "sha256-zKRVhqNHtgVj6JDkTV+6GEjmM1FICqQr286uTXwUvpo=";
};
enableParallelBuilding = true;
nativeBuildInputs = [
pkgconfig
];
buildInputs = [
libusb
curl # for optionally downloading firmware images
];
installPhase = ''
mkdir -p $out/bin
install -m 750 em100 $out/bin/em100
mkdir -p $out/lib/udev/rules.d/
install -m 644 60-dediprog-em100pro.rules $out/lib/udev/rules.d/
'';
/*
postInstall = lib.optionalString includeFirmware ''
wrapProgram $out/bin/em100 $out/bin/em100 --set EM100_HOME ${passthru.firmware}
'';
passthru = {
firmware = import ./firmware.nix { lib, fetchurl };
}
*/
meta = with lib; {
homepage = "https://www.coreboot.org/EM100pro";
description = "Allows operating a Dediprog EM100Pro SPI NOR Flash Emulator";
longDescription = # copied from README
''
This tool supports using the Dediprog EM100-Pro [1] in Linux. It supports both
the original version and the new -G2 variant.
The 'em100' device provides a way to emulate a SPI-flash chip. Various
connectors are available to allow it to take over from the in-circuit SPI chip
so that the SoC sees the em100's internal memory as the contents of the SPI
flash. Images can be loaded into the em100 over USB in a few seconds, thus
providing a much faster development cycle than is possible by reprogramming
the SPI flash each time.
Major features provided by the tool include:
- Set the chip being emulated (the tool supports about 600)
- Adjust the state of the hold pin, which supports overriding the internal SPI
- Use of several em100 devices, distinguished by their serial number
- Terminal mode, allowing the SoC to send messages
- Output a trace of SPI commands issued by the SoC
- Reading / writing em100 firmware (dangerous as it can brick your em100)
[1] https://www.dediprog.com/product/EM100Pro-G2
'';
license = licenses.gpl2Plus;
sourceProvenance = [ ];
badPlatforms = [
# TODO: investigate
lib.systems.inspect.patterns.isMips64n32
];
};
}