Skip to content

Commit

Permalink
gcc-arm-embedded-14: init at 14.2.rel1
Browse files Browse the repository at this point in the history
  • Loading branch information
mattkang committed Jan 13, 2025
1 parent 35d699a commit 5dab701
Showing 1 changed file with 94 additions and 0 deletions.
94 changes: 94 additions & 0 deletions pkgs/by-name/gc/gcc-arm-embedded-14/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
{
lib,
stdenv,
fetchurl,
ncurses5,
python39,
libxcrypt-legacy,
runtimeShell,
}:

stdenv.mkDerivation rec {
pname = "gcc-arm-embedded";
version = "14.2.rel1";

platform =
{
aarch64-darwin = "darwin-arm64";
aarch64-linux = "aarch64";
x86_64-darwin = "darwin-x86_64";
x86_64-linux = "x86_64";
}
.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");

src = fetchurl {
url = "https://developer.arm.com/-/media/Files/downloads/gnu/${version}/binrel/arm-gnu-toolchain-${version}-${platform}-arm-none-eabi.tar.xz";
# hashes obtained from location ${url}.sha256asc
sha256 =
{
aarch64-darwin = "c7c78ffab9bebfce91d99d3c24da6bf4b81c01e16cf551eb2ff9f25b9e0a3818";
aarch64-linux = "87330bab085dd8749d4ed0ad633674b9dc48b237b61069e3b481abd364d0a684";
x86_64-darwin = "2d9e717dd4f7751d18936ae1365d25916534105ebcb7583039eff1092b824505";
x86_64-linux = "62a63b981fe391a9cbad7ef51b17e49aeaa3e7b0d029b36ca1e9c3b2a9b78823";
}
.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
};

dontConfigure = true;
dontBuild = true;
dontPatchELF = true;
dontStrip = true;

installPhase = ''
mkdir -p $out
cp -r * $out
'';

preFixup = ''
find $out -type f | while read f; do
patchelf "$f" > /dev/null 2>&1 || continue
patchelf --set-interpreter $(cat ${stdenv.cc}/nix-support/dynamic-linker) "$f" || true
patchelf --set-rpath ${
lib.makeLibraryPath [
"$out"
stdenv.cc.cc
ncurses5
python39
libxcrypt-legacy
]
} "$f" || true
done
'';

postFixup = ''
mv $out/bin/arm-none-eabi-gdb $out/bin/arm-none-eabi-gdb-unwrapped
cat <<EOF > $out/bin/arm-none-eabi-gdb
#!${runtimeShell}
export PYTHONPATH=${python39}/lib/python3.9
export PYTHONHOME=${python39.interpreter}
exec $out/bin/arm-none-eabi-gdb-unwrapped "\$@"
EOF
chmod +x $out/bin/arm-none-eabi-gdb
'';

meta = with lib; {
description = "Pre-built GNU toolchain from ARM Cortex-M & Cortex-R processors";
homepage = "https://developer.arm.com/open-source/gnu-toolchain/gnu-rm";
license = with licenses; [
bsd2
gpl2
gpl3
lgpl21
lgpl3
mit
];
maintainers = with maintainers; [ mattkang ];
platforms = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
};
}

0 comments on commit 5dab701

Please sign in to comment.