Files
stm32u575-hal/flake.nix
2025-10-19 13:18:08 +02:00

69 lines
1.9 KiB
Nix
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
description = "STM32U575ZI-Q Rust Embedded Development Environment";
inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; };
outputs = { self, nixpkgs }: let
system = "x86_64-linux";
pkgs = import nixpkgs { inherit system; };
in {
devShells.${system}.default = pkgs.mkShell {
packages = with pkgs; [
# Base toolchain
rustup
llvm
gcc
gnumake
cmake
pkg-config
python3
git
curl
wget
unzip
svd2rust
form
# ARM embedded cross toolchain
gcc-arm-embedded
# Flashing / Debug
openocd
probe-rs
cargo-binutils
cargo-generate
flip-link
];
shellHook = ''
echo ">>> STM32U575ZI-Q Rust (HAL + PAC) DevShell"
echo "---------------------------------------------"
# Set up Rust target
rustup target add thumbv7em-none-eabihf 2>/dev/null || true
# Ensure probe-rs binary is in PATH
if ! command -v probe-rs >/dev/null; then
echo " probe-rs not found! (check nix installation)"
fi
export RUST_TARGET=thumbv7em-none-eabihf
export CARGO_TARGET_DIR=target
export PATH=$PATH:${pkgs.gcc-arm-embedded}/bin
echo "🧩 Target: $RUST_TARGET"
echo "💡 Examples:"
echo " 1 cargo generate --git https://github.com/rust-embedded/cortex-m-quickstart --name stm32u5-blinky"
echo " 2 cd stm32u5-blinky && cargo build --release --target thumbv7em-none-eabihf"
echo " 3 probe-rs run --chip STM32U575ZITxQ target/thumbv7em-none-eabihf/release/stm32u5-blinky"
echo ""
echo "🧠 TIP: Add stm32u5xx-hal to Cargo.toml to access register-level HAL API."
echo "---------------------------------------------"
rustc --version
arm-none-eabi-gcc --version | head -n1
'';
};
};
}