174: v0.4.3 r=japaric a=japaric

prepares a new release

Co-authored-by: Jorge Aparicio <jorge@japaric.io>
This commit is contained in:
bors[bot] 2019-04-21 16:21:57 +00:00
commit 852337e03b
4 changed files with 31 additions and 8 deletions

View file

@ -5,6 +5,18 @@ This project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased] ## [Unreleased]
## [v0.4.3] - 2019-04-21
### Changed
- Checking that the specified priorities are supported by the target device is
now done at compile time.
### Fixed
- Building this crate with the "nightly" feature and a recent compiler has been
fixed.
## [v0.4.2] - 2019-02-27 ## [v0.4.2] - 2019-02-27
### Added ### Added
@ -219,7 +231,8 @@ Yanked due to a soundness issue in `init`; the issue has been mostly fixed in v0
- Initial release - Initial release
[Unreleased]: https://github.com/japaric/cortex-m-rtfm/compare/v0.4.2...HEAD [Unreleased]: https://github.com/japaric/cortex-m-rtfm/compare/v0.4.3...HEAD
[v0.4.3]: https://github.com/japaric/cortex-m-rtfm/compare/v0.4.2...v0.4.3
[v0.4.2]: https://github.com/japaric/cortex-m-rtfm/compare/v0.4.1...v0.4.2 [v0.4.2]: https://github.com/japaric/cortex-m-rtfm/compare/v0.4.1...v0.4.2
[v0.4.1]: https://github.com/japaric/cortex-m-rtfm/compare/v0.4.0...v0.4.1 [v0.4.1]: https://github.com/japaric/cortex-m-rtfm/compare/v0.4.0...v0.4.1
[v0.4.0]: https://github.com/japaric/cortex-m-rtfm/compare/v0.3.4...v0.4.0 [v0.4.0]: https://github.com/japaric/cortex-m-rtfm/compare/v0.3.4...v0.4.0

View file

@ -12,7 +12,7 @@ license = "MIT OR Apache-2.0"
name = "cortex-m-rtfm" name = "cortex-m-rtfm"
readme = "README.md" readme = "README.md"
repository = "https://github.com/japaric/cortex-m-rtfm" repository = "https://github.com/japaric/cortex-m-rtfm"
version = "0.4.2" version = "0.4.3"
[lib] [lib]
name = "rtfm" name = "rtfm"
@ -36,7 +36,7 @@ required-features = ["timer-queue"]
[dependencies] [dependencies]
cortex-m = "0.5.8" cortex-m = "0.5.8"
cortex-m-rt = "0.6.7" cortex-m-rt = "0.6.7"
cortex-m-rtfm-macros = { path = "macros", version = "0.4.2" } cortex-m-rtfm-macros = { path = "macros", version = "0.4.3" }
heapless = "0.4.1" heapless = "0.4.1"
owned-singleton = "0.1.0" owned-singleton = "0.1.0"

View file

@ -9,7 +9,7 @@ license = "MIT OR Apache-2.0"
name = "cortex-m-rtfm-macros" name = "cortex-m-rtfm-macros"
readme = "../README.md" readme = "../README.md"
repository = "https://github.com/japaric/cortex-m-rtfm" repository = "https://github.com/japaric/cortex-m-rtfm"
version = "0.4.2" version = "0.4.3"
[lib] [lib]
proc-macro = true proc-macro = true

View file

@ -464,14 +464,15 @@ fn init(ctxt: &mut Context, app: &App, analysis: &Analysis) -> (proc_macro2::Tok
fn post_init(ctxt: &Context, app: &App, analysis: &Analysis) -> proc_macro2::TokenStream { fn post_init(ctxt: &Context, app: &App, analysis: &Analysis) -> proc_macro2::TokenStream {
let mut exprs = vec![]; let mut exprs = vec![];
// TODO turn the assertions that check that the priority is not larger than what's supported by
// the device into compile errors
let device = &app.args.device; let device = &app.args.device;
let nvic_prio_bits = quote!(#device::NVIC_PRIO_BITS); let nvic_prio_bits = quote!(#device::NVIC_PRIO_BITS);
for (handler, exception) in &app.exceptions { for (handler, exception) in &app.exceptions {
let name = exception.args.binds(handler); let name = exception.args.binds(handler);
let priority = exception.args.priority; let priority = exception.args.priority;
exprs.push(quote!(assert!(#priority <= (1 << #nvic_prio_bits))));
// compile time assert that the priority is supported by the device
exprs.push(quote!(let _ = [(); ((1 << #nvic_prio_bits) - #priority as usize)];));
exprs.push(quote!(p.SCB.set_priority( exprs.push(quote!(p.SCB.set_priority(
rtfm::export::SystemHandler::#name, rtfm::export::SystemHandler::#name,
((1 << #nvic_prio_bits) - #priority) << (8 - #nvic_prio_bits), ((1 << #nvic_prio_bits) - #priority) << (8 - #nvic_prio_bits),
@ -480,7 +481,10 @@ fn post_init(ctxt: &Context, app: &App, analysis: &Analysis) -> proc_macro2::Tok
if !analysis.timer_queue.tasks.is_empty() { if !analysis.timer_queue.tasks.is_empty() {
let priority = analysis.timer_queue.priority; let priority = analysis.timer_queue.priority;
exprs.push(quote!(assert!(#priority <= (1 << #nvic_prio_bits))));
// compile time assert that the priority is supported by the device
exprs.push(quote!(let _ = [(); ((1 << #nvic_prio_bits) - #priority as usize)];));
exprs.push(quote!(p.SCB.set_priority( exprs.push(quote!(p.SCB.set_priority(
rtfm::export::SystemHandler::SysTick, rtfm::export::SystemHandler::SysTick,
((1 << #nvic_prio_bits) - #priority) << (8 - #nvic_prio_bits), ((1 << #nvic_prio_bits) - #priority) << (8 - #nvic_prio_bits),
@ -1995,7 +1999,10 @@ fn pre_init(ctxt: &Context, app: &App, analysis: &Analysis) -> proc_macro2::Toke
let name = interrupt.args.binds(handler); let name = interrupt.args.binds(handler);
let priority = interrupt.args.priority; let priority = interrupt.args.priority;
exprs.push(quote!(p.NVIC.enable(#device::Interrupt::#name);)); exprs.push(quote!(p.NVIC.enable(#device::Interrupt::#name);));
// compile time assert that the priority is supported by the device
exprs.push(quote!(let _ = [(); ((1 << #nvic_prio_bits) - #priority as usize)];)); exprs.push(quote!(let _ = [(); ((1 << #nvic_prio_bits) - #priority as usize)];));
exprs.push(quote!(p.NVIC.set_priority( exprs.push(quote!(p.NVIC.set_priority(
#device::Interrupt::#name, #device::Interrupt::#name,
((1 << #nvic_prio_bits) - #priority) << (8 - #nvic_prio_bits), ((1 << #nvic_prio_bits) - #priority) << (8 - #nvic_prio_bits),
@ -2005,7 +2012,10 @@ fn pre_init(ctxt: &Context, app: &App, analysis: &Analysis) -> proc_macro2::Toke
for (priority, dispatcher) in &analysis.dispatchers { for (priority, dispatcher) in &analysis.dispatchers {
let name = &dispatcher.interrupt; let name = &dispatcher.interrupt;
exprs.push(quote!(p.NVIC.enable(#device::Interrupt::#name);)); exprs.push(quote!(p.NVIC.enable(#device::Interrupt::#name);));
// compile time assert that the priority is supported by the device
exprs.push(quote!(let _ = [(); ((1 << #nvic_prio_bits) - #priority as usize)];)); exprs.push(quote!(let _ = [(); ((1 << #nvic_prio_bits) - #priority as usize)];));
exprs.push(quote!(p.NVIC.set_priority( exprs.push(quote!(p.NVIC.set_priority(
#device::Interrupt::#name, #device::Interrupt::#name,
((1 << #nvic_prio_bits) - #priority) << (8 - #nvic_prio_bits), ((1 << #nvic_prio_bits) - #priority) << (8 - #nvic_prio_bits),