diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 05e549faff1d1ff7b2c904d04fd01c8424ecba92..e86a9273634c374dc2993820b1018010db87824f 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -75,6 +75,18 @@ "isDefault": true } }, + { + "type": "shell", + "label": "cargo build --example rtfm_interrupt --features stm32f4", + "command": "cargo build --example rtfm_interrupt --features stm32f4", + "problemMatcher": [ + "$rustc" + ], + "group": { + "kind": "build", + "isDefault": true + } + }, { "type": "shell", "label": "cargo build --example bare0", diff --git a/Cargo.toml b/Cargo.toml index eb009a14b59717d77464544524feba9d9d5fd70a..6c509df596c6f35da0ed81051c38e4d5639f2580 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,11 +6,12 @@ name = "app" version = "0.1.0" # [patch.crates-io] -# stm32f4xx-hal = { path = "../stm32f4xx-hal" } +# # stm32f4xx-hal = { path = "../stm32f4xx-hal" } +# stm32fxx-hal = {git = "https://github.com/stm32-rs/stm32f4xx-hal.git" } [dependencies] cortex-m-rt = "0.6.7" -# cortex-m-semihosting = "0.3.2" +cortex-m-semihosting = "0.3.2" panic-halt = "0.2.0" # panic-abort = "0.3.1" # requires nightly toolchain @@ -29,18 +30,19 @@ features = ["inline-asm"] # <- currently requires nightly compiler [dependencies.stm32f4] version = "0.5.0" -features = ["stm32f411", "rt"] +features = ["stm32f413", "rt"] # optional = true [dependencies.stm32f4xx-hal] +git = "https://github.com/stm32-rs/stm32f4xx-hal.git" version = "0.2.8" -features = ["stm32f411", "rt"] +features = ["stm32f413", "rt"] # this lets you use `cargo fix`! -# [[bin]] -# name = "app" -# test = false -# bench = false +[[bin]] +name = "app" +test = false +bench = false [profile.dev] incremental = false diff --git a/examples/bare6.rs b/examples/bare6.rs index cd278a618e5ee9a0e5efedf747010e55a6d79cb1..db6977d62059c7b0c750f5b7c4c4cb84207074b9 100644 --- a/examples/bare6.rs +++ b/examples/bare6.rs @@ -26,11 +26,13 @@ extern crate panic_halt; -use cortex_m::{iprint, iprintln, peripheral::itm::Stim, peripheral::syst::SystClkSource}; -use cortex_m_rt::{entry, exception}; +use cortex_m::{iprintln, peripheral::itm::Stim}; +use cortex_m_rt::{entry}; use stm32f4::stm32f411; -use stm32f411::{interrupt, Interrupt, DWT, GPIOA, GPIOC, ITM, NVIC, RCC, SYST}; +use stm32f411::{ + DWT, GPIOA, GPIOC, RCC, +}; #[entry] fn main() -> ! { diff --git a/examples/rtfm_interrupt.rs b/examples/rtfm_interrupt.rs index c24daa5057fa35dacad9bca592933f9c3791cec3..43ed5d0581ab0dfba5940d3fba04898a62b5393d 100644 --- a/examples/rtfm_interrupt.rs +++ b/examples/rtfm_interrupt.rs @@ -5,14 +5,14 @@ extern crate panic_halt; -extern crate stm32f4xx_hal as hal; +extern crate stm32f4; +//extern crate stm32f4xx_hal as hal; // use crate::hal::stm32::Interrupt::EXTI0; use rtfm::app; // use hal::stm32::Interrupt::EXTI0; -#[app(device = hal::stm32)] -// #[app(device = stm32f4xx_hal::stm32)] +#[app(device = stm32f4::stm32f413)] const APP: () = { // init runs in an interrupt free section @@ -21,4 +21,7 @@ const APP: () = { #[interrupt] fn EXTI0() {} + + #[interrupt] + fn USART2() {} }; diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000000000000000000000000000000000000..f36bdb3edeb66447ed3290aef1408356f3e64eea --- /dev/null +++ b/src/main.rs @@ -0,0 +1,15 @@ +//! Prints "Hello, world!" on the host console using semihosting + +#![no_main] +#![no_std] + +extern crate panic_halt; + +use cortex_m_rt::entry; +use cortex_m_semihosting::hprintln; + +#[entry] +fn main() -> ! { + hprintln!("Hello, world!").unwrap(); + loop {} +}