Compare commits

...

2 Commits

Author SHA1 Message Date
atse cb7acab03f Update nix repos 2024-01-29 17:29:54 +08:00
atse 82e27b1234 Use rust-objcopy instead of llvm-objcopy
This uses rust's own llvm version
2024-01-29 17:25:20 +08:00
3 changed files with 11 additions and 9 deletions

View File

@ -45,7 +45,7 @@ There are several options for flashing Thermostat. DFU requires only a micro-USB
### dfu-util on Linux ### dfu-util on Linux
* Install the DFU USB tool (dfu-util). * Install the DFU USB tool (dfu-util).
* Convert firmware from ELF to BIN: `arm-none-eabi-objcopy -O binary thermostat thermostat.bin` (you can skip this step if using the BIN from Hydra) * Convert firmware from ELF to BIN: `rust-objcopy -O binary target/thumbv7em-none-eabihf/release/thermostat thermostat.bin` (you can skip this step if using the BIN from Hydra)
* Connect to the Micro USB connector to Thermostat below the RJ45. * Connect to the Micro USB connector to Thermostat below the RJ45.
* Add jumper to Thermostat v2.0 across 2-pin jumper adjacent to JTAG connector. * Add jumper to Thermostat v2.0 across 2-pin jumper adjacent to JTAG connector.
* Cycle board power to put it in DFU update mode * Cycle board power to put it in DFU update mode

View File

@ -18,16 +18,16 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1691421349, "lastModified": 1704420045,
"narHash": "sha256-RRJyX0CUrs4uW4gMhd/X4rcDG8PTgaaCQM5rXEJOx6g=", "narHash": "sha256-C36QmoJd5tdQ5R9MC1jM7fBkZW9zBUqbUCsgwS6j4QU=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "011567f35433879aae5024fc6ec53f2a0568a6c4", "rev": "c1be43e8e837b8dbee2b3665a007e761680f0c3d",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "NixOS", "owner": "NixOS",
"ref": "nixos-23.05", "ref": "nixos-23.11",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }

View File

@ -1,7 +1,7 @@
{ {
description = "Firmware for the Sinara 8451 Thermostat"; description = "Firmware for the Sinara 8451 Thermostat";
inputs.nixpkgs.url = github:NixOS/nixpkgs/nixos-23.05; inputs.nixpkgs.url = github:NixOS/nixpkgs/nixos-23.11;
inputs.mozilla-overlay = { url = github:mozilla/nixpkgs-mozilla; flake = false; }; inputs.mozilla-overlay = { url = github:mozilla/nixpkgs-mozilla; flake = false; };
outputs = { self, nixpkgs, mozilla-overlay }: outputs = { self, nixpkgs, mozilla-overlay }:
@ -39,7 +39,7 @@
}; };
}; };
nativeBuildInputs = [ pkgs.llvm ]; nativeBuildInputs = [ pkgs.cargo-binutils ];
buildPhase = '' buildPhase = ''
cargo build --release --bin thermostat cargo build --release --bin thermostat
@ -49,11 +49,12 @@
mkdir -p $out $out/nix-support mkdir -p $out $out/nix-support
cp target/thumbv7em-none-eabihf/release/thermostat $out/thermostat.elf cp target/thumbv7em-none-eabihf/release/thermostat $out/thermostat.elf
echo file binary-dist $out/thermostat.elf >> $out/nix-support/hydra-build-products echo file binary-dist $out/thermostat.elf >> $out/nix-support/hydra-build-products
llvm-objcopy -O binary target/thumbv7em-none-eabihf/release/thermostat $out/thermostat.bin rust-objcopy -O binary target/thumbv7em-none-eabihf/release/thermostat $out/thermostat.bin
echo file binary-dist $out/thermostat.bin >> $out/nix-support/hydra-build-products echo file binary-dist $out/thermostat.bin >> $out/nix-support/hydra-build-products
''; '';
dontFixup = true; dontFixup = true;
auditable = false;
}; };
in { in {
packages.x86_64-linux = { packages.x86_64-linux = {
@ -67,7 +68,8 @@
devShell.x86_64-linux = pkgs.mkShell { devShell.x86_64-linux = pkgs.mkShell {
name = "thermostat-dev-shell"; name = "thermostat-dev-shell";
buildInputs = with pkgs; [ buildInputs = with pkgs; [
rust openocd dfu-util rust cargo-binutils
openocd dfu-util
] ++ (with python3Packages; [ ] ++ (with python3Packages; [
numpy matplotlib numpy matplotlib
]); ]);