humpback-dds/shell.nix

56 lines
1.7 KiB
Nix
Raw Normal View History

2020-08-07 13:12:58 +08:00
let
mozillaOverlay = import (builtins.fetchTarball https://github.com/mozilla/nixpkgs-mozilla/archive/master.tar.gz);
pkgs = import <nixpkgs> {overlays = [mozillaOverlay];};
2020-08-07 13:12:58 +08:00
in with pkgs;
let
migen = callPackage ./nix/migen.nix {};
openocd = callPackage ./nix/openocd.nix {};
rustPlatform = callPackage ./nix/rustPlatform.nix {};
itm = callPackage ./nix/itm.nix {inherit rustPlatform;};
2020-08-07 13:12:58 +08:00
runOpenOcdBlock = writeShellScriptBin "run-openocd-block" ''
openocd -f openocd/openocd.cfg
'';
2020-08-07 13:12:58 +08:00
openocdFlash = writeShellScriptBin "openocd-flash" ''
openocd -f openocd/openocd.cfg -f openocd/main.cfg
'';
2020-09-16 17:45:41 +08:00
publishMqtt = writeShellScriptBin "publish-mqtt" ''
mosquitto_pub -h localhost -t $1 -m "$2" -d
'';
openOCDFlashCustomised = writeShellScriptBin "openocd-flash-customised" ''
2020-10-06 15:02:49 +08:00
python3 flash.py $1 $2 $3 $4
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
2020-12-18 17:45:42 +08:00
flash write_image flash_config.bin 0x081e0000 bin
reset run
shutdown"
'';
2020-09-23 12:31:10 +08:00
2020-08-07 13:12:58 +08:00
in
stdenv.mkDerivation {
name = "Humpback-DDS";
buildInputs = with rustPlatform.rust; [
(pkgs.python3.withPackages(ps: [ migen ]))
pkgs.yosys
pkgs.nextpnr
pkgs.icestorm
pkgs.gdb
pkgs.mosquitto
openocd
rustc
cargo
itm
runOpenOcdBlock
openocdFlash
publishMqtt
openOCDFlashCustomised
];
}