Add openocd with zephyr patches

This commit is contained in:
adisbladis 2024-02-09 13:56:59 +13:00
parent b816c29566
commit 0670f97ed1
1 changed files with 32 additions and 6 deletions

View File

@ -4,6 +4,10 @@
, lib , lib
, fetchurl , fetchurl
, python38 , python38
, newScope
, openocd
, autoreconfHook
, fetchFromGitHub
}: }:
let let
@ -32,7 +36,10 @@ let
}; };
in in
rec { lib.makeScope newScope (self: let
inherit (self) callPackage;
in {
# Zephyr/west Python environment. # Zephyr/west Python environment.
pythonEnv = callPackage ./python.nix { pythonEnv = callPackage ./python.nix {
inherit zephyr-src; inherit zephyr-src;
@ -101,11 +108,11 @@ rec {
# # SDK with all targets selected # # SDK with all targets selected
sdkFull = sdkFull =
let let
inherit (sdk.passthru) platform arch; inherit (self.sdk.passthru) platform arch;
mToolchain = builtins.match "toolchain_${platform}-${arch}_(.+)\.tar\.xz"; mToolchain = builtins.match "toolchain_${platform}-${arch}_(.+)\.tar\.xz";
allTargets = map (x: builtins.head (mToolchain x)) (builtins.filter (f: mToolchain f != null) (lib.attrNames sdk'.files)); allTargets = map (x: builtins.head (mToolchain x)) (builtins.filter (f: mToolchain f != null) (lib.attrNames sdk'.files));
in in
sdk.override { self.sdk.override {
targets = allTargets; targets = allTargets;
}; };
@ -147,13 +154,32 @@ rec {
}) })
sdkArgs; sdkArgs;
openocd-zephyr = openocd.overrideAttrs(old: let
pname = "openocd-zephyr";
version = "20220611";
in {
inherit pname version;
name = "${pname}-${version}";
nativeBuildInputs = old.nativeBuildInputs ++ [
autoreconfHook
];
src = fetchFromGitHub {
owner = "zephyrproject-rtos";
repo = "openocd";
rev = "b6f95a16c1360e347a06faf91befd122c0d15864";
hash = "sha256-NItD5vrFlm3vfma5DexRYpGDsrl7yLjgmskiXPpbYP8=";
};
});
# A variant of hosttools, but all tools are taken from nixpkgs. # A variant of hosttools, but all tools are taken from nixpkgs.
hosttools-nix = callPackage hosttools-nix = callPackage
({ stdenv ({ stdenv
, bossa , bossa
, dtc , dtc
, nettle , nettle
, openocd , openocd-zephyr
, qemu_full , qemu_full
, shared-mime-info , shared-mime-info
}: stdenv.mkDerivation { }: stdenv.mkDerivation {
@ -166,7 +192,7 @@ rec {
bossa bossa
dtc dtc
nettle nettle
openocd openocd-zephyr
qemu_full qemu_full
shared-mime-info shared-mime-info
]; ];
@ -176,4 +202,4 @@ rec {
''; '';
}) })
{ }; { };
} })