start of a hal crate
This commit is contained in:
66
flake.nix
Normal file
66
flake.nix
Normal file
@@ -0,0 +1,66 @@
|
||||
{
|
||||
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
|
||||
|
||||
# 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
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user