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",
|
||||
"xtask",
|
||||
]
|
||||
resolver = "2"
|
||||
|
||||
[profile.release]
|
||||
codegen-units = 1
|
||||
|
@ -36,6 +37,3 @@ debug = false
|
|||
debug-assertions = false
|
||||
opt-level = 0
|
||||
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]
|
||||
|
||||
## [v2.0.1] - 2023-07-25
|
||||
|
||||
### Added
|
||||
|
||||
### Changed
|
||||
- `init` and `idle` can now be externed.
|
||||
|
||||
### Fixed
|
||||
|
||||
- Support new TAIT syntax requirement.
|
||||
|
||||
## [v2.0.0] - 2023-05-31
|
||||
|
||||
- Initial v2 release
|
||||
|
|
|
@ -22,7 +22,7 @@ name = "rtic-macros"
|
|||
readme = "../README.md"
|
||||
repository = "https://github.com/rtic-rs/rtic"
|
||||
|
||||
version = "2.0.0"
|
||||
version = "2.0.1"
|
||||
|
||||
[lib]
|
||||
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) =
|
||||
util::regroup_inputs(&spawnee.inputs);
|
||||
|
||||
let type_name = util::internal_task_ident(name, "F");
|
||||
|
||||
// Spawn caller
|
||||
items.push(quote!(
|
||||
#(#cfgs)*
|
||||
|
@ -157,10 +159,17 @@ pub fn codegen(ctxt: Context, app: &App, analysis: &Analysis) -> TokenStream2 {
|
|||
#[allow(non_snake_case)]
|
||||
#[doc(hidden)]
|
||||
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 {
|
||||
if #exec_name.try_allocate() {
|
||||
let f = #name(unsafe { #name::Context::new() } #(,#input_untupled)*);
|
||||
let f = tait_hack(#(#input_untupled,)*);
|
||||
#exec_name.spawn(f);
|
||||
#pend_interrupt
|
||||
|
||||
|
@ -169,7 +178,6 @@ pub fn codegen(ctxt: Context, app: &App, analysis: &Analysis) -> TokenStream2 {
|
|||
Err(#input_tupled)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
));
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ impl Timer {
|
|||
/// Start a `Monotonic` based on RP2040's Timer.
|
||||
pub fn start(
|
||||
timer: TIMER,
|
||||
resets: &mut RESETS,
|
||||
resets: &RESETS,
|
||||
_interrupt_token: impl crate::InterruptToken<Self>,
|
||||
) {
|
||||
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]
|
||||
|
||||
### Added
|
||||
- Allow #[init] and #[idle] to be defined externally
|
||||
|
||||
### Fixed
|
||||
|
||||
### 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
|
||||
- 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
|
||||
|
@ -568,7 +579,8 @@ Yanked due to a soundness issue in `init`; the issue has been mostly fixed in v0
|
|||
|
||||
- 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
|
||||
[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
|
||||
|
|
|
@ -22,7 +22,7 @@ name = "rtic"
|
|||
readme = "../README.md"
|
||||
repository = "https://github.com/rtic-rs/rtic"
|
||||
|
||||
version = "2.0.0"
|
||||
version = "2.0.1"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
features = ["rtic-macros/test-template"]
|
||||
|
@ -36,13 +36,13 @@ bare-metal = "1.0.0"
|
|||
#portable-atomic = { version = "0.3.19" }
|
||||
atomic-polyfill = "1"
|
||||
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"
|
||||
critical-section = "1"
|
||||
|
||||
[dev-dependencies]
|
||||
heapless = "0.7.7"
|
||||
lm3s6965 = "0.1.3"
|
||||
lm3s6965 = "0.2"
|
||||
cortex-m-semihosting = "0.5.0"
|
||||
rtic-time = { path = "../rtic-time" }
|
||||
rtic-sync = { path = "../rtic-sync" }
|
||||
|
|
|
@ -32,7 +32,7 @@ mod app {
|
|||
fn init(_: init::Context) -> (Shared, Local) {
|
||||
hprintln!("init");
|
||||
|
||||
async_task1::spawn().ok();
|
||||
async_task1::spawn(1).ok();
|
||||
async_task2::spawn().ok();
|
||||
async_task3::spawn().ok();
|
||||
async_task4::spawn().ok();
|
||||
|
@ -49,11 +49,11 @@ mod app {
|
|||
}
|
||||
|
||||
#[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!(
|
||||
"hello from async 1 a {}",
|
||||
cx.shared.a.lock(|a| {
|
||||
*a += 1;
|
||||
*a += inc;
|
||||
*a
|
||||
})
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue