aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmil Fresk <emil.fresk@gmail.com>2021-07-08 23:18:44 +0200
committerEmil Fresk <emil.fresk@gmail.com>2021-07-08 23:18:44 +0200
commit8f3704378295fe8007290dbddbc1f4946ac599f9 (patch)
tree3969e6f6bccfd16e187d7d5ccd56d269d3d9bb9e
parent98d2af9d73da56910c8bb6cb662fbc4d609a704a (diff)
Cleanup from review (needs releases to compile)
-rw-r--r--.github/workflows/build.yml2
-rw-r--r--Cargo.toml11
-rw-r--r--examples/t-init-main.rs24
-rw-r--r--examples/t-resource.rs85
-rw-r--r--examples/t-stask-main.rs29
-rw-r--r--examples/task_named_main.rs32
-rw-r--r--examples/type-usage.rs26
-rw-r--r--macros/Cargo.toml2
-rw-r--r--macros/src/codegen/local_resources.rs2
-rw-r--r--macros/src/codegen/module.rs3
-rw-r--r--macros/src/codegen/shared_resources.rs2
-rw-r--r--macros/src/codegen/software_tasks.rs2
-rw-r--r--macros/src/codegen/util.rs9
13 files changed, 11 insertions, 218 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 5f9ad1f..4d7ed95 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -138,7 +138,7 @@ jobs:
with:
use-cross: false
command: check
- args: --examples --target=${{ matrix.target }} --features __min_r1_43,${{ env.V7 }}
+ args: --examples --target=${{ matrix.target }} --features ${{ env.V7 }}
# Verify the example output with run-pass tests
testexamples:
diff --git a/Cargo.toml b/Cargo.toml
index a890330..cfeb620 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -32,10 +32,6 @@ name = "schedule"
required-features = ["__v7"]
[[example]]
-name = "t-cfg-resources"
-required-features = ["__min_r1_43"]
-
-[[example]]
name = "t-schedule"
required-features = ["__v7"]
@@ -46,14 +42,16 @@ required-features = ["__v7"]
[dependencies]
cortex-m = "0.7.0"
cortex-m-rtic-macros = { path = "macros", version = "0.6.0-alpha.4" }
-rtic-monotonic = "0.1.0-alpha.1"
+# rtic-monotonic = "0.1.0-alpha.2"
+rtic-monotonic = { path = "../rtic-monotonic" }
rtic-core = "0.3.1"
heapless = "0.6.1"
bare-metal = "1.0.0"
generic-array = "0.14"
[dependencies.dwt-systick-monotonic]
-version = "0.1.0-alpha.2"
+# version = "0.1.0-alpha.3"
+path = "../dwt-systick-monotonic"
optional = true
[build-dependencies]
@@ -73,7 +71,6 @@ trybuild = "1"
[features]
# used for testing this crate; do not use in applications
__v7 = ["dwt-systick-monotonic"]
-__min_r1_43 = []
[profile.release]
codegen-units = 1
diff --git a/examples/t-init-main.rs b/examples/t-init-main.rs
deleted file mode 100644
index 9271788..0000000
--- a/examples/t-init-main.rs
+++ /dev/null
@@ -1,24 +0,0 @@
-#![deny(unsafe_code)]
-#![deny(warnings)]
-#![no_main]
-#![no_std]
-
-use panic_semihosting as _;
-
-#[rtic::app(device = lm3s6965)]
-mod app {
- use cortex_m_semihosting::debug;
-
- #[shared]
- struct Shared {}
-
- #[local]
- struct Local {}
-
- #[init]
- fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {
- debug::exit(debug::EXIT_SUCCESS);
-
- (Shared {}, Local {}, init::Monotonics())
- }
-}
diff --git a/examples/t-resource.rs b/examples/t-resource.rs
deleted file mode 100644
index 2732491..0000000
--- a/examples/t-resource.rs
+++ /dev/null
@@ -1,85 +0,0 @@
-//! [compile-pass] Check code generation of shared resources
-
-#![deny(unsafe_code)]
-#![deny(warnings)]
-#![no_main]
-#![no_std]
-
-use panic_semihosting as _;
-
-#[rtic::app(device = lm3s6965)]
-mod app {
- #[shared]
- struct Shared {
- o2: u32, // idle
- o3: u32, // EXTI0
- o4: u32, // idle
- o5: u32, // EXTI1
- s1: u32, // idle & uart0
- s2: u32, // uart0 & uart1
- s3: u32, // idle & uart0
- }
-
- #[local]
- struct Local {}
-
- #[init]
- fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {
- (
- Shared {
- o2: 0,
- o3: 0,
- o4: 0,
- o5: 0,
- s1: 0,
- s2: 0,
- s3: 0,
- },
- Local {},
- init::Monotonics(),
- )
- }
-
- #[idle(shared = [o2, &o4, s1, &s3])]
- fn idle(mut c: idle::Context) -> ! {
- // owned by `idle` == `&'static mut`
- let _: shared_resources::o2 = c.shared.o2;
-
- // owned by `idle` == `&'static` if read-only
- let _: &u32 = c.shared.o4;
-
- // shared with `idle` == `Mutex`
- c.shared.s1.lock(|_| {});
-
- // `&` if read-only
- let _: &u32 = c.shared.s3;
-
- loop {
- cortex_m::asm::nop();
- }
- }
-
- #[task(binds = UART0, shared = [o3, s1, s2, &s3])]
- fn uart0(c: uart0::Context) {
- // owned by interrupt == `&mut`
- let _: shared_resources::o3 = c.shared.o3;
-
- // no `Mutex` proxy when access from highest priority task
- let _: shared_resources::s1 = c.shared.s1;
-
- // no `Mutex` proxy when co-owned by cooperative (same priority) tasks
- let _: shared_resources::s2 = c.shared.s2;
-
- // `&` if read-only
- let _: &u32 = c.shared.s3;
- }
-
- #[task(binds = UART1, shared = [s2, &o5])]
- fn uart1(c: uart1::Context) {
- // owned by interrupt == `&` if read-only
- let _: &u32 = c.shared.o5;
-
- // no `Mutex` proxy when co-owned by cooperative (same priority) tasks
- let _: shared_resources::s2 = c.shared.s2;
- }
-}
diff --git a/examples/t-stask-main.rs b/examples/t-stask-main.rs
deleted file mode 100644
index ee5959d..0000000
--- a/examples/t-stask-main.rs
+++ /dev/null
@@ -1,29 +0,0 @@
-#![deny(unsafe_code)]
-#![deny(warnings)]
-#![no_main]
-#![no_std]
-
-use panic_semihosting as _;
-
-#[rtic::app(device = lm3s6965, dispatchers = [SSI0])]
-mod app {
- use cortex_m_semihosting::debug;
-
- #[shared]
- struct Shared {}
-
- #[local]
- struct Local {}
-
- #[init]
- fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {
- taskmain::spawn().ok();
-
- (Shared {}, Local {}, init::Monotonics())
- }
-
- #[task]
- fn taskmain(_: taskmain::Context) {
- debug::exit(debug::EXIT_SUCCESS);
- }
-}
diff --git a/examples/task_named_main.rs b/examples/task_named_main.rs
deleted file mode 100644
index b030b5e..0000000
--- a/examples/task_named_main.rs
+++ /dev/null
@@ -1,32 +0,0 @@
-//! examples/task_named_main.rs
-
-#![deny(unsafe_code)]
-#![deny(warnings)]
-#![no_main]
-#![no_std]
-
-use panic_semihosting as _;
-
-#[rtic::app(device = lm3s6965, dispatchers = [SSI0])]
-mod app {
- use cortex_m_semihosting::{debug, hprintln};
-
- #[shared]
- struct Shared {}
-
- #[local]
- struct Local {}
-
- #[init]
- fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {
- main::spawn().unwrap();
-
- (Shared {}, Local {}, init::Monotonics())
- }
-
- #[task]
- fn main(_: main::Context) {
- hprintln!("This task is named main, useful for rust-analyzer").unwrap();
- debug::exit(debug::EXIT_SUCCESS);
- }
-}
diff --git a/examples/type-usage.rs b/examples/type-usage.rs
deleted file mode 100644
index e5a088f..0000000
--- a/examples/type-usage.rs
+++ /dev/null
@@ -1,26 +0,0 @@
-//! examples/type-usage.rs
-
-#![no_main]
-#![no_std]
-
-use panic_semihosting as _; // panic handler
-use rtic::app;
-
-#[app(device = lm3s6965, dispatchers = [SSI0])]
-mod app {
- type Test = u32;
-
- #[shared]
- struct Shared {}
-
- #[local]
- struct Local {}
-
- #[init]
- fn init(_: init::Context) -> (Shared, Local, init::Monotonics) {
- (Shared {}, Local {}, init::Monotonics {})
- }
-
- #[task]
- fn t1(_: t1::Context, _val: Test) {}
-}
diff --git a/macros/Cargo.toml b/macros/Cargo.toml
index d103865..3ae66cd 100644
--- a/macros/Cargo.toml
+++ b/macros/Cargo.toml
@@ -23,4 +23,4 @@ proc-macro-error = "1"
quote = "1"
syn = "1"
# rtic-syntax = "0.5.0-alpha.3"
-rtic-syntax = { git = "https://github.com/rtic-rs/rtic-syntax.git", branch = "resources_take_2" }
+rtic-syntax = { git = "https://github.com/rtic-rs/rtic-syntax.git" }
diff --git a/macros/src/codegen/local_resources.rs b/macros/src/codegen/local_resources.rs
index c5cddfb..a9ffa92 100644
--- a/macros/src/codegen/local_resources.rs
+++ b/macros/src/codegen/local_resources.rs
@@ -28,7 +28,7 @@ pub fn codegen(
let attrs = &res.attrs;
// late resources in `util::link_section_uninit`
- let section = util::link_section_uninit(true);
+ let section = util::link_section_uninit();
// For future use
// let doc = format!(" RTIC internal: {}:{}", file!(), line!());
diff --git a/macros/src/codegen/module.rs b/macros/src/codegen/module.rs
index 4fba2f3..a59d662 100644
--- a/macros/src/codegen/module.rs
+++ b/macros/src/codegen/module.rs
@@ -198,9 +198,6 @@ pub fn codegen(
pub use super::#internal_context_name as Context;
));
- // not sure if this is the right way, maybe its backwards,
- // that spawn_module should put in in root
-
if let Context::SoftwareTask(..) = ctxt {
let spawnee = &app.software_tasks[name];
let priority = spawnee.args.priority;
diff --git a/macros/src/codegen/shared_resources.rs b/macros/src/codegen/shared_resources.rs
index d6336b3..181832f 100644
--- a/macros/src/codegen/shared_resources.rs
+++ b/macros/src/codegen/shared_resources.rs
@@ -24,7 +24,7 @@ pub fn codegen(
let mangled_name = util::mark_internal_ident(&util::static_shared_resource_ident(&name));
// late resources in `util::link_section_uninit`
- let section = util::link_section_uninit(true);
+ let section = util::link_section_uninit();
let attrs = &res.attrs;
// For future use
diff --git a/macros/src/codegen/software_tasks.rs b/macros/src/codegen/software_tasks.rs
index 6941d9a..cfd21e4 100644
--- a/macros/src/codegen/software_tasks.rs
+++ b/macros/src/codegen/software_tasks.rs
@@ -45,7 +45,7 @@ pub fn codegen(
quote!(rtic::export::Queue(unsafe {
rtic::export::iQueue::u8_sc()
})),
- Box::new(|| util::link_section_uninit(true)),
+ Box::new(|| util::link_section_uninit()),
)
};
mod_app.push(quote!(
diff --git a/macros/src/codegen/util.rs b/macros/src/codegen/util.rs
index 3b0b9e4..86bd695 100644
--- a/macros/src/codegen/util.rs
+++ b/macros/src/codegen/util.rs
@@ -152,13 +152,8 @@ fn link_section_index() -> usize {
}
// NOTE `None` means in shared memory
-pub fn link_section_uninit(empty_expr: bool) -> Option<TokenStream2> {
- let section = if empty_expr {
- let index = link_section_index();
- format!(".uninit.rtic{}", index)
- } else {
- format!(".uninit.rtic{}", link_section_index())
- };
+pub fn link_section_uninit() -> Option<TokenStream2> {
+ let section = format!(".uninit.rtic{}", link_section_index());
Some(quote!(#[link_section = #section]))
}