diff --git a/blinky/Cargo.toml b/blinky/Cargo.toml index 28cefb4..3b73349 100644 --- a/blinky/Cargo.toml +++ b/blinky/Cargo.toml @@ -7,13 +7,17 @@ authors = ["guozhanxin "] [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 diff --git a/blinky/elf2bin.sh b/blinky/elf2bin.sh new file mode 100755 index 0000000..a25b4c0 --- /dev/null +++ b/blinky/elf2bin.sh @@ -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!' \ No newline at end of file diff --git a/blinky/src/main.rs b/blinky/src/main.rs index 7e4aab4..e0e0f5f 100644 --- a/blinky/src/main.rs +++ b/blinky/src/main.rs @@ -2,7 +2,6 @@ //! //! pe7 is used as pandora LED. //! -#![deny(unsafe_code)] #![deny(warnings)] #![no_main] #![no_std] @@ -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); @@ -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); -} \ No newline at end of file +}