Im trying to flash a nucleo-l476RG board with blink template from GitHub - David-OConnor/stm32-hal-quickstart: A default template for STM32-HAL
It says that flashing is complete, but the led isn't working, and there is no communication, only this error message
My memory.x looks like this
/* Change this as required for your MCU */
MEMORY
{
/* NOTE 1 K = 1 KiBi = 1024 bytes */
FLASH : ORIGIN = 0x08000000, LENGTH = 1024K
RAM : ORIGIN = 0x20000000, LENGTH = 128K
}
cargo.toml
[package]
authors = ["Your name <your@em.ail>"]
name = "project_name"
edition = "2021"
version = "0.1.0"
[dependencies]
defmt = "0.3.2"
defmt-rtt = "0.4.0"
panic-probe = { version = "0.3.0", features = ["print-defmt"] }
cortex-m = {version = "^0.7.7", features = ["critical-section-single-core"]}
cortex-m-rt = "0.7.3"
# Change this import as required for your MCU.
stm32-hal2 = { version = "^1.5.5", features = ["l4x6", "l4rt"]}
# cargo build/run
[profile.dev]
codegen-units = 1
debug = 2
debug-assertions = true # <-
incremental = false
opt-level = 3 # <-
overflow-checks = true # <-
# cargo test
[profile.test]
codegen-units = 1
debug = 2
debug-assertions = true # <-
incremental = false
opt-level = 3 # <-
overflow-checks = true # <-
# cargo build/run --release
[profile.release]
codegen-units = 1
debug = 2
debug-assertions = false # <-
incremental = false
lto = 'fat'
opt-level = 3 # <-
overflow-checks = false # <-
# cargo test --release
[profile.bench]
codegen-units = 1
debug = 2
debug-assertions = false # <-
incremental = false
lto = 'fat'
opt-level = 3 # <-
overflow-checks = false # <-
config.toml
[target.'cfg(all(target_arch = "arm", target_os = "none"))']
# Change this runner as required for your MCU.
runner = "probe-run --chip STM32L476RGTx" # to list chips, run `probe-run --list-chips.`
rustflags = [
"-C", "linker=flip-link",
"-C", "link-arg=-Tlink.x",
"-C", "link-arg=-Tdefmt.x",
# This is needed if your flash or ram addresses are not aligned to 0x10000 in memory.x
# See https://github.com/rust-embedded/cortex-m-quickstart/pull/95
"-C", "link-arg=--nmagic",
]
[build]
# Change this target as required for your MCU.
target = "thumbv7em-none-eabihf" # Cortex-M4F and Cortex-M7F (eg F, L4, H7)
[alias]
rb = "run --bin"
rrb = "run --release --bin"
rr = "run --release"
and the code itself
#![no_std]
#![no_main]
use core::panic::PanicInfo;
use cortex_m::delay::Delay;
use cortex_m_rt::entry; // The runtime
use stm32_hal2::{
self,
clocks::{Clocks, InputSrc},
gpio::{Pin, PinMode, Port},
pac,
};
use defmt_rtt as _;
#[entry]
fn main() -> ! {
let cp = cortex_m::Peripherals::take().unwrap();
let mut dp = pac::Peripherals::take().unwrap();
let clock_cfg = Clocks::default();
defmt::println!("Hello, world!");
clock_cfg.setup().unwrap();
let mut delay = Delay::new(cp.SYST, clock_cfg.systick());
let mut led = Pin::new(Port::A, 5, PinMode::Output);
loop {
led.set_low();
delay.delay_ms(1_000);
led.set_high();
delay.delay_ms(1_000);
defmt::println!("Loopin");
}
}
#[panic_handler]
fn panic(_info: &PanicInfo) -> ! {
cortex_m::asm::udf()
}
/// Terminates the application and makes `probe-run` exit with exit-code = 0
pub fn exit() -> ! {
loop {
cortex_m::asm::bkpt();
}
}