Skip to content

Commit

Permalink
update blinky dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
Guozhanxin committed May 29, 2022
1 parent d185122 commit 5c3f93b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
8 changes: 6 additions & 2 deletions blinky/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,17 @@ authors = ["guozhanxin <[email protected]>"]

[dependencies]
cortex-m = "0.7"
cortex-m-rt = "0.6.5"
cortex-m-rt = "0.7"
panic-halt = "0.2.0"
panic-semihosting = "0.6.0"
cortex-m-semihosting = "0.5.0"
stm32l4xx-hal = { version = "0.6.0", features = ["rt", "stm32l4x2"] }
nb = "1.0.0"

[dependencies.stm32l4xx-hal]
git = "https://github.com/stm32-rs/stm32l4xx-hal"
tag = "v0.7.1"
features = ["rt", "stm32l475"]

[profile.dev]
opt-level = 1
debug = true
Expand Down
6 changes: 6 additions & 0 deletions blinky/elf2bin.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

project_path=$(cd `dirname $0`; pwd)
project_name="${project_path##*/}"
/opt/gcc-arm-none-eabi-10-2020-q4-major/bin/arm-none-eabi-objcopy target/thumbv7em-none-eabihf/release/$project_name -O binary $project_name.bin
echo 'make' $project_name'.bin OK!'
15 changes: 7 additions & 8 deletions blinky/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
//!
//! pe7 is used as pandora LED.
//!
#![deny(unsafe_code)]
#![deny(warnings)]
#![no_main]
#![no_std]
Expand Down Expand Up @@ -34,9 +33,9 @@ fn main() -> ! {
// TRY this alternate clock configuration (clocks run at nearly the maximum frequency)
let clocks = rcc
.cfgr
.sysclk(80.mhz())
.pclk1(80.mhz())
.pclk2(80.mhz())
.sysclk(80.MHz())
.pclk1(80.MHz())
.pclk2(80.MHz())
.freeze(&mut flash.acr, &mut pwr);

let mut gpioe = dp.GPIOE.split(&mut rcc.ahb2);
Expand All @@ -47,16 +46,16 @@ fn main() -> ! {
let mut timer = Delay::new(cp.SYST, clocks);

loop {
led.set_low().ok();
led.set_low();
timer.delay_ms(1000 as u32);

led.set_high().ok();
led.set_high();
timer.delay_ms(1000 as u32);
}

}

#[exception]
fn HardFault(ef: &ExceptionFrame) -> ! {
unsafe fn HardFault(ef: &ExceptionFrame) -> ! {
panic!("{:#?}", ef);
}
}

0 comments on commit 5c3f93b

Please sign in to comment.