Skip to content

Commit

Permalink
move to embedded-hal v0.2 and cortex-m-rt v0.5 to reduce the number o…
Browse files Browse the repository at this point in the history
…f unstable features
  • Loading branch information
japaric committed May 12, 2018
1 parent 8c3be1f commit cdee343
Show file tree
Hide file tree
Showing 40 changed files with 681 additions and 896 deletions.
12 changes: 4 additions & 8 deletions .cargo/config
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
[target.thumbv7em-none-eabi]
runner = 'arm-none-eabi-gdb'
rustflags = [
"-C", "link-arg=-Tlink.x",
"-C", "linker=arm-none-eabi-ld",
"-Z", "linker-flavor=ld",
"-Z", "thinlto=no",
"-C", "link-arg=-Wl,-Tlink.x",
"-C", "link-arg=-nostartfiles",
]

[target.thumbv7em-none-eabihf]
runner = 'arm-none-eabi-gdb'
rustflags = [
"-C", "link-arg=-Tlink.x",
"-C", "linker=arm-none-eabi-ld",
"-Z", "linker-flavor=ld",
"-Z", "thinlto=no",
"-C", "link-arg=-Wl,-Tlink.x",
"-C", "link-arg=-nostartfiles",
]

[build]
Expand Down
11 changes: 4 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,20 @@ language: rust
matrix:
include:
- env: TARGET=x86_64-unknown-linux-gnu
rust: nightly

- env: TARGET=thumbv7em-none-eabi
rust: nightly
addons:
apt:
sources:
- debian-sid
packages:
- binutils-arm-none-eabi
- gcc-arm-none-eabi

- env: TARGET=thumbv7em-none-eabihf
rust: nightly
addons:
apt:
sources:
- debian-sid
packages:
- binutils-arm-none-eabi
- gcc-arm-none-eabi

before_install: set -e

Expand Down
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

## [v0.6.0] - 2018-05-12

- [breaking-change] bumped the `stm32f30x-hal` dependency to v0.2.0.

- [breaking-change] this crate now requires `arm-none-eabi-gcc` to be installed and available on
`$PATH` to build.

## [v0.5.3] - 2018-02-19

### Added
Expand Down Expand Up @@ -118,7 +125,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

- Low level access to some peripherals: DBGMCU, GPIO, RCC and TIM

[Unreleased]: https://github.com/japaric/f3/compare/v0.5.3...HEAD
[Unreleased]: https://github.com/japaric/f3/compare/v0.6.0...HEAD
[v0.6.0]: https://github.com/japaric/f3/compare/v0.5.3...v0.6.0
[v0.5.3]: https://github.com/japaric/f3/compare/v0.5.2...v0.5.3
[v0.5.2]: https://github.com/japaric/f3/compare/v0.5.1...v0.5.2
[v0.5.1]: https://github.com/japaric/f3/compare/v0.5.0...v0.5.1
Expand Down
36 changes: 13 additions & 23 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,20 @@ keywords = ["arm", "cortex-m", "stm32"]
license = "MIT OR Apache-2.0"
name = "f3"
repository = "https://github.com/japaric/f3"
version = "0.5.3"
version = "0.6.0"

[dependencies]
l3gd20 = "0.1.2"
lsm303dlhc = "0.1.2"
stm32f30x-hal = "0.1.2"
l3gd20 = "0.2.0"
lsm303dlhc = "0.2.0"
stm32f30x-hal = "0.2.0"

[dev-dependencies]
aligned = "0.1.1"
cortex-m = "0.4.1"
cortex-m-rtfm = "0.3.1"
cortex-m-semihosting = "0.2.0"
madgwick = "0.1.0"
aligned = "0.2.0"
cortex-m = "0.5.0"
cortex-m-rt = "0.5.0"
cortex-m-semihosting = "0.3.0"
madgwick = "0.1.1"
panic-semihosting = "0.2.0"

[dev-dependencies.byteorder]
default-features = false
Expand All @@ -33,25 +34,14 @@ version = "0.2.2"
default-features = false
version = "0.1.3"

[dev-dependencies.cortex-m-rt]
features = ["abort-on-panic"]
version = "0.3.12"

[dev-dependencies.nb]
features = ["unstable"]
version = "0.1.1"

[dev-dependencies.stm32f30x-hal]
stm32f30x-hal = "0.2.0"
features = ["rt"]
version = "0.1.1"

[features]
rt = ["stm32f30x-hal/rt"]

[profile.dev]
codegen-units = 1
incremental = false

[profile.release]
codegen-units = 1
debug = true
lto = true
lto = true
6 changes: 0 additions & 6 deletions Xargo.toml

This file was deleted.

3 changes: 2 additions & 1 deletion ci/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ main() {
return
fi

cargo check --target $TARGET --examples
cargo build --target $TARGET --examples
cargo build --target $TARGET --examples --release
}

main
21 changes: 20 additions & 1 deletion examples/blinky.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,23 @@
#![deny(unsafe_code)]
#![deny(warnings)]
#![no_std]
#![no_main]

extern crate cortex_m;
#[macro_use(entry, exception)]
extern crate cortex_m_rt as rt;
extern crate f3;
extern crate panic_semihosting;

use f3::hal::delay::Delay;
use f3::hal::prelude::*;
use f3::hal::stm32f30x;
use f3::led::Led;
use rt::ExceptionFrame;

fn main() {
entry!(main);

fn main() -> ! {
let cp = cortex_m::Peripherals::take().unwrap();
let dp = stm32f30x::Peripherals::take().unwrap();

Expand All @@ -37,3 +44,15 @@ fn main() {
delay.delay_ms(1_000_u16);
}
}

exception!(HardFault, hard_fault);

fn hard_fault(ef: &ExceptionFrame) -> ! {
panic!("{:#?}", ef);
}

exception!(*, default_handler);

fn default_handler(irqn: i16) {
panic!("Unhandled exception (IRQn = {})", irqn);
}
79 changes: 0 additions & 79 deletions examples/cooperative.rs

This file was deleted.

23 changes: 22 additions & 1 deletion examples/hello.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,36 @@
//! Prints "Hello, world" on the OpenOCD console
#![deny(unsafe_code)]
#![deny(warnings)]
#![no_main]
#![no_std]

#[macro_use(entry, exception)]
extern crate cortex_m_rt as rt;
extern crate cortex_m_semihosting as semihosting;
extern crate f3;
extern crate panic_semihosting;

use core::fmt::Write;

use rt::ExceptionFrame;
use semihosting::hio;

fn main() {
entry!(main);

fn main() -> ! {
writeln!(hio::hstdout().unwrap(), "Hello, world!").unwrap();

loop {}
}

exception!(HardFault, hard_fault);

fn hard_fault(ef: &ExceptionFrame) -> ! {
panic!("{:#?}", ef);
}

exception!(*, default_handler);

fn default_handler(irqn: i16) {
panic!("Unhandled exception (IRQn = {})", irqn);
}
27 changes: 26 additions & 1 deletion examples/itm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,40 @@
//! [`itm`]: https://docs.rs/itm/0.2.0/itm/
#![deny(unsafe_code)]
#![deny(warnings)]
#![no_main]
#![no_std]

#[macro_use]
extern crate cortex_m;
extern crate f3;
extern crate panic_semihosting;
#[macro_use(entry, exception)]
extern crate cortex_m_rt as rt;

fn main() {
use cortex_m::asm;
use rt::ExceptionFrame;

entry!(main);

fn main() -> ! {
let p = cortex_m::Peripherals::take().unwrap();
let mut itm = p.ITM;

iprintln!(&mut itm.stim[0], "Hello, world!");

asm::bkpt();

loop {}
}

exception!(HardFault, hard_fault);

fn hard_fault(ef: &ExceptionFrame) -> ! {
panic!("{:#?}", ef);
}

exception!(*, default_handler);

fn default_handler(irqn: i16) {
panic!("Unhandled exception (IRQn = {})", irqn);
}
Loading

0 comments on commit cdee343

Please sign in to comment.