mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-11-25 21:19:35 +01:00
commit
b73263e8fa
11 changed files with 90 additions and 25 deletions
24
CHANGELOG.md
24
CHANGELOG.md
|
@ -5,6 +5,27 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|||
|
||||
## [Unreleased]
|
||||
|
||||
## [v0.3.0] - 2018-01-15
|
||||
|
||||
### Added
|
||||
|
||||
- [feat] `&'static mut` references can be safely created by assigning resources to `init`. See the
|
||||
`init.resources` section of the `app!` macro documentation and the `safe-static-mut-ref` example
|
||||
for details.
|
||||
|
||||
### Changed
|
||||
|
||||
- [breaking-change] svd2rust dependency has been bumped to v0.12.0
|
||||
|
||||
- [breaking-change] resources assigned to tasks, or to idle, that were not declared in the top
|
||||
`resources` field generate compiler errors. Before these were assumed to be peripherals, that's no
|
||||
longer the case.
|
||||
|
||||
- [breaking-change] the layout of `init::Peripherals` has changed. This struct now has two fields:
|
||||
`core` and `device`. The value of the `core` field is a struct that owns all the core peripherals
|
||||
of the device and the value of the `device` field is a struct that owns all the device specific
|
||||
peripherals of the device.
|
||||
|
||||
## [v0.2.2] - 2017-11-22
|
||||
|
||||
### Added
|
||||
|
@ -56,7 +77,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|||
|
||||
- Initial release
|
||||
|
||||
[Unreleased]: https://github.com/japaric/cortex-m-rtfm/compare/v0.2.2...HEAD
|
||||
[Unreleased]: https://github.com/japaric/cortex-m-rtfm/compare/v0.3.0...HEAD
|
||||
[v0.3.0]: https://github.com/japaric/cortex-m-rtfm/compare/v0.2.2...v0.3.0
|
||||
[v0.2.2]: https://github.com/japaric/cortex-m-rtfm/compare/v0.2.1...v0.2.2
|
||||
[v0.2.1]: https://github.com/japaric/cortex-m-rtfm/compare/v0.2.0...v0.2.1
|
||||
[v0.2.0]: https://github.com/japaric/cortex-m-rtfm/compare/v0.1.1...v0.2.0
|
||||
|
|
12
Cargo.toml
12
Cargo.toml
|
@ -13,23 +13,21 @@ repository = "https://github.com/japaric/cortex-m-rtfm"
|
|||
version = "0.3.0"
|
||||
|
||||
[dependencies]
|
||||
cortex-m = { git = "https://github.com/japaric/cortex-m" }
|
||||
cortex-m = "0.4.0"
|
||||
cortex-m-rtfm-macros = "0.3.0"
|
||||
rtfm-core = "0.2.0"
|
||||
untagged-option = "0.1.1"
|
||||
# rtfm-core = "0.2.0"
|
||||
rtfm-core = { git = "https://github.com/japaric/rtfm-core" }
|
||||
cortex-m-rtfm-macros = { path = "macros" }
|
||||
|
||||
[target.'cfg(target_arch = "x86_64")'.dev-dependencies]
|
||||
compiletest_rs = "0.3.5"
|
||||
|
||||
[dev-dependencies.cortex-m-rt]
|
||||
features = ["abort-on-panic"]
|
||||
version = "0.3.3"
|
||||
version = "0.3.9"
|
||||
|
||||
[dev-dependencies.stm32f103xx]
|
||||
features = ["rt"]
|
||||
git = "https://github.com/japaric/stm32f103xx"
|
||||
# version = "0.8.0"
|
||||
version = "0.8.0"
|
||||
|
||||
[features]
|
||||
cm7-r0p1 = ["cortex-m/cm7-r0p1"]
|
||||
|
|
|
@ -22,7 +22,7 @@ app! {
|
|||
}
|
||||
|
||||
fn init(_p: init::Peripherals, r: init::Resources) {
|
||||
let _buf: &'static mut [u8] = r.BUFFER;
|
||||
let _buf: &'static mut [u8; 16] = r.BUFFER;
|
||||
}
|
||||
|
||||
fn idle() -> ! {
|
||||
|
|
|
@ -11,6 +11,7 @@ main() {
|
|||
preemption
|
||||
nested
|
||||
late-resources
|
||||
safe-static-mut-ref
|
||||
generics
|
||||
full-syntax
|
||||
)
|
||||
|
|
|
@ -7,13 +7,12 @@ keywords = ["arm", "cortex-m"]
|
|||
license = "MIT OR Apache-2.0"
|
||||
name = "cortex-m-rtfm-macros"
|
||||
repository = "https://github.com/japaric/cortex-m-rtfm"
|
||||
version = "0.2.1"
|
||||
version = "0.3.0"
|
||||
|
||||
[dependencies]
|
||||
error-chain = "0.10.0"
|
||||
quote = "0.3.15"
|
||||
# rtfm-syntax = "0.2.0"
|
||||
rtfm-syntax = { git = "https://github.com/japaric/rtfm-syntax" }
|
||||
rtfm-syntax = "0.2.1"
|
||||
syn = "0.11.11"
|
||||
|
||||
[lib]
|
||||
|
|
|
@ -58,7 +58,7 @@ mod trans;
|
|||
/// ```
|
||||
///
|
||||
/// The initial value of a resource can be omitted. This means that the resource will be runtime
|
||||
/// initialized.
|
||||
/// initialized; these runtime initialized resources are also known as *late resources*.
|
||||
///
|
||||
/// If this key is omitted its value defaults to an empty list.
|
||||
///
|
||||
|
@ -79,6 +79,18 @@ mod trans;
|
|||
///
|
||||
/// If the key is omitted its value defaults to `init`.
|
||||
///
|
||||
/// ## `init.resources`
|
||||
///
|
||||
/// This key is optional. Its value is a set of resources the `init` function *owns*. The resources
|
||||
/// in this list must be a subset of the resources listed in the top `resources` key. Note that some
|
||||
/// restrictions apply:
|
||||
///
|
||||
/// - The resources in this list can't be late resources.
|
||||
/// - The resources that appear in this list can't appear in other list like `idle.resources` or
|
||||
/// `tasks.$TASK.resources`
|
||||
///
|
||||
/// If this key is omitted its value is assumed to be an empty list.
|
||||
///
|
||||
/// # `idle`
|
||||
///
|
||||
/// This key is optional. Its value is a set of key values. All the possible keys are shown below:
|
||||
|
@ -100,9 +112,7 @@ mod trans;
|
|||
/// ## `idle.resources`
|
||||
///
|
||||
/// This key is optional. Its value is a list of resources the `idle` loop has access to. The
|
||||
/// resources in this list can refer to the resources listed in the top `resources` key. If the name
|
||||
/// doesn't match one of the resources /// listed in the top `resources` key the resource is assumed
|
||||
/// to be a peripheral.
|
||||
/// resources in this list must be a subset of the resources listed in the top `resources` key.
|
||||
///
|
||||
/// If omitted its value defaults to an empty list.
|
||||
///
|
||||
|
@ -154,9 +164,7 @@ mod trans;
|
|||
/// ## `tasks.$TASK.resources`
|
||||
///
|
||||
/// This key is optional. Its value is a list of resources this task has access to. The resources in
|
||||
/// this list can refer to the resources listed in the top `resources` key. If the name doesn't
|
||||
/// match one of the resources listed in the top `resources` key the resource is assumed to be a
|
||||
/// peripheral.
|
||||
/// this list must be a subset of the resources listed in the top `resources` key.
|
||||
///
|
||||
/// If omitted its value defaults to an empty list.
|
||||
#[proc_macro]
|
||||
|
|
36
src/examples/_6_safe_static_mut_ref.rs
Normal file
36
src/examples/_6_safe_static_mut_ref.rs
Normal file
|
@ -0,0 +1,36 @@
|
|||
//! Safe creation of `&'static mut` references
|
||||
//!
|
||||
//! ```
|
||||
//! #![deny(unsafe_code)]
|
||||
//! #![deny(warnings)]
|
||||
//! #![feature(proc_macro)]
|
||||
//! #![no_std]
|
||||
//!
|
||||
//! extern crate cortex_m_rtfm as rtfm;
|
||||
//! extern crate stm32f103xx;
|
||||
//!
|
||||
//! use rtfm::app;
|
||||
//!
|
||||
//! app! {
|
||||
//! device: stm32f103xx,
|
||||
//!
|
||||
//! resources: {
|
||||
//! static BUFFER: [u8; 16] = [0; 16];
|
||||
//! },
|
||||
//!
|
||||
//! init: {
|
||||
//! resources: [BUFFER],
|
||||
//! },
|
||||
//! }
|
||||
//!
|
||||
//! fn init(_p: init::Peripherals, r: init::Resources) {
|
||||
//! let _buf: &'static mut [u8; 16] = r.BUFFER;
|
||||
//! }
|
||||
//!
|
||||
//! fn idle() -> ! {
|
||||
//! loop {
|
||||
//! rtfm::wfi();
|
||||
//! }
|
||||
//! }
|
||||
//! ```
|
||||
// Auto-generated. Do not modify.
|
|
@ -6,5 +6,6 @@ pub mod _2_two_tasks;
|
|||
pub mod _3_preemption;
|
||||
pub mod _4_nested;
|
||||
pub mod _5_late_resources;
|
||||
pub mod _6_generics;
|
||||
pub mod _7_full_syntax;
|
||||
pub mod _6_safe_static_mut_ref;
|
||||
pub mod _7_generics;
|
||||
pub mod _8_full_syntax;
|
||||
|
|
|
@ -37,18 +37,18 @@
|
|||
//! # Dependencies
|
||||
//!
|
||||
//! The application crate must depend on a device crate generated using
|
||||
//! [`svd2rust`] v0.11.x and the "rt" feature of that crate must be enabled. The
|
||||
//! [`svd2rust`] v0.12.x and the "rt" feature of that crate must be enabled. The
|
||||
//! SVD file used to generate the device crate *must* contain [`<cpu>`]
|
||||
//! information.
|
||||
//!
|
||||
//! [`svd2rust`]: https://docs.rs/svd2rust/0..0/svd2rust/
|
||||
//! [`svd2rust`]: https://docs.rs/svd2rust/0.12.0/svd2rust/
|
||||
//! [`<cpu>`]: https://www.keil.com/pack/doc/CMSIS/SVD/html/elem_cpu.html
|
||||
//!
|
||||
//! # `app!`
|
||||
//!
|
||||
//! The `app!` macro is documented [here].
|
||||
//!
|
||||
//! [here]: https://docs.rs/cortex-m-rtfm-macros/0.2.0/cortex_m_rtfm_macros/fn.app.html
|
||||
//! [here]: https://docs.rs/cortex-m-rtfm-macros/0.2.1/cortex_m_rtfm_macros/fn.app.html
|
||||
//!
|
||||
//! # Important: Cortex-M7 devices
|
||||
//!
|
||||
|
@ -90,13 +90,13 @@ extern crate untagged_option;
|
|||
use core::{mem, u8};
|
||||
|
||||
pub use cortex_m::asm::{bkpt, wfi};
|
||||
pub use cortex_m::peripheral::NVIC;
|
||||
pub use cortex_m_rtfm_macros::app;
|
||||
pub use rtfm_core::{Resource, Threshold};
|
||||
#[doc(hidden)]
|
||||
pub use untagged_option::UntaggedOption;
|
||||
|
||||
use cortex_m::interrupt::{self, Nr};
|
||||
use cortex_m::peripheral::NVIC;
|
||||
#[cfg(not(armv6m))]
|
||||
use cortex_m::register::basepri;
|
||||
|
||||
|
|
Loading…
Reference in a new issue