stm32 should now work

This commit is contained in:
Priec
2025-10-07 11:19:43 +02:00
commit 0836af0f4f
17 changed files with 843 additions and 0 deletions

66
flake.nix Normal file
View 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
'';
};
};
}