mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-11-25 13:09:37 +01:00
Fixed new TAIT requirement and release v2.0.1 of RTIC
This commit is contained in:
parent
1967058784
commit
0228350ef4
8 changed files with 39 additions and 17 deletions
|
@ -16,6 +16,7 @@ members = [
|
||||||
"rtic-time",
|
"rtic-time",
|
||||||
"xtask",
|
"xtask",
|
||||||
]
|
]
|
||||||
|
resolver = "2"
|
||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
codegen-units = 1
|
codegen-units = 1
|
||||||
|
@ -36,6 +37,3 @@ debug = false
|
||||||
debug-assertions = false
|
debug-assertions = false
|
||||||
opt-level = 0
|
opt-level = 0
|
||||||
overflow-checks = false
|
overflow-checks = false
|
||||||
|
|
||||||
[patch.crates-io]
|
|
||||||
lm3s6965 = { git = "https://github.com/japaric/lm3s6965" }
|
|
||||||
|
|
|
@ -7,12 +7,16 @@ For each category, *Added*, *Changed*, *Fixed* add new entries at the top!
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
## [v2.0.1] - 2023-07-25
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
### Changed
|
- `init` and `idle` can now be externed.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
- Support new TAIT syntax requirement.
|
||||||
|
|
||||||
## [v2.0.0] - 2023-05-31
|
## [v2.0.0] - 2023-05-31
|
||||||
|
|
||||||
- Initial v2 release
|
- Initial v2 release
|
||||||
|
|
|
@ -22,7 +22,7 @@ name = "rtic-macros"
|
||||||
readme = "../README.md"
|
readme = "../README.md"
|
||||||
repository = "https://github.com/rtic-rs/rtic"
|
repository = "https://github.com/rtic-rs/rtic"
|
||||||
|
|
||||||
version = "2.0.0"
|
version = "2.0.1"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
proc-macro = true
|
proc-macro = true
|
||||||
|
|
|
@ -150,6 +150,8 @@ pub fn codegen(ctxt: Context, app: &App, analysis: &Analysis) -> TokenStream2 {
|
||||||
let (input_args, input_tupled, input_untupled, input_ty) =
|
let (input_args, input_tupled, input_untupled, input_ty) =
|
||||||
util::regroup_inputs(&spawnee.inputs);
|
util::regroup_inputs(&spawnee.inputs);
|
||||||
|
|
||||||
|
let type_name = util::internal_task_ident(name, "F");
|
||||||
|
|
||||||
// Spawn caller
|
// Spawn caller
|
||||||
items.push(quote!(
|
items.push(quote!(
|
||||||
#(#cfgs)*
|
#(#cfgs)*
|
||||||
|
@ -157,10 +159,17 @@ pub fn codegen(ctxt: Context, app: &App, analysis: &Analysis) -> TokenStream2 {
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub fn #internal_spawn_ident(#(#input_args,)*) -> Result<(), #input_ty> {
|
pub fn #internal_spawn_ident(#(#input_args,)*) -> Result<(), #input_ty> {
|
||||||
// SAFETY: If `try_allocate` suceeds one must call `spawn`, which we do.
|
// New TAIT requirement hack; the opaque type must be in the argument or return
|
||||||
|
// position of a function...
|
||||||
|
#[inline(always)]
|
||||||
|
fn tait_hack(#(#input_args,)*) -> #type_name {
|
||||||
|
#name(unsafe { #name::Context::new() } #(,#input_untupled)*)
|
||||||
|
}
|
||||||
|
|
||||||
|
// SAFETY: If `try_allocate` succeeds one must call `spawn`, which we do.
|
||||||
unsafe {
|
unsafe {
|
||||||
if #exec_name.try_allocate() {
|
if #exec_name.try_allocate() {
|
||||||
let f = #name(unsafe { #name::Context::new() } #(,#input_untupled)*);
|
let f = tait_hack(#(#input_untupled,)*);
|
||||||
#exec_name.spawn(f);
|
#exec_name.spawn(f);
|
||||||
#pend_interrupt
|
#pend_interrupt
|
||||||
|
|
||||||
|
@ -169,7 +178,6 @@ pub fn codegen(ctxt: Context, app: &App, analysis: &Analysis) -> TokenStream2 {
|
||||||
Err(#input_tupled)
|
Err(#input_tupled)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ impl Timer {
|
||||||
/// Start a `Monotonic` based on RP2040's Timer.
|
/// Start a `Monotonic` based on RP2040's Timer.
|
||||||
pub fn start(
|
pub fn start(
|
||||||
timer: TIMER,
|
timer: TIMER,
|
||||||
resets: &mut RESETS,
|
resets: &RESETS,
|
||||||
_interrupt_token: impl crate::InterruptToken<Self>,
|
_interrupt_token: impl crate::InterruptToken<Self>,
|
||||||
) {
|
) {
|
||||||
resets.reset.modify(|_, w| w.timer().clear_bit());
|
resets.reset.modify(|_, w| w.timer().clear_bit());
|
||||||
|
|
|
@ -8,12 +8,23 @@ For each category, *Added*, *Changed*, *Fixed* add new entries at the top!
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
- Allow #[init] and #[idle] to be defined externally
|
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
## [v2.0.1] - 2023-07-25
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Allow `#[init]` and `#[idle]` to be defined externally
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Support new TAIT syntax requirement.
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
- `cortex-m` set as an optional dependency
|
- `cortex-m` set as an optional dependency
|
||||||
- Moved `cortex-m`-related utilities from `rtic/lib.rs` to `rtic/export.rs`
|
- Moved `cortex-m`-related utilities from `rtic/lib.rs` to `rtic/export.rs`
|
||||||
- Make async task priorities start at 0, instead of 1, to always start at the lowest priority
|
- Make async task priorities start at 0, instead of 1, to always start at the lowest priority
|
||||||
|
@ -568,7 +579,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/rtic-rs/rtic/compare/v2.0.0...HEAD
|
[Unreleased]: https://github.com/rtic-rs/rtic/compare/v2.0.1...HEAD
|
||||||
|
[v2.0.1]: https://github.com/rtic-rs/rtic/compare/v2.0.0...v2.0.1
|
||||||
[v2.0.0]: https://github.com/rtic-rs/rtic/compare/v1.1.4...v2.0.0
|
[v2.0.0]: https://github.com/rtic-rs/rtic/compare/v1.1.4...v2.0.0
|
||||||
[v1.1.4]: https://github.com/rtic-rs/rtic/compare/v1.1.3...v1.1.4
|
[v1.1.4]: https://github.com/rtic-rs/rtic/compare/v1.1.3...v1.1.4
|
||||||
[v1.1.3]: https://github.com/rtic-rs/rtic/compare/v1.1.2...v1.1.3
|
[v1.1.3]: https://github.com/rtic-rs/rtic/compare/v1.1.2...v1.1.3
|
||||||
|
|
|
@ -22,7 +22,7 @@ name = "rtic"
|
||||||
readme = "../README.md"
|
readme = "../README.md"
|
||||||
repository = "https://github.com/rtic-rs/rtic"
|
repository = "https://github.com/rtic-rs/rtic"
|
||||||
|
|
||||||
version = "2.0.0"
|
version = "2.0.1"
|
||||||
|
|
||||||
[package.metadata.docs.rs]
|
[package.metadata.docs.rs]
|
||||||
features = ["rtic-macros/test-template"]
|
features = ["rtic-macros/test-template"]
|
||||||
|
@ -36,13 +36,13 @@ bare-metal = "1.0.0"
|
||||||
#portable-atomic = { version = "0.3.19" }
|
#portable-atomic = { version = "0.3.19" }
|
||||||
atomic-polyfill = "1"
|
atomic-polyfill = "1"
|
||||||
rtic-monotonics = { path = "../rtic-monotonics", version = "1.0.0", optional = true }
|
rtic-monotonics = { path = "../rtic-monotonics", version = "1.0.0", optional = true }
|
||||||
rtic-macros = { path = "../rtic-macros", version = "2.0.0" }
|
rtic-macros = { path = "../rtic-macros", version = "2.0.1" }
|
||||||
rtic-core = "1"
|
rtic-core = "1"
|
||||||
critical-section = "1"
|
critical-section = "1"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
heapless = "0.7.7"
|
heapless = "0.7.7"
|
||||||
lm3s6965 = "0.1.3"
|
lm3s6965 = "0.2"
|
||||||
cortex-m-semihosting = "0.5.0"
|
cortex-m-semihosting = "0.5.0"
|
||||||
rtic-time = { path = "../rtic-time" }
|
rtic-time = { path = "../rtic-time" }
|
||||||
rtic-sync = { path = "../rtic-sync" }
|
rtic-sync = { path = "../rtic-sync" }
|
||||||
|
|
|
@ -32,7 +32,7 @@ mod app {
|
||||||
fn init(_: init::Context) -> (Shared, Local) {
|
fn init(_: init::Context) -> (Shared, Local) {
|
||||||
hprintln!("init");
|
hprintln!("init");
|
||||||
|
|
||||||
async_task1::spawn().ok();
|
async_task1::spawn(1).ok();
|
||||||
async_task2::spawn().ok();
|
async_task2::spawn().ok();
|
||||||
async_task3::spawn().ok();
|
async_task3::spawn().ok();
|
||||||
async_task4::spawn().ok();
|
async_task4::spawn().ok();
|
||||||
|
@ -49,11 +49,11 @@ mod app {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[task(priority = 1, shared = [a, b])]
|
#[task(priority = 1, shared = [a, b])]
|
||||||
async fn async_task1(mut cx: async_task1::Context) {
|
async fn async_task1(mut cx: async_task1::Context, inc: u32) {
|
||||||
hprintln!(
|
hprintln!(
|
||||||
"hello from async 1 a {}",
|
"hello from async 1 a {}",
|
||||||
cx.shared.a.lock(|a| {
|
cx.shared.a.lock(|a| {
|
||||||
*a += 1;
|
*a += inc;
|
||||||
*a
|
*a
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue