fix the rkbfirm build
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Charlotte 🦝 Delenk 2022-06-30 15:35:56 +01:00
parent 61a2db14a8
commit c0fcfe9dbb
Signed by: darkkirb
GPG key ID: AB2BD8DAF2E37122
5 changed files with 78 additions and 37 deletions

28
Cargo.lock generated
View file

@ -429,6 +429,20 @@ dependencies = [
"regex",
]
[[package]]
name = "rkbfirm"
version = "0.1.0"
dependencies = [
"cortex-m",
"cortex-m-rt",
"defmt",
"defmt-rtt",
"embedded-hal",
"embedded-time",
"panic-probe",
"rp-pico",
]
[[package]]
name = "rp-pico"
version = "0.4.1"
@ -500,20 +514,6 @@ dependencies = [
"vcell",
]
[[package]]
name = "rust-template"
version = "0.1.0"
dependencies = [
"cortex-m",
"cortex-m-rt",
"defmt",
"defmt-rtt",
"embedded-hal",
"embedded-time",
"panic-probe",
"rp-pico",
]
[[package]]
name = "rustc_version"
version = "0.2.3"

View file

@ -4,7 +4,7 @@
args@{
release ? true,
rootFeatures ? [
"rust-template/default"
"rkbfirm/default"
],
rustPackages,
buildRustPackages,
@ -41,7 +41,7 @@ in
{
cargo2nixVersion = "0.11.0";
workspace = {
rust-template = rustPackages.unknown.rust-template."0.1.0";
rkbfirm = rustPackages.unknown.rkbfirm."0.1.0";
};
"registry+https://github.com/rust-lang/crates.io-index".aho-corasick."0.7.18" = overridableMkRustCrate (profileName: rec {
name = "aho-corasick";
@ -622,6 +622,23 @@ in
};
});
"unknown".rkbfirm."0.1.0" = overridableMkRustCrate (profileName: rec {
name = "rkbfirm";
version = "0.1.0";
registry = "unknown";
src = fetchCrateLocal workspaceSrc;
dependencies = {
cortex_m = rustPackages."registry+https://github.com/rust-lang/crates.io-index".cortex-m."0.7.5" { inherit profileName; };
cortex_m_rt = rustPackages."registry+https://github.com/rust-lang/crates.io-index".cortex-m-rt."0.7.1" { inherit profileName; };
defmt = rustPackages."registry+https://github.com/rust-lang/crates.io-index".defmt."0.3.2" { inherit profileName; };
defmt_rtt = rustPackages."registry+https://github.com/rust-lang/crates.io-index".defmt-rtt."0.3.2" { inherit profileName; };
embedded_hal = rustPackages."registry+https://github.com/rust-lang/crates.io-index".embedded-hal."0.2.7" { inherit profileName; };
embedded_time = rustPackages."registry+https://github.com/rust-lang/crates.io-index".embedded-time."0.12.1" { inherit profileName; };
panic_probe = rustPackages."registry+https://github.com/rust-lang/crates.io-index".panic-probe."0.3.0" { inherit profileName; };
rp_pico = rustPackages."registry+https://github.com/rust-lang/crates.io-index".rp-pico."0.4.1" { inherit profileName; };
};
});
"registry+https://github.com/rust-lang/crates.io-index".rp-pico."0.4.1" = overridableMkRustCrate (profileName: rec {
name = "rp-pico";
version = "0.4.1";
@ -712,23 +729,6 @@ in
};
});
"unknown".rust-template."0.1.0" = overridableMkRustCrate (profileName: rec {
name = "rust-template";
version = "0.1.0";
registry = "unknown";
src = fetchCrateLocal workspaceSrc;
dependencies = {
cortex_m = rustPackages."registry+https://github.com/rust-lang/crates.io-index".cortex-m."0.7.5" { inherit profileName; };
cortex_m_rt = rustPackages."registry+https://github.com/rust-lang/crates.io-index".cortex-m-rt."0.7.1" { inherit profileName; };
defmt = rustPackages."registry+https://github.com/rust-lang/crates.io-index".defmt."0.3.2" { inherit profileName; };
defmt_rtt = rustPackages."registry+https://github.com/rust-lang/crates.io-index".defmt-rtt."0.3.2" { inherit profileName; };
embedded_hal = rustPackages."registry+https://github.com/rust-lang/crates.io-index".embedded-hal."0.2.7" { inherit profileName; };
embedded_time = rustPackages."registry+https://github.com/rust-lang/crates.io-index".embedded-time."0.12.1" { inherit profileName; };
panic_probe = rustPackages."registry+https://github.com/rust-lang/crates.io-index".panic-probe."0.3.0" { inherit profileName; };
rp_pico = rustPackages."registry+https://github.com/rust-lang/crates.io-index".rp-pico."0.4.1" { inherit profileName; };
};
});
"registry+https://github.com/rust-lang/crates.io-index".rustc_version."0.2.3" = overridableMkRustCrate (profileName: rec {
name = "rustc_version";
version = "0.2.3";

View file

@ -1,5 +1,5 @@
[package]
name = "rust-template"
name = "rkbfirm"
version = "0.1.0"
edition = "2021"

13
elf2uf2.patch Normal file
View file

@ -0,0 +1,13 @@
diff --git a/src/main.rs b/src/main.rs
index 7d55e7b..72bfdeb 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -176,7 +176,7 @@ fn elf2uf2(mut input: impl Read + Seek, mut output: impl Write) -> Result<(), Bo
fn main() -> Result<(), Box<dyn Error>> {
OPTS.set(Opts::parse()).unwrap();
- let serial_ports_before = serialport::available_ports()?;
+ let serial_ports_before = Vec::new();
let mut deployed_path = None;
{

View file

@ -43,9 +43,11 @@
targets = ["thumbv6m-none-eabi"];
})
cargo2nix.packages.${system}.cargo2nix
elf2uf2-rs
cargo-embed
];
};
packages = {
packages = rec {
rkbfirm-source = pkgs.releaseTools.sourceTarball {
name = "rkbfirm-source";
src = self;
@ -60,8 +62,34 @@
(cd .. && tar -cf- $releaseName | zstd --ultra -22 > $out/tarballs/$releaseName.tar.zst) || false
'';
};
rust-template = rustPkgs.workspace.rust-template { };
rkbfirm-crate = (rustPkgs.workspace.rkbfirm { }).overrideAttrs(old: {
configureCargo = "true";
});
rkbfirm = pkgs.stdenvNoCC.mkDerivation {
pname = "rkbfirm";
src = self;
version = self.lastModifiedDate;
nativeBuildInputs = with pkgs; [
(elf2uf2-rs.overrideAttrs (old: {
patches = [
./elf2uf2.patch
];
}))
zstd
];
buildInputs = [rkbfirm-crate];
buildPhase = ''
elf2uf2-rs ${rkbfirm-crate}/bin/rkbfirm rkbfirm.uf2 --verbose
'';
installPhase = ''
mkdir $out
zstd --ultra -22 < rkbfirm.uf2 > $out/rkbfirm.uf2.zst
mkdir $out/nix-support
echo "file binary-dist $out/rkbfirm.uf2.zst" > $out/nix-support/hydra-build-products
echo "$pname-$version" > $out/nix-support/hydra-release-name
'';
};
default = rkbfirm;
};
nixosModules.default = import ./nixos {
inherit inputs system;