From b006b3c355616c89d66084880b5a5a87f0241009 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Sat, 9 Oct 2021 23:41:40 +0200 Subject: Basic build environment for Teensy 4.0 programs --- core.nix | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 core.nix (limited to 'core.nix') diff --git a/core.nix b/core.nix new file mode 100644 index 0000000..6a98e55 --- /dev/null +++ b/core.nix @@ -0,0 +1,42 @@ +{ pkgs, ... }: + +pkgs.stdenvNoCC.mkDerivation rec { + name = "teensy-core"; + version = "1.54"; + + src = pkgs.fetchFromGitHub { + owner = "PaulStoffregen"; + repo = "cores"; + rev = "${version}"; + sha256 = "6IXKPVc06WCjJDOnDFOOqjPZSt4UhRW7LHyblEaZ7fw="; + }; + + buildInputs = with pkgs; [ + binutils + gcc-arm-embedded + ]; + + buildPhase = '' + export CC=arm-none-eabi-gcc + export CXX=arm-none-eabi-g++ + + pushd teensy4 + rm main.cpp + cp ${./Makefile.lib} Makefile + make + ar rvs libteensy-core.a *.o + popd + ''; + + installPhase = '' + mkdir -p $out/{include,lib} + pushd teensy4 + cp -r *.h $out/include/ + cp -r avr $out/include/ + cp -r debug $out/include/ + cp -r util $out/include/ + cp libteensy-core.a $out/lib/ + cp imxrt1062.ld $out/lib/ + popd + ''; +} -- cgit v1.2.3