From cc1ce16b0484c104c17acb18ccfdf50a8e9efa98 Mon Sep 17 00:00:00 2001 From: Leon Schuermann Date: Thu, 25 Jan 2024 14:49:09 -0500 Subject: [PATCH 1/2] shell.nix: remove custom GCC & newlib build, remove jlink --- shell.nix | 61 +++++++++++++++++++------------------------------------ 1 file changed, 21 insertions(+), 40 deletions(-) diff --git a/shell.nix b/shell.nix index 640361c54..ec5ce3279 100644 --- a/shell.nix +++ b/shell.nix @@ -5,19 +5,13 @@ # * `tockloader` # * arm-none-eabi toolchain # * elf2tab -# * (optionally) riscv32-embedded toolchain +# * riscv32-embedded toolchain # # To use: # # $ nix-shell -# -# The RISC-V toolchain can be disabled optionally. This will further -# prevent RISC-V specific environment variables from being set in the -# Nix shell environment: -# -# $ nix-shell shell.nix --arg disableRiscvToolchain true -{ pkgs ? import {}, disableRiscvToolchain ? false, withUnfreePkgs ? false }: +{ pkgs ? import {}, withUnfreePkgs ? false }: with builtins; let @@ -49,41 +43,28 @@ in name = "tock-dev"; buildInputs = with pkgs; [ - nrf-command-line-tools elf2tab gcc-arm-embedded python3Full tockloader - ] ++ (lib.optionals withUnfreePkgs [ - segger-jlink - tockloader.nrf-command-line-tools - ]) ++ (lib.optional (!disableRiscvToolchain) ( - pkgsCross.riscv32-embedded.buildPackages.gcc.override (oldCc: { - cc = (pkgsCross.riscv32-embedded.buildPackages.gcc.cc.override (oldCcArgs: { - libcCross = oldCcArgs.libcCross.overrideAttrs (oldNewlibAttrs: { - configureFlags = oldNewlibAttrs.configureFlags ++ [ - "--enable-libssp" - ]; - }); - })).overrideAttrs (oldCcAttrs: { - configureFlags = oldCcAttrs.configureFlags ++ [ - "--without-headers" - "--disable-shared" - "--disable-libssp" - "--disable-multilib" - "--with-newlib" - ]; - gcc_cv_libc_provides_ssp = "yes"; - }); - }) - )); - - shellHook = '' - ${if (!disableRiscvToolchain) then '' - export RISCV=1 - '' else ""} + pkgsCross.riscv32-embedded.buildPackages.gcc + ]; - # TODO: This should be patched into the rpath of the respective libraries! - export LD_LIBRARY_PATH=${pkgs.libusb}/lib:${pkgs.segger-jlink}/lib:$LD_LIBRARY_PATH - ''; + # Unfortunately, `segger-jlink` has been removed from Nixpkgs due to its + # hard dependency in Qt4, which has multiple security issues and is + # deprecated since a few years now. Efforts exist to bring the package back, + # but for now we don't assume it's available. Once [1] is merged, we can add + # the following back: + # + # buildInputs ++ (lib.optionals withUnfreePkgs [ + # segger-jlink + # tockloader.nrf-command-line-tools + # ]) + # + # shellHook = '' + # # TODO: This should be patched into the rpath of the respective libraries! + # export LD_LIBRARY_PATH=${pkgs.libusb}/lib:${pkgs.segger-jlink}/lib:$LD_LIBRARY_PATH + # ''; + # + # [1]: https://github.com/NixOS/nixpkgs/pull/255185 } From df156eaf480ed97a0263f32337731ff04f5a7592 Mon Sep 17 00:00:00 2001 From: Leon Schuermann Date: Thu, 25 Jan 2024 14:54:47 -0500 Subject: [PATCH 2/2] shell.nix: update to Tockloader v1.11.0 --- shell.nix | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/shell.nix b/shell.nix index ec5ce3279..afaa5f08a 100644 --- a/shell.nix +++ b/shell.nix @@ -17,12 +17,11 @@ with builtins; let inherit (pkgs) stdenv stdenvNoCC lib; - # Tockloader v1.11.0pre-git tockloader = import (pkgs.fetchFromGitHub { owner = "tock"; repo = "tockloader"; - rev = "df8823545cbdd3ef49ce3d255404b7adaef5fcfc"; - sha256 = "sha256-gl+uz+JrzZ6RRIu2r7xALtstKzhfiUENbKeNhuSNXAQ="; + rev = "v1.11.0"; + sha256 = "sha256-bPEfpfOZOjOiazqRgn1cnqe4ohLPvocuENKoZx/Qw80="; }) { inherit pkgs withUnfreePkgs; }; elf2tab = pkgs.rustPlatform.buildRustPackage rec {