Skip to content

Commit

Permalink
Attempt to fix AtTiny85 builds
Browse files Browse the repository at this point in the history
  • Loading branch information
jwillikers committed Dec 19, 2024
1 parent fef8fd5 commit 83990a0
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ indent_size = unset
[*.lock]
indent_style = unset

[*.{adoc,envrc,nix,nu,yaml,yml}]
[*.{adoc,envrc,lock,nix,nu,yaml,yml}]
max_line_length = off

[{justfile,.justfile,*.just,*.rs}]
Expand Down
8 changes: 4 additions & 4 deletions .justfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ build board="attiny85" profile="dev":
alias fmt := format

format:
treefmt
treefmt-nix

alias f := run
alias flash := run
Expand Down Expand Up @@ -78,8 +78,8 @@ update:
nix run ".#update-nixos-release"
nix flake update
cd "{{ justfile_directory() }}/boards/attiny85"
cargo update
cargo update --verbose
cd "{{ justfile_directory() }}/boards/pico"
cargo update
cargo update --verbose
cd "{{ justfile_directory() }}/boards/qt-py-ch32v203"
cargo update
cargo update --verbose
2 changes: 1 addition & 1 deletion boards/attiny85/.justfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ alias up := update

update:
nix flake update
cargo update
cargo update --verbose
16 changes: 8 additions & 8 deletions boards/attiny85/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 6 additions & 5 deletions boards/attiny85/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@ homepage = "https://github.com/jwillikers/pwm-fan-controller"
description = "A simple PWM fan controller for microcontrollers"
license = "MIT OR Apache-2.0"
repository = "https://github.com/jwillikers/pwm-fan-controller.git"
# autobin = false

[dependencies]
embedded-hal = "1.0.0"
nb = "1.1.0"
panic-halt = "0.2.0"
ufmt = "0.2.0"
embedded-hal = "1.0"
nb = "1.1"
panic-halt = "1.0"
ufmt = "0.2"

#[dependencies.avr-device]
#version = "0.4.0"
#version = "0.6.0"
#features = ["attiny85"]

[dependencies.avr-hal-generic]
Expand Down
2 changes: 0 additions & 2 deletions boards/attiny85/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
cargoArtifacts,
commonArgs,
craneLib,
# deadnix: skip
stdenv,
}:
craneLib.buildPackage commonArgs
// {
Expand Down
1 change: 1 addition & 0 deletions boards/attiny85/rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[toolchain]
channel = "nightly-2024-03-22"
# channel = "nightly"
components = ["llvm-tools-preview", "rust-src"]
profile = "minimal"
targets = ["avr-unknown-none-attiny85.json"]
2 changes: 1 addition & 1 deletion boards/pico/.justfile
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ alias up := package

update:
nix flake update
cargo update
cargo update --verbose
2 changes: 1 addition & 1 deletion boards/qt-py-ch32v203/.justfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ alias up := package

update:
nix flake update
cargo update
cargo update --verbose
6 changes: 4 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
p:
(p.rust-bin.fromRustupToolchainFile ./boards/attiny85/rust-toolchain.toml).override {
# Remove the avr-unknown-none-attiny85.json file from the list of targets for the Rust toolchain.
# Nix doesn't really support target JSON files specified in the toolchain and even if it did, it won't be ablet to build a toolchain for AVR.
# Nix doesn't really support target JSON files specified in the toolchain and even if it did, it won't be able to build a toolchain for AVR.
# The AVR toolchain is unstable and does not include std.
targets = [ p.stdenv.hostPlatform.rust.rustcTarget ];
};
Expand Down Expand Up @@ -140,15 +140,17 @@
# will avoid IFD entirely but will require manually keeping the file
# up to date!
"${rustToolchain.passthru.availableComponents.rust-src}/lib/rustlib/src/rust/Cargo.lock"
# "${rustToolchain.passthru.availableComponents.rust-src}/lib/rustlib/src/rust/library/Cargo.lock"
];
};
cargoExtraArgs = "--target avr-unknown-none-attiny85.json -Z build-std=core";
inherit nativeBuildInputs;

extraDummyScript = ''
cp --archive ${./boards/attiny85/avr-unknown-none-attiny85.json} $out/avr-unknown-none-attiny85.json
rm --force --recursive $out/src/bin/crane-dummy-*
(shopt -s globstar; rm --force --recursive $out/**/src/bin/crane-dummy-*)
'';
# # rm --force --recursive $out/src/bin/crane-dummy-*
};

cargoArtifacts = craneLib.buildDepsOnly commonArgs;
Expand Down

0 comments on commit 83990a0

Please sign in to comment.