Skip to content
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

Fixed new TAIT requirement and release v2.0.1 of RTIC #782

Merged
merged 1 commit into from
Jul 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ members = [
"rtic-time",
"xtask",
]
resolver = "2"

[profile.release]
codegen-units = 1
Expand All @@ -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" }
6 changes: 5 additions & 1 deletion rtic-macros/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion rtic-macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 11 additions & 3 deletions rtic-macros/src/codegen/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,17 +150,26 @@ 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)*
/// Spawns the task directly
#[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

Expand All @@ -169,7 +178,6 @@ pub fn codegen(ctxt: Context, app: &App, analysis: &Analysis) -> TokenStream2 {
Err(#input_tupled)
}
}

}
));

Expand Down
2 changes: 1 addition & 1 deletion rtic-monotonics/src/rp2040.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
16 changes: 14 additions & 2 deletions rtic/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions rtic/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand All @@ -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" }
Expand Down
6 changes: 3 additions & 3 deletions rtic/examples/async-task-multiple-prios.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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
})
);
Expand Down