Skip to content

Commit 93abfac

Browse files
committed
stable by default, remove exception module, add SCB.vect_active, ..
tweak Exception enum to match CMSIS names, document the parts of the API that require opting into `"inline-asm"`.
1 parent b098b6a commit 93abfac

17 files changed

+248
-113
lines changed

.travis.yml

+19
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,33 @@ language: rust
22

33
matrix:
44
include:
5+
- env: TARGET=x86_64-unknown-linux-gnu
6+
rust: beta
7+
8+
- env: TARGET=thumbv6m-none-eabi
9+
rust: beta
10+
11+
- env: TARGET=thumbv7m-none-eabi
12+
rust: beta
13+
14+
- env: TARGET=thumbv7em-none-eabi
15+
rust: beta
16+
17+
- env: TARGET=thumbv7em-none-eabihf
18+
rust: beta
19+
520
- env: TARGET=x86_64-unknown-linux-gnu
621
rust: nightly
22+
723
- env: TARGET=thumbv6m-none-eabi
824
rust: nightly
25+
926
- env: TARGET=thumbv7m-none-eabi
1027
rust: nightly
28+
1129
- env: TARGET=thumbv7em-none-eabi
1230
rust: nightly
31+
1332
- env: TARGET=thumbv7em-none-eabihf
1433
rust: nightly
1534

CHANGELOG.md

+23-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,29 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/)
66
and this project adheres to [Semantic Versioning](http://semver.org/).
77

8-
## [Unreleased]
8+
## [v0.5.0] - 2018-05-11
9+
10+
### Added
11+
12+
- `DebugMonitor` and `SecureFault` variants to the `Exception` enumeration.
13+
14+
- An optional `"inline-asm"` feature
15+
16+
### Changed
17+
18+
- [breaking-change] This crate now requires `arm-none-eabi-gcc` to be installed and available in
19+
`$PATH` when built with the `"inline-asm"` feature disabled (which is disabled by default).
20+
21+
- [breaking-change] The `register::{apsr,lr,pc}` modules are now behind the `"inline-asm"` feature.
22+
23+
- [breaking-change] Some variants of the `Exception` enumeration are no longer available on
24+
`thumbv6m-none-eabi`. See API docs for details.
25+
26+
### Removed
27+
28+
- [breaking-change] The `exception` module has been removed. A replacement for `Exception::active`
29+
can be found in `SCB::vect_active`. A modified version `exception::Exception` can be found in the
30+
`peripheral::scb` module.
931

1032
## [v0.4.3] - 2018-01-25
1133

Cargo.toml

+3-10
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,16 @@ keywords = ["arm", "cortex-m", "register", "peripheral"]
77
license = "MIT OR Apache-2.0"
88
name = "cortex-m"
99
repository = "https://github.com/japaric/cortex-m"
10-
version = "0.4.4"
10+
version = "0.5.0"
1111

1212
[build-dependencies]
1313
cc = "1.0.10"
1414

1515
[dependencies]
16+
aligned = "0.2.0"
17+
bare-metal = "0.2.0"
1618
volatile-register = "0.2.0"
1719

18-
[dependencies.aligned]
19-
default-features = false
20-
version = "0.1.2"
21-
22-
[dependencies.bare-metal]
23-
default-features = false
24-
version = "0.1.2"
25-
2620
[features]
2721
cm7-r0p1 = []
28-
default = ["inline-asm"]
2922
inline-asm = []

asm/nop.s

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
.global __nop
22
__nop:
3-
nop
43
bx lr

ci/script.sh

+13-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,25 @@
11
set -euxo pipefail
22

33
main() {
4+
cargo check --target $TARGET
5+
6+
if [ $TRAVIS_RUST_VERSION = nightly ]; then
7+
cargo check --target $TARGET --features inline-asm
8+
fi
9+
410
case $TARGET in
511
thumbv7em-none-eabi*)
612
cargo check --target $TARGET --features cm7-r0p1
7-
cargo check --target $TARGET
13+
14+
if [ $TRAVIS_RUST_VERSION = nightly ]; then
15+
cargo check --target $TARGET --features 'cm7-r0p1 inline-asm'
16+
fi
817
;;
18+
919
thumbv*-none-eabi*)
10-
cargo check --target $TARGET
1120
;;
12-
*)
21+
22+
x86_64-unknown-linux-gnu)
1323
cargo test --target $TARGET
1424
;;
1525
esac

src/exception.rs

-72
This file was deleted.

src/lib.rs

+27-8
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,35 @@
55
//! - Access to core peripherals like NVIC, SCB and SysTick.
66
//! - Access to core registers like CONTROL, MSP and PSR.
77
//! - Interrupt manipulation mechanisms
8-
//! - Safe wrappers around assembly instructions like `bkpt`
8+
//! - Safe wrappers around Cortex-M specific instructions like `bkpt`
9+
//!
10+
//! # Requirements
11+
//!
12+
//! To use this crate on the stable or beta channel `arm-none-eabi-gcc` needs to be installed and
13+
//! available in your `$PATH`.
14+
//!
15+
//! # Optional features
16+
//!
17+
//! ## `inline-asm`
18+
//!
19+
//! When this feature is enabled the implementation of all the functions inside the `asm` and
20+
//! `register` modules use inline assembly (`asm!`) instead of external assembly (FFI into separate
21+
//! assembly files compiled using `arm-none-eabi-gcc`). The advantages the enabling `inline-asm`
22+
//! are:
23+
//!
24+
//! - Reduced overhead. FFI eliminates the possibility of inlining so all operations include a
25+
//! function call overhead when `inline-asm` is not enabled.
26+
//!
27+
//! - `arm-none-eabi-gcc` is not required for building this crate.
28+
//!
29+
//! - Some of the `register` API only becomes available only when `inline-asm` is enabled. Check the
30+
//! API docs for details.
31+
//!
32+
//! The disadvantage is that `inline-asm` requires a nightly toolchain.
933
34+
#![cfg_attr(feature = "inline-asm", feature(asm))]
1035
#![deny(missing_docs)]
1136
#![deny(warnings)]
12-
#![cfg_attr(feature = "inline-asm", feature(asm))]
1337
#![no_std]
1438

1539
extern crate aligned;
@@ -20,16 +44,11 @@ extern crate volatile_register;
2044
mod macros;
2145

2246
pub mod asm;
23-
pub mod exception;
2447
pub mod interrupt;
25-
// NOTE(target_arch) is for documentation purposes
48+
// NOTE(target_arch = "x86_64") is used throughout this crate for documentation purposes
2649
#[cfg(any(armv7m, target_arch = "x86_64"))]
2750
pub mod itm;
2851
pub mod peripheral;
2952
pub mod register;
3053

3154
pub use peripheral::Peripherals;
32-
33-
#[cfg(feature = "singleton")]
34-
#[doc(hidden)]
35-
pub use untagged_option::UntaggedOption;

src/macros.rs

+7-4
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,19 @@ macro_rules! singleton {
6363
let expr = $expr;
6464

6565
#[allow(unsafe_code)]
66-
unsafe { VAR = Some(expr) }
66+
unsafe {
67+
VAR = Some(expr)
68+
}
6769

6870
#[allow(unsafe_code)]
69-
unsafe { VAR.as_mut() }
71+
unsafe {
72+
VAR.as_mut()
73+
}
7074
}
7175
})
72-
}
76+
};
7377
}
7478

75-
7679
/// ``` compile_fail
7780
/// #[macro_use(singleton)]
7881
/// extern crate cortex_m;

src/peripheral/nvic.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
33
use volatile_register::{RO, RW};
44

5-
use peripheral::NVIC;
65
use interrupt::Nr;
6+
use peripheral::NVIC;
77

88
/// Register block
99
#[repr(C)]

0 commit comments

Comments
 (0)