mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-23 07:23:20 +00:00
Merge pull request #58330 from AerialX/msp430
TI MSP430 cross compiling
This commit is contained in:
commit
842b14ba98
@ -34,6 +34,7 @@ rec {
|
||||
else if final.isUClibc then "uclibc"
|
||||
else if final.isAndroid then "bionic"
|
||||
else if final.isLinux /* default */ then "glibc"
|
||||
else if final.isMsp430 then "newlib"
|
||||
else if final.isAvr then "avrlibc"
|
||||
# TODO(@Ericson2314) think more about other operating systems
|
||||
else "native/impure";
|
||||
|
@ -102,6 +102,11 @@ rec {
|
||||
riscv64 = riscv "64";
|
||||
riscv32 = riscv "32";
|
||||
|
||||
msp430 = {
|
||||
config = "msp430-elf";
|
||||
libc = "newlib";
|
||||
};
|
||||
|
||||
avr = {
|
||||
config = "avr";
|
||||
};
|
||||
|
@ -20,6 +20,7 @@ rec {
|
||||
isRiscV = { cpu = { family = "riscv"; }; };
|
||||
isSparc = { cpu = { family = "sparc"; }; };
|
||||
isWasm = { cpu = { family = "wasm"; }; };
|
||||
isMsp430 = { cpu = { family = "msp430"; }; };
|
||||
isAvr = { cpu = { family = "avr"; }; };
|
||||
isAlpha = { cpu = { family = "alpha"; }; };
|
||||
|
||||
|
@ -109,6 +109,7 @@ rec {
|
||||
|
||||
alpha = { bits = 64; significantByte = littleEndian; family = "alpha"; };
|
||||
|
||||
msp430 = { bits = 16; significantByte = littleEndian; family = "msp430"; };
|
||||
avr = { bits = 8; family = "avr"; };
|
||||
};
|
||||
|
||||
|
@ -147,6 +147,11 @@
|
||||
github = "aepsil0n";
|
||||
name = "Eduard Bopp";
|
||||
};
|
||||
aerialx = {
|
||||
email = "aaron+nixos@aaronlindsay.com";
|
||||
github = "AerialX";
|
||||
name = "Aaron Lindsay";
|
||||
};
|
||||
aespinosa = {
|
||||
email = "allan.espinosa@outlook.com";
|
||||
github = "aespinosa";
|
||||
|
@ -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.isMsp430 then "msp430"
|
||||
else if targetPlatform.isAvr then "avr"
|
||||
else if targetPlatform.isAlpha then "alpha"
|
||||
else throw "unknown emulation for platform: " + targetPlatform.config;
|
||||
|
31
pkgs/development/misc/msp430/gcc-support.nix
Normal file
31
pkgs/development/misc/msp430/gcc-support.nix
Normal file
@ -0,0 +1,31 @@
|
||||
{ stdenvNoCC, fetchzip }:
|
||||
|
||||
let
|
||||
mspgccVersion = "6_1_0_0";
|
||||
version = "1.206";
|
||||
in stdenvNoCC.mkDerivation {
|
||||
name = "msp430-gcc-support-files-${version}";
|
||||
src = fetchzip {
|
||||
url = "http://software-dl.ti.com/msp430/msp430_public_sw/mcu/msp430/MSPGCC/${mspgccVersion}/exports/msp430-gcc-support-files-${version}.zip";
|
||||
sha256 = "0h297jms3gkmdcqmfpr3cg6v9wxnms34qbwvwl2fkmrz20vk766q";
|
||||
};
|
||||
|
||||
buildCommand = ''
|
||||
find $src/include -name '*.ld' | xargs install -Dm0644 -t $out/lib
|
||||
find $src/include -name '*.h' | xargs install -Dm0644 -t $out/include
|
||||
install -Dm0644 -t $out/include $src/include/devices.csv
|
||||
|
||||
# appease bintoolsWrapper_addLDVars, search path needed for ld scripts
|
||||
touch $out/lib/lib
|
||||
'';
|
||||
|
||||
meta = with stdenvNoCC.lib; {
|
||||
description = ''
|
||||
Development headers and linker scripts for TI MSP430 microcontrollers
|
||||
'';
|
||||
homepage = https://www.ti.com/tool/msp430-gcc-opensource;
|
||||
license = licenses.bsd3;
|
||||
platforms = [ "msp430-none" ];
|
||||
maintainers = with maintainers; [ aerialx ];
|
||||
};
|
||||
}
|
25
pkgs/development/misc/msp430/mspdebug.nix
Normal file
25
pkgs/development/misc/msp430/mspdebug.nix
Normal file
@ -0,0 +1,25 @@
|
||||
{ stdenv, fetchFromGitHub, libusb, readline ? null }:
|
||||
|
||||
let
|
||||
version = "0.25";
|
||||
in stdenv.mkDerivation {
|
||||
name = "mspdebug-${version}";
|
||||
src = fetchFromGitHub {
|
||||
owner = "dlbeer";
|
||||
repo = "mspdebug";
|
||||
rev = "v${version}";
|
||||
sha256 = "0prgwb5vx6fd4bj12ss1bbb6axj2kjyriyjxqrzd58s5jyyy8d3c";
|
||||
};
|
||||
|
||||
buildInputs = [ libusb readline ];
|
||||
makeFlags = [ "PREFIX=$(out)" "INSTALL=install" ] ++
|
||||
(if readline == null then [ "WITHOUT_READLINE=1" ] else []);
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
description = "A free programmer, debugger, and gdb proxy for MSP430 MCUs";
|
||||
homepage = https://dlbeer.co.nz/mspdebug/;
|
||||
license = licenses.gpl2;
|
||||
platforms = platforms.all;
|
||||
maintainers = with maintainers; [ aerialx ];
|
||||
};
|
||||
}
|
25
pkgs/development/misc/msp430/newlib.nix
Normal file
25
pkgs/development/misc/msp430/newlib.nix
Normal file
@ -0,0 +1,25 @@
|
||||
{ stdenvNoCC, lndir, newlib, msp430GccSupport }:
|
||||
|
||||
stdenvNoCC.mkDerivation {
|
||||
name = "msp430-${newlib.name}";
|
||||
inherit newlib;
|
||||
inherit msp430GccSupport;
|
||||
|
||||
preferLocalBuild = true;
|
||||
allowSubstitutes = false;
|
||||
|
||||
buildCommand = ''
|
||||
mkdir $out
|
||||
${lndir}/bin/lndir -silent $newlib $out
|
||||
${lndir}/bin/lndir -silent $msp430GccSupport/include $out/${newlib.incdir}
|
||||
${lndir}/bin/lndir -silent $msp430GccSupport/lib $out/${newlib.libdir}
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
inherit (newlib) incdir libdir;
|
||||
};
|
||||
|
||||
meta = {
|
||||
platforms = [ "msp430-none" ];
|
||||
};
|
||||
}
|
@ -8373,6 +8373,16 @@ in
|
||||
binutils-arm-embedded = pkgsCross.arm-embedded.buildPackages.binutils;
|
||||
};
|
||||
|
||||
msp430GccSupport = callPackage ../development/misc/msp430/gcc-support.nix { };
|
||||
|
||||
msp430Newlib = callPackage ../development/misc/msp430/newlib.nix { };
|
||||
msp430NewlibCross = callPackage ../development/misc/msp430/newlib.nix {
|
||||
inherit (buildPackages.xorg) lndir;
|
||||
newlib = newlibCross;
|
||||
};
|
||||
|
||||
mspdebug = callPackage ../development/misc/msp430/mspdebug.nix { };
|
||||
|
||||
pharo-vms = callPackage ../development/pharo/vm { };
|
||||
pharo = pharo-vms.multi-vm-wrapper;
|
||||
pharo-cog32 = pharo-vms.cog32;
|
||||
@ -10141,6 +10151,7 @@ in
|
||||
else if name == "bionic" then targetPackages.bionic or bionic
|
||||
else if name == "uclibc" then targetPackages.uclibcCross or uclibcCross
|
||||
else if name == "avrlibc" then targetPackages.avrlibcCross or avrlibcCross
|
||||
else if name == "newlib" && stdenv.targetPlatform.isMsp430 then targetPackages.msp430NewlibCross or msp430NewlibCross
|
||||
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
|
||||
|
@ -140,6 +140,7 @@ in
|
||||
android64 = mapTestOnCross lib.systems.examples.aarch64-android-prebuilt (linuxCommon // {
|
||||
});
|
||||
|
||||
msp430 = mapTestOnCross lib.systems.examples.msp430 embedded;
|
||||
avr = mapTestOnCross lib.systems.examples.avr embedded;
|
||||
arm-embedded = mapTestOnCross lib.systems.examples.arm-embedded embedded;
|
||||
powerpc-embedded = mapTestOnCross lib.systems.examples.ppc-embedded embedded;
|
||||
|
Loading…
Reference in New Issue
Block a user