Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support for thumbv7em-none-eabihf #64

Open
Spaqin opened this issue Jan 19, 2022 · 2 comments
Open

support for thumbv7em-none-eabihf #64

Spaqin opened this issue Jan 19, 2022 · 2 comments
Labels
question Further information is requested

Comments

@Spaqin
Copy link

Spaqin commented Jan 19, 2022

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?

@figsoda
Copy link
Member

figsoda commented May 3, 2022

Haave you tried using rust-src from x86_64-linux?

@WizardUli
Copy link

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"

@figsoda figsoda added the question Further information is requested label Aug 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants