"url": "https://git.libre-soc.org/git/nmigen-soc.git"
}
},
+ "openocd": {
+ "flake": false,
+ "locked": {
+ "allRefs": true,
+ "lastModified": 1632577048,
+ "narHash": "sha256-jL6CvgEFslg3V4WIH3irLgXQRa1HczBZowZhTztW7nM=",
+ "ref": "master",
+ "rev": "c3993d3188da5976a64f47d4cbf4d7e5b63f0c8d",
+ "revCount": 9294,
+ "submodules": true,
+ "type": "git",
+ "url": "https://github.com/openocd-org/openocd?rev=35eed36ffdd082f5abfc16d4cc93511f6e225284&allR"
+ },
+ "original": {
+ "allRefs": true,
+ "submodules": true,
+ "type": "git",
+ "url": "https://github.com/openocd-org/openocd?rev=35eed36ffdd082f5abfc16d4cc93511f6e225284&allR"
+ }
+ },
"root": {
"inputs": {
"c4m-jtag": "c4m-jtag",
"nixpkgs": "nixpkgs",
"nmigen": "nmigen",
"nmigen-soc": "nmigen-soc",
+ "openocd": "openocd",
"yosys": "yosys"
}
},
inputs.migen.flake = false;
inputs.yosys.url = "github:YosysHQ/yosys?rev=a58571d0fe8971cb7d3a619a31b2c21be6d75bac";
inputs.yosys.flake = false;
+ # submodules needed
inputs.nix-litex.url = "git+https://git.sr.ht/~lschuermann/nix-litex?ref=main";
inputs.nix-litex.flake = false;
in
{
overlay = final: prev: {
- python37Packages = prev.python37Packages.override {
- overrides = lib.composeExtensions (litex final).pythonOverlay (pfinal: pprev: {
+ python37 = prev.python37.override {
+ packageOverrides = lib.composeExtensions (litex final).pythonOverlay (pfinal: pprev: {
libresoc-ieee754fpu = pfinal.callPackage ./nix/ieee754fpu.nix {};
libresoc-openpower-isa = pfinal.callPackage ./nix/openpower-isa.nix {};
c4m-jtag = pfinal.callPackage (import ./nix/c4m-jtag.nix { src = c4m-jtag; version = getv c4m-jtag; }) {};
libresoc-pre-litex = final.callPackage (import ./nix/pre-litex.nix { version = getv self; }) { python3Packages = final.python37Packages; };
libresoc-ls180 = final.callPackage (import ./nix/ls180.nix { version = getv self; }) { python3Packages = final.python37Packages; };
libresoc-ecp5 = final.callPackage (import ./nix/ecp5.nix { version = getv self; }) { python3Packages = final.python37Packages; };
+ libresoc-ecp5-program = final.callPackage (import ./nix/ecp5-program.nix { version = getv self; }) { python3Packages = final.python37Packages; };
libresoc-pinmux = final.callPackage (import ./nix/pinmux.nix { version = getv self; }) {};
};
+ apps = forAllSystems (system: {
+ ecp5 = {
+ type = "app";
+ program = "${nixpkgsFor.${system}.libresoc-ecp5-program}";
+ };
+ });
+ defaultApp = forAllSystems (system: self.apps.${system}.ecp5);
+
packages = forAllSystems (system: {
soc = nixpkgsFor.${system}.python37Packages.libresoc-soc;
pre-litex = nixpkgsFor.${system}.libresoc-pre-litex;
pinmux = nixpkgsFor.${system}.libresoc-pinmux;
ls180 = nixpkgsFor.${system}.libresoc-ls180;
ecp5 = nixpkgsFor.${system}.libresoc-ecp5;
+ ecp5-program = nixpkgsFor.${system}.libresoc-ecp5-program;
openpower-isa = nixpkgsFor.${system}.python37Packages.libresoc-openpower-isa;
debugNixpkgs = nixpkgsFor.${system};
});
--- /dev/null
+{ version }:
+
+{ writeShellScript, openocd, python3Packages, libresoc-ecp5, yosys, libresoc-pre-litex, libresoc-pinmux, pkgsCross
+, nextpnr, trellis }:
+
+let
+ pythonWithEnv = python3Packages.python.withPackages (ps: with ps; [
+ requests migen libresoc-soc litex-boards litex litedram liteeth liteiclink litescope litesdcard
+ ]);
+in
+writeShellScript "program-ecp5-libresoc" ''
+ export PATH="${openocd}/bin:${pythonWithEnv}/bin:${trellis}/bin:${nextpnr}/bin:$PATH"
+
+ dir="$(mktemp -d)"
+ cd "$dir"
+ echo "$dir"
+
+ export PYTHONPATH="${../src/soc/litex/florent}:$PYTHONPATH"
+
+ python ${../src/soc/litex/florent/versa_ecp5.py} --sys-clk-freq=55e6 --load-from ${libresoc-ecp5}
+''