Pentatube controller in Rust with Blackpill STM32F103
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

default.nix 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. { # Use master branch of the overlay by default
  2. mozillaOverlay ? import (builtins.fetchTarball https://github.com/mozilla/nixpkgs-mozilla/archive/master.tar.gz),
  3. rustManifest ? builtins.fetchurl "https://static.rust-lang.org/dist/channel-rust-nightly.toml"
  4. }:
  5. let
  6. pkgs = import <nixpkgs> { overlays = [ mozillaOverlay ]; };
  7. in
  8. with pkgs;
  9. let
  10. targets = [
  11. "x86_64-unknown-linux-gnu"
  12. "thumbv6m-none-eabi"
  13. "thumbv7m-none-eabi"
  14. "thumbv7em-none-eabi"
  15. "thumbv7em-none-eabihf"
  16. ];
  17. rust =
  18. rustChannelOfTargets "nightly" null targets;
  19. rustPlatform = recurseIntoAttrs (makeRustPlatform {
  20. rustc = rust;
  21. cargo = rust;
  22. });
  23. openocd =
  24. stdenv.mkDerivation {
  25. name = "openocd-stlink-blackpill";
  26. buildInputs = [
  27. pkgs.openocd
  28. makeWrapper
  29. ];
  30. src = ./src;
  31. noBuild = true;
  32. installPhase =
  33. let
  34. openOcdFlags = [
  35. "-f" "${pkgs.openocd}/share/openocd/scripts/interface/stlink-v2-1.cfg"
  36. "-f" "${pkgs.openocd}/share/openocd/scripts/target/stm32f1x.cfg"
  37. "-c" "init"
  38. ];
  39. in ''
  40. mkdir -p $out/bin
  41. makeWrapper ${pkgs.openocd}/bin/openocd $out/bin/openocd-stlink-blackpill \
  42. --add-flags "${lib.escapeShellArgs openOcdFlags}"
  43. '';
  44. };
  45. in {
  46. inherit pkgs rustPlatform openocd;
  47. }