Merge pull request #48286 from matthewbauer/avrgcc

avr: use new cross compilation infrastructure
This commit is contained in:
Matthew Bauer 2018-10-30 13:49:08 -05:00 committed by GitHub
commit a6fa5bd936
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
38 changed files with 362 additions and 530 deletions

View file

@ -32,6 +32,7 @@ rec {
else if final.isUClibc then "uclibc"
else if final.isAndroid then "bionic"
else if final.isLinux /* default */ then "glibc"
else if final.isAvr then "avrlibc"
# TODO(@Ericson2314) think more about other operating systems
else "native/impure";
extensions = {

View file

@ -99,6 +99,34 @@ rec {
riscv64 = riscv "64";
riscv32 = riscv "32";
avr = {
config = "avr";
};
arm-embedded = {
config = "arm-none-eabi";
libc = "newlib";
};
aarch64-embedded = {
config = "aarch64-none-elf";
libc = "newlib";
};
ppc-embedded = {
config = "powerpc-none-eabi";
libc = "newlib";
};
i686-embedded = {
config = "i686-elf";
libc = "newlib";
};
x86_64-embedded = {
config = "x86_64-elf";
libc = "newlib";
};
#
# Darwin

View file

@ -19,6 +19,7 @@ rec {
isRiscV = { cpu = { family = "riscv"; }; };
isSparc = { cpu = { family = "sparc"; }; };
isWasm = { cpu = { family = "wasm"; }; };
isAvr = { cpu = { family = "avr"; }; };
is32bit = { cpu = { bits = 32; }; };
is64bit = { cpu = { bits = 64; }; };

View file

@ -101,6 +101,8 @@ rec {
wasm32 = { bits = 32; significantByte = littleEndian; family = "wasm"; };
wasm64 = { bits = 64; significantByte = littleEndian; family = "wasm"; };
avr = { bits = 8; family = "avr"; };
};
################################################################################
@ -117,6 +119,7 @@ rec {
apple = {};
pc = {};
none = {};
unknown = {};
};
@ -200,6 +203,7 @@ rec {
cygnus = {};
msvc = {};
eabi = {};
elf = {};
androideabi = {};
android = {
@ -255,9 +259,16 @@ rec {
setType "system" components;
mkSkeletonFromList = l: {
"1" = if elemAt l 0 == "avr"
then { cpu = elemAt l 0; kernel = "none"; abi = "unknown"; }
else throw "Target specification with 1 components is ambiguous";
"2" = # We only do 2-part hacks for things Nix already supports
if elemAt l 1 == "cygwin"
then { cpu = elemAt l 0; kernel = "windows"; abi = "cygnus"; }
else if (elemAt l 1 == "eabi")
then { cpu = elemAt l 0; vendor = "none"; kernel = "none"; abi = elemAt l 1; }
else if (elemAt l 1 == "elf")
then { cpu = elemAt l 0; vendor = "none"; kernel = "none"; abi = elemAt l 1; }
else { cpu = elemAt l 0; kernel = elemAt l 1; };
"3" = # Awkwards hacks, beware!
if elemAt l 1 == "apple"
@ -268,6 +279,10 @@ rec {
then { cpu = elemAt l 0; vendor = elemAt l 1; kernel = "windows"; abi = "gnu"; }
else if hasPrefix "netbsd" (elemAt l 2)
then { cpu = elemAt l 0; vendor = elemAt l 1; kernel = elemAt l 2; }
else if (elemAt l 2 == "eabi")
then { cpu = elemAt l 0; vendor = elemAt l 1; kernel = "none"; abi = elemAt l 2; }
else if (elemAt l 2 == "elf")
then { cpu = elemAt l 0; vendor = elemAt l 1; kernel = "none"; abi = elemAt l 2; }
else throw "Target specification with 3 components is ambiguous";
"4" = { cpu = elemAt l 0; vendor = elemAt l 1; kernel = elemAt l 2; abi = elemAt l 3; };
}.${toString (length l)}

View file

@ -1,5 +1,6 @@
{ stdenv, fetchFromGitHub, fetchurl, makeWrapper, unzip
, gnumake, gcc-arm-embedded, dfu-util-axoloti, jdk, ant, libfaketime }:
, gnumake, gcc-arm-embedded, binutils-arm-embedded
, dfu-util-axoloti, jdk, ant, libfaketime }:
stdenv.mkDerivation rec {
version = "1.0.12-2";
@ -20,7 +21,15 @@ stdenv.mkDerivation rec {
sha256 = "0lb5s8pkj80mqhsy47mmq0lqk34s2a2m3xagzihalvabwd0frhlj";
};
buildInputs = [ makeWrapper unzip gcc-arm-embedded dfu-util-axoloti jdk ant libfaketime ];
nativeBuildInputs = [
makeWrapper
unzip
gcc-arm-embedded
binutils-arm-embedded
dfu-util-axoloti
ant
];
buildInputs = [jdk libfaketime ];
patchPhase = ''
unzip ${chibios}

View file

@ -1,4 +1,4 @@
{ stdenv, fetchurl, unzip, mono, avrbinutils, avrgcc, avrdude, gtk2, xdg_utils }:
{ stdenv, fetchurl, unzip, mono, avrdude, gtk2, xdg_utils }:
stdenv.mkDerivation rec {
name = "avrdudess-2.2.20140102";
@ -23,7 +23,7 @@ stdenv.mkDerivation rec {
export LD_LIBRARY_PATH="${stdenv.lib.makeLibraryPath [gtk2 mono]}"
# We need PATH from user env for xdg-open to find its tools, which
# typically depend on the currently running desktop environment.
export PATH="${stdenv.lib.makeBinPath [ avrgcc avrbinutils avrdude xdg_utils ]}:\$PATH"
export PATH="${stdenv.lib.makeBinPath [ avrdude xdg_utils ]}:\$PATH"
# avrdudess must have its resource files in its current working directory
cd $out/avrdudess && exec ${mono}/bin/mono "$out/avrdudess/avrdudess.exe" "\$@"

View file

@ -1,5 +1,5 @@
{ stdenv, fetchFromGitHub
, cmake, gcc-arm-embedded, python
, cmake, gcc-arm-embedded, binutils-arm-embedded, python
, qt5, SDL, gmock
, dfu-util, avrdude
}:
@ -21,10 +21,12 @@ in stdenv.mkDerivation {
enableParallelBuilding = true;
nativeBuildInputs = [ cmake ];
nativeBuildInputs = [
cmake
gcc-arm-embedded binutils-arm-embedded
];
buildInputs = with qt5; [
gcc-arm-embedded
python python.pkgs.pyqt4
qtbase qtmultimedia qttranslations
SDL gmock

View file

@ -186,6 +186,7 @@ stdenv.mkDerivation {
}.${targetPlatform.parsed.cpu.name}
else if targetPlatform.isPower then if targetPlatform.isBigEndian then "ppc" else "lppc"
else if targetPlatform.isSparc then "sparc"
else if targetPlatform.isAvr then "avr"
else throw "unknown emulation for platform: " + targetPlatform.config;
in targetPlatform.platform.bfdEmulation or (fmt + sep + arch);
@ -209,7 +210,7 @@ stdenv.mkDerivation {
## General libc support
##
echo "-L${libc_lib}/lib" > $out/nix-support/libc-ldflags
echo "-L${libc_lib}${libc.libdir or "/lib"}" > $out/nix-support/libc-ldflags
echo "${libc_lib}" > $out/nix-support/orig-libc
echo "${libc_dev}" > $out/nix-support/orig-libc-dev
@ -292,6 +293,16 @@ stdenv.mkDerivation {
hardening_unsupported_flags+=" pic"
''
+ optionalString targetPlatform.isAvr ''
hardening_unsupported_flags+=" relro bindnow"
''
+ optionalString (libc != null && targetPlatform.isAvr) ''
for isa in avr5 avr3 avr4 avr6 avr25 avr31 avr35 avr51 avrxmega2 avrxmega4 avrxmega5 avrxmega6 avrxmega7 tiny-stack; do
echo "-L${getLib libc}/avr/lib/$isa" >> $out/nix-support/libc-cflags
done
''
+ ''
set +u
substituteAll ${./add-flags.sh} $out/nix-support/add-flags.sh

View file

@ -232,7 +232,7 @@ stdenv.mkDerivation {
# compile, because it uses "#include_next <limits.h>" to find the
# limits.h file in ../includes-fixed. To remedy the problem,
# another -idirafter is necessary to add that directory again.
echo "-B${libc_lib}/lib/ -idirafter ${libc_dev}/include ${optionalString isGNU "-idirafter ${cc}/lib/gcc/*/*/include-fixed"}" > $out/nix-support/libc-cflags
echo "-B${libc_lib}${libc.libdir or "/lib/"} -idirafter ${libc_dev}${libc.incdir or "/include"} ${optionalString isGNU "-idirafter ${cc}/lib/gcc/*/*/include-fixed"}" > $out/nix-support/libc-cflags
echo "${libc_lib}" > $out/nix-support/orig-libc
echo "${libc_dev}" > $out/nix-support/orig-libc-dev
@ -284,6 +284,20 @@ stdenv.mkDerivation {
hardening_unsupported_flags+=" stackprotector"
''
+ optionalString targetPlatform.isAvr ''
hardening_unsupported_flags+=" stackprotector pic"
''
+ optionalString (targetPlatform.libc == "newlib") ''
hardening_unsupported_flags+=" stackprotector fortify pie pic"
''
+ optionalString (libc != null && targetPlatform.isAvr) ''
for isa in avr5 avr3 avr4 avr6 avr25 avr31 avr35 avr51 avrxmega2 avrxmega4 avrxmega5 avrxmega6 avrxmega7 tiny-stack; do
echo "-B${getLib libc}/avr/lib/$isa" >> $out/nix-support/libc-cflags
done
''
+ ''
substituteAll ${./add-flags.sh} $out/nix-support/add-flags.sh
substituteAll ${./add-hardening.sh} $out/nix-support/add-hardening.sh

View file

@ -1,45 +0,0 @@
{ stdenv, fetchurl, ncurses5, python27 }:
stdenv.mkDerivation rec {
name = "gcc-arm-embedded-${version}";
version = "6-2017-q2-update";
subdir = "6-2017q2";
platformString =
if stdenv.isLinux then "linux"
else if stdenv.isDarwin then "mac"
else throw "unsupported platform";
urlString = "https://developer.arm.com/-/media/Files/downloads/gnu-rm/${subdir}/gcc-arm-none-eabi-${version}-${platformString}.tar.bz2";
src =
if stdenv.isLinux then fetchurl { url=urlString; sha256="1hvwi02mx34al525sngnl0cm7dkmzxfkb1brq9kvbv28wcplp3p6"; }
else if stdenv.isDarwin then fetchurl { url=urlString; sha256="0019ylpq4inq7p5gydpmc9m8ni72fz2csrjlqmgx1698998q0c3x"; }
else throw "unsupported platform";
phases = [ "unpackPhase" "installPhase" "fixupPhase" ];
installPhase = ''
mkdir -p $out
cp -r * $out
'';
dontPatchELF = true;
dontStrip = true;
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 ${stdenv.lib.makeLibraryPath [ "$out" stdenv.cc.cc ncurses5 python27 ]} "$f" || true
done
'';
meta = {
description = "Pre-built GNU toolchain from ARM Cortex-M & Cortex-R processors (Cortex-M0/M0+/M3/M4/M7, Cortex-R4/R5/R7/R8)";
homepage = https://developer.arm.com/open-source/gnu-toolchain/gnu-rm;
license = with stdenv.lib.licenses; [ bsd2 gpl2 gpl3 lgpl21 lgpl3 mit ];
maintainers = with stdenv.lib.maintainers; [ vinymeuh ];
platforms = with stdenv.lib.platforms; linux ++ darwin;
};
}

View file

@ -1,39 +0,0 @@
{ stdenv, lib, fetchurl, ncurses5, python27 }:
with lib;
stdenv.mkDerivation rec {
name = "gcc-arm-embedded-${version}";
version = "7-2018-q2-update";
subdir = "7-2018q2";
urlString = "https://developer.arm.com/-/media/Files/downloads/gnu-rm/${subdir}/gcc-arm-none-eabi-${version}-linux.tar.bz2";
src = fetchurl { url=urlString; sha256="0sgysp3hfpgrkcbfiwkp0a7ymqs02khfbrjabm52b5z61sgi05xv"; };
phases = [ "unpackPhase" "installPhase" "fixupPhase" ];
installPhase = ''
mkdir -p $out
cp -r * $out
'';
dontPatchELF = true;
dontStrip = true;
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 ${stdenv.lib.makeLibraryPath [ "$out" stdenv.cc.cc ncurses5 python27 ]} "$f" || true
done
'';
meta = {
description = "Pre-built GNU toolchain from ARM Cortex-M & Cortex-R processors (Cortex-M0/M0+/M3/M4/M7, Cortex-R4/R5/R7/R8)";
homepage = https://developer.arm.com/open-source/gnu-toolchain/gnu-rm;
license = with licenses; [ bsd2 gpl2 gpl3 lgpl21 lgpl3 mit ];
maintainers = with maintainers; [ prusnak ];
platforms = platforms.linux;
};
}

View file

@ -1,50 +0,0 @@
{ stdenv, bzip2, patchelf, glibc, gcc, fetchurl, version, releaseType, sha256, ncurses
, dirName ? null, subdirName ? null }:
with stdenv.lib;
let
versionParts = splitString "-" version; # 4.7 2013q3 20130916
majorVersion = elemAt versionParts 0; # 4.7
yearQuarter = elemAt versionParts 1; # 2013q3
underscoreVersion = replaceChars ["."] ["_"] version; # 4_7-2013q3-20130916
yearQuarterParts = splitString "q" yearQuarter; # 2013 3
year = elemAt yearQuarterParts 0; # 2013
quarter = elemAt yearQuarterParts 1; # 3
dirName_ = if dirName != null then dirName else majorVersion;
subdirName_ = if subdirName != null then subdirName
else "${majorVersion}-${year}-q${quarter}-${releaseType}"; # 4.7-2013-q3-update
in
stdenv.mkDerivation {
name = "gcc-arm-embedded-${version}";
src = fetchurl {
url = "https://launchpad.net/gcc-arm-embedded/${dirName_}/${subdirName_}/+download/gcc-arm-none-eabi-${underscoreVersion}-linux.tar.bz2";
sha256 = sha256;
};
nativeBuildInputs = [ bzip2 patchelf ];
dontPatchELF = true;
phases = "unpackPhase patchPhase installPhase";
installPhase = ''
mkdir -pv $out
cp -r ./* $out
for f in $(find $out); do
if [ -f "$f" ] && patchelf "$f" 2> /dev/null; then
patchelf --set-interpreter ${getLib glibc}/lib/ld-linux.so.2 \
--set-rpath ${stdenv.lib.makeLibraryPath [ "$out" gcc ncurses ]} \
"$f" || true
fi
done
'';
meta = with stdenv.lib; {
description = "Pre-built GNU toolchain from ARM Cortex-M & Cortex-R processors (Cortex-M0/M0+/M3/M4, Cortex-R4/R5/R7)";
homepage = https://launchpad.net/gcc-arm-embedded;
license = with licenses; [ bsd2 gpl2 gpl3 lgpl21 lgpl3 mit ];
maintainers = [ maintainers.rasendubi ];
platforms = platforms.linux;
};
}

View file

@ -130,7 +130,7 @@ let version = "4.8.5";
"--disable-libmpx" # requires libc
] else [
(if crossDarwin then "--with-sysroot=${getLib libcCross}/share/sysroot"
else "--with-headers=${getDev libcCross}/include")
else "--with-headers=${getDev libcCross}${libcCross.incdir or "/include"}")
"--enable-__cxa_atexit"
"--enable-long-long"
] ++
@ -148,10 +148,15 @@ let version = "4.8.5";
# In uclibc cases, libgomp needs an additional '-ldl'
# and as I don't know how to pass it, I disable libgomp.
"--disable-libgomp"
] ++ [
"--enable-threads=posix"
"--enable-nls"
"--disable-decimal-float" # No final libdecnumber (it may work only in 386)
]
++ optional (targetPlatform.libc == "newlib") "--with-newlib"
++ optional (targetPlatform.libc == "avrlibc") "--with-avrlibc"
++ [
"--enable-threads=${if targetPlatform.isUnix then "posix"
else if targetPlatform.isWindows then "win32"
else "single"}"
"--enable-nls"
"--disable-decimal-float" # No final libdecnumber (it may work only in 386)
]));
stageNameAddon = if crossStageStatic then "-stage-static" else "-stage-final";
crossNameAddon = if targetPlatform != hostPlatform then "${targetPlatform.config}${stageNameAddon}-" else "";
@ -270,7 +275,7 @@ stdenv.mkDerivation ({
}"
] ++
(if enableMultilib
(if (enableMultilib || targetPlatform.isAvr)
then ["--enable-multilib" "--disable-libquadmath"]
else ["--disable-multilib"]) ++
optional (!enableShared) "--disable-shared" ++
@ -360,20 +365,20 @@ stdenv.mkDerivation ({
EXTRA_TARGET_FLAGS = optionals
(targetPlatform != hostPlatform && libcCross != null)
([
"-idirafter ${libcCross.dev}/include"
"-idirafter ${getDev libcCross}${libcCross.incdir or "/include"}"
] ++ optionals (! crossStageStatic) [
"-B${libcCross.out}/lib"
"-B${libcCross.out}${libcCross.libdir or "/lib"}"
]);
EXTRA_TARGET_LDFLAGS = optionals
(targetPlatform != hostPlatform && libcCross != null)
([
"-Wl,-L${libcCross.out}/lib"
"-Wl,-L${libcCross.out}${libcCross.libdir or "/lib"}"
] ++ (if crossStageStatic then [
"-B${libcCross.out}/lib"
"-B${libcCross.out}${libcCross.libdir or "/lib"}"
] else [
"-Wl,-rpath,${libcCross.out}/lib"
"-Wl,-rpath-link,${libcCross.out}/lib"
"-Wl,-rpath,${libcCross.out}${libcCross.libdir or "/lib"}"
"-Wl,-rpath-link,${libcCross.out}${libcCross.libdir or "/lib"}"
]));
passthru = {

View file

@ -135,7 +135,7 @@ let version = "4.9.4";
"--disable-libmpx" # requires libc
] else [
(if crossDarwin then "--with-sysroot=${getLib libcCross}/share/sysroot"
else "--with-headers=${getDev libcCross}/include")
else "--with-headers=${getDev libcCross}${libcCross.incdir or "/include"}")
"--enable-__cxa_atexit"
"--enable-long-long"
] ++
@ -156,10 +156,15 @@ let version = "4.9.4";
# In uclibc cases, libgomp needs an additional '-ldl'
# and as I don't know how to pass it, I disable libgomp.
"--disable-libgomp"
] ++ [
"--enable-threads=posix"
"--enable-nls"
"--disable-decimal-float" # No final libdecnumber (it may work only in 386)
]
++ optional (targetPlatform.libc == "newlib") "--with-newlib"
++ optional (targetPlatform.libc == "avrlibc") "--with-avrlibc"
++ [
"--enable-threads=${if targetPlatform.isUnix then "posix"
else if targetPlatform.isWindows then "win32"
else "single"}"
"--enable-nls"
"--disable-decimal-float" # No final libdecnumber (it may work only in 386)
]));
stageNameAddon = if crossStageStatic then "-stage-static" else "-stage-final";
crossNameAddon = if targetPlatform != hostPlatform then "${targetPlatform.config}${stageNameAddon}-" else "";
@ -292,7 +297,7 @@ stdenv.mkDerivation ({
}"
] ++
(if enableMultilib
(if (enableMultilib || targetPlatform.isAvr)
then ["--enable-multilib" "--disable-libquadmath"]
else ["--disable-multilib"]) ++
optional (!enableShared) "--disable-shared" ++
@ -381,20 +386,20 @@ stdenv.mkDerivation ({
EXTRA_TARGET_FLAGS = optionals
(targetPlatform != hostPlatform && libcCross != null)
([
"-idirafter ${getDev libcCross}/include"
"-idirafter ${getDev libcCross}${libcCross.incdir or "/include"}"
] ++ optionals (! crossStageStatic) [
"-B${libcCross.out}/lib"
"-B${libcCross.out}${libcCross.libdir or "/lib"}"
]);
EXTRA_TARGET_LDFLAGS = optionals
(targetPlatform != hostPlatform && libcCross != null)
([
"-Wl,-L${libcCross.out}/lib"
"-Wl,-L${libcCross.out}${libcCross.libdir or "/lib"}"
] ++ (if crossStageStatic then [
"-B${libcCross.out}/lib"
"-B${libcCross.out}${libcCross.libdir or "/lib"}"
] else [
"-Wl,-rpath,${libcCross.out}/lib"
"-Wl,-rpath-link,${libcCross.out}/lib"
"-Wl,-rpath,${libcCross.out}${libcCross.libdir or "/lib"}"
"-Wl,-rpath-link,${libcCross.out}${libcCross.libdir or "/lib"}"
]));
passthru =

View file

@ -122,7 +122,7 @@ let version = "5.5.0";
"--disable-libmpx" # requires libc
] else [
(if crossDarwin then "--with-sysroot=${getLib libcCross}/share/sysroot"
else "--with-headers=${getDev libcCross}/include")
else "--with-headers=${getDev libcCross}${libcCross.incdir or "/include"}")
"--enable-__cxa_atexit"
"--enable-long-long"
] ++
@ -143,10 +143,15 @@ let version = "5.5.0";
# In uclibc cases, libgomp needs an additional '-ldl'
# and as I don't know how to pass it, I disable libgomp.
"--disable-libgomp"
] ++ [
"--enable-threads=posix"
"--enable-nls"
"--disable-decimal-float" # No final libdecnumber (it may work only in 386)
]
++ optional (targetPlatform.libc == "newlib") "--with-newlib"
++ optional (targetPlatform.libc == "avrlibc") "--with-avrlibc"
++ [
"--enable-threads=${if targetPlatform.isUnix then "posix"
else if targetPlatform.isWindows then "win32"
else "single"}"
"--enable-nls"
"--disable-decimal-float" # No final libdecnumber (it may work only in 386)
]));
stageNameAddon = if crossStageStatic then "-stage-static" else "-stage-final";
crossNameAddon = if targetPlatform != hostPlatform then "${targetPlatform.config}${stageNameAddon}-" else "";
@ -296,7 +301,7 @@ stdenv.mkDerivation ({
}"
] ++
(if enableMultilib
(if (enableMultilib || targetPlatform.isAvr)
then ["--enable-multilib" "--disable-libquadmath"]
else ["--disable-multilib"]) ++
optional (!enableShared) "--disable-shared" ++
@ -387,20 +392,20 @@ stdenv.mkDerivation ({
EXTRA_TARGET_FLAGS = optionals
(targetPlatform != hostPlatform && libcCross != null)
([
"-idirafter ${getDev libcCross}/include"
"-idirafter ${getDev libcCross}${libcCross.incdir or "/include"}"
] ++ optionals (! crossStageStatic) [
"-B${libcCross.out}/lib"
"-B${libcCross.out}${libcCross.libdir or "/lib"}"
]);
EXTRA_TARGET_LDFLAGS = optionals
(targetPlatform != hostPlatform && libcCross != null)
([
"-Wl,-L${libcCross.out}/lib"
"-Wl,-L${libcCross.out}${libcCross.libdir or "/lib"}"
] ++ (if crossStageStatic then [
"-B${libcCross.out}/lib"
"-B${libcCross.out}${libcCross.libdir or "/lib"}"
] else [
"-Wl,-rpath,${libcCross.out}/lib"
"-Wl,-rpath-link,${libcCross.out}/lib"
"-Wl,-rpath,${libcCross.out}${libcCross.libdir or "/lib"}"
"-Wl,-rpath-link,${libcCross.out}${libcCross.libdir or "/lib"}"
]));
passthru =

View file

@ -120,7 +120,7 @@ let version = "6.4.0";
"--disable-libmpx" # requires libc
] else [
(if crossDarwin then "--with-sysroot=${getLib libcCross}/share/sysroot"
else "--with-headers=${getDev libcCross}/include")
else "--with-headers=${getDev libcCross}${libcCross.incdir or "/include"}")
"--enable-__cxa_atexit"
"--enable-long-long"
] ++
@ -143,10 +143,15 @@ let version = "6.4.0";
"--disable-libgomp"
# musl at least, disable: https://git.buildroot.net/buildroot/commit/?id=873d4019f7fb00f6a80592224236b3ba7d657865
"--disable-libmpx"
] ++ [
"--enable-threads=posix"
"--enable-nls"
"--disable-decimal-float" # No final libdecnumber (it may work only in 386)
]
++ optional (targetPlatform.libc == "newlib") "--with-newlib"
++ optional (targetPlatform.libc == "avrlibc") "--with-avrlibc"
++ [
"--enable-threads=${if targetPlatform.isUnix then "posix"
else if targetPlatform.isWindows then "win32"
else "single"}"
"--enable-nls"
"--disable-decimal-float" # No final libdecnumber (it may work only in 386)
]));
stageNameAddon = if crossStageStatic then "-stage-static" else "-stage-final";
crossNameAddon = if targetPlatform != hostPlatform then "${targetPlatform.config}${stageNameAddon}-" else "";
@ -301,7 +306,7 @@ stdenv.mkDerivation ({
}"
] ++
(if enableMultilib
(if (enableMultilib || targetPlatform.isAvr)
then ["--enable-multilib" "--disable-libquadmath"]
else ["--disable-multilib"]) ++
optional (!enableShared) "--disable-shared" ++
@ -391,20 +396,20 @@ stdenv.mkDerivation ({
EXTRA_TARGET_FLAGS = optionals
(targetPlatform != hostPlatform && libcCross != null)
([
"-idirafter ${getDev libcCross}/include"
"-idirafter ${getDev libcCross}${libcCross.incdir or "/include"}"
] ++ optionals (! crossStageStatic) [
"-B${libcCross.out}/lib"
"-B${libcCross.out}${libcCross.libdir or "/lib"}"
]);
EXTRA_TARGET_LDFLAGS = optionals
(targetPlatform != hostPlatform && libcCross != null)
([
"-Wl,-L${libcCross.out}/lib"
"-Wl,-L${libcCross.out}${libcCross.libdir or "/lib"}"
] ++ (if crossStageStatic then [
"-B${libcCross.out}/lib"
"-B${libcCross.out}${libcCross.libdir or "/lib"}"
] else [
"-Wl,-rpath,${libcCross.out}/lib"
"-Wl,-rpath-link,${libcCross.out}/lib"
"-Wl,-rpath,${libcCross.out}${libcCross.libdir or "/lib"}"
"-Wl,-rpath-link,${libcCross.out}${libcCross.libdir or "/lib"}"
]));
passthru =

View file

@ -67,7 +67,7 @@ let version = "7.3.0";
[ "--with-as=${targetPackages.stdenv.cc.bintools}/bin/${targetPlatform.config}-as"
"--with-ld=${targetPackages.stdenv.cc.bintools}/bin/${targetPlatform.config}-ld" ] ++
(if crossMingw && crossStageStatic then [
"--with-headers=${libcCross}/include"
"--with-headers=${getDev libcCross}${libcCross.incdir or "/include"}"
"--with-gcc"
"--with-gnu-as"
"--with-gnu-ld"
@ -92,7 +92,7 @@ let version = "7.3.0";
"--disable-libmpx" # requires libc
] else [
(if crossDarwin then "--with-sysroot=${getLib libcCross}/share/sysroot"
else "--with-headers=${getDev libcCross}/include")
else "--with-headers=${getDev libcCross}${libcCross.incdir or "/include"}")
"--enable-__cxa_atexit"
"--enable-long-long"
] ++
@ -115,11 +115,17 @@ let version = "7.3.0";
"--disable-libgomp"
# musl at least, disable: https://git.buildroot.net/buildroot/commit/?id=873d4019f7fb00f6a80592224236b3ba7d657865
"--disable-libmpx"
] ++ [
"--enable-threads=posix"
"--enable-nls"
"--disable-decimal-float" # No final libdecnumber (it may work only in 386)
]));
]
++ optional (targetPlatform.libc == "newlib") "--with-newlib"
++ optional (targetPlatform.libc == "avrlibc") "--with-avrlibc"
++ [
"--enable-threads=${if targetPlatform.isUnix then "posix"
else if targetPlatform.isWindows then "win32"
else "single"}"
"--enable-nls"
# No final libdecnumber (it may work only in 386)
"--disable-decimal-float"
]));
stageNameAddon = if crossStageStatic then "-stage-static" else "-stage-final";
crossNameAddon = if targetPlatform != hostPlatform then "${targetPlatform.config}${stageNameAddon}-" else "";
@ -188,7 +194,12 @@ stdenv.mkDerivation ({
sed -i gcc/config/linux.h -e '1i#undef LOCAL_INCLUDE_DIR'
''
)
else "");
else "")
+ stdenv.lib.optionalString targetPlatform.isAvr ''
makeFlagsArray+=(
'LIMITS_H_TEST=false'
)
'';
inherit noSysDirs staticCompiler crossStageStatic
libcCross crossMingw;
@ -267,7 +278,7 @@ stdenv.mkDerivation ({
}"
] ++
(if enableMultilib
(if (enableMultilib || targetPlatform.isAvr)
then ["--enable-multilib" "--disable-libquadmath"]
else ["--disable-multilib"]) ++
optional (!enableShared) "--disable-shared" ++
@ -334,20 +345,20 @@ stdenv.mkDerivation ({
EXTRA_TARGET_FLAGS = optionals
(targetPlatform != hostPlatform && libcCross != null)
([
"-idirafter ${getDev libcCross}/include"
"-idirafter ${getDev libcCross}${libcCross.incdir or "/include"}"
] ++ optionals (! crossStageStatic) [
"-B${libcCross.out}/lib"
"-B${libcCross.out}${libcCross.libdir or "/lib"}"
]);
EXTRA_TARGET_LDFLAGS = optionals
(targetPlatform != hostPlatform && libcCross != null)
([
"-Wl,-L${libcCross.out}/lib"
"-Wl,-L${libcCross.out}${libcCross.libdir or "/lib"}"
] ++ (if crossStageStatic then [
"-B${libcCross.out}/lib"
"-B${libcCross.out}${libcCross.libdir or "/lib"}"
] else [
"-Wl,-rpath,${libcCross.out}/lib"
"-Wl,-rpath-link,${libcCross.out}/lib"
"-Wl,-rpath,${libcCross.out}${libcCross.libdir or "/lib"}"
"-Wl,-rpath-link,${libcCross.out}${libcCross.libdir or "/lib"}"
]));
passthru =

View file

@ -87,7 +87,7 @@ let version = "8.2.0";
"--disable-libmpx" # requires libc
] else [
(if crossDarwin then "--with-sysroot=${getLib libcCross}/share/sysroot"
else "--with-headers=${getDev libcCross}/include")
else "--with-headers=${getDev libcCross}${libcCross.incdir or "/include"}")
"--enable-__cxa_atexit"
"--enable-long-long"
] ++
@ -110,10 +110,15 @@ let version = "8.2.0";
"--disable-libgomp"
# musl at least, disable: https://git.buildroot.net/buildroot/commit/?id=873d4019f7fb00f6a80592224236b3ba7d657865
"--disable-libmpx"
] ++ [
"--enable-threads=posix"
"--enable-nls"
"--disable-decimal-float" # No final libdecnumber (it may work only in 386)
]
++ optional (targetPlatform.libc == "newlib") "--with-newlib"
++ optional (targetPlatform.libc == "avrlibc") "--with-avrlibc"
++ [
"--enable-threads=${if targetPlatform.isUnix then "posix"
else if targetPlatform.isWindows then "win32"
else "single"}"
"--enable-nls"
"--disable-decimal-float" # No final libdecnumber (it may work only in 386)
]));
stageNameAddon = if crossStageStatic then "-stage-static" else "-stage-final";
crossNameAddon = if targetPlatform != hostPlatform then "-${targetPlatform.config}" + stageNameAddon else "";
@ -261,7 +266,7 @@ stdenv.mkDerivation ({
}"
] ++
(if enableMultilib
(if (enableMultilib || targetPlatform.isAvr)
then ["--enable-multilib" "--disable-libquadmath"]
else ["--disable-multilib"]) ++
optional (!enableShared) "--disable-shared" ++
@ -322,23 +327,16 @@ stdenv.mkDerivation ({
LIBRARY_PATH = optionals (targetPlatform == hostPlatform) (makeLibraryPath (optional (zlib != null) zlib));
EXTRA_TARGET_FLAGS = optionals
(targetPlatform != hostPlatform && libcCross != null)
([
"-idirafter ${getDev libcCross}/include"
] ++ optionals (! crossStageStatic) [
"-B${libcCross.out}/lib"
]);
EXTRA_TARGET_LDFLAGS = optionals
(targetPlatform != hostPlatform && libcCross != null)
([
"-Wl,-L${libcCross.out}/lib"
"-Wl,-L${libcCross.out}${libcCross.libdir or "/lib"}"
] ++ (if crossStageStatic then [
"-B${libcCross.out}/lib"
"-B${libcCross.out}${libcCross.libdir or "/lib"}"
] else [
"-Wl,-rpath,${libcCross.out}/lib"
"-Wl,-rpath-link,${libcCross.out}/lib"
"-Wl,-rpath,${libcCross.out}${libcCross.libdir or "/lib"}"
"-Wl,-rpath-link,${libcCross.out}${libcCross.libdir or "/lib"}"
]));
passthru =

View file

@ -104,10 +104,15 @@ let version = "7-20170409";
# In uclibc cases, libgomp needs an additional '-ldl'
# and as I don't know how to pass it, I disable libgomp.
"--disable-libgomp"
] ++ [
"--enable-threads=posix"
"--enable-nls"
"--disable-decimal-float" # No final libdecnumber (it may work only in 386)
]
++ optional (targetPlatform.libc == "newlib") "--with-newlib"
++ optional (targetPlatform.libc == "avrlibc") "--with-avrlibc"
++ [
"--enable-threads=${if targetPlatform.isUnix then "posix"
else if targetPlatform.isWindows then "win32"
else "single"}"
"--enable-nls"
"--disable-decimal-float" # No final libdecnumber (it may work only in 386)
]));
stageNameAddon = if crossStageStatic then "-stage-static" else "-stage-final";
crossNameAddon = if targetPlatform != hostPlatform then "-${targetPlatform.config}" + stageNameAddon else "";
@ -290,20 +295,20 @@ stdenv.mkDerivation ({
EXTRA_TARGET_FLAGS = optionals
(targetPlatform != hostPlatform && libcCross != null)
([
"-idirafter ${getDev libcCross}/include"
"-idirafter ${getDev libcCross}${libcCross.incdir or "/include"}"
] ++ optionals (! crossStageStatic) [
"-B${libcCross.out}/lib"
"-B${libcCross.out}${libcCross.libdir or "/lib"}"
]);
EXTRA_TARGET_LDFLAGS = optionals
(targetPlatform != hostPlatform && libcCross != null)
([
"-Wl,-L${libcCross.out}/lib"
"-Wl,-L${libcCross.out}${libcCross.libdir or "/lib"}"
] ++ (if crossStageStatic then [
"-B${libcCross.out}/lib"
"-B${libcCross.out}${libcCross.libdir or "/lib"}"
] else [
"-Wl,-rpath,${libcCross.out}/lib"
"-Wl,-rpath-link,${libcCross.out}/lib"
"-Wl,-rpath,${libcCross.out}${libcCross.libdir or "/lib"}"
"-Wl,-rpath-link,${libcCross.out}${libcCross.libdir or "/lib"}"
]));
passthru =

View file

@ -1,80 +0,0 @@
# Sourcery CodeBench Lite toolchain(s) (GCC) from Mentor Graphics
{ stdenv, fetchurl, patchelf, ncurses }:
let
buildToolchain =
{ name, src, description }:
stdenv.mkDerivation rec {
inherit name src;
nativeBuildInputs = [ patchelf ];
buildCommand = ''
# Unpack tarball
mkdir -p "$out"
tar --strip-components=1 -xjf "$src" -C "$out"
# Patch binaries
interpreter="$(cat "$NIX_CC"/nix-support/dynamic-linker)"
for file in "$out"/bin/* "$out"/libexec/gcc/*/*/* "$out"/*/bin/*; do
# Skip non-executable files
case "$file" in
*README.txt) echo "skipping $file"; continue;;
*liblto_plugin.so*) echo "skipping $file"; continue;;
esac
# Skip directories
test -d "$file" && continue
echo "patchelf'ing $file"
patchelf --set-interpreter "$interpreter" "$file"
# GDB needs ncurses
case "$file" in
*gdb) patchelf --set-rpath "${ncurses.out}/lib" "$file";;
esac
done
# Manpages
mkdir -p "$out/share/man"
ln -s "$out"/share/doc/*/man/man1 "$out/share/man/man1"
ln -s "$out"/share/doc/*/man/man7 "$out/share/man/man7"
'';
meta = with stdenv.lib; {
inherit description;
homepage = https://www.mentor.com/embedded-software/sourcery-tools/sourcery-codebench/editions/lite-edition/;
license = licenses.gpl3;
platforms = platforms.linux;
maintainers = [ maintainers.bjornfor ];
};
};
in
{
armLinuxGnuEabi = let version = "2013.05-24"; in buildToolchain rec {
name = "sourcery-codebench-lite-arm-linux-gnueabi-${version}";
description = "Sourcery CodeBench Lite toolchain (GCC) for ARM GNU/Linux, from Mentor Graphics";
src = fetchurl {
url = "http://sourcery.mentor.com/public/gnu_toolchain/arm-none-linux-gnueabi/arm-${version}-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2";
sha256 = "1xb075ia61c59cya2jl8zp4fvqpfnwkkc5330shvgdlg9981qprr";
};
};
armEabi = let version = "2013.05-23"; in buildToolchain rec {
name = "sourcery-codebench-lite-arm-eabi-${version}";
description = "Sourcery CodeBench Lite toolchain (GCC) for ARM EABI, from Mentor Graphics";
src = fetchurl {
url = "http://sourcery.mentor.com/public/gnu_toolchain/arm-none-eabi/arm-${version}-arm-none-eabi-i686-pc-linux-gnu.tar.bz2";
sha256 = "0nbvdwj3kcv9scx808gniqp0ncdiy2i7afmdvribgkz1lsfin923";
};
};
# TODO: Sourcery CodeBench is also available for MIPS, Power, SuperH,
# ColdFire (and more).
}

View file

@ -1,4 +1,4 @@
{ stdenv, fetchzip, vim, avrdude, avrbinutils, avrgcc, avrlibc, makeWrapper }:
{ stdenv, fetchzip, vim, makeWrapper }:
stdenv.mkDerivation rec {
name = "microscheme-${version}";
@ -10,15 +10,10 @@ stdenv.mkDerivation rec {
sha256 = "1r3ng4pw1s9yy1h5rafra1rq19d3vmb5pzbpcz1913wz22qdd976";
};
# Just a guess
propagatedBuildInputs = [ avrlibc ];
buildInputs = [ makeWrapper vim ];
installPhase = ''
make install PREFIX=$out
wrapProgram $out/bin/microscheme \
--prefix PATH : "${stdenv.lib.makeBinPath [ avrdude avrgcc avrbinutils ]}"
'';
meta = with stdenv.lib; {

View file

@ -1,22 +0,0 @@
{ stdenv, fetchurl }:
let
version = "2.31.1";
in
stdenv.mkDerivation {
name = "avr-binutils-${version}";
src = fetchurl {
url = "mirror://gnu/binutils/binutils-${version}.tar.bz2";
sha256 = "1l34hn1zkmhr1wcrgf0d4z7r3najxnw3cx2y2fk7v55zjlk3ik7z";
};
configureFlags = [ "--target=avr" "--enable-languages=c,c++" ];
meta = with stdenv.lib; {
description = "the GNU Binutils for AVR microcontrollers";
homepage = http://www.gnu.org/software/binutils/;
license = licenses.gpl3Plus;
platforms = platforms.unix;
maintainers = with maintainers; [ mguentner ];
};
}

View file

@ -1,15 +0,0 @@
diff --git a/gcc/gcc-ar.c b/gcc/gcc-ar.c
index 838ebc2..3ac4ee7 100644
--- a/gcc/gcc-ar.c
+++ b/gcc/gcc-ar.c
@@ -118,8 +118,8 @@ setup_prefixes (const char *exec_path)
dir_separator, NULL);
prefix_from_string (self_libexec_prefix, &target_path);
- /* Add path as a last resort. */
- prefix_from_env ("PATH", &path);
+ /* Add path to avrbinutils. */
+ prefix_from_string ("@avrbinutils@/bin", &path);
}
int

View file

@ -1,60 +0,0 @@
{ stdenv, fetchurl, gmp, mpfr, libmpc, zlib, avrbinutils, texinfo }:
let
version = "8.2.0";
in
stdenv.mkDerivation {
name = "avr-gcc-${version}";
src = fetchurl {
url = "mirror://gcc/releases/gcc-${version}/gcc-${version}.tar.xz";
sha256 = "10007smilswiiv2ymazr3b6x2i933c0ycxrr529zh4r6p823qv0r";
};
patches = [
./avrbinutils-path.patch
];
# avrbinutils-path.patch introduces a reference to @avrbinutils@, substitute
# it now.
postPatch = ''
substituteInPlace gcc/gcc-ar.c --subst-var-by avrbinutils ${avrbinutils}
'';
buildInputs = [ gmp mpfr libmpc zlib avrbinutils ];
nativeBuildInputs = [ texinfo ];
hardeningDisable = [ "format" ];
stripDebugList= [ "bin" "libexec" ];
enableParallelBuilding = true;
configurePhase = ''
mkdir gcc-build
cd gcc-build
../configure \
--prefix=$out \
--host=$CHOST \
--build=$CHOST \
--target=avr \
--with-as=${avrbinutils}/bin/avr-as \
--with-gnu-as \
--with-gnu-ld \
--with-ld=${avrbinutils}/bin/avr-ld \
--with-system-zlib \
--disable-install-libiberty \
--disable-nls \
--disable-libssp \
--with-dwarf2 \
--enable-languages=c,c++'';
meta = with stdenv.lib; {
description = "GNU Compiler Collection, version ${version} for AVR microcontrollers";
homepage = http://gcc.gnu.org;
license = licenses.gpl3Plus;
platforms = with platforms; linux ++ darwin;
maintainers = with maintainers; [ mguentner ];
};
}

View file

@ -1,4 +1,4 @@
{ stdenv, fetchurl, avrgcc, avrbinutils, automake, autoconf }:
{ stdenv, fetchurl, automake, autoconf }:
let
version = "2.0.0";
@ -11,28 +11,21 @@ stdenv.mkDerivation {
sha256 = "15svr2fx8j6prql2il2fc0ppwlv50rpmyckaxx38d3gxxv97zpdj";
};
buildInputs = [ avrgcc avrbinutils automake autoconf ];
configurePhase = ''
unset LD
unset AS
unset AR
unset CC
unset CXX
unset RANLIB
unset STRIP
./configure --prefix=$out --build=$(./config.guess) --host=avr
'';
nativeBuildInputs = [ automake autoconf ];
# Make sure we don't strip the libraries in lib/gcc/avr.
stripDebugList= "bin";
stripDebugList = "bin";
dontPatchELF = true;
passthru = {
incdir = "/avr/include";
};
meta = with stdenv.lib; {
description = "a C runtime library for AVR microcontrollers";
homepage = http://savannah.nongnu.org/projects/avr-libc/;
license = licenses.bsd3;
platforms = platforms.unix;
platforms = platforms.all;
maintainers = with maintainers; [ mguentner ];
};
}

View file

@ -0,0 +1,35 @@
{ stdenv, fetchurl, buildPackages }:
let version = "3.0.0";
in stdenv.mkDerivation {
name = "newlib-${version}";
src = fetchurl {
url = "ftp://sourceware.org/pub/newlib/newlib-${version}.tar.gz";
sha256 = "0chka3szh50krcz2dcxcsr1v1i000jylwnsrp2pgrrblxqsn6mn8";
};
depsBuildBuild = [ buildPackages.stdenv.cc ];
# newlib expects CC to build for build platform, not host platform
preConfigure = ''
export CC=cc
'';
configurePlatforms = [ "build" "target" ];
configureFlags = [
"--host=${stdenv.buildPlatform.config}"
"--disable-newlib-supplied-syscalls"
"--disable-nls"
"--enable-newlib-io-long-long"
"--enable-newlib-register-fini"
"--enable-newlib-retargetable-locking"
];
dontDisableStatic = true;
passthru = {
incdir = "/${stdenv.targetPlatform.config}/include";
libdir = "/${stdenv.targetPlatform.config}/lib";
};
}

View file

@ -0,0 +1,27 @@
{ stdenv, fetchFromGitHub
, avrgcc, avrbinutils
, gcc-arm-embedded, binutils-arm-embedded
, teensy-loader-cli, dfu-programmer, dfu-util }:
let version = "0.6.144";
in stdenv.mkDerivation {
name = "qmk_firmware-${version}";
src = fetchFromGitHub {
owner = "qmk";
repo = "qmk_firmware";
rev = version;
sha256 = "0m71f9w32ksqjkrwhqwhr74q5v3pr38bihjyb9ks0k5id0inhrjn";
fetchSubmodules = true;
};
buildFlags = "all:default";
NIX_CFLAGS_COMPILE = "-Wno-error";
nativeBuildInputs = [
avrgcc
avrbinutils
gcc-arm-embedded
teensy-loader-cli
dfu-programmer
dfu-util
];
}

View file

@ -1,5 +1,5 @@
{ stdenv, fetchFromGitHub
, gcc-arm-embedded, python2
, gcc-arm-embedded, binutils-arm-embedded, python2
, skipTargets ? [
# These targets do not build, for the reasons listed, along with the last version checked.
# Probably all of the issues with these targets need to be addressed upstream.
@ -24,8 +24,8 @@ in stdenv.mkDerivation rec {
sha256 = "1wyp23p876xbfi9z6gm4xn1nwss3myvrjjjq9pd3s0vf5gkclkg5";
};
buildInputs = [
gcc-arm-embedded
nativeBuildInputs = [
gcc-arm-embedded binutils-arm-embedded
python2
];
@ -58,7 +58,6 @@ in stdenv.mkDerivation rec {
homepage = https://github.com/betaflight/betaflight;
license = licenses.gpl3;
maintainers = with maintainers; [ elitak ];
platforms = [ "i686-linux" "x86_64-linux" ];
};
}

View file

@ -1,5 +1,5 @@
{ stdenv, fetchFromGitHub
, gcc-arm-embedded, ruby
, gcc-arm-embedded, binutils-arm-embedded, ruby
}:
let
@ -17,8 +17,8 @@ in stdenv.mkDerivation rec {
sha256 = "15zai8qf43b06fmws1sbkmdgip51zp7gkfj7pp9b6gi8giarzq3y";
};
buildInputs = [
gcc-arm-embedded
nativeBuildInputs = [
gcc-arm-embedded binutils-arm-embedded
ruby
];
@ -50,7 +50,6 @@ in stdenv.mkDerivation rec {
homepage = https://inavflight.github.io;
license = licenses.gpl3;
maintainers = with maintainers; [ elitak ];
platforms = [ "i686-linux" "x86_64-linux" ];
};
}

View file

@ -1,5 +1,5 @@
{ stdenv, lib, fetchFromGitHub
, gcc-arm-embedded, libftdi
, gcc-arm-embedded, binutils-arm-embedded, libftdi
, python, pythonPackages
}:
@ -17,8 +17,11 @@ stdenv.mkDerivation rec {
fetchSubmodules = true;
};
nativeBuildInputs = [
gcc-arm-embedded binutils-arm-embedded
];
buildInputs = [
gcc-arm-embedded
libftdi
python
pythonPackages.intelhex

View file

@ -19,6 +19,6 @@ stdenv.mkDerivation rec {
description = "A Device Firmware Update based USB programmer for Atmel chips with a USB bootloader";
homepage = http://dfu-programmer.sourceforge.net/;
maintainers = [ maintainers.the-kenny ];
platforms = platforms.linux;
platforms = platforms.unix;
};
}

View file

@ -10,7 +10,7 @@ stdenv.mkDerivation {
sha256 = "1a663bv3lvm7bsf2wcaj2c0vpmniak7w5hwix5qgz608bvm2v781";
};
buildInputs = [ unzip libusb ];
buildInputs = [ libusb ];
installPhase = ''
install -Dm755 teensy_loader_cli $out/bin/teensy-loader-cli
@ -21,6 +21,6 @@ stdenv.mkDerivation {
description = "Firmware uploader for the Teensy microcontroller boards";
homepage = https://www.pjrc.com/teensy/;
maintainers = with maintainers; [ the-kenny ];
platforms = platforms.linux;
platforms = platforms.unix;
};
}

View file

@ -1,4 +1,5 @@
{ stdenv, fetchFromGitHub, avrbinutils, avrgcc, avrlibc, libelf, which, git, pkgconfig, freeglut
{ stdenv, fetchFromGitHub, libelf, which, git, pkgconfig, freeglut
, avrbinutils, avrgcc, avrlibc
, libGLU_combined }:
stdenv.mkDerivation rec {
@ -15,14 +16,10 @@ stdenv.mkDerivation rec {
# ld: cannot find -lsimavr
enableParallelBuilding = false;
preConfigure = ''
substituteInPlace Makefile.common --replace "-I../simavr/sim/avr -I../../simavr/sim/avr" \
"-I${avrlibc}/avr/include -L${avrlibc}/avr/lib/avr5 -B${avrlibc}/avr/lib -I../simavr/sim/avr -I../../simavr/sim/avr"
'';
buildFlags = "AVR_ROOT=${avrlibc}/avr SIMAVR_VERSION=${version}";
installFlags = buildFlags + " DESTDIR=$(out)";
# Hack to avoid TMPDIR in RPATHs.
preFixup = ''rm -rf "$(pwd)" && mkdir "$(pwd)" '';
@ -31,8 +28,8 @@ stdenv.mkDerivation rec {
patchelf --set-rpath "$(patchelf --print-rpath "$target"):$out/lib" "$target"
'';
nativeBuildInputs = [ pkgconfig ];
buildInputs = [ which git avrbinutils avrgcc avrlibc libelf freeglut libGLU_combined ];
nativeBuildInputs = [ which git pkgconfig avrgcc avrbinutils ];
buildInputs = [ libelf freeglut libGLU_combined ];
meta = with stdenv.lib; {
description = "A lean and mean Atmel AVR simulator";
@ -43,4 +40,3 @@ stdenv.mkDerivation rec {
};
}

View file

@ -1,4 +1,4 @@
{ stdenv, gcc-arm-embedded, makeWrapper
{ stdenv, gcc-arm-embedded, binutils-arm-embedded, makeWrapper
, python, pythonPackages
# Extra options
@ -14,7 +14,7 @@ stdenv.mkDerivation {
inherit src;
nativeBuildInputs = [ gcc-arm-embedded makeWrapper ];
nativeBuildInputs = [ gcc-arm-embedded binutils-arm-embedded makeWrapper ];
buildInputs = [ python ] ++ (with pythonPackages; [ pyusb colorama ]);
configurePhase = ''

View file

@ -1,11 +0,0 @@
{ callPackage, fetchgit, ... } @ args:
callPackage ./generic.nix (args // rec {
version = "2015-04-22";
src = fetchgit {
url = "git://git.gniibe.org/gnuk/gnuk.git";
rev = "3d5a776ab15a4ae6e17d91341a58eda3db09f700";
sha256 = "1f9l1rwy630z8cnjd6lfv0zp6ij3c9ifbm3fym245049hh2xds7v";
};
})

View file

@ -1,11 +0,0 @@
{ callPackage, fetchgit, ... } @ args:
callPackage ./generic.nix (args // rec {
version = "1.1.4";
src = fetchgit {
url = "git://git.gniibe.org/gnuk/gnuk.git";
rev = "e7e8b9f5ca414a5c901f61b0f043c8da42414103";
sha256 = "0js9dc1iyvrrcb0d8a2irivrli3yb7mxmpxws5a2n53hj5xc4n6l";
};
})

View file

@ -830,7 +830,10 @@ with pkgs;
libssl = openssl;
};
axoloti = callPackage ../applications/audio/axoloti { };
axoloti = callPackage ../applications/audio/axoloti {
gcc-arm-embedded = pkgsCross.arm-embedded.buildPackages.gcc;
binutils-arm-embedded = pkgsCross.arm-embedded.buildPackages.binutils;
};
dfu-util-axoloti = callPackage ../applications/audio/axoloti/dfu-util.nix { };
libusb1-axoloti = callPackage ../applications/audio/axoloti/libusb1.nix {
inherit (darwin) libobjc;
@ -6833,36 +6836,6 @@ with pkgs;
gcl_2_6_13_pre = callPackage ../development/compilers/gcl/2.6.13-pre.nix { };
gcc-arm-embedded-4_7 = pkgsi686Linux.callPackage ../development/compilers/gcc-arm-embedded {
version = "4.7-2013q3-20130916";
releaseType = "update";
sha256 = "1bd9bi9q80xn2rpy0rn1vvj70rh15kb7dmah0qs4q2rv78fqj40d";
ncurses = pkgsi686Linux.ncurses5;
};
gcc-arm-embedded-4_8 = pkgsi686Linux.callPackage ../development/compilers/gcc-arm-embedded {
version = "4.8-2014q1-20140314";
releaseType = "update";
sha256 = "ce92859550819d4a3d1a6e2672ea64882b30afa2c08cf67fa8e1d93788c2c577";
ncurses = pkgsi686Linux.ncurses5;
};
gcc-arm-embedded-4_9 = pkgsi686Linux.callPackage ../development/compilers/gcc-arm-embedded {
version = "4.9-2015q1-20150306";
releaseType = "update";
sha256 = "c5e0025b065750bbd76b5357b4fc8606d88afbac9ff55b8a82927b4b96178154";
ncurses = pkgsi686Linux.ncurses5;
};
gcc-arm-embedded-5 = pkgs.pkgsi686Linux.callPackage ../development/compilers/gcc-arm-embedded {
dirName = "5.0";
subdirName = "5-2016-q2-update";
version = "5.4-2016q2-20160622";
releaseType = "update";
sha256 = "1r0rqbnw7rf94f5bsa3gi8bick4xb7qnp1dkvdjfbvqjvysvc44r";
ncurses = pkgsi686Linux.ncurses5;
};
gcc-arm-embedded-6 = callPackage ../development/compilers/gcc-arm-embedded/6 {};
gcc-arm-embedded-7 = callPackage ../development/compilers/gcc-arm-embedded/7 {};
gcc-arm-embedded = gcc-arm-embedded-7;
gforth = callPackage ../development/compilers/gforth {};
gtk-server = callPackage ../development/interpreters/gtk-server {};
@ -7202,10 +7175,6 @@ with pkgs;
manticore = callPackage ../development/compilers/manticore { };
mentorToolchains = recurseIntoAttrs (
pkgsi686Linux.callPackage ../development/compilers/mentor {}
);
mercury = callPackage ../development/compilers/mercury { };
microscheme = callPackage ../development/compilers/microscheme { };
@ -7989,17 +7958,17 @@ with pkgs;
amtk = callPackage ../development/libraries/amtk { };
avrgcclibc = throw "avrgcclibs are now separate packages, install avrbinutils, avrgcc and avrlibc";
avrbinutils = callPackage ../development/misc/avr/binutils {};
avrgcc = callPackage ../development/misc/avr/gcc {};
avrlibc = callPackage ../development/misc/avr/libc {};
avrlibc = callPackage ../development/misc/avr/libc {};
avrlibcCross = callPackage ../development/misc/avr/libc {
stdenv = crossLibcStdenv;
};
avr8burnomat = callPackage ../development/misc/avr8-burn-omat { };
betaflight = callPackage ../development/misc/stm32/betaflight { };
betaflight = callPackage ../development/misc/stm32/betaflight {
gcc-arm-embedded = pkgsCross.arm-embedded.buildPackages.gcc;
binutils-arm-embedded = pkgsCross.arm-embedded.buildPackages.binutils;
};
sourceFromHead = callPackage ../build-support/source-from-head-fun.nix {};
@ -8035,7 +8004,10 @@ with pkgs;
guile = guile_2_0;
};
inav = callPackage ../development/misc/stm32/inav { };
inav = callPackage ../development/misc/stm32/inav {
gcc-arm-embedded = pkgsCross.arm-embedded.buildPackages.gcc;
binutils-arm-embedded = pkgsCross.arm-embedded.buildPackages.binutils;
};
pharo-vms = callPackage ../development/pharo/vm { };
pharo = pharo-vms.multi-vm-wrapper;
@ -8193,6 +8165,8 @@ with pkgs;
blackmagic = callPackage ../development/tools/misc/blackmagic {
stdenv = overrideCC stdenv gcc6;
gcc-arm-embedded = pkgsCross.arm-embedded.buildPackages.gcc;
binutils-arm-embedded = pkgsCross.arm-embedded.buildPackages.binutils;
};
bloaty = callPackage ../development/tools/bloaty { };
@ -9740,6 +9714,8 @@ with pkgs;
/**/ if name == "glibc" then targetPackages.glibcCross or glibcCross
else if name == "bionic" then targetPackages.bionic
else if name == "uclibc" then targetPackages.uclibcCross
else if name == "avrlibc" then targetPackages.avrlibcCross or avrlibcCross
else if name == "newlib" then targetPackages.newlibCross or newlibCross
else if name == "musl" then targetPackages.muslCross or muslCross
else if name == "msvcrt" then targetPackages.windows.mingw_w64 or windows.mingw_w64
else if stdenv.targetPlatform.useiOSPrebuilt then targetPackages.darwin.iosSdkPkgs.libraries
@ -12201,7 +12177,11 @@ with pkgs;
graphite2 = callPackage ../development/libraries/silgraphite/graphite2.nix {};
simavr = callPackage ../development/tools/simavr { };
simavr = callPackage ../development/tools/simavr {
avrgcc = pkgsCross.avr.buildPackages.gcc;
avrbinutils = pkgsCross.avr.buildPackages.binutils;
avrlibc = pkgsCross.avr.libcCross;
};
simgear = callPackage ../development/libraries/simgear { };
@ -18299,7 +18279,10 @@ with pkgs;
opentimestamps-client = python3Packages.callPackage ../tools/misc/opentimestamps-client {};
opentx = callPackage ../applications/misc/opentx { };
opentx = callPackage ../applications/misc/opentx {
gcc-arm-embedded = pkgsCross.arm-embedded.buildPackages.gcc;
binutils-arm-embedded = pkgsCross.arm-embedded.buildPackages.binutils;
};
opera = callPackage ../applications/networking/browsers/opera {};
@ -21982,14 +21965,9 @@ with pkgs;
gnome-breeze = callPackage ../misc/themes/gnome-breeze { };
gnuk = callPackage ../misc/gnuk {
gcc-arm-embedded = gcc-arm-embedded-4_9;
gcc-arm-embedded = pkgsCross.arm-embedded.buildPackages.gcc;
binutils-arm-embedded = pkgsCross.arm-embedded.buildPackages.binutils;
};
gnuk-unstable = lowPrio (callPackage ../misc/gnuk/unstable.nix {
gcc-arm-embedded = gcc-arm-embedded-4_9;
});
gnuk-git = lowPrio (callPackage ../misc/gnuk/git.nix {
gcc-arm-embedded = gcc-arm-embedded-4_9;
});
greybird = callPackage ../misc/themes/greybird { };
@ -22835,4 +22813,16 @@ with pkgs;
};
tsung = callPackage ../applications/networking/tsung {};
qmk_firmware = callPackage ../development/misc/qmk_firmware {
avrgcc = pkgsCross.avr.buildPackages.gcc;
avrbinutils = pkgsCross.avr.buildPackages.binutils;
gcc-arm-embedded = pkgsCross.arm-embedded.buildPackages.gcc;
binutils-arm-embedded = pkgsCross.arm-embedded.buildPackages.binutils;
};
newlib = callPackage ../development/misc/newlib { };
newlibCross = callPackage ../development/misc/newlib {
stdenv = crossLibcStdenv;
};
}

View file

@ -12,6 +12,12 @@ with import ./release-lib.nix { inherit supportedSystems scrubJobs; };
let
nativePlatforms = all;
embedded = {
buildPackages.binutils = nativePlatforms;
buildPackages.gcc = nativePlatforms;
libcCross = nativePlatforms;
};
common = {
buildPackages.binutils = nativePlatforms;
gmp = nativePlatforms;
@ -134,6 +140,13 @@ in
android64 = mapTestOnCross lib.systems.examples.aarch64-android-prebuilt (linuxCommon // {
});
avr = mapTestOnCross lib.systems.examples.avr embedded;
arm-embedded = mapTestOnCross lib.systems.examples.arm-embedded embedded;
powerpc-embedded = mapTestOnCross lib.systems.examples.powerpc-embedded embedded;
aarch64-embedded = mapTestOnCross lib.systems.examples.aarch64-embedded embedded;
i686-embedded = mapTestOnCross lib.systems.examples.i686-embedded embedded;
x86_64-embedded = mapTestOnCross lib.systems.examples.x86_64-embedded embedded;
/* Cross-built bootstrap tools for every supported platform */
bootstrapTools = let
tools = import ../stdenv/linux/make-bootstrap-tools-cross.nix { system = "x86_64-linux"; };