aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmil Fresk <emil.fresk@gmail.com>2023-07-25 10:01:51 +0200
committerEmil Fresk <emil.fresk@gmail.com>2023-07-25 08:16:13 +0000
commit0228350ef4758c45623e325c41116720bbc2b30a (patch)
tree31ef9889d6332e64ec624c4047af284c82ac7a45
parent1967058784ae674b69302500f4b95c1fc4ab4056 (diff)
Fixed new TAIT requirement and release v2.0.1 of RTIC
-rw-r--r--Cargo.toml4
-rw-r--r--rtic-macros/CHANGELOG.md6
-rw-r--r--rtic-macros/Cargo.toml2
-rw-r--r--rtic-macros/src/codegen/module.rs14
-rw-r--r--rtic-monotonics/src/rp2040.rs2
-rw-r--r--rtic/CHANGELOG.md16
-rw-r--r--rtic/Cargo.toml6
-rw-r--r--rtic/examples/async-task-multiple-prios.rs6
8 files changed, 39 insertions, 17 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 6fccc1d..6aedb70 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -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" }
diff --git a/rtic-macros/CHANGELOG.md b/rtic-macros/CHANGELOG.md
index d682ab7..3413d8a 100644
--- a/rtic-macros/CHANGELOG.md
+++ b/rtic-macros/CHANGELOG.md
@@ -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
diff --git a/rtic-macros/Cargo.toml b/rtic-macros/Cargo.toml
index 4649850..ade6842 100644
--- a/rtic-macros/Cargo.toml
+++ b/rtic-macros/Cargo.toml
@@ -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
diff --git a/rtic-macros/src/codegen/module.rs b/rtic-macros/src/codegen/module.rs
index cf066ef..7d3ac54 100644
--- a/rtic-macros/src/codegen/module.rs
+++ b/rtic-macros/src/codegen/module.rs
@@ -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)
}
}
-
}
));
diff --git a/rtic-monotonics/src/rp2040.rs b/rtic-monotonics/src/rp2040.rs
index a9fd3f3..a6e0af6 100644
--- a/rtic-monotonics/src/rp2040.rs
+++ b/rtic-monotonics/src/rp2040.rs
@@ -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());
diff --git a/rtic/CHANGELOG.md b/rtic/CHANGELOG.md
index 1987409..fb3a35b 100644
--- a/rtic/CHANGELOG.md
+++ b/rtic/CHANGELOG.md
@@ -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
diff --git a/rtic/Cargo.toml b/rtic/Cargo.toml
index 05c6362..310c71f 100644
--- a/rtic/Cargo.toml
+++ b/rtic/Cargo.toml
@@ -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" }
diff --git a/rtic/examples/async-task-multiple-prios.rs b/rtic/examples/async-task-multiple-prios.rs
index 88f4cf4..7580b51 100644
--- a/rtic/examples/async-task-multiple-prios.rs
+++ b/rtic/examples/async-task-multiple-prios.rs
@@ -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
})
);