| Crates.io | NUCLEO-G474RE-blink-for-embedded-rust |
| lib.rs | NUCLEO-G474RE-blink-for-embedded-rust |
| version | 0.2.0 |
| created_at | 2025-12-27 04:56:46.84059+00 |
| updated_at | 2026-01-02 23:13:31.789014+00 |
| description | Example project for blinking an LED on the NUCLEO-G474RE board using embedded Rust. |
| homepage | |
| repository | https://github.com/Patricio-Andre/NUCLEO-G474RE-blink-for-embedded-rust |
| max_upload_size | |
| id | 2006702 |
| size | 2,985,599 |
This repository contains a minimal Rust example that blinks the LED on the
Nucleo G474RE board. The project is intended as a starting point for
embedded Rust development on the STM32G4xx family. The repository includes a
canonical project layout, Cargo.toml, .cargo/config.toml, a Makefile, and
memory.x linker script — common components for embedded Rust projects.
Main contents:
src/main.rs — embedded application (main loop toggling PA5).src/utils/ — utilities for the example (previously included logging helpers).memory.x — linker script (Flash/RAM layout).Makefile — convenient targets (build, release, embed, flash, clippy, ...)..cargo/config.toml — build/target configuration.The crate is configured for the thumbv7em-none-eabihf target and uses the
stm32g474 feature of stm32g4xx-hal. This example focuses on blinking the
LED and does not depend on any logging backend by default.
rustup target add thumbv7em-none-eabihf
sudo apt update
sudo apt install gcc-arm-none-eabi binutils-arm-none-eabi
cargo install probe-rs # runner for `cargo run`
cargo install cargo-flash # cargo-flash
cargo install cargo-embed # cargo-embed (optional, supports many boards)
.cargo/config.tomlThis project includes .cargo/config.toml with target = "thumbv7em-none-eabihf".
It also contains a rustflags entry:
[target.thumbv7em-none-eabihf]
rustflags = ["-C", "link-arg=-Tlink.x"]
[build]
target = "thumbv7em-none-eabihf"
Important: the provided linker script is named memory.x.
Debug build:
cargo build
Release build (optimized):
cargo build --release
Using the Makefile is convenient but you should understand the underlying
commands.
If automatic detection fails, specify the chip explicitly:
cargo run
# or (with cargo-embed)
cargo embed
Use the product pages above to download the latest datasheet and reference manuals for the MCU and the Nucleo board. These manuals contain pinouts, electrical characteristics, peripheral descriptions, and programming guidelines that are helpful when adapting this example to other boards.
SVD file for debugging purposes: https://github.com/modm-io/cmsis-svd-stm32.git
Uses defmt for logging, enabled via RTT by default. Read the documentation to use it properly: https://defmt.ferrous-systems.com/
This project includes a .vscode/launch.json file configured for debugging
with the Cortex-Debug extension. Make sure to install the extension and adjust
the executable path if necessary.