-
Notifications
You must be signed in to change notification settings - Fork 240
trampoline functionalty #1106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
trampoline functionalty #1106
Changes from all commits
11d2ca9
13285e7
936dfc5
ccddee6
4c855d6
dbafce1
d422879
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
gpioa lock | ||
gpioa unlock | ||
SysTick start | ||
idle | ||
SysTick start | ||
idle end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
//! examples/bouncy_trampoline.rs | ||
#![no_std] | ||
#![no_main] | ||
#![deny(warnings)] | ||
#![deny(unsafe_code)] | ||
#![deny(missing_docs)] | ||
|
||
use panic_semihosting as _; | ||
|
||
// `examples/bouncy_trampoline.rs` testing trampoline feature | ||
#[rtic::app(device = lm3s6965)] | ||
mod app { | ||
use cortex_m_semihosting::{debug, hprintln}; | ||
use lm3s6965::Interrupt; | ||
|
||
#[shared] | ||
struct Shared { | ||
h_priority: u8, | ||
} | ||
|
||
#[local] | ||
struct Local {} | ||
|
||
#[init] | ||
fn init(_: init::Context) -> (Shared, Local) { | ||
// Trigger SW0 interrupt to test NMI preemption | ||
rtic::pend(Interrupt::GPIOA); | ||
(Shared { h_priority: 0 }, Local {}) | ||
} | ||
|
||
#[idle] | ||
fn idle(_: idle::Context) -> ! { | ||
hprintln!("idle"); | ||
|
||
// pend another interrupt to test trampoline | ||
cortex_m::peripheral::SCB::set_pendst(); | ||
hprintln!("idle end"); | ||
|
||
debug::exit(debug::EXIT_SUCCESS); | ||
loop { | ||
cortex_m::asm::wfi(); | ||
} | ||
} | ||
|
||
#[task(binds = SysTick, trampoline = GPIOC, priority = 2, shared = [h_priority])] | ||
fn sys_tick(_: sys_tick::Context) { | ||
hprintln!("SysTick start"); | ||
} | ||
|
||
#[task(binds = GPIOA, priority = 1, shared = [h_priority])] | ||
fn gpioa(mut ctx: gpioa::Context) { | ||
ctx.shared.h_priority.lock(|_| { | ||
hprintln!("gpioa lock"); | ||
cortex_m::peripheral::SCB::set_pendst(); | ||
cortex_m::asm::delay(100_000_000); | ||
hprintln!("gpioa unlock"); | ||
}); | ||
} | ||
|
||
#[task(binds = GPIOB, priority = 3, shared = [h_priority])] | ||
fn high_priority_task(_: high_priority_task::Context) { | ||
hprintln!("High priority task"); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,10 +5,17 @@ This project adheres to [Semantic Versioning](http://semver.org/). | |
|
||
For each category, *Added*, *Changed*, *Fixed* add new entries at the top! | ||
|
||
## Unreleased | ||
## [Unreleased] | ||
|
||
### Changed | ||
|
||
- changed (sysclk % timer_hz) == 0 to sysclk.is_multiple_of(timer_hz) to make clippy happy as required to CI. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CI always uses latest stable Rust, so new versions bring in new lints/defaults all the time :) Thank you for dealing with this, could you split out the 'rtic-monotonics' changes into a separate commit? If you want you could even create a separate PR for this, to help your colleague, that can be fast-tracked into master branch that way :) Great you added to the CHANGELOG, but please add new entries above, building like a stack. Please cleanup the commentary and the double |
||
It is unclear why this was not already implemented since the current version does not pass CI. | ||
|
||
### Changed | ||
|
||
- Panic if STM32 prescaler value would overflow | ||
- Changed modulo to ``is_multiple_of()``, to make clippy happy | ||
|
||
## v2.1.0 - 2025-06-22 | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: Filename and comment are disagreeing :)