diff --git a/.cargo/config b/.cargo/config index 6f290348bda557ea46416913b79dd160fd625253..f604d34af8ed2d87835566a5ab4875654c9948d0 100644 --- a/.cargo/config +++ b/.cargo/config @@ -1,4 +1,4 @@ -[target.thumbv7m-none-eabi] +[target.thumbv7em-none-eabihf] runner = 'arm-none-eabi-gdb' rustflags = [ "-C", "link-arg=-Tlink.x", @@ -7,4 +7,4 @@ rustflags = [ ] [build] -target = "thumbv7m-none-eabi" +target = "thumbv7em-none-eabihf" diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000000000000000000000000000000000000..b10947e9bc40c0d2335dc083ded62b9cc087e364 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,44 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + // { + // "type": "gdb", + // "request": "attach", + // "name": "Release", + // "gdbpath": "/usr/bin/arm-none-eabi-gdb", + // "executable": "./target/thumbv7em-none-eabihf/release/nucleo-64", + // "target": ":3333", + // "remote": true, + // "autorun": [ + // "monitor arm semihosting enable", + // "monitor reset init", + // //"set target-async off", + // "load ./target/thumbv7em-none-eabihf/release/nucleo-64" + // //"set remotetimeout 30", + // //"monitor reset halt", + // //"step" + // ], + // "cwd": "${workspaceRoot}" + // }, + { + "type": "gdb", + "request": "attach", + "name": "Debug hello", + "gdbpath": "/usr/bin/arm-none-eabi-gdb", + //"executable": ".target/thumbv7em-none-eabihf/debug/examples/hello", + "target": ":3333", + "remote": true, + //"debugger_args": [], + "autorun": [ + "monitor reset halt", + "monitor arm semihosting enable", + "file ./target/thumbv7em-none-eabihf/debug/examples/hello", + "load" + ], + "cwd": "${workspaceRoot}" + } + ] +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000000000000000000000000000000000000..82feda55a753077ce774db99d9b49f4a9ac892ad --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,31 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + "version": "2.0.0", + "tasks": [ + { + "taskName": "xargo build --example hello --release", + "type": "shell", + "command": "xargo build --example hello --release", + // "group": { + // "kind": "build", + // "isDefault": true + // }, + "problemMatcher": [ + "$rustc" + ] + }, + { + "taskName": "xargo build --example hello", + "type": "shell", + "command": "xargo build --example hello", + "group": { + "kind": "build", + "isDefault": true + }, + "problemMatcher": [ + "$rustc" + ] + } + ] +} \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index efc67a39717fd05284fd98b4efedcccbad34790f..3f06ac7dfbd53ada79d30055cabd4d911799763c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,11 +1,11 @@ [package] -authors = ["Jorge Aparicio <jorge@japaric.io>"] +authors = ["Per Lindgren <per.lindgren@ltu.se>"] categories = ["asynchronous", "embedded", "hardware-support", "no-std"] -description = "Board Support Crate for the Blue Pill" +description = "Board Support Crate for the Nucleo-64 stm32f401x" keywords = ["arm", "cortex-m", "stm32"] license = "MIT OR Apache-2.0" -name = "blue-pill" -repository = "https://github.com/japaric/blue-pill" +name = "nucleo-64" +repository = "https://gitlab.henriktjader.com/pln/nucleo-64" version = "0.1.0" [dependencies] @@ -23,12 +23,13 @@ rev = "7d904f515d15fd5fe7ea34e18820ea83e2651fa2" [dependencies.nb] git = "https://github.com/japaric/nb" -[dependencies.stm32f103xx] +[dependencies.stm32f40x] +git = "https://gitlab.henriktjader.com/pln/STM32F40x" features = ["rt"] -version = "0.7.2" +#version = "0.7.2" [dev-dependencies] -cortex-m = "0.3.0" +cortex-m = "0.3.1" cortex-m-rtfm = "0.2.0" cortex-m-semihosting = "0.2.0" diff --git a/README.md b/README.md index cac0ef7c88a0d739e8466daa82a20d4f97428fc6..a0acf2c67aff2d8944034ac9a7611e864dbd1e5f 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ # `blue-pill` -> Board Support Crate for [Blue Pill] +> Board Support Crate for [Nucleo-64-stm32f401re] -[Blue Pill]: http://wiki.stm32duino.com/index.php?title=Blue_Pill +[nucleo-64] board: http://www.st.com/content/ccc/resource/technical/document/user_manual/98/2e/fa/4b/e0/82/43/b7/DM00105823.pdf/files/DM00105823.pdf/jcr:content/translations/en.DM00105823.pdf -## [Documentation](https://japaric.github.io/blue-pill/blue_pill) +## [Documentation](todo) ## License diff --git a/examples/hello-world.rs b/examples/hello-world.rs index 1d22e08920ee980aca5ab011b241832c0e3b8143..de1d50a00987520abb34a88d0de92c787fb262a4 100644 --- a/examples/hello-world.rs +++ b/examples/hello-world.rs @@ -4,9 +4,9 @@ #![feature(proc_macro)] #![no_std] -extern crate blue_pill; extern crate cortex_m_rtfm as rtfm; extern crate cortex_m_semihosting as semihosting; +extern crate nucleo_64; use core::fmt::Write; @@ -14,7 +14,7 @@ use rtfm::{app, Threshold}; use semihosting::hio::{self, HStdout}; app! { - device: blue_pill::stm32f103xx, + device: nucleo_64::stm32f401xx, resources: { static HSTDOUT: Option<HStdout> = None; diff --git a/examples/hello.rs b/examples/hello.rs index 85afeb372b52bcb07da3836c392b8456453ef5e4..bda6020c9c9687546f9fb2e2f4c8d2e85c7995c1 100644 --- a/examples/hello.rs +++ b/examples/hello.rs @@ -4,9 +4,9 @@ #![feature(proc_macro)] #![no_std] -extern crate blue_pill; extern crate cortex_m_rtfm as rtfm; extern crate cortex_m_semihosting as semihosting; +extern crate nucleo_64; use core::fmt::Write; @@ -14,13 +14,13 @@ use rtfm::app; use semihosting::hio; app! { - device: blue_pill::stm32f103xx, + device: nucleo_64::stm32f40x, } fn init(_p: init::Peripherals) {} fn idle() -> ! { - writeln!(hio::hstdout().unwrap(), "Hello, world!").unwrap(); + writeln!(hio::hstdout().unwrap(), "Hello, Rust 3 world!").unwrap(); loop { rtfm::wfi(); diff --git a/src/adc.rs b/src/adc.rs index a4c60bcddc22ed5c36185189014e2d7f0dde5083..a17f7a1fef872c809cf94a9d4e5825782f528b60 100644 --- a/src/adc.rs +++ b/src/adc.rs @@ -7,7 +7,7 @@ use hal::prelude::*; use static_ref::Static; use dma::{self, CircBuffer, Dma1Channel1}; -use stm32f103xx::{ADC1, DMA1, TIM2, GPIOA, RCC}; +use stm32f40x::{ADC1, DMA1, TIM2, GPIOA, RCC}; use {Channel, Pwm}; /// ADC Channel 1 (PA1) diff --git a/src/lib.rs b/src/lib.rs index 91fdfbb4512a71629f4d4d948350fc6f79f5cb7b..3980613b3d89d755dc6cbb988cecf6562945a35c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -11,7 +11,8 @@ //! [i]: https://docs.rs/cortex-m-quickstart/0.1.8/cortex_m_quickstart/ #![deny(missing_docs)] -#![deny(warnings)] +//#![deny(warnings)] +#![allow(warnings)] #![feature(const_cell_new)] #![feature(const_fn)] #![feature(const_unsafe_cell_new)] @@ -25,29 +26,29 @@ extern crate embedded_hal as hal; extern crate nb; extern crate static_ref; -pub extern crate stm32f103xx; - -pub mod adc; -pub mod capture; -pub mod dma; -pub mod gpio; -pub mod led; -pub mod pwm; -pub mod qei; -pub mod rtc; -pub mod serial; -pub mod spi; -pub mod time; -pub mod timer; +pub extern crate stm32f40x; + +// pub mod adc; +// pub mod capture; +// pub mod dma; +// pub mod gpio; +// pub mod led; +// pub mod pwm; +// pub mod qei; +// pub mod rtc; +// pub mod serial; +// pub mod spi; +// pub mod time; +// pub mod timer; pub use hal::prelude; -pub use capture::Capture; -pub use pwm::Pwm; -pub use qei::Qei; -pub use rtc::Rtc; -pub use serial::Serial; -pub use spi::Spi; -pub use timer::{Channel, Timer}; +// pub use capture::Capture; +// pub use pwm::Pwm; +// pub use qei::Qei; +// pub use rtc::Rtc; +// pub use serial::Serial; +// pub use spi::Spi; +// pub use timer::{Channel, Timer}; macro_rules! frequency { ($FREQUENCY:expr) => { @@ -119,17 +120,17 @@ macro_rules! frequency { } } -/// Advance High-performance Bus (AHB) -pub mod ahb { - frequency!(8_000_000); -} +// /// Advance High-performance Bus (AHB) +// pub mod ahb { +// frequency!(8_000_000); +// } -/// Advance Peripheral Bus 1 (APB1) -pub mod apb1 { - frequency!(8_000_000); -} +// /// Advance Peripheral Bus 1 (APB1) +// pub mod apb1 { +// frequency!(8_000_000); +// } -/// Advance Peripheral Bus 2 (APB2) -pub mod apb2 { - frequency!(8_000_000); -} +// /// Advance Peripheral Bus 2 (APB2) +// pub mod apb2 { +// frequency!(8_000_000); +// }