From 9ae311c46c262c17a7c2fc24395ba7d1c3f4acfc Mon Sep 17 00:00:00 2001
From: Per <Per Lindgren>
Date: Wed, 18 Oct 2017 23:42:28 +0200
Subject: [PATCH] debugging sort of works
---
.cargo/config | 4 +--
.vscode/launch.json | 44 ++++++++++++++++++++++++++
.vscode/tasks.json | 31 ++++++++++++++++++
Cargo.toml | 15 ++++-----
README.md | 6 ++--
examples/hello-world.rs | 4 +--
examples/hello.rs | 6 ++--
src/adc.rs | 2 +-
src/lib.rs | 69 +++++++++++++++++++++--------------------
9 files changed, 129 insertions(+), 52 deletions(-)
create mode 100644 .vscode/launch.json
create mode 100644 .vscode/tasks.json
diff --git a/.cargo/config b/.cargo/config
index 6f29034..f604d34 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 0000000..b10947e
--- /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 0000000..82feda5
--- /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 efc67a3..3f06ac7 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 cac0ef7..a0acf2c 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 1d22e08..de1d50a 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 85afeb3..bda6020 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 a4c60bc..a17f7a1 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 91fdfbb..3980613 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);
+// }
--
GitLab