support for thumbv7em-none-eabihf
I tried to introduce flakes to our embedded systems projects, and Fenix seemed like a nice lightweight solution, especially for someone new in the nix ecosystem like me.
Seems like this would be the correct flake code:
toolchain = fenix.packages.x86_64-linux.toolchainOf {
date = "2020-10-30";
sha256 = "0iygcwzh8s0lfdghj5809krvzifc1ii1wm4sd3qqn7s0rz1s14hi";
};
rc = fenix.packages.x86_64-linux.combine [
toolchain.rustc
toolchain.cargo
fenix.packages.x86_64-linux.targets.thumbv7em-none-eabihf.latest.rust-std
];
rustPlatform = pkgs.makeRustPlatform {
cargo = rc;
rustc = rc;
};
...
Which does get me to the compiling stage, but unfortunately it errors out later with
> error[E0463]: can't find crate for `core`
> |
> = note: the `thumbv7em-none-eabihf` target may not be installed
However, the only package for that platform for crosscompiling is rust-std - which doesn't cover our needs (we'd need rust-src).
How difficult would it be to add support for this, and possibly other embedded development platforms?
Haave you tried using rust-src from x86_64-linux?
This works (or at least I can successfully build https://github.com/rp-rs/rp2040-project-template): flake.nix:
{
description = "A simple flake";
inputs = {
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-utils.url = "github:numtide/flake-utils";
# nixpkgs are tracking github:NixOS/nixpkgs/nixos-22.05
};
outputs = { self, nixpkgs, fenix, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; overlays = [ fenix.overlay ]; };
in
{
devShells.default = pkgs.mkShell {
packages = with pkgs; [
(pkgs.fenix.fromToolchainFile { dir = ./.; })
];
};
}
);
}
rust-toolchain.toml:
[toolchain]
channel = "stable"
targets = ["thumbv6m-none-eabi"]
profile = "complete"